]> source.dussan.org Git - nextcloud-server.git/commitdiff
Simplify app js locating for layout pages
authorBart Visscher <bartv@thisnet.nl>
Fri, 19 Apr 2013 14:08:43 +0000 (16:08 +0200)
committerBart Visscher <bartv@thisnet.nl>
Fri, 26 Apr 2013 12:21:51 +0000 (14:21 +0200)
lib/templatelayout.php

index 92837658a5f4c6453d2688451097a45555a92eed..686a38a7386d87bb1d1c49013431ed942f78aac0 100644 (file)
@@ -173,18 +173,15 @@ class OC_TemplateLayout extends OC_Template {
 
                        }else{
                                // Is it part of an app?
-                               $append = false;
-                               foreach( OC::$APPSROOTS as $apps_dir) {
-                                       if(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script$fext.js")) {
-                                               $append = true;
-                                               break;
-                                       }
-                                       elseif(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script.js")) {
-                                               $append = true;
-                                               break;
-                                       }
+                               $app = substr($script, 0, strpos($script, '/'));
+                               $script = substr($script, strpos($script, '/')+1);
+                               $app_path = OC_App::getAppPath($app);
+                               $app_url = OC_App::getAppWebPath($app);
+                               if(self::appendIfExist($files, $app_path, $app_url, "$script$fext.js")) {
+                               }
+                               elseif(self::appendIfExist($files, $app_path, $app_url, "$script.js")) {
                                }
-                               if(! $append) {
+                               else {
                                        echo('js file not found: script:'.$script.' formfactor:'.$fext
                                                .' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
                                        die();