diff options
author | Fabio Varesano <fax8@13637.no-reply.drupal.org> | 2006-06-19 22:49:16 +0000 |
---|---|---|
committer | Fabio Varesano <fax8@13637.no-reply.drupal.org> | 2006-06-19 22:49:16 +0000 |
commit | 38373b18497493630ba298df1ec638655d09f8db (patch) | |
tree | 56d48a2888f761b0c63479d6f2acc11966dd5018 | |
parent | 512d567e3b66002127eb4fb96040d7979050e97b (diff) | |
download | video-38373b18497493630ba298df1ec638655d09f8db.tar.gz video-38373b18497493630ba298df1ec638655d09f8db.tar.bz2 |
Some debugging for plugins.
Patch #69330 by geodan (http://drupal.org/user/37266)
Allow users to edit own videos:
This patch adds an 'edit own videos' permission to allow users
to edit their own video nodes without having the 'administer nodes' privelage.
-rw-r--r-- | plugins/video_image/video_image.module | 6 | ||||
-rw-r--r-- | plugins/video_multidownload/video_multidownload.module | 2 | ||||
-rw-r--r-- | plugins/video_upload/video_upload.module | 11 | ||||
-rw-r--r-- | video.module | 4 |
4 files changed, 16 insertions, 7 deletions
diff --git a/plugins/video_image/video_image.module b/plugins/video_image/video_image.module index 59795cf..89a9e96 100644 --- a/plugins/video_image/video_image.module +++ b/plugins/video_image/video_image.module @@ -55,6 +55,9 @@ function video_image_form_alter($form_id, &$form) { function video_image_nodeapi(&$node, $op, $teaser) { if($node->type == 'video') { switch ($op) { + case 'load': + $output['iid'] = $node->serial_data['iid']; + return $output; case 'submit': $node->serial_data['iid'] = $node->iid; break; @@ -80,7 +83,6 @@ function video_image_nodeapi(&$node, $op, $teaser) { break; case 'view': - //print_r($node); if($teaser) { if ($node->serial_data['image_teaser'] || $node->serial_data['iid']) { //If we are dealing with a teaser. $node->teaser = theme('video_image_teaser', $node); @@ -111,7 +113,7 @@ function theme_video_image_teaser($node) { $image = node_load($node->serial_data['iid']); $image = image_display($image, 'thumbnail', array('class' => 'video_image_teaser')); } - else { + else { // only for backward compatibility $image = theme('image', $node->serial_data['image_teaser'], $node->title, $node->title, array('class' => 'video_image_teaser'), FALSE); } $output .= l($image, "node/$node->nid", array(), NULL, NULL, FALSE, TRUE); //Create a link with an image in it. diff --git a/plugins/video_multidownload/video_multidownload.module b/plugins/video_multidownload/video_multidownload.module index ddbba8e..e912c19 100644 --- a/plugins/video_multidownload/video_multidownload.module +++ b/plugins/video_multidownload/video_multidownload.module @@ -103,7 +103,7 @@ function video_multidownload_form_alter($form_id, &$form) { /** * Implementation of hook_nodeapi() */ -function video_upload_nodeapi(&$node, $op, $teaser) { +function video_multidownload_nodeapi(&$node, $op, $teaser) { if($node->type == 'video') { switch ($op) { diff --git a/plugins/video_upload/video_upload.module b/plugins/video_upload/video_upload.module index 1f82b2a..832cf3f 100644 --- a/plugins/video_upload/video_upload.module +++ b/plugins/video_upload/video_upload.module @@ -68,8 +68,13 @@ function video_upload_nodeapi(&$node, $op, $teaser) { case 'load': $output['video_upload_file'] = _video_upload_load($node); - $output['vidfile'] = file_create_url($output['video_upload_file']->filepath); - return $output; + if($node->vidfile == '') { // we will disable uploaded file if a path is already live + $output['vidfile'] = file_create_url($output['video_upload_file']->filepath); + return $output; + } + else { + return NULL; + } case 'prepare': _video_upload_prepare($node); break; @@ -133,7 +138,7 @@ function video_upload_form_alter($form_id, &$form) { '#title' => t('Upload video'), '#weight' => -19, '#collapsible' => TRUE, - '#collapsed' => TRUE, + '#collapsed' => (isset($node->video_upload_file) ? TRUE : FALSE ), ); $form['video']['video_upload'] += _video_upload_form($node); diff --git a/video.module b/video.module index 1e687d4..cbc0251 100644 --- a/video.module +++ b/video.module @@ -218,7 +218,7 @@ function video_feed() { * array of permissions */ function video_perm() { - $array = array('create video', 'access video', 'administer video', 'download video', 'view play counter', 'view download counter'); + $array = array('create video', 'access video', 'administer video', 'download video', 'view play counter', 'view download counter', 'edit own video'); return $array; } @@ -337,6 +337,8 @@ function video_access($op, $node) { return $node->status; // see book.module for reference case 'create': return user_access('create video'); + case 'update': + return user_access('edit own video') && ($user->uid == $node->uid); } } |