summaryrefslogtreecommitdiffstats
path: root/lib/templatelayout.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/templatelayout.php')
-rw-r--r--lib/templatelayout.php79
1 files changed, 34 insertions, 45 deletions
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index 69bebac0503..7115b8f0306 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -18,6 +18,20 @@ class OC_TemplateLayout extends OC_Template {
$this->assign('bodyid', 'body-user');
}
+ // Update notification
+ if(OC_Config::getValue('updatechecker', true) === true) {
+ $data=OC_Updater::check();
+ if(isset($data['version']) && $data['version'] != '' and $data['version'] !== Array() && OC_User::isAdminUser(OC_User::getUser())) {
+ $this->assign('updateAvailable', true);
+ $this->assign('updateVersion', $data['versionstring']);
+ $this->assign('updateLink', $data['web']);
+ } else {
+ $this->assign('updateAvailable', false); // No update available or not an admin user
+ }
+ } else {
+ $this->assign('updateAvailable', false); // Update check is disabled
+ }
+
// Add navigation entry
$this->assign( 'application', '', false );
$navigation = OC_App::getNavigation();
@@ -42,7 +56,7 @@ class OC_TemplateLayout extends OC_Template {
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);
if (OC_Config::getValue('installed', false) && $renderas!='error') {
- $this->append( 'jsfiles', OC_Helper::linkToRoute('js_config'));
+ $this->append( 'jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
}
if (!empty(OC_Util::$core_scripts)) {
$this->append( 'jsfiles', OC_Helper::linkToRemoteBase('core.js', false) . $versionParameter);
@@ -64,25 +78,8 @@ class OC_TemplateLayout extends OC_Template {
$root = $info[0];
$web = $info[1];
$file = $info[2];
- $paths = explode('/', $file);
- $in_root = false;
- foreach(OC::$APPSROOTS as $app_root) {
- if($root == $app_root['path']) {
- $in_root = true;
- break;
- }
- }
-
- if($in_root ) {
- $app = $paths[0];
- unset($paths[0]);
- $path = implode('/', $paths);
- $this->append( 'cssfiles', OC_Helper::linkTo($app, $path) . $versionParameter);
- }
- else {
- $this->append( 'cssfiles', $web.'/'.$file);
- }
+ $this->append( 'cssfiles', $web.'/'.$file . $versionParameter);
}
}
@@ -103,7 +100,7 @@ class OC_TemplateLayout extends OC_Template {
static public function findStylesheetFiles($styles) {
// Read the selected theme from the config file
- $theme=OC_Config::getValue( 'theme' );
+ $theme = OC_Util::getTheme();
// Read the detected formfactor and use the right file name.
$fext = self::getFormFactorExtension();
@@ -123,20 +120,15 @@ class OC_TemplateLayout extends OC_Template {
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
}else{
- $append = false;
- // or in apps?
- foreach( OC::$APPSROOTS as $apps_dir)
- {
- if(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style$fext.css")) {
- $append = true;
- break;
- }
- elseif(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style.css")) {
- $append = true;
- break;
- }
+ $app = substr($style, 0, strpos($style, '/'));
+ $style = substr($style, strpos($style, '/')+1);
+ $app_path = OC_App::getAppPath($app);
+ $app_url = OC::$WEBROOT . '/index.php/apps/' . $app;
+ if(self::appendIfExist($files, $app_path, $app_url, "$style$fext.css")) {
}
- if(! $append) {
+ elseif(self::appendIfExist($files, $app_path, $app_url, "$style.css")) {
+ }
+ else {
echo('css file not found: style:'.$style.' formfactor:'.$fext
.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
die();
@@ -162,7 +154,7 @@ class OC_TemplateLayout extends OC_Template {
static public function findJavascriptFiles($scripts) {
// Read the selected theme from the config file
- $theme=OC_Config::getValue( 'theme' );
+ $theme = OC_Util::getTheme();
// Read the detected formfactor and use the right file name.
$fext = self::getFormFactorExtension();
@@ -195,18 +187,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();