Index: config/container.js =================================================================== --- config/container.js (revision 902815) +++ config/container.js (working copy) @@ -114,7 +114,7 @@ }, "rpc" : { // Path to the relay file. Automatically appended to the parent - /// parameter if it passes input validation and is not null. + // parameter if it passes input validation and is not null. // This should never be on the same host in a production environment! // Only use this for TESTING! "parentRelayUrl" : "/gadgets/files/container/rpc_relay.html", Index: php/config/container.php =================================================================== --- php/config/container.php (revision 901528) +++ php/config/container.php (working copy) @@ -110,7 +110,7 @@ 'jsondb_path' => realpath(dirname(__FILE__) . '/../../javascript/sampledata') . '/canonicaldb.json', // Force these libraries to be external (included through \n"; + foreach ($scripts as $script) { + if ($script['type'] == 'inline') { + $content .= "\n"; + } else { + $content .= "\n"; + } } - if (!empty($scripts['inline'])) { - $content .= "\n"; - } + $content .= "\n\n"; $content .= $gadget->substitutions->substitute($view['content']); $content .= '\n"; Index: php/src/gadgets/render/GadgetRenderer.php =================================================================== --- php/src/gadgets/render/GadgetRenderer.php (revision 901528) +++ php/src/gadgets/render/GadgetRenderer.php (working copy) @@ -38,12 +38,10 @@ * @return string the list of libraries in core:caja:etc.js?v=checksum> format */ protected function getJsUrl($features) { - $ret = ''; if (! is_array($features) || ! count($features)) { - $ret = 'core'; - } else { - $ret = implode(':', $features); + return 'null'; } + $ret = implode(':', $features); $cache = Cache::createCache(Config::get('feature_cache'), 'FeatureCache'); if (($md5 = $cache->get(md5('getJsUrlMD5'))) === false) { $registry = $this->context->getRegistry(); Index: php/src/gadgets/render/GadgetUrlRenderer.php =================================================================== --- php/src/gadgets/render/GadgetUrlRenderer.php (revision 901528) +++ php/src/gadgets/render/GadgetUrlRenderer.php (working copy) @@ -22,7 +22,7 @@ /** * Renders an 'URL' type view (where the iframe is redirected to the specified url) - * This is more a legacy iGoogle support feature then something that should be actually + * This is more a legacy iGoogle support feature than something that should be actually * used. Proxied content is the socially aware (and higher performance) version of this * See GadgetHrefRenderer for it's implementation. * @@ -35,13 +35,21 @@ $queryStr = strpos($redirURI, '?') !== false ? substr($redirURI, strpos($redirURI, '?')) : ''; $query = $queryStr; $query .= $this->getPrefsQueryString($gadget->gadgetSpec->userPrefs); + + // deal with features + $registry = $this->context->getRegistry(); + // since the URL mode doesn't actually have the gadget XML body, it can't inline + // the javascript content anyway - thus could us just ignore the 'forcedJsLibs' part. + $forcedJsLibs = array(); + $sortedFeatureGroups = array(); + $registry->sortFeatures($gadget->features, $forcedJsLibs, $sortedFeatureGroups); + + // join the groups $features = array(); - $forcedLibs = Config::get('focedJsLibs'); - if ($forcedLibs == null) { - $features = $gadget->features; - } else { - $features = explode(':', $forcedLibs); + foreach ($sortedFeatureGroups as $featureGroup) { + $features = array_merge($features, $featureGroup['features']); } + $query .= $this->appendLibsToQuery($features); $query .= '&lang=' . urlencode(isset($_GET['lang']) ? $_GET['lang'] : 'en'); $query .= '&country=' . urlencode(isset($_GET['country']) ? $_GET['country'] : 'US'); Index: php/src/gadgets/servlet/JsServlet.php =================================================================== --- php/src/gadgets/servlet/JsServlet.php (revision 901528) +++ php/src/gadgets/servlet/JsServlet.php (working copy) @@ -25,7 +25,7 @@ /** * This event handler deals with the /js/core:caja:etc.js request which content type=url gadgets can use * to retrieve our features javascript code, or used to make the most frequently used part of the feature - * library external, and hence cachable by the browser + * library external, and hence cachable by the browser. */ class JsServlet extends HttpServlet { @@ -56,7 +56,7 @@ $missing = array(); $context = new GadgetContext('GADGET'); $registry = new GadgetFeatureRegistry(Config::get('features_path')); - if ($registry->resolveFeatures($needed, $found, $missing)) { + if ($registry->resolveFeatures($needed, $found, $missing, false)) { $isGadgetContext = !isset($_GET["c"]) || $_GET['c'] == 0 ? true : false; $jsData = ''; foreach ($found as $feature) {