mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
allow to package templates like applicatons in an own directory, cleand up index.php a bit
This commit is contained in:
parent
8589cdd874
commit
472a420231
52
index.php
52
index.php
@ -1,15 +1,14 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare *
|
||||
* http://www.egroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
/**
|
||||
* EGroupware index page
|
||||
*
|
||||
* Starts all applications using $_GET[menuaction]
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package api
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
// forward for not existing or empty header to setup
|
||||
if(!file_exists('header.inc.php') || !filesize('header.inc.php'))
|
||||
@ -72,17 +71,17 @@ if (isset($_GET['tz']))
|
||||
// Check if we are using windows or normal webpage
|
||||
$windowed = false;
|
||||
$tpl_info = EGW_SERVER_ROOT . '/phpgwapi/templates/' . basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']) . '/setup/setup.inc.php';
|
||||
|
||||
if (!file_exists($tpl_info))
|
||||
{
|
||||
$tpl_info = EGW_SERVER_ROOT.'/'.basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']) . '/setup/setup.inc.php';
|
||||
}
|
||||
if(@file_exists($tpl_info))
|
||||
{
|
||||
include_once($tpl_info);
|
||||
// if(isset($template_info))
|
||||
// {
|
||||
if($GLOBALS['egw_info']['template'][$GLOBALS['egw_info']['user']['preferences']['common']['template_set']]['windowed'])
|
||||
{
|
||||
$windowed = true;
|
||||
}
|
||||
// }
|
||||
include_once($tpl_info);
|
||||
if($GLOBALS['egw_info']['template'][$GLOBALS['egw_info']['user']['preferences']['common']['template_set']]['windowed'])
|
||||
{
|
||||
$windowed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($app == 'home' && !$api_requested && !$windowed)
|
||||
@ -93,13 +92,13 @@ if($app == 'home' && !$api_requested && !$windowed)
|
||||
}
|
||||
if($GLOBALS['egw_info']['user']['preferences']['common']['default_app'] && !$hasupdates)
|
||||
{
|
||||
$GLOBALS['egw']->redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app']));
|
||||
egw::redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/home/index.php');
|
||||
egw::redirect_link('/home/index.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($windowed && $_GET['cd'] == 'yes')
|
||||
{
|
||||
@ -108,9 +107,8 @@ if($windowed && $_GET['cd'] == 'yes')
|
||||
'nonavbar' => False,
|
||||
'currentapp' => 'eGroupWare'
|
||||
);
|
||||
$GLOBALS['egw']->common->egw_header();
|
||||
$GLOBALS['egw']->common->egw_footer();
|
||||
|
||||
common::egw_header();
|
||||
common::egw_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -166,6 +164,6 @@ else
|
||||
|
||||
if(!isset($GLOBALS['egw_info']['nofooter']))
|
||||
{
|
||||
$GLOBALS['egw']->common->egw_footer();
|
||||
common::egw_footer();
|
||||
}
|
||||
}
|
||||
|
@ -644,8 +644,7 @@ class common
|
||||
* get template dir of an application
|
||||
*
|
||||
* @param $appname appication name optional can be derived from $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
* @static
|
||||
* @return string/boolean dir or false if no dir is found
|
||||
* @return string|boolean dir or false if no dir is found
|
||||
*/
|
||||
static function get_tpl_dir($appname = '')
|
||||
{
|
||||
@ -675,7 +674,9 @@ class common
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw_info']['user']['preferences']['common']['template_set'];
|
||||
}
|
||||
if (!file_exists(EGW_SERVER_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'.
|
||||
if (!file_exists(EGW_SERVER_ROOT.'/phpgwapi/templates/'.basename($GLOBALS['egw_info']['server']['template_set']).'/class.'.
|
||||
$GLOBALS['egw_info']['server']['template_set'].'_framework.inc.php') &&
|
||||
!file_exists(EGW_SERVER_ROOT.'/'.basename($GLOBALS['egw_info']['server']['template_set']).'/inc/class.'.
|
||||
$GLOBALS['egw_info']['server']['template_set'].'_framework.inc.php'))
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['template_set'] = 'idots';
|
||||
@ -691,10 +692,7 @@ class common
|
||||
{
|
||||
return $tpldir_default;
|
||||
}
|
||||
else
|
||||
{
|
||||
return False;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -618,10 +618,13 @@ class egw_minimal
|
||||
case 'framework':
|
||||
// setup the new eGW framework (template sets)
|
||||
$class = $GLOBALS['egw_info']['server']['template_set'].'_framework';
|
||||
require_once($file=EGW_INCLUDE_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'.$class.'.inc.php');
|
||||
if (!in_array($file,(array)$_SESSION['egw_required_files']))
|
||||
if (!class_exists($class)) // first try to autoload the class
|
||||
{
|
||||
$_SESSION['egw_required_files'][] = $file; // automatic load the used framework class, when the object get's restored
|
||||
require_once($file=EGW_INCLUDE_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'.$class.'.inc.php');
|
||||
if (!in_array($file,(array)$_SESSION['egw_required_files']))
|
||||
{
|
||||
$_SESSION['egw_required_files'][] = $file; // automatic load the used framework class, when the object get's restored
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'template': // need to be instancated for the current app
|
||||
|
@ -45,6 +45,13 @@ abstract class egw_framework
|
||||
*/
|
||||
var $template;
|
||||
|
||||
/**
|
||||
* Path relative to EGW_SERVER_ROOT for the template directory
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $template_dir;
|
||||
|
||||
/**
|
||||
* true if $this->header() was called
|
||||
*
|
||||
@ -73,6 +80,7 @@ abstract class egw_framework
|
||||
{
|
||||
$GLOBALS['egw']->framework = $this;
|
||||
}
|
||||
$this->template_dir = '/phpgwapi/templates/'.$template;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -647,14 +655,14 @@ abstract class egw_framework
|
||||
}
|
||||
}
|
||||
#_debug_array($GLOBALS['egw_info']['user']['preferences']['common']);
|
||||
$theme_css = '/phpgwapi/templates/'.$this->template.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css';
|
||||
$theme_css = $this->template_dir.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css';
|
||||
if(!file_exists(EGW_SERVER_ROOT.$theme_css))
|
||||
{
|
||||
$theme_css = '/phpgwapi/templates/'.$this->template.'/css/'.$this->template.'.css';
|
||||
$theme_css = $this->template_dir.'/css/'.$this->template.'.css';
|
||||
}
|
||||
$theme_css = $GLOBALS['egw_info']['server']['webserver_url'] . $theme_css .'?'.filemtime(EGW_SERVER_ROOT.$theme_css);
|
||||
|
||||
$print_css = '/phpgwapi/templates/'.$this->template.'/print.css';
|
||||
$print_css = $this->template_dir.'/print.css';
|
||||
if(!file_exists(EGW_SERVER_ROOT.$print_css))
|
||||
{
|
||||
$print_css = '/phpgwapi/templates/idots/print.css';
|
||||
|
Loading…
Reference in New Issue
Block a user