You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by ch...@apache.org on 2010/02/10 09:27:34 UTC

svn commit: r908384 - /shindig/trunk/php/src/gadgets/render/GadgetRenderer.php

Author: chabotc
Date: Wed Feb 10 08:27:34 2010
New Revision: 908384

URL: http://svn.apache.org/viewvc?rev=908384&view=rev
Log:
Patch by Jacky Wang - Don't expand feartures in forcedJsLibs script tag

Modified:
    shindig/trunk/php/src/gadgets/render/GadgetRenderer.php

Modified: shindig/trunk/php/src/gadgets/render/GadgetRenderer.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/render/GadgetRenderer.php?rev=908384&r1=908383&r2=908384&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/render/GadgetRenderer.php (original)
+++ shindig/trunk/php/src/gadgets/render/GadgetRenderer.php Wed Feb 10 08:27:34 2010
@@ -33,7 +33,7 @@
    * generates the library string (core:caja:etc.js) including a checksum of all the
    * javascript content (?v=<md5 of js>) for cache busting
    *
-   * @param string $features
+   * @param array $features
    * @param Gadget $gadget
    * @return string the list of libraries in core:caja:etc.js?v=checksum> format
    */
@@ -41,10 +41,17 @@
     if (! is_array($features) || ! count($features)) {
       return 'null';
     }
-    $ret = implode(':', $features);
+    $registry = $this->context->getRegistry();
+    // Given the JsServlet automatically expends the js library, we just need
+    // to include the "leaf" nodes of the features.
+    $ret = $features;
+    foreach ($features as $feature) {
+      $depFeatures = $registry->features[$feature]['deps'];
+      $ret = array_diff($ret, $depFeatures);
+    }
+    $ret = implode(':', $ret);
     $cache = Cache::createCache(Config::get('feature_cache'), 'FeatureCache');
     if (($md5 = $cache->get(md5('getJsUrlMD5'))) === false) {
-      $registry = $this->context->getRegistry();
       $features = $registry->features;
 
       // Build a version string from the md5() checksum of all included javascript