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 22:59:19 -0000
@@ -56,39 +56,372 @@
 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. '),
+  );
+
   
-   $form['om_show_player_logo'] = array(
+  /* 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_playlistfile', ''),
+    '#description' => t('Location of an XML playlist to load into the player '),
+  );
+
+  
+  /* 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_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_share'] = array(
+  $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('Background color of the controlbar and playlist. This is white by default.'),
+  );
+
+  $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('Color of all icons and texts in the controlbar and playlist. Is black by default.'),
+  );
+
+  $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('Color of an icon or text when you rollover it with the mouse. Is black by default.'),
+  );
+
+  $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('Background color of the display. Is black by default.'),
+  );
+
+  
+  /* 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('When the playlist is positioned below the display, this option can be used to change its height. When the playlist lives left or right of the display, this option represents its width. In the other cases, this option isn\'t needed.'),
+  );
+
+  $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('Set this to false to list plugin buttons in the controlbar. By default (true), plugin buttons are shown in the display.'),
+  );
+
+  $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, a file with graphics that drastically changes the look of the player.'),
+  );
+
+  
+  /* 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('Set this to true to automatically start the player on load.'),
+  );
+
+  $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 of the file that has to be loaded before the player starts playback. Set this to a low value to enable instant-start (good for fast connections) and to a high value to get less mid-stream buffering (good for slow connections).'),
+  );
+  
+  $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('Playlist item that should start to play. Use this to start the player with a specific item instead of with the first item.'),
+  );
+
+  $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 sounds on startup. Is saved in a cookie.'),
+  );
+  
+  $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('What to do when the mediafile has ended.'),
+  );
+  
+  $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 playback of playlist items. The player will randomly pick the items.'),
+  );
+
+  $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('Defines how to resize the poster image and video to fit the display. Can be:
+	<ul><li><b>none</b>: keep the original dimensions.</li>
+	<li><b>exactfit</b>: disproportionally stretch the video/image to exactly fit the display.</li>
+	<li><b>uniform</b>: stretch the image/video while maintaining its aspect ratio. There\'ll be black borders.</li>
+	<li><b>fill</b>: stretch the image/video while maintaining its aspect ratio, completely filling the display.</li></ul>'),
+  );
+
+  $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 audio volume of the player. Can be 0 to 100.'),
+  );
+  
+
+  /* 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_provider'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Provider'),
+    '#default_value' => variable_get('om_show_player_provider', ''),
+    '#description' => t('Set this flashvar to tell the player in which format (regular/streaming) the player is. By default, the provider is detected by the player based upon the file extension. If there is no suiteable extension, it can be manually set. Example provider strings: video, htttp, rtmp.'),
+  );
+  
+  $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('A comma-separated list of other plugins to load.'),
+  );
+
+  $form['om_show_player_external']['om_show_player_plugins']['om_show_player_pluginvariables'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Additional plugin variables'),
+    '#default_value' => variable_get('om_show_player_pluginvariables', ''),
+    '#description' => t('Additional variables for enabled plugins, comma-separated. Example: gapro.accountid=UA-XXXXXXX-X, gapro.trackstarts=true'),
   );
   
   return system_settings_form($form); 
@@ -106,7 +439,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 +468,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) {
-  
+
    //check cc license
   $cc_license = $element['#node']->cc;
   if($cc_license->name=='None (All Rights Reserved)'){
@@ -151,7 +484,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,30 +513,65 @@
   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;
-  
+
   if (module_exists('browscap')) {
     $browser = browscap_get_browser();
   }
   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 +580,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 . $videoimagepath  . '\');';
     
     $output .= 'so.write(\'mediaspace\');';
     $output .= '</script>'; 

