Test: smarty integration and iphone template
This commit is contained in:
parent
6fff66add4
commit
32967c6227
24
htdocs/core/templates/footer.tpl
Normal file
24
htdocs/core/templates/footer.tpl
Normal file
@ -0,0 +1,24 @@
|
||||
{* 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 SMARTY TEMPLATE -->
|
||||
|
||||
|
||||
|
||||
<!-- END SMARTY TEMPLATE -->
|
||||
34
htdocs/core/templates/google_ad.tpl
Normal file
34
htdocs/core/templates/google_ad.tpl
Normal 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 SMARTY 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 SMARTY TEMPLATE -->
|
||||
24
htdocs/core/templates/header.tpl
Normal file
24
htdocs/core/templates/header.tpl
Normal file
@ -0,0 +1,24 @@
|
||||
{* 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 SMARTY TEMPLATE -->
|
||||
|
||||
|
||||
|
||||
<!-- END SMARTY TEMPLATE -->
|
||||
179
htdocs/core/templates/login.tpl
Normal file
179
htdocs/core/templates/login.tpl
Normal file
@ -0,0 +1,179 @@
|
||||
{* 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$
|
||||
*}
|
||||
{php}
|
||||
header('Cache-Control: Public, must-revalidate');
|
||||
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
{/php}
|
||||
|
||||
<!-- BEGIN SMARTY TEMPLATE -->
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title>{$langs->trans('Login')}</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{$conf_css}">
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#login {ldelim}
|
||||
margin-top: 70px;
|
||||
margin-bottom: 30px;
|
||||
text-align: center;
|
||||
font: 12px arial,helvetica;
|
||||
{rdelim}
|
||||
#login table {ldelim}
|
||||
width: 498px;
|
||||
border: 1px solid #C0C0C0;
|
||||
background: #F0F0F0 url({$login_background}) repeat-x;
|
||||
font-size: 12px;
|
||||
{rdelim}
|
||||
-->
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
function donnefocus(element) {
|
||||
document.getElementById(element).focus();
|
||||
}
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
{if $main_html_header}
|
||||
{$main_html_header}
|
||||
{/if}
|
||||
|
||||
<!-- HTTP_USER_AGENT = {$smarty.server.HTTP_USER_AGENT} -->
|
||||
</head>
|
||||
|
||||
<body class="body" onload="donnefocus({$focus_element});">
|
||||
<form id="login" name="login" method="post" action="{$php_self}">
|
||||
<input type="hidden" name="token" value="{$smarty.session.newtoken}">
|
||||
|
||||
<table class="login" summary="{$title}" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||
<tr class="vmenu"><td align="center">{$title}</td></tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
<table class="login" summary="Login area" cellpadding="2" align="center">
|
||||
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="bottom"> <b>{$langs->trans('Login')}</b> </td>
|
||||
<td valign="bottom" nowrap="nowrap">
|
||||
<input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="{$login}" tabindex="1" /></td>
|
||||
|
||||
<td rowspan="{$logo_rowspan}" align="center" valign="top">
|
||||
<img alt="Logo" title="" src="{$logo}" />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td valign="top" nowrap="nowrap"> <b>{$langs->trans('Password')}</b> </td>
|
||||
<td valign="top" nowrap="nowrap">
|
||||
<input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="{$password}" tabindex="2">
|
||||
</td></tr>
|
||||
|
||||
{if $entity}
|
||||
<tr><td valign="top" nowrap="nowrap"> <b>{$langs->trans('Entity')}</b> </td>
|
||||
<td valign="top" nowrap="nowrap">
|
||||
{$entity}
|
||||
</td></tr>
|
||||
{/if}
|
||||
|
||||
{if $captcha}
|
||||
<tr><td valign="middle" nowrap="nowrap"> <b>{$langs->trans('SecurityCode')}</b></td>
|
||||
<td valign="top" nowrap="nowrap" align="left" class="none">
|
||||
|
||||
<table style="width: 100px;"><tr>
|
||||
<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="4"></td>
|
||||
<td><img src="{$dol_url_root}/lib/antispamimage.php" border="0" width="128" height="36"></td>
|
||||
<td><a href="{$php_self}">{$captcha_refresh}</a></td>
|
||||
</tr></table>
|
||||
|
||||
</td></tr>
|
||||
{/if}
|
||||
|
||||
<tr><td colspan="3"> </td></tr>
|
||||
|
||||
<tr><td colspan="3" style="text-align:center;"><br>
|
||||
<input type="submit" class="button" value=" {$langs->trans('Connection')} " tabindex="5" />
|
||||
</td></tr>
|
||||
|
||||
{if $forgetpasslink || $helpcenterlink}
|
||||
<tr><td colspan="3" align="center">
|
||||
{if $forgetpasslink}
|
||||
<a style="color: #888888; font-size: 10px" href="{$dol_url_root}/user/passwordforgotten.php">(
|
||||
{$langs->trans('PasswordForgotten')}
|
||||
{/if}
|
||||
|
||||
{if $helpcenterlink}
|
||||
<a style="color: #888888; font-size: 10px" href="{$dol_url_root}/support/index.php" target="_blank">
|
||||
{if $forgetpasslink}
|
||||
-
|
||||
{else}
|
||||
(
|
||||
{/if}
|
||||
{$langs->trans('NeedHelpCenter')}
|
||||
{/if}
|
||||
)</a>
|
||||
</td></tr>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
|
||||
<input type="hidden" name="loginfunction" value="loginfunction" />
|
||||
|
||||
</form>
|
||||
|
||||
{if $dol_loginmesg}
|
||||
<center><table width="60%"><tr><td align="center"><div class="error">
|
||||
{$dol_loginmesg}
|
||||
</div></td></tr></table></center>
|
||||
{/if}
|
||||
|
||||
{if $main_home}
|
||||
<center><table summary="info" cellpadding="0" cellspacing="0" border="0" align="center" width="750">
|
||||
<tr><td align="center">
|
||||
{$main_home}
|
||||
</td></tr></table></center><br>
|
||||
{/if}
|
||||
|
||||
{if $main_google_ad_client}
|
||||
<div align="center">
|
||||
{include file=$google_ad_tpl}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- authentication mode = {$main_authentication} -->
|
||||
<!-- cookie name used for this session = {$session_name} -->
|
||||
<!-- urlfrom in this session = {$smarty.session.urlfrom} -->
|
||||
|
||||
{if $main_html_footer}
|
||||
{$main_html_footer}
|
||||
{/if}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- END SMARTY TEMPLATE -->
|
||||
@ -339,14 +339,18 @@ function dol_loginfunction2($langs,$conf,$mysoc)
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("other");
|
||||
$langs->load("help");
|
||||
|
||||
$smarty->assign('langs', $langs);
|
||||
|
||||
if (! empty($conf->global->MAIN_HTML_HEADER)) $smarty->assign('main_html_header', $conf->global->MAIN_HTML_HEADER);
|
||||
|
||||
$php_self = $_SERVER['PHP_SELF'];
|
||||
$php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:'';
|
||||
|
||||
$smarty->assign('php_self', $php_self);
|
||||
|
||||
|
||||
// Select templates
|
||||
if ($conf->browser->phone)
|
||||
{
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone))
|
||||
@ -357,20 +361,31 @@ function dol_loginfunction2($langs,$conf,$mysoc)
|
||||
{
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/phones/other/default/templates/";
|
||||
}
|
||||
// Differencier les pages dans le cache
|
||||
$cache_id = $conf->browser->phone;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/login.tpl"))
|
||||
{
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/";
|
||||
}
|
||||
else
|
||||
{
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/";
|
||||
}
|
||||
|
||||
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/";
|
||||
|
||||
// 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);
|
||||
|
||||
// Differencier les pages dans le cache
|
||||
$cache_id = $conf->theme;
|
||||
}
|
||||
|
||||
|
||||
$smarty->assign('dol_url_root', DOL_URL_ROOT);
|
||||
$smarty->assign('character_set_client', $conf->file->character_set_client);
|
||||
|
||||
// Set cookie for timeout management
|
||||
$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
|
||||
@ -378,6 +393,18 @@ function dol_loginfunction2($langs,$conf,$mysoc)
|
||||
|
||||
if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"];
|
||||
else unset($_SESSION["urlfrom"]);
|
||||
|
||||
if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username');
|
||||
else $smarty->assign('focus_element', 'password');
|
||||
|
||||
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');
|
||||
}
|
||||
else
|
||||
{
|
||||
$smarty->assign('login_background', DOL_URL_ROOT.'/theme/login_background.png');
|
||||
}
|
||||
|
||||
// Title
|
||||
$title='Dolibarr '.DOL_VERSION;
|
||||
@ -424,7 +451,9 @@ function dol_loginfunction2($langs,$conf,$mysoc)
|
||||
|
||||
// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
|
||||
$width=0;
|
||||
$rowspan=2;
|
||||
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
|
||||
|
||||
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
|
||||
{
|
||||
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small);
|
||||
@ -439,8 +468,11 @@ function dol_loginfunction2($langs,$conf,$mysoc)
|
||||
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
|
||||
}
|
||||
|
||||
$smarty->assign('logo_url', $urllogo);
|
||||
$smarty->assign('login_width', $width);
|
||||
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++;
|
||||
|
||||
$smarty->assign('logo', $urllogo);
|
||||
$smarty->assign('logo_width', $width);
|
||||
$smarty->assign('logo_rowspan', $rowspan);
|
||||
|
||||
// Entity field
|
||||
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
|
||||
@ -459,53 +491,68 @@ function dol_loginfunction2($langs,$conf,$mysoc)
|
||||
if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
|
||||
{
|
||||
$smarty->assign('captcha', 1);
|
||||
$smarty->assign('captcha_refresh', img_refresh());
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
// Extra link
|
||||
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
|
||||
{
|
||||
if (! empty($conf->browser->phone)) print '<tr><td colspan="3"> </td></tr>'; // More space with phones
|
||||
|
||||
print '<tr><td colspan="3" align="center">';
|
||||
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
|
||||
{
|
||||
print '<a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php">(';
|
||||
print $langs->trans("PasswordForgotten");
|
||||
$smarty->assign('forgetpasslink', 1);
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
|
||||
{
|
||||
$langs->load("help");
|
||||
print '<a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/support/index.php" target="_blank">';
|
||||
if (! empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) print '(';
|
||||
else print ' - ';
|
||||
print $langs->trans("NeedHelpCenter");
|
||||
$smarty->assign('helpcenterlink', 1);
|
||||
}
|
||||
print ')</a>';
|
||||
}
|
||||
*/
|
||||
// Message
|
||||
|
||||
// Error message
|
||||
if (! empty($_SESSION["dol_loginmesg"]))
|
||||
{
|
||||
$smarty->assign('dol_loginmesg', $_SESSION["dol_loginmesg"]);
|
||||
$_SESSION["dol_loginmesg"]="";
|
||||
}
|
||||
/*
|
||||
|
||||
// Home message
|
||||
if (! empty($conf->global->MAIN_HOME))
|
||||
{
|
||||
print '<center><table summary="info" cellpadding="0" cellspacing="0" border="0" align="center"'.(empty($conf->browser->phone)?' width="750"':'').'><tr><td align="center">';
|
||||
$i=0;
|
||||
while (preg_match('/__\(([a-zA-Z]+)\)__/i',$conf->global->MAIN_HOME,$reg) && $i < 100)
|
||||
{
|
||||
$conf->global->MAIN_HOME=preg_replace('/__\('.$reg[1].'\)__/i',$langs->trans($reg[1]),$conf->global->MAIN_HOME);
|
||||
$i++;
|
||||
}
|
||||
print nl2br($conf->global->MAIN_HOME);
|
||||
print '</td></tr></table></center><br>'."\n";
|
||||
$smarty->assign('main_home', nl2br($conf->global->MAIN_HOME));
|
||||
}
|
||||
*/
|
||||
|
||||
$smarty->display('login.tpl');
|
||||
// Google Adsense (ex: demo mode)
|
||||
if (! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))
|
||||
{
|
||||
$smarty->assign('main_google_ad_client', $conf->global->MAIN_GOOGLE_AD_CLIENT);
|
||||
$smarty->assign('main_google_ad_name', $conf->global->MAIN_GOOGLE_AD_NAME);
|
||||
$smarty->assign('main_google_ad_slot', $conf->global->MAIN_GOOGLE_AD_SLOT);
|
||||
$smarty->assign('main_google_ad_width', $conf->global->MAIN_GOOGLE_AD_WIDTH);
|
||||
$smarty->assign('main_google_ad_height', $conf->global->MAIN_GOOGLE_AD_HEIGHT);
|
||||
|
||||
$google_ad_template = DOL_DOCUMENT_ROOT."/core/templates/google_ad.tpl";
|
||||
$smarty->assign('google_ad_tpl', $google_ad_template);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_HTML_FOOTER)) $smarty->assign('main_html_footer', $conf->global->MAIN_HTML_FOOTER);
|
||||
|
||||
$smarty->assign('main_authentication', $conf->file->main_authentication);
|
||||
$smarty->assign('session_name', session_name());
|
||||
|
||||
// Activation du cache
|
||||
$smarty->caching = 1;
|
||||
|
||||
// Creation et mise en cache du template avec un id
|
||||
$smarty->display('login.tpl', $cache_id);
|
||||
|
||||
// Suppression de la version compilee
|
||||
$smarty->clear_compiled_tpl('login.tpl');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,10 @@
|
||||
*
|
||||
* $Id$
|
||||
*}
|
||||
{php}
|
||||
header('Cache-Control: Public, must-revalidate');
|
||||
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
{/php}
|
||||
|
||||
<!-- BEGIN SMARTY TEMPLATE -->
|
||||
|
||||
@ -43,7 +47,7 @@
|
||||
|
||||
<form title="{$title}" id="login" name="login" class="panel" method="post" action="{$php_self}" selected="true">
|
||||
<div align="center">
|
||||
<img src="{$logo_url}">
|
||||
<img src="{$logo}">
|
||||
</div>
|
||||
<fieldset>
|
||||
<input type="hidden" name="token" value="{$smarty.session.newtoken}">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user