Author: ornicar2
Date: 2010-01-18 14:46:29 +0100 (Mon, 18 Jan 2010)
New Revision: 26813

Added:
   plugins/dmFlowPlayerPlugin/web/js/widget/view.js
Removed:
   plugins/dmFlowPlayerPlugin/config/dmFlowPlayerPluginConfiguration.class.php
   plugins/dmFlowPlayerPlugin/web/js/launcher.js
Modified:
   plugins/dmFlowPlayerPlugin/config/dm/assets.yml
   plugins/dmFlowPlayerPlugin/lib/dmWidget/dmWidgetContentFlowPlayerForm.php
   plugins/dmFlowPlayerPlugin/lib/dmWidget/dmWidgetContentFlowPlayerView.php
   plugins/dmFlowPlayerPlugin/web/js/widget/form.js
Log:
[Diem][dmFlowPlayerPlugin]
- enhanced asynchronous assets inclusion

Modified: plugins/dmFlowPlayerPlugin/config/dm/assets.yml
===================================================================
--- plugins/dmFlowPlayerPlugin/config/dm/assets.yml     2010-01-18 13:45:45 UTC 
(rev 26812)
+++ plugins/dmFlowPlayerPlugin/config/dm/assets.yml     2010-01-18 13:46:29 UTC 
(rev 26813)
@@ -3,10 +3,9 @@
   dmFlowPlayerPlugin:
     
     flowPlayer:       lib/flowplayer-3.1.4.min
-    
-    launcher:         launcher
-    
+
     widgetForm:       widget/form
+    widgetView:       widget/view
 
 other:
 

Deleted: 
plugins/dmFlowPlayerPlugin/config/dmFlowPlayerPluginConfiguration.class.php
===================================================================
--- plugins/dmFlowPlayerPlugin/config/dmFlowPlayerPluginConfiguration.class.php 
2010-01-18 13:45:45 UTC (rev 26812)
+++ plugins/dmFlowPlayerPlugin/config/dmFlowPlayerPluginConfiguration.class.php 
2010-01-18 13:46:29 UTC (rev 26813)
@@ -1,22 +0,0 @@
-<?php
-
-class dmFlowPlayerPluginConfiguration extends sfPluginConfiguration
-{
-  
-  /**
-   * @see sfPluginConfiguration
-   */
-  public function initialize()
-  {
-    $this->dispatcher->connect('dm.context.loaded', array($this, 
'listenToContextLoadedEvent'));
-  }
-  
-  public function listenToContextLoadedEvent(sfEvent $e)
-  {
-    $response = $e->getSubject()->getResponse();
-    
-    $response->addJavascript('dmFlowPlayerPlugin.flowPlayer');
-    $response->addJavascript('dmFlowPlayerPlugin.launcher');
-  }
-
-}
\ No newline at end of file

Modified: 
plugins/dmFlowPlayerPlugin/lib/dmWidget/dmWidgetContentFlowPlayerForm.php
===================================================================
--- plugins/dmFlowPlayerPlugin/lib/dmWidget/dmWidgetContentFlowPlayerForm.php   
2010-01-18 13:45:45 UTC (rev 26812)
+++ plugins/dmFlowPlayerPlugin/lib/dmWidget/dmWidgetContentFlowPlayerForm.php   
2010-01-18 13:46:29 UTC (rev 26813)
@@ -9,15 +9,6 @@
     
     unset($this['legend']);
     
-    $this->addRequiredStylesheet(array(
-      'lib.ui-tabs'
-    ));
-    $this->addRequiredJavascript(array(
-      'lib.ui-tabs',
-      'core.tabForm',
-      'dmFlowPlayerPlugin.widgetForm'
-    ));
-    
     $this->widgetSchema['autoplay'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['autoplay'] = new sfValidatorBoolean();
     
@@ -54,6 +45,22 @@
     
     $this->configureSplashMediaFields();
   }
+
+  public function getJavascripts()
+  {
+    return array_merge(parent::getJavascripts(), array(
+      'lib.ui-tabs',
+      'core.tabForm',
+      'dmFlowPlayerPlugin.widgetForm'
+    ));
+  }
+
+  public function getStylesheets()
+  {
+    return array_merge(parent::getStylesheets(), array(
+      'lib.ui-tabs'
+    ));
+  }
   
   protected function configureSplashMediaFields()
   {
@@ -212,7 +219,7 @@
       }
     }
     
