mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-20 07:23:47 +01:00
Rework on template files to use blocks
This commit is contained in:
parent
cd8908391d
commit
de73ffdd60
21 changed files with 106 additions and 112 deletions
|
@ -393,4 +393,5 @@ input[type='submit'].LSview_search {
|
|||
max-width: 50%;
|
||||
border-radius: 1em;
|
||||
font-weight: bold;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
|
|
@ -651,7 +651,7 @@ class LSsession {
|
|||
self :: displayLoginForm();
|
||||
}
|
||||
else {
|
||||
self :: setTemplate('blank.tpl');
|
||||
self :: setTemplate('base.tpl');
|
||||
LSerror :: addErrorCode('LSsession_10');
|
||||
}
|
||||
return;
|
||||
|
@ -934,6 +934,19 @@ class LSsession {
|
|||
return self :: $LSuserObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is connected
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com
|
||||
*
|
||||
* @retval boolean True if user connected, false instead
|
||||
*/
|
||||
public static function isConnected() {
|
||||
if (self :: $LSuserObject)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le DN de l'utilisateur connecté
|
||||
*
|
||||
|
@ -1423,7 +1436,7 @@ class LSsession {
|
|||
LSdebug_print();
|
||||
}
|
||||
if (!self :: $template)
|
||||
self :: setTemplate('empty.tpl');
|
||||
self :: setTemplate('base_connected.tpl');
|
||||
|
||||
LStemplate :: assign('connected_as',_("Connected as"));
|
||||
|
||||
|
|
|
@ -67,6 +67,12 @@ class LStemplate {
|
|||
// Registered events
|
||||
private static $_events = array();
|
||||
|
||||
// Deprecated templates files
|
||||
private static $deprecated_template_files = array (
|
||||
'accueil.tpl', 'blank.tpl', 'empty.tpl',
|
||||
'top.tpl', 'bottom.tpl',
|
||||
);
|
||||
|
||||
/**
|
||||
* Start LStemplate
|
||||
*
|
||||
|
@ -261,12 +267,19 @@ class LStemplate {
|
|||
/**
|
||||
* Return the path of the Smarty template file to use
|
||||
*
|
||||
* @param[in] string $template The template name (eg: top.tpl)
|
||||
* @param[in] string $template The template name (eg: base.tpl)
|
||||
* @param[in] bool $with_nocache If true, include nocache URL param (default: false)
|
||||
*
|
||||
* @retval string The path of the Smarty template file
|
||||
**/
|
||||
public static function getTemplatePath($template, $with_nocache=false) {
|
||||
if (in_array($template, self :: $deprecated_template_files))
|
||||
LSlog :: fatal(
|
||||
getFData(
|
||||
_("LStemplate : Request template '%{tpl}' is now deprecated. Please refer to upgrade documentation to adapt your templates."),
|
||||
$template
|
||||
)
|
||||
);
|
||||
return self :: getFilePath($template, self :: $config['template_dir'], null, $with_nocache);
|
||||
}
|
||||
|
||||
|
@ -287,7 +300,7 @@ class LStemplate {
|
|||
/**
|
||||
* Return the content of a Smarty template file.
|
||||
*
|
||||
* @param[in] string $template The template name (eg: top.tpl)
|
||||
* @param[in] string $template The template name (eg: base.tpl)
|
||||
*
|
||||
* @retval string The content of the Smarty template file
|
||||
**/
|
||||
|
@ -299,7 +312,7 @@ class LStemplate {
|
|||
// template name in lower first systematically
|
||||
return '';
|
||||
}
|
||||
$tpl_path=self :: getTemplatePath('empty.tpl');
|
||||
$tpl_path = self :: getTemplatePath(LSsession :: isConnected()?'base_connected.tpl':'base.tpl');
|
||||
LSerror::addErrorCode('LStemplate_01',$template);
|
||||
}
|
||||
return implode('',file($tpl_path));
|
||||
|
@ -309,7 +322,7 @@ class LStemplate {
|
|||
* Return the timestamp of the last change of a Smarty
|
||||
* template file.
|
||||
*
|
||||
* @param[in] string $template The template name (eg: top.tpl)
|
||||
* @param[in] string $template The template name (eg: base.tpl)
|
||||
*
|
||||
* @retval string The timestamp of the last change of the Smarty template file
|
||||
**/
|
||||
|
@ -338,7 +351,7 @@ class LStemplate {
|
|||
/**
|
||||
* Display a template
|
||||
*
|
||||
* @param[in] string $template The template name (eg: empty.tpl)
|
||||
* @param[in] string $template The template name (eg: base_connected.tpl)
|
||||
*
|
||||
* @retval void
|
||||
**/
|
||||
|
@ -361,7 +374,7 @@ class LStemplate {
|
|||
/**
|
||||
* Fetch a template
|
||||
*
|
||||
* @param[in] string $template The template name (eg: empty.tpl)
|
||||
* @param[in] string $template The template name (eg: base_connected.tpl)
|
||||
*
|
||||
* @retval string The template compiled
|
||||
**/
|
||||
|
|
|
@ -39,7 +39,7 @@ function handle_index($request) {
|
|||
LStemplate :: assign('pagetitle', _('Home'));
|
||||
|
||||
// Template
|
||||
LSsession :: setTemplate('accueil.tpl');
|
||||
LSsession :: setTemplate('homepage.tpl');
|
||||
|
||||
// Display template
|
||||
LSsession :: displayTemplate();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{include file='ls:top.tpl'}
|
||||
{extends file='ls:base_connected.tpl'}
|
||||
{block name="content"}
|
||||
<div id='LSaccessRightsMatrixView'>
|
||||
<h1>{$pagetitle}</h1>
|
||||
<ul class="LSaccessRightsMatrixView_tabs">
|
||||
|
@ -84,4 +85,4 @@
|
|||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{include file='ls:bottom.tpl'}
|
||||
{/block}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{include file='ls:top.tpl'}
|
||||
<h1>{$pagetitle}</h1>
|
||||
{include file='ls:bottom.tpl'}
|
|
@ -6,15 +6,20 @@
|
|||
<title>LdapSaisie{if $pagetitle != ''} - {$pagetitle|escape:"htmlall"}{/if}</title>
|
||||
<base href="{$public_root_url}/"/>
|
||||
<link rel="icon" href="image/favicon" />
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" type="text/css" href="{css name='base.css'}" title="Normal" />
|
||||
<link rel="stylesheet" type="text/css" href="{css name='base_print.css'}" media='print' title="Normal" />
|
||||
{include file='ls:LSsession_css.tpl'}
|
||||
{/block}
|
||||
{block name="head"}{/block}
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{include file='ls:LSdefault.tpl'}
|
||||
|
||||
{include file='ls:LSsession_js.tpl'}
|
||||
{block name="body"}{/block}
|
||||
|
||||
{include file='ls:LSsession_js.tpl'}
|
||||
{block name="js"}{/block}
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +1,5 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset={$LSencoding}">
|
||||
<title>LdapSaisie{if $pagetitle != ''} - {$pagetitle|escape:"htmlall"}{/if}</title>
|
||||
<base href="{$public_root_url}/"/>
|
||||
<link rel="icon" href="image/favicon" />
|
||||
<link rel="stylesheet" type="text/css" href="{css name='base.css'}" title="Normal" />
|
||||
<link rel="stylesheet" type="text/css" href="{css name='base_print.css'}" media='print' title="Normal" />
|
||||
{include file='ls:LSsession_css.tpl'}
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{include file='ls:LSdefault.tpl'}
|
||||
|
||||
{extends file='ls:base.tpl'}
|
||||
{block name="body"}
|
||||
<table id='main'>
|
||||
<tr>
|
||||
<td rowspan=2 id='left'>
|
||||
|
@ -66,3 +52,10 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td id='right'>
|
||||
|
||||
{block name="content"}{/block}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/block}
|
|
@ -1,6 +0,0 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{include file='ls:LSsession_js.tpl'}
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +1,5 @@
|
|||
{include file='ls:top.tpl'}
|
||||
{extends file='ls:base_connected.tpl'}
|
||||
{block name="content"}
|
||||
{if $pagetitle != ''}<h1 id='LSform_title'>{$pagetitle|escape:"htmlall"}</h1>{/if}
|
||||
|
||||
{if !empty($listAvailableDataEntryForm)}
|
||||
|
@ -11,4 +12,4 @@
|
|||
{/if}
|
||||
|
||||
{include file='ls:LSform.tpl'}
|
||||
{include file='ls:bottom.tpl'}
|
||||
{/block}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
{include file='ls:top.tpl'}
|
||||
{include file='ls:bottom.tpl'}
|
|
@ -1,18 +1,12 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset={$LSencoding}">
|
||||
<title>LdapSaisie - {if isset($pagetitle) && $pagetitle}{$pagetitle|escape:"htmlall"}{else}{$error}{/if}</title>
|
||||
<base href="{$public_root_url}/"/>
|
||||
<link rel="icon" href="image/favicon" />
|
||||
<link rel="stylesheet" type="text/css" href="{css name='base.css'}" title="Normal" />
|
||||
<link rel="stylesheet" type="text/css" href="{css name='base_print.css'}" media='print' title="Normal" />
|
||||
{include file='ls:LSsession_css.tpl'}
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{include file='ls:LSdefault.tpl'}
|
||||
{if isset($LSsession_username) && $LSsession_username}
|
||||
{assign var="extended_tpl" value="ls:base_connected.tpl"}
|
||||
{assign var="extended_block" value="content"}
|
||||
{else}
|
||||
{assign var="extended_tpl" value="ls:base.tpl"}
|
||||
{assign var="extended_block" value="body"}
|
||||
{/if}
|
||||
{extends file=$extended_tpl}
|
||||
{block name=$extended_block}
|
||||
|
||||
<div id="error">
|
||||
<h1>{$error}</h1>
|
||||
|
@ -24,6 +18,4 @@
|
|||
{/if}
|
||||
</div>
|
||||
|
||||
{include file='ls:LSsession_js.tpl'}
|
||||
</body>
|
||||
</html>
|
||||
{/block}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{include file='ls:top.tpl'}
|
||||
|
||||
|
||||
{extends file='ls:base_connected.tpl'}
|
||||
{block name="content"}
|
||||
<form action='search' method='post' class='LSview_search' id='LSsearch_form'>
|
||||
<div class='LSview_search'>
|
||||
<input type='text' name='pattern' class='LSview_search' value='{$pattern|escape:"htmlall"}'/>
|
||||
|
@ -26,4 +25,4 @@
|
|||
{/foreach}
|
||||
</form>
|
||||
|
||||
{include file='ls:bottom.tpl'}
|
||||
{/block}
|
||||
|
|
4
src/templates/default/homepage.tpl
Normal file
4
src/templates/default/homepage.tpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
{extends file='ls:base_connected.tpl'}
|
||||
{block name="content"}
|
||||
<h1>{$pagetitle}</h1>
|
||||
{/block}
|
|
@ -1,4 +1,5 @@
|
|||
{include file='ls:top.tpl'}
|
||||
{extends file='ls:base_connected.tpl'}
|
||||
{block name="content"}
|
||||
{if $pagetitle != ''}<h1 id='LSview_title'>{$pagetitle|escape:"htmlall"}</h1>{/if}
|
||||
|
||||
<div class='LSform'>
|
||||
|
@ -86,4 +87,4 @@
|
|||
{/if}
|
||||
|
||||
{/if}
|
||||
{include file='ls:bottom.tpl'}
|
||||
{/block}
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>LdapSaisie{if $pagetitle != ''} - {$pagetitle|escape:"htmlall"}{/if}</title>
|
||||
<base href="{$public_root_url}/"/>
|
||||
<link rel="icon" href="image/favicon" />
|
||||
<link rel="stylesheet" type="text/css" href="{css name='login.css'}" media="screen" title="Normal" />
|
||||
{include file='ls:LSsession_css.tpl'}
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{include file='ls:LSdefault.tpl'}
|
||||
|
||||
{extends file='ls:base.tpl'}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" type="text/css" href="{css name='login.css'}" media="screen" title="Normal" />
|
||||
{include file='ls:LSsession_css.tpl'}
|
||||
{/block}
|
||||
{block name="body"}
|
||||
<div class='loginform'>
|
||||
<img src='{img name='logo'}' alt='Logo' id='loginform_logo' />
|
||||
<div id='loading_zone'></div>
|
||||
|
@ -42,6 +33,4 @@
|
|||
<span>{tr msg="Language"} : <img id='LSlang' src='{img name=$LSlang}' alt='{$LSlang|escape:"htmlall"}' title='{$LSlang|escape:"htmlall"}'/></span>
|
||||
<a href='?LSsession_recoverPassword' class='LSsession_recoverPassword LSsession_recoverPassword_hidden'>{tr msg="Forgot your password ?"}</a>
|
||||
</div>
|
||||
{include file='ls:LSsession_js.tpl'}
|
||||
</body>
|
||||
</html>
|
||||
{/block}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{include file='ls:top.tpl'}
|
||||
{extends file='ls:base_connected.tpl'}
|
||||
{block name="content"}
|
||||
{if $pagetitle != ''}<h1 id='LSform_title'>{$pagetitle|escape:"htmlall"}</h1>{/if}
|
||||
{if $LSview_actions != ''}
|
||||
<ul class='LSview-actions'>
|
||||
|
@ -9,5 +10,4 @@
|
|||
{/if}
|
||||
|
||||
{include file='ls:LSform.tpl'}
|
||||
|
||||
{include file='ls:bottom.tpl'}
|
||||
{/block}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{include file='ls:top.tpl'}
|
||||
{extends file='ls:base_connected.tpl'}
|
||||
{block name="content"}
|
||||
{if $pagetitle != ''}<h1>{$pagetitle|escape:"htmlall"}</h1>{/if}
|
||||
{if $LSview_actions != ''}
|
||||
<p class='LSview-actions'>
|
||||
|
@ -10,4 +11,4 @@
|
|||
|
||||
<p class='question'>{$question}</p>
|
||||
<a href='{$validation_url}' class='question'>{$validation_label|escape:"htmlall"}</a>
|
||||
{include file='ls:bottom.tpl'}
|
||||
{/block}
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>LdapSaisie{if $pagetitle != ''} - {$pagetitle|escape:"htmlall"}{/if}</title>
|
||||
<base href="{$public_root_url}/"/>
|
||||
<link rel="stylesheet" type="text/css" href="{css name='recoverpassword.css'}" media="screen" title="Normal" />
|
||||
{include file='ls:LSsession_css.tpl'}
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{include file='ls:LSdefault.tpl'}
|
||||
|
||||
{extends file='ls:base.tpl'}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" type="text/css" href="{css name='recoverpassword.css'}" media="screen" title="Normal" />
|
||||
{include file='ls:LSsession_css.tpl'}
|
||||
{/block}
|
||||
{block name="body"}
|
||||
<div class='recoverpasswordform'>
|
||||
<img src='{img name='logo'}' alt='Logo' id='recoverpasswordform_logo' />
|
||||
<div id='loading_zone'></div>
|
||||
|
@ -33,6 +25,4 @@
|
|||
<span>{tr msg="Language"} : <img id='LSlang' src='{img name=$LSlang}' alt='{$LSlang|escape:"htmlall"}' title='{$LSlang|escape:"htmlall"}'/></span>
|
||||
<a href='' id='recoverpassword_back'>{tr msg="Back"}</a>
|
||||
</div>
|
||||
{include file='ls:LSsession_js.tpl'}
|
||||
</body>
|
||||
</html>
|
||||
{/block}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{include file='ls:top.tpl'}
|
||||
{extends file='ls:base_connected.tpl'}
|
||||
{block name="content"}
|
||||
{if $pagetitle != ''}<h1 id='LSview_title'>{$pagetitle|escape:"htmlall"}</h1>{/if}
|
||||
{if $LSview_actions != ''}
|
||||
<ul class='LSview-actions'>
|
||||
|
@ -30,4 +31,4 @@
|
|||
{include file='ls:LSrelations.tpl'}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{include file='ls:bottom.tpl'}
|
||||
{/block}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{include file='ls:top.tpl'}
|
||||
{extends file='ls:base_connected.tpl'}
|
||||
{block name="content"}
|
||||
<form action='{$searchForm.action}' method='post' class='LSview_search' id='LSsearch_form'>
|
||||
|
||||
<div class='LSview_search'>
|
||||
|
@ -174,4 +175,4 @@
|
|||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
{include file='ls:bottom.tpl'}
|
||||
{/block}
|
||||
|
|
Loading…
Reference in a new issue