Merge branch 'master' into calendar_export
This commit is contained in:
commit
6e405513ab
|
@ -8,6 +8,7 @@
|
||||||
<require>4</require>
|
<require>4</require>
|
||||||
<shipped>true</shipped>
|
<shipped>true</shipped>
|
||||||
<types>
|
<types>
|
||||||
|
<prelogin/>
|
||||||
<authentication/>
|
<authentication/>
|
||||||
</types>
|
</types>
|
||||||
</info>
|
</info>
|
||||||
|
|
|
@ -5,11 +5,11 @@ OC_App::loadApps();
|
||||||
|
|
||||||
if ($service == 'core.css'){
|
if ($service == 'core.css'){
|
||||||
$minimizer = new OC_Minimizer_CSS();
|
$minimizer = new OC_Minimizer_CSS();
|
||||||
$files = $minimizer->findFiles(OC_Util::$core_styles);
|
$files = OC_TemplateLayout::findStylesheetFiles(OC_Util::$core_styles);
|
||||||
$minimizer->output($files, $service);
|
$minimizer->output($files, $service);
|
||||||
}
|
}
|
||||||
else if ($service == 'core.js'){
|
else if ($service == 'core.js'){
|
||||||
$minimizer = new OC_Minimizer_JS();
|
$minimizer = new OC_Minimizer_JS();
|
||||||
$files = $minimizer->findFiles(OC_Util::$core_scripts);
|
$files = OC_TemplateLayout::findJavascriptFiles(OC_Util::$core_scripts);
|
||||||
$minimizer->output($files, $service);
|
$minimizer->output($files, $service);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ elseif(OC_User::isLoggedIn()) {
|
||||||
|
|
||||||
// For all others cases, we display the guest page :
|
// For all others cases, we display the guest page :
|
||||||
} else {
|
} else {
|
||||||
|
OC_App::loadApps(array('prelogin'));
|
||||||
$error = false;
|
$error = false;
|
||||||
// remember was checked after last login
|
// remember was checked after last login
|
||||||
if(isset($_COOKIE["oc_remember_login"]) && isset($_COOKIE["oc_token"]) && isset($_COOKIE["oc_username"]) && $_COOKIE["oc_remember_login"]) {
|
if(isset($_COOKIE["oc_remember_login"]) && isset($_COOKIE["oc_token"]) && isset($_COOKIE["oc_username"]) && $_COOKIE["oc_remember_login"]) {
|
||||||
|
|
34
lib/base.php
34
lib/base.php
|
@ -95,31 +95,6 @@ class OC{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* autodetects the formfactor of the used device
|
|
||||||
* default -> the normal desktop browser interface
|
|
||||||
* mobile -> interface for smartphones
|
|
||||||
* tablet -> interface for tablets
|
|
||||||
* standalone -> the default interface but without header, footer and sidebar. just the application. useful to ue just a specific app on the desktop in a standalone window.
|
|
||||||
*/
|
|
||||||
public static function detectFormfactor(){
|
|
||||||
// please add more useragent strings for other devices
|
|
||||||
if(isset($_SERVER['HTTP_USER_AGENT'])){
|
|
||||||
if(stripos($_SERVER['HTTP_USER_AGENT'],'ipad')>0) {
|
|
||||||
$mode='tablet';
|
|
||||||
}elseif(stripos($_SERVER['HTTP_USER_AGENT'],'iphone')>0){
|
|
||||||
$mode='mobile';
|
|
||||||
}elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'nokia')>0)){
|
|
||||||
$mode='mobile';
|
|
||||||
}else{
|
|
||||||
$mode='default';
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$mode='default';
|
|
||||||
}
|
|
||||||
return($mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function initPaths(){
|
public static function initPaths(){
|
||||||
// calculate the root directories
|
// calculate the root directories
|
||||||
OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13));
|
OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13));
|
||||||
|
@ -237,15 +212,6 @@ class OC{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function initTemplateEngine() {
|
public static function initTemplateEngine() {
|
||||||
// if the formfactor is not yet autodetected do the autodetection now. For possible forfactors check the detectFormfactor documentation
|
|
||||||
if(!isset($_SESSION['formfactor'])){
|
|
||||||
$_SESSION['formfactor']=OC::detectFormfactor();
|
|
||||||
}
|
|
||||||
// allow manual override via GET parameter
|
|
||||||
if(isset($_GET['formfactor'])){
|
|
||||||
$_SESSION['formfactor']=$_GET['formfactor'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the stuff we need always
|
// Add the stuff we need always
|
||||||
OC_Util::addScript( "jquery-1.7.2.min" );
|
OC_Util::addScript( "jquery-1.7.2.min" );
|
||||||
OC_Util::addScript( "jquery-ui-1.8.16.custom.min" );
|
OC_Util::addScript( "jquery-ui-1.8.16.custom.min" );
|
||||||
|
|
|
@ -1,17 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
abstract class OC_Minimizer
|
abstract class OC_Minimizer {
|
||||||
{
|
|
||||||
protected $files = array();
|
|
||||||
|
|
||||||
protected function appendIfExist($root, $webroot, $file) {
|
|
||||||
if (is_file($root.'/'.$file)) {
|
|
||||||
$this->files[] = array($root, $webroot, $file);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLastModified($files) {
|
public function getLastModified($files) {
|
||||||
$last_modified = 0;
|
$last_modified = 0;
|
||||||
foreach($files as $file_info) {
|
foreach($files as $file_info) {
|
||||||
|
|
|
@ -6,50 +6,6 @@ class OC_Minimizer_CSS extends OC_Minimizer
|
||||||
{
|
{
|
||||||
protected $contentType = 'text/css';
|
protected $contentType = 'text/css';
|
||||||
|
|
||||||
public function findFiles($styles) {
|
|
||||||
// Read the selected theme from the config file
|
|
||||||
$theme=OC_Config::getValue( "theme" );
|
|
||||||
|
|
||||||
// Read the detected formfactor and use the right file name.
|
|
||||||
$fext = OC_Template::getFormFactorExtension();
|
|
||||||
foreach($styles as $style){
|
|
||||||
// is it in 3rdparty?
|
|
||||||
if($this->appendIfExist(OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style.'.css')) {
|
|
||||||
|
|
||||||
// or in apps?
|
|
||||||
}elseif($this->appendIfExist(OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style$fext.css" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style.css" )) {
|
|
||||||
|
|
||||||
// or in the owncloud root?
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$style$fext.css" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$style.css" )) {
|
|
||||||
|
|
||||||
// or in core ?
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$style$fext.css" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
|
|
||||||
|
|
||||||
}else{
|
|
||||||
echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add the theme css files. you can override the default values here
|
|
||||||
if(!empty($theme)) {
|
|
||||||
foreach($styles as $style){
|
|
||||||
if($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style$fext.css" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style.css" )) {
|
|
||||||
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style$fext.css" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style.css" )) {
|
|
||||||
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style$fext.css" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style.css" )) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $this->files;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function minimizeFiles($files) {
|
public function minimizeFiles($files) {
|
||||||
$css_out = '';
|
$css_out = '';
|
||||||
$appswebroot = (string) OC::$APPSWEBROOT;
|
$appswebroot = (string) OC::$APPSWEBROOT;
|
||||||
|
|
|
@ -6,49 +6,6 @@ class OC_Minimizer_JS extends OC_Minimizer
|
||||||
{
|
{
|
||||||
protected $contentType = 'application/javascript';
|
protected $contentType = 'application/javascript';
|
||||||
|
|
||||||
public function findFiles($scripts) {
|
|
||||||
// Read the selected theme from the config file
|
|
||||||
$theme=OC_Config::getValue( "theme" );
|
|
||||||
|
|
||||||
// Read the detected formfactor and use the right file name.
|
|
||||||
$fext = OC_Template::getFormFactorExtension();
|
|
||||||
// Add the core js files or the js files provided by the selected theme
|
|
||||||
foreach($scripts as $script){
|
|
||||||
// Is it in 3rd party?
|
|
||||||
if($this->appendIfExist(OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script.'.js')) {
|
|
||||||
|
|
||||||
// Is it in apps and overwritten by the theme?
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script$fext.js" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script.js" )) {
|
|
||||||
|
|
||||||
// Is it part of an app?
|
|
||||||
}elseif($this->appendIfExist(OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script$fext.js" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script.js" )) {
|
|
||||||
|
|
||||||
// Is it in the owncloud root but overwritten by the theme?
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script$fext.js" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script.js" )) {
|
|
||||||
|
|
||||||
// Is it in the owncloud root ?
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$script$fext.js" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$script.js" )) {
|
|
||||||
|
|
||||||
// Is in core but overwritten by a theme?
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script$fext.js" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script.js" )) {
|
|
||||||
|
|
||||||
// Is it in core?
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$script$fext.js" )) {
|
|
||||||
}elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$script.js" )) {
|
|
||||||
|
|
||||||
}else{
|
|
||||||
echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $this->files;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function minimizeFiles($files) {
|
public function minimizeFiles($files) {
|
||||||
$js_out = '';
|
$js_out = '';
|
||||||
foreach($files as $file_info) {
|
foreach($files as $file_info) {
|
||||||
|
|
167
lib/template.php
167
lib/template.php
|
@ -166,11 +166,48 @@ class OC_Template{
|
||||||
$this->findTemplate($name);
|
$this->findTemplate($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* autodetects the formfactor of the used device
|
||||||
|
* default -> the normal desktop browser interface
|
||||||
|
* mobile -> interface for smartphones
|
||||||
|
* tablet -> interface for tablets
|
||||||
|
* standalone -> the default interface but without header, footer and
|
||||||
|
* sidebar, just the application. Useful to use just a specific
|
||||||
|
* app on the desktop in a standalone window.
|
||||||
|
*/
|
||||||
|
public static function detectFormfactor(){
|
||||||
|
// please add more useragent strings for other devices
|
||||||
|
if(isset($_SERVER['HTTP_USER_AGENT'])){
|
||||||
|
if(stripos($_SERVER['HTTP_USER_AGENT'],'ipad')>0) {
|
||||||
|
$mode='tablet';
|
||||||
|
}elseif(stripos($_SERVER['HTTP_USER_AGENT'],'iphone')>0){
|
||||||
|
$mode='mobile';
|
||||||
|
}elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'nokia')>0)){
|
||||||
|
$mode='mobile';
|
||||||
|
}else{
|
||||||
|
$mode='default';
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$mode='default';
|
||||||
|
}
|
||||||
|
return($mode);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the formfactor extension for current formfactor
|
* @brief Returns the formfactor extension for current formfactor
|
||||||
*/
|
*/
|
||||||
static public function getFormFactorExtension()
|
static public function getFormFactorExtension()
|
||||||
{
|
{
|
||||||
|
// if the formfactor is not yet autodetected do the
|
||||||
|
// autodetection now. For possible formfactors check the
|
||||||
|
// detectFormfactor documentation
|
||||||
|
if(!isset($_SESSION['formfactor'])){
|
||||||
|
$_SESSION['formfactor'] = self::detectFormfactor();
|
||||||
|
}
|
||||||
|
// allow manual override via GET parameter
|
||||||
|
if(isset($_GET['formfactor'])){
|
||||||
|
$_SESSION['formfactor']=$_GET['formfactor'];
|
||||||
|
}
|
||||||
$formfactor=$_SESSION['formfactor'];
|
$formfactor=$_SESSION['formfactor'];
|
||||||
if($formfactor=='default') {
|
if($formfactor=='default') {
|
||||||
$fext='';
|
$fext='';
|
||||||
|
@ -270,7 +307,7 @@ class OC_Template{
|
||||||
*
|
*
|
||||||
* If the key existed before, it will be overwritten
|
* If the key existed before, it will be overwritten
|
||||||
*/
|
*/
|
||||||
public function assign( $key, $value, $sanitizeHTML=true ){
|
public function assign( $key, $value, $sanitizeHTML=true ){
|
||||||
if($sanitizeHTML == true) {
|
if($sanitizeHTML == true) {
|
||||||
if(is_array($value)) {
|
if(is_array($value)) {
|
||||||
array_walk_recursive($value,'OC_Template::sanitizeHTML');
|
array_walk_recursive($value,'OC_Template::sanitizeHTML');
|
||||||
|
@ -339,29 +376,6 @@ class OC_Template{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief append the $file-url if exist at $root
|
|
||||||
* @param $type of collection to use when appending
|
|
||||||
* @param $root path to check
|
|
||||||
* @param $web base for path
|
|
||||||
* @param $file the filename
|
|
||||||
*/
|
|
||||||
public function appendIfExist($type, $root, $web, $file) {
|
|
||||||
if (is_file($root.'/'.$file)) {
|
|
||||||
$pathes = explode('/', $file);
|
|
||||||
if($type == 'cssfiles' && $root == OC::$APPSROOT && $pathes[0] == 'apps'){
|
|
||||||
$app = $pathes[1];
|
|
||||||
unset($pathes[0]);
|
|
||||||
unset($pathes[1]);
|
|
||||||
$path = implode('/', $pathes);
|
|
||||||
$this->append( $type, OC_Helper::linkTo($app, $path));
|
|
||||||
}else{
|
|
||||||
$this->append( $type, $web.'/'.$file);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @brief Proceeds the template
|
* @brief Proceeds the template
|
||||||
* @returns content
|
* @returns content
|
||||||
|
@ -373,109 +387,9 @@ class OC_Template{
|
||||||
$data = $this->_fetch();
|
$data = $this->_fetch();
|
||||||
|
|
||||||
if( $this->renderas ){
|
if( $this->renderas ){
|
||||||
// Decide which page we show
|
$page = new OC_TemplateLayout($this->renderas);
|
||||||
if( $this->renderas == "user" ){
|
if($this->renderas == 'user') {
|
||||||
$page = new OC_Template( "core", "layout.user" );
|
|
||||||
$page->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' ), false);
|
|
||||||
$page->assign('requesttoken', $this->vars['requesttoken']);
|
$page->assign('requesttoken', $this->vars['requesttoken']);
|
||||||
if(array_search(OC_APP::getCurrentApp(),array('settings','admin','help'))!==false){
|
|
||||||
$page->assign('bodyid','body-settings', false);
|
|
||||||
}else{
|
|
||||||
$page->assign('bodyid','body-user', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add navigation entry
|
|
||||||
$navigation = OC_App::getNavigation();
|
|
||||||
$page->assign( "navigation", $navigation, false);
|
|
||||||
$page->assign( "settingsnavigation", OC_App::getSettingsNavigation(), false);
|
|
||||||
foreach($navigation as $entry) {
|
|
||||||
if ($entry['active']) {
|
|
||||||
$page->assign( 'application', $entry['name'], false );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$page = new OC_Template( "core", "layout.guest" );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read the selected theme from the config file
|
|
||||||
$theme=OC_Config::getValue( "theme" );
|
|
||||||
|
|
||||||
// Read the detected formfactor and use the right file name.
|
|
||||||
$fext = self::getFormFactorExtension();
|
|
||||||
|
|
||||||
$page->assign('jsfiles', array(), false);
|
|
||||||
// Add the core js files or the js files provided by the selected theme
|
|
||||||
foreach(OC_Util::$scripts as $script){
|
|
||||||
// Is it in 3rd party?
|
|
||||||
if($page->appendIfExist('jsfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script.'.js')) {
|
|
||||||
|
|
||||||
// Is it in apps and overwritten by the theme?
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script$fext.js" )) {
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script.js" )) {
|
|
||||||
|
|
||||||
// Is it part of an app?
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script$fext.js" )) {
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script.js" )) {
|
|
||||||
|
|
||||||
// Is it in the owncloud root but overwritten by the theme?
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script$fext.js" )) {
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script.js" )) {
|
|
||||||
|
|
||||||
// Is it in the owncloud root ?
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "$script$fext.js" )) {
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "$script.js" )) {
|
|
||||||
|
|
||||||
// Is in core but overwritten by a theme?
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script$fext.js" )) {
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script.js" )) {
|
|
||||||
|
|
||||||
// Is it in core?
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/$script$fext.js" )) {
|
|
||||||
}elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/$script.js" )) {
|
|
||||||
|
|
||||||
}else{
|
|
||||||
echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add the css files
|
|
||||||
$page->assign('cssfiles', array());
|
|
||||||
foreach(OC_Util::$styles as $style){
|
|
||||||
// is it in 3rdparty?
|
|
||||||
if($page->appendIfExist('cssfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style.'.css')) {
|
|
||||||
|
|
||||||
// or in apps?
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style$fext.css" )) {
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style.css" )) {
|
|
||||||
|
|
||||||
// or in the owncloud root?
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "$style$fext.css" )) {
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "$style.css" )) {
|
|
||||||
|
|
||||||
// or in core ?
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/$style$fext.css" )) {
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
|
|
||||||
|
|
||||||
}else{
|
|
||||||
echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add the theme css files. you can override the default values here
|
|
||||||
if(!empty($theme)) {
|
|
||||||
foreach(OC_Util::$styles as $style){
|
|
||||||
if($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style$fext.css" )) {
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style.css" )) {
|
|
||||||
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style$fext.css" )) {
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style.css" )) {
|
|
||||||
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style$fext.css" )) {
|
|
||||||
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style.css" )) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add custom headers
|
// Add custom headers
|
||||||
|
@ -484,7 +398,6 @@ class OC_Template{
|
||||||
$page->append('headers',$header);
|
$page->append('headers',$header);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add css files and js files
|
|
||||||
$page->assign( "content", $data, false );
|
$page->assign( "content", $data, false );
|
||||||
return $page->fetchPage();
|
return $page->fetchPage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,170 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
* later.
|
||||||
|
* See the COPYING-README file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class OC_TemplateLayout extends OC_Template {
|
||||||
|
public function __construct( $renderas ){
|
||||||
|
// Decide which page we show
|
||||||
|
if( $renderas == 'user' ){
|
||||||
|
parent::__construct( 'core', 'layout.user' );
|
||||||
|
$this->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' ), false);
|
||||||
|
if(array_search(OC_APP::getCurrentApp(),array('settings','admin','help'))!==false){
|
||||||
|
$this->assign('bodyid','body-settings', false);
|
||||||
|
}else{
|
||||||
|
$this->assign('bodyid','body-user', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add navigation entry
|
||||||
|
$navigation = OC_App::getNavigation();
|
||||||
|
$this->assign( 'navigation', $navigation, false);
|
||||||
|
$this->assign( 'settingsnavigation', OC_App::getSettingsNavigation(), false);
|
||||||
|
foreach($navigation as $entry) {
|
||||||
|
if ($entry['active']) {
|
||||||
|
$this->assign( 'application', $entry['name'], false );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
parent::__construct( 'core', 'layout.guest' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the js files
|
||||||
|
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
|
||||||
|
$this->assign('jsfiles', array(), false);
|
||||||
|
foreach($jsfiles as $info) {
|
||||||
|
$root = $info[0];
|
||||||
|
$web = $info[1];
|
||||||
|
$file = $info[2];
|
||||||
|
$this->append( 'jsfiles', $web.'/'.$file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the css files
|
||||||
|
$cssfiles = self::findStylesheetFiles(OC_Util::$styles);
|
||||||
|
$this->assign('cssfiles', array());
|
||||||
|
foreach($cssfiles as $info) {
|
||||||
|
$root = $info[0];
|
||||||
|
$web = $info[1];
|
||||||
|
$file = $info[2];
|
||||||
|
$paths = explode('/', $file);
|
||||||
|
if($root == OC::$APPSROOT && $paths[0] == 'apps'){
|
||||||
|
$app = $paths[1];
|
||||||
|
unset($paths[0]);
|
||||||
|
unset($paths[1]);
|
||||||
|
$path = implode('/', $paths);
|
||||||
|
$this->append( 'cssfiles', OC_Helper::linkTo($app, $path));
|
||||||
|
}else{
|
||||||
|
$this->append( 'cssfiles', $web.'/'.$file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief append the $file-url if exist at $root
|
||||||
|
* @param $files array to append file info to
|
||||||
|
* @param $root path to check
|
||||||
|
* @param $web base for path
|
||||||
|
* @param $file the filename
|
||||||
|
*/
|
||||||
|
static public function appendIfExist(&$files, $root, $webroot, $file) {
|
||||||
|
if (is_file($root.'/'.$file)) {
|
||||||
|
$files[] = array($root, $webroot, $file);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function findStylesheetFiles($styles){
|
||||||
|
// Read the selected theme from the config file
|
||||||
|
$theme=OC_Config::getValue( 'theme' );
|
||||||
|
|
||||||
|
// Read the detected formfactor and use the right file name.
|
||||||
|
$fext = self::getFormFactorExtension();
|
||||||
|
|
||||||
|
$files = array();
|
||||||
|
foreach($styles as $style){
|
||||||
|
// is it in 3rdparty?
|
||||||
|
if(self::appendIfExist($files, OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style.'.css')) {
|
||||||
|
|
||||||
|
// or in apps?
|
||||||
|
}elseif(self::appendIfExist($files, OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style$fext.css" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style.css" )) {
|
||||||
|
|
||||||
|
// or in the owncloud root?
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$style$fext.css" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$style.css" )) {
|
||||||
|
|
||||||
|
// or in core ?
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$style$fext.css" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
|
||||||
|
|
||||||
|
}else{
|
||||||
|
echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add the theme css files. you can override the default values here
|
||||||
|
if(!empty($theme)) {
|
||||||
|
foreach($styles as $style){
|
||||||
|
if(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style$fext.css" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style.css" )) {
|
||||||
|
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style$fext.css" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style.css" )) {
|
||||||
|
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style$fext.css" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style.css" )) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function findJavascriptFiles($scripts){
|
||||||
|
// Read the selected theme from the config file
|
||||||
|
$theme=OC_Config::getValue( 'theme' );
|
||||||
|
|
||||||
|
// Read the detected formfactor and use the right file name.
|
||||||
|
$fext = self::getFormFactorExtension();
|
||||||
|
|
||||||
|
$files = array();
|
||||||
|
foreach($scripts as $script){
|
||||||
|
// Is it in 3rd party?
|
||||||
|
if(self::appendIfExist($files, OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script.'.js')) {
|
||||||
|
|
||||||
|
// Is it in apps and overwritten by the theme?
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script$fext.js" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script.js" )) {
|
||||||
|
|
||||||
|
// Is it part of an app?
|
||||||
|
}elseif(self::appendIfExist($files, OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script$fext.js" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script.js" )) {
|
||||||
|
|
||||||
|
// Is it in the owncloud root but overwritten by the theme?
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script$fext.js" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script.js" )) {
|
||||||
|
|
||||||
|
// Is it in the owncloud root ?
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$script$fext.js" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$script.js" )) {
|
||||||
|
|
||||||
|
// Is in core but overwritten by a theme?
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script$fext.js" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script.js" )) {
|
||||||
|
|
||||||
|
// Is it in core?
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$script$fext.js" )) {
|
||||||
|
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$script.js" )) {
|
||||||
|
|
||||||
|
}else{
|
||||||
|
echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
|
||||||
|
die();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,7 +17,8 @@ OC_App::setActiveNavigationEntry( 'personal' );
|
||||||
|
|
||||||
// calculate the disc space
|
// calculate the disc space
|
||||||
$rootInfo=OC_FileCache::get('');
|
$rootInfo=OC_FileCache::get('');
|
||||||
$used=$rootInfo['size'];
|
$sharedInfo=OC_FileCache::get('/Shared');
|
||||||
|
$used=$rootInfo['size']-$sharedInfo['size'];
|
||||||
$free=OC_Filesystem::free_space();
|
$free=OC_Filesystem::free_space();
|
||||||
$total=$free+$used;
|
$total=$free+$used;
|
||||||
if($total==0) $total=1; // prevent division by zero
|
if($total==0) $total=1; // prevent division by zero
|
||||||
|
|
Loading…
Reference in New Issue