-    return 
self::$serviceContainer->getService('helper')->renderPartial('dmWidgetContentFlowPlayer',
 $template, array(
+    return $this->getHelper()->renderPartial('dmWidgetContentFlowPlayer', 
$template, array(
       'form' => $this,
       'hasSplashMedia' => (boolean) $this->getValueOrDefault('splashMediaId'),
       'baseTabId' => 'dm_widget_flow_player_'.$this->dmWidget->get('id')

Modified: 
plugins/dmFlowPlayerPlugin/lib/dmWidget/dmWidgetContentFlowPlayerView.php
===================================================================
--- plugins/dmFlowPlayerPlugin/lib/dmWidget/dmWidgetContentFlowPlayerView.php   
2010-01-18 13:45:45 UTC (rev 26812)
+++ plugins/dmFlowPlayerPlugin/lib/dmWidget/dmWidgetContentFlowPlayerView.php   
2010-01-18 13:46:29 UTC (rev 26813)
@@ -7,11 +7,11 @@
     parent::configure();
 
     $this->addRequiredVar('method');
-    
-//    $this->addRequiredJavascript(array(
-//      'dmFlowPlayerPlugin.flowPlayer',
-//      'dmFlowPlayerPlugin.launcher'
-//    ));
+
+    $this->addJavascript(array(
+      'dmFlowPlayerPlugin.flowPlayer',
+      'dmFlowPlayerPlugin.widgetView'
+    ));
   }
 
   protected function filterViewVars(array $vars = array())
@@ -31,13 +31,13 @@
           throw new dmException('No DmMedia found for media id : 
'.$vars['splashMediaId']);
         }
         
-        $splashTag = $this->context->getHelper()->£media($splashMedia)
-        ->alt($vars['splashAlt']);
+        $splashTag = 
$this->getHelper()->£media($splashMedia)->alt($vars['splashAlt']);
         
         $vars['mediaTag']->splash($splashTag);
       }
       
-      $vars['mediaTag']->autoplay($vars['autoplay'])
+      $vars['mediaTag']
+      ->autoplay($vars['autoplay'])
       ->method($vars['method'])
       ->control($vars['control']);
     }

Deleted: plugins/dmFlowPlayerPlugin/web/js/launcher.js
===================================================================
--- plugins/dmFlowPlayerPlugin/web/js/launcher.js       2010-01-18 13:45:45 UTC 
(rev 26812)
+++ plugins/dmFlowPlayerPlugin/web/js/launcher.js       2010-01-18 13:46:29 UTC 
(rev 26813)
@@ -1,45 +0,0 @@
-(function($)
-{
-  // on page load
-  $(function()
-  {
-               
-               $.dmLaunchFlowPlayer = function()
-               {
-                       var idCount = 1;
-                       
-                       // starts all players in the page
-                       $('div.dm_flow_player').each(function()
-                       {
-                               var id = 'dm_widget_content_flow_player_' + 
(idCount++), $this = $(this).attr('id', id), options = $this.metadata();
-                               
-                               switch (options.mimeGroup)
-                               {
-                                       case 'application':
-                                               flashembed(id, 
$.extend(options.flashConfig, {
-                                                       src: options.src
-                                               }), options.flashVars);
-                                               break;
-                                       case 'video':
-                                       case 'audio':
-                                               flowplayer(id, 
options.player_web_path, {
-                                                       clip: {
-                                                               url: 
options.src,
-                                                               autoPlay: 
options.autoplay || false,
-                                                               scaling: 
options.resize_method || 'orig'
-                                                       },
-                                                       plugins: {
-                                                               controls: 
options.control || null
-                                                       }
-                                               });
-                                               break;
-                                       default:
-                                               $.dbg('Unknown mime group : ' + 
options.mimeGroup);
-                               }
-                       });
-               };
-               
-               $.dmLaunchFlowPlayer();
-  });
-  
-})(jQuery);

Modified: plugins/dmFlowPlayerPlugin/web/js/widget/form.js
===================================================================
--- plugins/dmFlowPlayerPlugin/web/js/widget/form.js    2010-01-18 13:45:45 UTC 
(rev 26812)
+++ plugins/dmFlowPlayerPlugin/web/js/widget/form.js    2010-01-18 13:46:29 UTC 
(rev 26813)
@@ -24,7 +24,5 @@
         $form.submit();
       }
     });
-               
-               $.dmLaunchFlowPlayer();
   }
 });
\ No newline at end of file

Copied: plugins/dmFlowPlayerPlugin/web/js/widget/view.js (from rev 26057, 
plugins/dmFlowPlayerPlugin/web/js/launcher.js)
===================================================================
--- plugins/dmFlowPlayerPlugin/web/js/widget/view.js                            
(rev 0)
+++ plugins/dmFlowPlayerPlugin/web/js/widget/view.js    2010-01-18 13:46:29 UTC 
(rev 26813)
@@ -0,0 +1,38 @@
+(function($)
+{
+  var idCount = 1;
+
+  $('#dm_page 
div.dm_widget.dm_widget_content_flow_player').live('dmWidgetLaunch', function()
+  {
+    var $player = $(this).find('div.dm_flow_player');
+
+    var id = 'dm_widget_content_flow_player_' + (idCount++), options = 
$player.metadata();
+
+    $player.attr('id', id);
+
+    switch (options.mimeGroup)
+    {
+      case 'application':
+        flashembed(id, $.extend(options.flashConfig, {
+          src: options.src
+        }), options.flashVars);
+        break;
+      case 'video':
+      case 'audio':
+        flowplayer(id, options.player_web_path, {
+          clip: {
+            url: options.src,
+            autoPlay: options.autoplay || false,
+            scaling: options.resize_method || 'orig'
+          },
+          plugins: {
+            controls: options.control || null
+          }
+        });
+        break;
+      default:
+        $.dbg('Unknown mime group : ' + options.mimeGroup);
+    }
+  });
+  
+})(jQuery);

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to