aboutsummaryrefslogtreecommitdiff
path: root/plugins/video_params/video_params.module
diff options
context:
space:
mode:
authorFabio Varesano <fax8@13637.no-reply.drupal.org>2006-06-18 14:41:32 +0000
committerFabio Varesano <fax8@13637.no-reply.drupal.org>2006-06-18 14:41:32 +0000
commitbff6fafe62a4201c99bdba20144313276d654bca (patch)
tree3f58c4adad06446274c6e842f9f9fb6155ba4b34 /plugins/video_params/video_params.module
parent2540b23c26f79ed8b223d6ec8b00ca4bfc76e7ef (diff)
downloadvideo-bff6fafe62a4201c99bdba20144313276d654bca.tar.gz
video-bff6fafe62a4201c99bdba20144313276d654bca.tar.bz2
List of changes:
Pluginization: Video.module file was too big and complex. I isolated each different feature which was not excencial and removed from the video.module file. Those features are now added by helper modules called plugins under the directory "plugins". The download has been separed from multidownload. There is now a separated plugin called video_multidownload which add multidownload feature. There are also some hooks being defined. See file hooks.php for details. XHTML Compliace: I worked hard to remove unvalid code from video module. Now the code generated by the module validates on W3C validator. This will probæbly generate some problems with uncommon browsers we will try to solve them as soon as reported. Thanks a lot to Karl Rudd who point me to the right direction towards compliace. Thumbnailing: There is plugin called video_image.module which add thumbnails support for the video module. Thumbnails are uploaded throught the video creation form and a image node is created with it. Video file Uploads: There is a plugin called video_upload.module which add a file upload field to the node creation form. The uploaded file is automatically set as path of the video. Then usable for plays/downloads. NOTE ON BUGS: I tryed to test new features the most as possible but I can't guarantee that all this code is bugfree. Video module is becaming too big to be tested by only one person (me). Hope you guys will be able to help with debugging. Fabio
Diffstat (limited to 'plugins/video_params/video_params.module')
-rw-r--r--plugins/video_params/video_params.module105
1 files changed, 105 insertions, 0 deletions
diff --git a/plugins/video_params/video_params.module b/plugins/video_params/video_params.module
new file mode 100644
index 0000000..46fa2e3
--- /dev/null
+++ b/plugins/video_params/video_params.module
@@ -0,0 +1,105 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Enable addition of params to object generated by video module
+ *
+ * @author Fabio Varesano <fvaresano at yahoo dot it>
+ */
+
+
+
+/**
+ * Implementation of hook_help().
+ */
+function video_params_help($section) {
+ switch ($section) {
+ case 'admin/modules#description':
+ return t('Enable addition of html params to object generated by video module. Useful if you need to use swf videos which needs params to be passed.');
+ }
+}
+
+
+/**
+ * Implementation of hook_perm().
+ */
+function video_params_perm() {
+ return array('insert object params');
+}
+
+
+
+
+/**
+ * Implementation of hook_form_alter()
+ * We use this to add a text area to the video creation form.
+ * In the text area the user will be able to insert his param value association.
+ */
+function video_params_form_alter($form_id, &$form) {
+
+ if($form_id == 'video_node_form' && isset($form['video']) && user_access('insert object params')) {
+
+ // get node object
+ $node = $form['#node'];
+
+ //We must convert the array data back to something that can go in the textarea.
+ $textarea = '';
+ if(is_array($node->serial_data['object_parameters'])) {
+ foreach ($node->serial_data['object_parameters'] as $param => $value) {
+ $textarea .= $param . '=' . $value . "\n";
+ }
+ $textarea = substr($textarea, 0, -1); //Remove the last newline "\n" from the end.
+ }
+ $form['parameters'] = array('#type' => 'fieldset', '#title' => t('HTML object parameters'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -17);
+ $form['parameters']['object_parameters'] = array(
+ '#title' => t('Embedded object parameters'),
+ '#type' => 'textarea',
+ '#rows' => 5,
+ '#default_value' => $textarea,
+ '#description' => t('Enter the values that you would like to be embedded in &#60;param name="param_1" value="value_1" /&#62; tags. Each parameter should be on a seperate line with an equal sign between the parameter and its assigned value. Like param=value for example.')
+ );
+ }
+}
+
+
+/**
+ * Implementation of hook_nodeapi()
+ */
+function video_params_nodeapi(&$node, $op, $teaser) {
+ if($node->type == 'video') {
+ switch ($op) {
+ case 'submit':
+ //Process the data in the object_parameters textarea.
+ if ($node->object_parameters != '') { //Make sure the textarea was not empty.
+ $lines = explode("\r\n", $node->object_parameters); //Make an array of each line from the textarea.
+ foreach ($lines as $line) { //Loop through each line.
+ $array = explode('=', $line); //Break apart at the "=" sign. $line should be in format param=value
+ $node->serial_data['object_parameters'][$array[0]] = $array[1]; //Assign the "param" as the key and "value" as the value.
+ }
+ }
+ break;
+ }
+ }
+}
+
+
+/**
+ * Implementation of hook_v_get_param() - video module specific hook
+ */
+function video_params_v_get_params(&$node) {
+
+ $serial_data = $node->serial_data;
+
+ if(is_array($serial_data) && array_key_exists('object_parameters', $serial_data) && !empty($serial_data['object_parameters'])) {
+ return $serial_data['object_parameters'];
+ }
+ else {
+ return NULL;
+ }
+}
+
+
+
+
+