aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-12-15 16:18:38 +0100
committerLukas Reschke <lukas@owncloud.com>2014-12-15 16:18:38 +0100
commit76357af2d50b7f040109311286cc57ee53c44cf1 (patch)
tree1a0cd8adec0a641f1d4f3e30afb6deef49f4e57e /lib
parent6602d3ac777f0338e1fcfbd9c4a67c1fdf792905 (diff)
parent9f30d3529ab6d577d56147b397c5cc6aab24aea0 (diff)
downloadnextcloud-server-76357af2d50b7f040109311286cc57ee53c44cf1.tar.gz
nextcloud-server-76357af2d50b7f040109311286cc57ee53c44cf1.zip
Merge pull request #11946 from owncloud/load-vendor-from-core-json
Implement method that reads vendor libs from core.json
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/base.php b/lib/base.php
index 24ca55584ad..1dd259b0914 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -336,15 +336,25 @@ class OC {
public static function initTemplateEngine() {
// Add the stuff we need always
- // TODO: read from core/js/core.json
- OC_Util::addVendorScript('jquery/jquery.min');
- OC_Util::addVendorScript('jquery/jquery-migrate.min');
- OC_Util::addVendorScript('jquery-ui/ui/jquery-ui.custom');
+
+ // following logic will import all vendor libraries that are
+ // specified in core/js/core.json
+ $fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json');
+ if($fileContent !== false) {
+ $coreDependencies = json_decode($fileContent, true);
+ foreach($coreDependencies['vendor'] as $vendorLibrary) {
+ // remove trailing ".js" as addVendorScript will append it
+ OC_Util::addVendorScript(
+ substr($vendorLibrary, 0, strlen($vendorLibrary) - 3));
+ }
+ } else {
+ throw new \Exception('Cannot read core/js/core.json');
+ }
+
OC_Util::addScript("jquery-showpassword");
OC_Util::addScript("placeholders");
OC_Util::addScript("jquery-tipsy");
OC_Util::addScript("compatibility");
- OC_Util::addVendorScript("underscore/underscore");
OC_Util::addScript("jquery.ocdialog");
OC_Util::addScript("oc-dialogs");
OC_Util::addScript("js");
@@ -358,7 +368,6 @@ class OC {
OC_Util::addScript("oc-requesttoken");
OC_Util::addScript("apps");
OC_Util::addVendorScript('snapjs/dist/latest/snap');
- OC_Util::addVendorScript('moment/min/moment-with-locales');
// avatars
if (\OC::$server->getSystemConfig()->getValue('enable_avatars', true) === true) {