Core templates are in core/templates directory

This commit is contained in:
Laurent Destailleur 2010-01-04 19:39:16 +00:00
parent eb8ac6c1b0
commit 90d099ddf2
6 changed files with 186 additions and 152 deletions

View File

@ -0,0 +1,34 @@
{* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN GOOGLE AD TEMPLATE -->
<script type="text/javascript"><!--
google_ad_client = "{$main_google_ad_client}";
/* {$main_google_ad_width}x{$main_google_ad_height}, {$main_google_ad_name} */
google_ad_slot = "{$main_google_ad_slot}";
google_ad_width = {$main_google_ad_width};
google_ad_height = {$main_google_ad_height};
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- END GOOGLE AD TEMPLATE -->

View File

@ -29,7 +29,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
<meta name="robots" content="noindex,nofollow"> <meta name="robots" content="noindex,nofollow">
<title><?php echo $langs->trans('Login'); ?></title> <title><?php echo $langs->trans('Login'); ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>"> <link rel="stylesheet" type="text/css" href="<?php echo $conf->css; ?>">
<style type="text/css"> <style type="text/css">
<!-- <!--
@ -82,8 +82,8 @@ function donnefocus() {
<td valign="bottom" nowrap="nowrap"> <td valign="bottom" nowrap="nowrap">
<input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" /></td> <input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" /></td>
<td rowspan="<?php echo $logo_rowspan; ?>" align="center" valign="top"> <td rowspan="<?php echo $rowspan; ?>" align="center" valign="top">
<img alt="Logo" title="" src="<?php echo $logo; ?>" /> <img alt="Logo" title="" src="<?php echo $urllogo; ?>" />
</td> </td>
</tr> </tr>
@ -163,7 +163,7 @@ function donnefocus() {
<?php if ($main_google_ad_client) { ?> <?php if ($main_google_ad_client) { ?>
<div align="center"> <div align="center">
<?php include($google_ad_tpl); ?> <?php include('google_ad.tpl.php'); ?>
</div> </div>
<?php } ?> <?php } ?>

View File

@ -34,18 +34,15 @@
*/ */
function dol_loginfunction($langs,$conf,$mysoc) function dol_loginfunction($langs,$conf,$mysoc)
{ {
global $dolibarr_main_demo,$db;
$langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]); $langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]);
$langs->setDefaultLang($langcode); $langs->setDefaultLang($langcode);
$langs->load("main"); $langs->load("main");
$langs->load("other"); $langs->load("other");
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; $conf->css = "theme/".$conf->theme."/".$conf->theme.".css.php";
// Si feuille de style en php existe
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php";
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
// Set cookie for timeout management // Set cookie for timeout management
$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]); $sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
@ -54,6 +51,46 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"]; if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"];
else unset($_SESSION["urlfrom"]); else unset($_SESSION["urlfrom"]);
$demologin='';
$demopassword='';
if (! empty($dolibarr_main_demo))
{
$tab=explode(',',$dolibarr_main_demo);
$demologin=$tab[0];
$demopassword=$tab[1];
}
// Entity cookie
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
{
$lastuser = '';
$lastentity = $_POST['entity'];
if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
{
$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
if (isset($_COOKIE[$entityCookieName]))
{
include_once(DOL_DOCUMENT_ROOT . "/core/cookie.class.php");
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
$entityCookie = new DolCookie($cryptkey);
$cookieValue = $entityCookie->_getCookie($entityCookieName);
list($lastuser, $lastentity) = explode('|', $cookieValue);
}
}
}
$title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
// Ce DTD est KO car inhibe document.body.scrollTop // Ce DTD est KO car inhibe document.body.scrollTop
//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; //print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
// Ce DTD est OK // Ce DTD est OK
@ -112,8 +149,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
// Table 1 // Table 1
$title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
print '<table class="login" summary="'.$title.'" cellpadding="0" cellspacing="0" border="0" align="center">'."\n";; print '<table class="login" summary="'.$title.'" cellpadding="0" cellspacing="0" border="0" align="center">'."\n";;
print '<tr class="vmenu"><td align="center">'.$title.'</td></tr>'."\n"; print '<tr class="vmenu"><td align="center">'.$title.'</td></tr>'."\n";
print '</table>'."\n"; print '</table>'."\n";
@ -126,38 +161,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '<tr>'; print '<tr>';
$demologin='';
$demopassword='';
global $dolibarr_main_demo;
if (! empty($dolibarr_main_demo))
{
$tab=explode(',',$dolibarr_main_demo);
$demologin=$tab[0];
$demopassword=$tab[1];
}
// Entity cookie
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
{
$lastuser = '';
$lastentity = $_POST['entity'];
if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
{
$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
if (isset($_COOKIE[$entityCookieName]))
{
include_once(DOL_DOCUMENT_ROOT . "/core/cookie.class.php");
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
$entityCookie = new DolCookie($cryptkey);
$cookieValue = $entityCookie->_getCookie($entityCookieName);
list($lastuser, $lastentity) = explode('|', $cookieValue);
}
}
}
// Login field // Login field
print '<td valign="bottom"> &nbsp; <b>'.$langs->trans("Login").'</b> &nbsp; </td>'."\n"; print '<td valign="bottom"> &nbsp; <b>'.$langs->trans("Login").'</b> &nbsp; </td>'."\n";
print '<td valign="bottom" nowrap="nowrap"><input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="'; print '<td valign="bottom" nowrap="nowrap"><input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="';
@ -205,8 +208,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
{ {
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php'); require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
global $db;
$mc = new Multicompany($db); $mc = new Multicompany($db);
$mc->getEntities(); $mc->getEntities();
@ -336,6 +337,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
*/ */
function dol_loginfunction2($langs,$conf,$mysoc) function dol_loginfunction2($langs,$conf,$mysoc)
{ {
global $dolibarr_main_demo,$db;
global $smarty; global $smarty;
$langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]); $langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]);
@ -379,10 +381,8 @@ function dol_loginfunction2($langs,$conf,$mysoc)
$smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/"; $smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/";
} }
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; $conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
$conf->css.=".php?lang=".$langs->defaultlang;
// Si feuille de style en php existe
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php?lang=".$langs->defaultlang;
$smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css); $smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css);
} }
@ -398,14 +398,11 @@ function dol_loginfunction2($langs,$conf,$mysoc)
if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username'); if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username');
else $smarty->assign('focus_element', 'password'); else $smarty->assign('focus_element', 'password');
$login_background=DOL_URL_ROOT.'/theme/login_background.png';
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png')) if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
{ {
$smarty->assign('login_background', DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'); $smarty->assign('login_background', DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png');
} }
else
{
$smarty->assign('login_background', DOL_URL_ROOT.'/theme/login_background.png');
}
// Title // Title
$title='Dolibarr '.DOL_VERSION; $title='Dolibarr '.DOL_VERSION;
@ -415,7 +412,6 @@ function dol_loginfunction2($langs,$conf,$mysoc)
$demologin=''; $demologin='';
$demopassword=''; $demopassword='';
global $dolibarr_main_demo;
if (! empty($dolibarr_main_demo)) if (! empty($dolibarr_main_demo))
{ {
$tab=explode(',',$dolibarr_main_demo); $tab=explode(',',$dolibarr_main_demo);
@ -447,8 +443,9 @@ function dol_loginfunction2($langs,$conf,$mysoc)
// Login // Login
$login = (!empty($lastuser)?$lastuser:(isset($_REQUEST["username"])?$_REQUEST["username"]:$demologin)); $login = (!empty($lastuser)?$lastuser:(isset($_REQUEST["username"])?$_REQUEST["username"]:$demologin));
$password = $demopassword;
$smarty->assign('login', $login); $smarty->assign('login', $login);
$smarty->assign('password', $demopassword); $smarty->assign('password', $password);
// Show logo (search in order: small company logo, large company logo, theme logo, common logo) // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width=0; $width=0;
@ -480,18 +477,18 @@ function dol_loginfunction2($langs,$conf,$mysoc)
{ {
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php'); require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
global $db;
$mc = new Multicompany($db); $mc = new Multicompany($db);
$mc->getEntities(); $mc->getEntities();
$smarty->assign('select_entity', $mc->select_entities($mc->entities,$lastentity,'tabindex="3"')); $select_entity=$mc->select_entities($mc->entities,$lastentity,'tabindex="3"');
$smarty->assign('select_entity', $select_entity);
} }
// Security graphical code // Security graphical code
if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
{ {
$smarty->assign('captcha', 1); $captcha=1;
$smarty->assign('captcha', $captcha);
$smarty->assign('captcha_refresh', img_refresh()); $smarty->assign('captcha_refresh', img_refresh());
} }
@ -500,12 +497,14 @@ function dol_loginfunction2($langs,$conf,$mysoc)
{ {
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
{ {
$smarty->assign('forgetpasslink', 1); $forgetpasslink=1;
$smarty->assign('forgetpasslink', $forgetpasslink);
} }
if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
{ {
$smarty->assign('helpcenterlink', 1); $helpcenterlink=1;
$smarty->assign('helpcenterlink', $helpcenterlink);
} }
} }
@ -546,7 +545,8 @@ function dol_loginfunction2($langs,$conf,$mysoc)
} }
// Creation du template // Creation du template
$smarty->display('login.tpl'); $smarty->display('login.tpl'); // To use Smarty
// include(DOL_DOCUMENT_ROOT.'/core/templates/login.tpl.php'); // To use native PHP
// Suppression de la version compilee // Suppression de la version compilee
$smarty->clear_compiled_tpl('login.tpl'); $smarty->clear_compiled_tpl('login.tpl');

View File

@ -167,13 +167,13 @@ if ($conf->global->MAIN_SMARTY)
} }
else else
{ {
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/user/passwordforgotten.tpl")) if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/core/templates/passwordforgotten.tpl"))
{ {
$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/user/"; $smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/core/";
} }
else else
{ {
$smarty->template_dir = DOL_DOCUMENT_ROOT."/user/templates/"; $smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/";
} }
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; $conf->css = "theme/".$conf->theme."/".$conf->theme.".css";