Index: om_show_jwplayer.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/om_show/modules/om_show_jwpalyer/Attic/om_show_jwplayer.module,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 om_show_jwplayer.module
--- om_show_jwplayer.module	6 Jul 2010 20:51:50 -0000	1.1.2.1
+++ om_show_jwplayer.module	17 Jul 2010 00:54:34 -0000
@@ -56,39 +56,354 @@
 function om_show_jwplayer_admin_settings() {
   $form = array();
 
-  $form['om_show_player_path'] = array(
+  
+  /* Embed parameters */
+  
+  $form['om_show_player_embed'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Embed parameters'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  
+  $form['om_show_player_embed']['om_show_player_path'] = array(
     '#type' => 'textfield',
     '#title' => t('Location of JWPlayer'),
     '#default_value' => variable_get('om_show_player_path', '/sites/all/plugins/mediaplayer/'),
     '#description' => t('Be sure both swfobject.js and player.swf are in this path . '),
   );
+
+  $form['om_show_player_embed']['om_show_player_height'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Height'),
+    '#default_value' => variable_get('om_show_player_height', '320'),
+    '#description' => t('The overall height of the player. '),
+  );
+
+  $form['om_show_player_embed']['om_show_player_width'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Width'),
+    '#default_value' => variable_get('om_show_player_width', '470'),
+    '#description' => t('The overall width of the player. '),
+  );
+
+  
+  /* Playlist */
+	
+  $form['om_show_player_playlist'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Playlist'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['om_show_player_playlist']['om_show_player_playlistfile'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Playlist file'),
+    '#default_value' => variable_get('om_show_player_width', ''),
+    '#description' => t('Location of XML playlist file. '),
+  );
+
+  
+  /* File properties */
+  
+  $form['om_show_player_fileproperties'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('File properties'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['om_show_player_fileproperties']['om_show_player_videofiledir'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Path to video folder'),
+    '#default_value' => variable_get('om_show_player_videofiledir', ''),
+    '#description' => t('Path to the folder where the videos are residing. If a show has an absolute path to its video file, that will overrule this path.'),
+  );
+
+  $form['om_show_player_fileproperties']['om_show_player_imagefiledir'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Path to image folder'),
+    '#default_value' => variable_get('om_show_player_imagefiledir', ''),
+    '#description' => t('Path to the folder where the images are residing. If a show has an absolute path to its image file, that will overrule this path.'),
+  );
   
-   $form['om_show_player_logo'] = array(
+   $form['om_show_player_fileproperties']['om_show_player_logo'] = array(
     '#type' => 'textfield',
     '#title' => t('Full URL of Logo'),
     '#default_value' => variable_get('om_show_player_logo', 'http://YOURURL/sites/all/themes/YOURSUBTHEME/dom_player_logo.png'),
     '#description' => t('This logo is added to the player when the video is embedded in an external site . '),
   );
+
+  
+  /* Colors */
+  
+  $form['om_show_player_colors'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Colors'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['om_show_player_colors']['om_show_player_backcolor'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Background color'),
+    '#default_value' => variable_get('om_show_player_backcolor', ''),
+    '#description' => t('The background color of the player.'),
+  );
+
+  $form['om_show_player_colors']['om_show_player_frontcolor'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Front color'),
+    '#default_value' => variable_get('om_show_player_frontcolor', ''),
+    '#description' => t('The icon/text color of the player.'),
+  );
+
+  $form['om_show_player_colors']['om_show_player_lightcolor'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Light color'),
+    '#default_value' => variable_get('om_show_player_lightcolor', ''),
+    '#description' => t('The rollover color of the player.'),
+  );
+
+  $form['om_show_player_colors']['om_show_player_screencolor'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Screen color'),
+    '#default_value' => variable_get('om_show_player_screencolor', ''),
+    '#description' => t('The display color of the player.'),
+  );
+
+  
+  /* Layout */
+  
+  $form['om_show_player_layout'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Layout'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['om_show_player_layout']['om_show_player_controlbar'] = array(
+    '#type' => 'select',
+    '#title' => t('Controlbar'),
+    '#default_value' => variable_get('om_show_player_controlbar', 'bottom (default)'),
+	'#options' => array(
+      '' => t('bottom (default)'), 
+      'top' => t('top'), 
+      'over' => t('over'),
+	  'none' => t('none'),
+  ),
+    '#description' => t('Position of the control bar.'),
+  );
+
+  $form['om_show_player_layout']['om_show_player_playlistlayout'] = array(
+    '#type' => 'select',
+    '#title' => t('Playlist'),
+    '#default_value' => variable_get('om_show_player_playlistlayout', 'none (default)'),
+	'#options' => array(
+      '' => t('none (default)'), 
+      'bottom' => t('bottom'), 
+      'over' => t('over'),
+	  'right' => t('right'),
+	  'left' => t('left'),
+	  'top' => t('top'),
+  ),
+    '#description' => t('Position of the playlist.'),
+  );
+
+  $form['om_show_player_layout']['om_show_player_playlistsize'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Playlist size'),
+    '#default_value' => variable_get('om_show_player_playlistsize', ''),
+    '#description' => t('Height or width of the playlist.'),
+  );
+
+  $form['om_show_player_layout']['om_show_player_dock'] = array(
+    '#type' => 'select',
+    '#title' => t('Dock'),
+    '#default_value' => variable_get('om_show_player_dock', 'true (default)'),
+	'#options' => array(
+      '' => t('true (default)'), 
+      'false' => t('false'), 
+  ),
+    '#description' => t('Whether to show a dock.'),
+  );
+
+  $form['om_show_player_layout']['om_show_player_skin'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Skin'),
+    '#default_value' => variable_get('om_show_player_skin', ''),
+    '#description' => t('The location of a skin XML file.'),
+  );
+
+  
+  /* Behaviour */
+  
+  $form['om_show_player_behaviour'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Behaviour'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['om_show_player_behaviour']['om_show_player_autostart'] = array(
+    '#type' => 'select',
+    '#title' => t('Autostart'),
+    '#default_value' => variable_get('om_show_player_autostart', 'false (default)'),
+	'#options' => array(
+      '' => t('false (default)'), 
+      'true' => t('true'), 
+  ),
+    '#description' => t('Automatically start playing.'),
+  );
+
+  $form['om_show_player_behaviour']['om_show_player_bufferlength'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Buffer length'),
+    '#default_value' => variable_get('om_show_player_bufferlength', ''),
+    '#description' => t('Number of seconds to buffer before starting.'),
+  );
+  
+  $form['om_show_player_behaviour']['om_show_player_icons'] = array(
+    '#type' => 'select',
+    '#title' => t('Icons'),
+    '#default_value' => variable_get('om_show_player_icons', 'true (default)'),
+	'#options' => array(
+      '' => t('true (default)'), 
+      'false' => t('false'), 
+  ),
+    '#description' => t('Hide the icons in the display.'),
+  );
+
+  $form['om_show_player_behaviour']['om_show_player_item'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Item'),
+    '#default_value' => variable_get('om_show_player_item', ''),
+    '#description' => t('Item in the playlist to start.'),
+  );
+
+  $form['om_show_player_behaviour']['om_show_player_mute'] = array(
+    '#type' => 'select',
+    '#title' => t('Mute'),
+    '#default_value' => variable_get('om_show_player_mute', 'false (default)'),
+	'#options' => array(
+      '' => t('false (default)'), 
+      'true' => t('true'), 
+  ),
+    '#description' => t('Mute the player on startup.'),
+  );
+  
+  $form['om_show_player_behaviour']['om_show_player_quality'] = array(
+    '#type' => 'select',
+    '#title' => t('High quality'),
+    '#default_value' => variable_get('om_show_player_quality', 'true (default)'),
+	'#options' => array(
+      '' => t('true (default)'), 
+      'false' => t('false'), 
+  ),
+    '#description' => t('Use high-quality playback.'),
+  );
+
+  $form['om_show_player_behaviour']['om_show_player_repeat'] = array(
+    '#type' => 'select',
+    '#title' => t('Repeat'),
+    '#default_value' => variable_get('om_show_player_repeat', 'none (default)'),
+	'#options' => array(
+      '' => t('none (default)'), 
+      'list' => t('list'), 
+	  'always' => t('always'), 
+  ),
+    '#description' => t('Continously repeat playback.'),
+  );
   
-  $form['om_show_share'] = array(
+  $form['om_show_player_behaviour']['om_show_player_shuffle'] = array(
+    '#type' => 'select',
+    '#title' => t('Shuffle'),
+    '#default_value' => variable_get('om_show_player_shuffle', 'false (default)'),
+	'#options' => array(
+      '' => t('false (default)'), 
+      'true' => t('true'), 
+  ),
+    '#description' => t('Shuffle the playback order.'),
+  );
+
+  $form['om_show_player_behaviour']['om_show_player_stretching'] = array(
+    '#type' => 'select',
+    '#title' => t('Stretching'),
+    '#default_value' => variable_get('om_show_player_stretching', 'uniform (default)'),
+	'#options' => array(
+      '' => t('uniform (default)'), 
+      'fill' => t('fill'), 
+	  'exactfit' => t('exactfit'), 
+	  'none' => t('none'), 
+  ), 
+    '#description' => t('Resize mode of display content.'),
+  );
+
+  $form['om_show_player_behaviour']['om_show_player_volume'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Volume'),
+    '#default_value' => variable_get('om_show_player_volume', ''),
+    '#description' => t('Startup volume.'),
+  );
+  
+
+  /* External communication */
+  
+  $form['om_show_player_external'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('External communication'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['om_show_player_external']['om_show_player_linktarget'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Link target'),
+    '#default_value' => variable_get('om_show_player_linktarget', ''),
+    '#description' => t('Target frame to open external links in.'),
+  );
+
+  $form['om_show_player_external']['om_show_player_streamer'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Streamer'),
+    '#default_value' => variable_get('om_show_player_streamer', ''),
+    '#description' => t('Location of server/script to use for streaming.'),
+  );
+
+  $form['om_show_player_external']['om_show_player_plugins'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Plugins'),
+    '#collapsible' => FALSE,
+    '#collapsed' => FALSE,
+  );
+  
+  $form['om_show_player_external']['om_show_player_plugins']['om_show_share'] = array(
     '#type' => 'checkbox',
-    '#title' => t('Enable Share Plug-in for JWPlayer'),
+    '#title' => t('Share Plug-in'),
     '#default_value' => variable_get('om_show_share', '1'),
-    '#description' => t('This Plug-in enables the embed feature as well as links to send video to Facebook, Twitter, or email . '),
+    '#description' => t('This plug-in enables the embed feature as well as links to send video to Facebook, Twitter, or email. '),
   );
   
-  $form['om_show_snapshot'] = array(
+  $form['om_show_player_external']['om_show_player_plugins']['om_show_snapshot'] = array(
     '#type' => 'checkbox',
-    '#title' => t('Enable Snapshot Plug-in for JWPlayer'),
+    '#title' => t('Snapshot Plug-in'),
     '#default_value' => variable_get('om_show_snapshot', '1'),
-    '#description' => t('This Plug-in enables users with the proper permissions to update the default Screen Capture with any frame from the video . '),
+    '#description' => t('This plug-in enables users with the proper permissions to update the default Screen Capture with any frame from the video. '),
   );
   
-  $form['om_show_drelated'] = array(
+  $form['om_show_player_external']['om_show_player_plugins']['om_show_drelated'] = array(
     '#type' => 'checkbox',
-    '#title' => t('Enable DRelated Plug-in for JWPlayer'),
+    '#title' => t('DRelated Plug-in'),
     '#default_value' => variable_get('om_show_drelated', '1'),
-    '#description' => t('This Plug-in displays related videos after the video plays . '),
+    '#description' => t('This plug-in displays related videos after the video plays. '),
+  );
+  
+  $form['om_show_player_external']['om_show_player_plugins']['om_show_player_otherplugins'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Other plugins'),
+    '#default_value' => variable_get('om_show_player_otherplugins', ''),
+    '#description' => t('IDs of other plugins to load.'),
   );
   
   return system_settings_form($form); 
@@ -106,7 +421,7 @@
   $formatters = array(
     'jwplayer' => array(
       'label' => t('Display Video with JWPlayer'),
-      'field types' => array('filefield'),
+      'field types' => array('text'),
       'description' => t('Displays video with JWPlayer or HTML5 video.'),
     ),
   );
@@ -135,7 +450,7 @@
 * And here we do our magic. You can use dsm($element) to see what you have to play with (requires devel module).
 */
 function theme_om_show_jwplayer_formatter_jwplayer($element) {
-  
+  dsm($element);
    //check cc license
   $cc_license = $element['#node']->cc;
   if($cc_license->name=='None (All Rights Reserved)'){
@@ -151,7 +466,7 @@
     $output = '<div class="messages error">' . $error . '</div>';
   } 
   else {
-    $output = om_show_add_player($element['#node']->field_om_show_flash[0]['filepath']);
+    $output = om_show_add_player($element['#node']->field_om_show_vod_path[0]['value'], $element['#node']->field_om_show_screencapture_path[0]['value']);
   }
   
   return $output;
@@ -180,7 +495,7 @@
   echo "There has been an error";
 }
 
-function om_show_add_player($videofilepath, $videoimagepath = 0, $duration = 0, $alt_message = 0) {
+function om_show_add_player($videofilepath, $videoimagepath, $duration = 0, $alt_message = 0) {
   global $base_url; 
   global $base_path;
   
@@ -189,21 +504,56 @@
   }
   if (isset($browser['ismobiledevice']) && $browser['ismobiledevice']) {
     
-    $output = '<video src="' . $videofilepath . '">';
+    $output = '<video src="' . $videofiledir . $videofilepath . '">';
     
   } 
   else {
-  
     $player_path = variable_get('om_show_player_path', '/sites/all/libraries/mediaplayer/');
+	$height = variable_get('om_show_player_height', '320');
+	$width = variable_get('om_show_player_width', '470');
+	$playlistfile = variable_get('playlistfile', '');
+	$videofiledir = variable_get('om_show_player_videofiledir', '');
+	$imagefiledir = variable_get('om_show_player_imagefiledir', '');
     $logo_path = variable_get('om_show_player_logo', '');
+	$backcolor = variable_get('om_show_player_backcolor', '');
+	$frontcolor = variable_get('om_show_player_frontcolor', '');
+	$lightcolor = variable_get('om_show_player_lightcolor', '');
+	$screencolor = variable_get('om_show_player_screencolor', '');
+	$controlbar = variable_get('om_show_player_controlbar', '');
+	$playlistlayout = variable_get('om_show_player_playlistlayout', '');
+	$playlistsize = variable_get('om_show_player_playlistsize', '');
+	$dock = variable_get('om_show_player_dock', '');
+	$skin = variable_get('om_show_player_skin', '');
+	$autostart = variable_get('om_show_player_autostart', '');
+	$bufferlength = variable_get('om_show_player_bufferlength', '');
+	$icons = variable_get('om_show_player_icons', '');
+	$item = variable_get('om_show_player_item', '');
+	$mute = variable_get('om_show_player_mute', '');
+	$quality = variable_get('om_show_player_quality', '');
+	$repeat = variable_get('om_show_player_repeat', '');
+	$shuffle = variable_get('om_show_player_shuffle', '');	
+	$stretching = variable_get('om_show_player_stretching', '');	
+	$volume = variable_get('om_show_player_volume', '');		
+	$linktarget = variable_get('om_show_player_linktarget', '');		
+	$streamer = variable_get('om_show_player_streamer', '');		
+	$plugins = variable_get('om_show_player_plugins', '');		
+	
   
     $output .= '<script type="text/javascript" src="' . $player_path  . 'swfobject.js"></script>';
   
     $output .= '<div id="mediaspace">' . $alt_message . '</div>';
     $output .= '<script type="text/javascript">';
-    $output .= 'var so = new SWFObject("' .  $player_path  . 'player.swf","mpl","470","320","9");';
-    
-    $output .= 'so.addVariable(\'sharing.code\', escape(\'<embed src="' . $base_url . $base_path  . 'sites/all/plugins/mediaplayer/player.swf" width="470" height="320" allowfullscreen="true" allowscriptaccess="always" flashvars="file=' . $base_url . $base_path .  $filepath  . '&image=' . $base_url . $base_path . $videoimagepath  . '&plugins=logobox-1&logobox.file=' . $logo_path . '&logobox.link=' . $base_url  . '"></embed>\'));';
+    $output .= 'var so = new SWFObject("' .  $player_path  . 'player.swf","mpl","' . $width . '","' . $height . '","9");';
+
+	$embed_flashvars = array('backcolor', 'frontcolor', 'lightcolor', 'screencolor', 'controlbar', 'dock', 'skin', 'autostart', 'bufferlength', 'icons', 'item', 'mute', 'quality', 'repeat', 'shuffle', 'stretching', 'volume', 'linktarget', 'streamer', 'plugins');
+	foreach($embed_flashvars as $embed_name)
+	{
+		if ($$name):
+			$embed_output .= $embed_name . '=' . $$embed_name . '&';
+		endif;
+	}
+     
+    $output .= 'so.addVariable(\'sharing.code\', escape(\'<embed src="' . $base_url . $base_path  . 'sites/all/plugins/mediaplayer/player.swf" width="' . $width . '" height="' . $height . '" allowfullscreen="true" allowscriptaccess="always" flashvars="' . $embed_output . 'file=' . $videofilepath  . '&image=' . $base_path . $videoimagepath  . '&plugins=logobox-1&logobox.file=' . $logo_path . '&logobox.link=' . $base_url  . '"></embed>\'));';
     
     $output .= 'so.addParam(\'allowfullscreen\',\'true\');';
     $output .= 'so.addParam(\'allowscriptaccess\',\'always\');';
@@ -212,8 +562,17 @@
     if ($duration):
       $output .= 'so.addVariable(\'duration\',\'' .  $duration . '\');';
     endif;
-    $output .= 'so.addVariable(\'file\',\'' . $base_path . $videofilepath . '\');';
-    $output .= 'so.addVariable(\'image\',\'' . $base_path . $videoimagepath  . '\');';
+	
+	$flashvars = array('backcolor', 'frontcolor', 'lightcolor', 'screencolor', 'controlbar', 'dock', 'skin', 'autostart', 'bufferlength', 'icons', 'item', 'mute', 'quality', 'repeat', 'shuffle', 'stretching', 'volume', 'linktarget', 'streamer', 'plugins');
+	foreach($flashvars as $name)
+	{
+		if ($$name):
+			$output .= 'so.addVariable(\'' . $name . '\',\'' . $$name . '\');';
+		endif;
+	}
+	 
+    $output .= 'so.addVariable(\'file\',\'' . $videofiledir . $videofilepath . '\');';
+    $output .= 'so.addVariable(\'image\',\'' . $imagefiledir . $imagepath  . '\');';
     
     $output .= 'so.write(\'mediaspace\');';
     $output .= '</script>'; 

