LStemplate : added a template abstraction class

This commit is contained in:
Benjamin Renard 2013-06-17 23:39:22 +02:00
parent 5ae76c1692
commit e992df1ddd
37 changed files with 539 additions and 187 deletions

View file

@ -177,7 +177,7 @@ $GLOBALS['LSconfig'] = array(
// Theme Default
define('LS_THEME','default');
define('LS_TEMPLATES_DIR', 'templates/'.LS_THEME);
define('LS_TEMPLATES_DIR', 'templates');
define('LS_IMAGES_DIR', 'images/'.LS_THEME);
define('LS_CSS_DIR', 'css/'.LS_THEME);

View file

@ -46,11 +46,11 @@ if(LSsession :: startLSsession()) {
if (isset($_REQUEST['LSform_dataEntryForm'])) {
$form -> applyDataEntryForm((string)$_REQUEST['LSform_dataEntryForm']);
$GLOBALS['Smarty'] -> assign('LSform_dataEntryForm',(string)$_REQUEST['LSform_dataEntryForm']);
LStemplate :: assign('LSform_dataEntryForm',(string)$_REQUEST['LSform_dataEntryForm']);
}
$GLOBALS['Smarty'] -> assign('listAvailableDataEntryForm',LSform :: listAvailableDataEntryForm($LSobject));
$GLOBALS['Smarty'] -> assign('DataEntryFormLabel',_('Data entry form'));
LStemplate :: assign('listAvailableDataEntryForm',LSform :: listAvailableDataEntryForm($LSobject));
LStemplate :: assign('DataEntryFormLabel',_('Data entry form'));
if ($form->validate()) {
// Data update for LDAP object
@ -95,7 +95,7 @@ if(LSsession :: startLSsession()) {
exit();
}
// Define page title
$GLOBALS['Smarty'] -> assign('pagetitle',_('New').' : '.$object -> getLabel());
LStemplate :: assign('pagetitle',_('New').' : '.$object -> getLabel());
LSsession :: setTemplate('create.tpl');
$form -> display();
}

View file

@ -43,7 +43,7 @@ if(LSsession :: startLSsession()) {
}
if (isset($_GET['valid']) || $config['noConfirmation']) {
$objectname=$object -> getDisplayName();
$GLOBALS['Smarty'] -> assign('pagetitle',$title.' : '.$objectname);
LStemplate :: assign('pagetitle',$title.' : '.$objectname);
if ($config['function']($object)) {
if ($config['disableOnSuccessMsg']!=true) {
if ($config['onSuccessMsgFormat']) {
@ -77,10 +77,10 @@ if(LSsession :: startLSsession()) {
)
)
);
$GLOBALS['Smarty'] -> assign('pagetitle',$title.' : '.$objectname);
$GLOBALS['Smarty'] -> assign('question',$question);
$GLOBALS['Smarty'] -> assign('validation_url','custom_action.php?LSobject='.urlencode($LSobject).'&dn='.urlencode($dn).'&customAction='.urlencode($customAction).'&valid');
$GLOBALS['Smarty'] -> assign('validation_label',_('Validate'));
LStemplate :: assign('pagetitle',$title.' : '.$objectname);
LStemplate :: assign('question',$question);
LStemplate :: assign('validation_url','custom_action.php?LSobject='.urlencode($LSobject).'&dn='.urlencode($dn).'&customAction='.urlencode($customAction).'&valid');
LStemplate :: assign('validation_label',_('Validate'));
}
LSsession :: setTemplate('question.tpl');
}

View file

@ -82,7 +82,7 @@ class LSerror {
if ($return) {
return $errors;
}
$GLOBALS['Smarty'] -> assign('LSerrors',$errors);
LStemplate :: assign('LSerrors',$errors);
}
}

View file

@ -100,7 +100,7 @@ class LSform {
)
);
$GLOBALS['Smarty'] -> assign('LSform_action',$_SERVER['PHP_SELF']);
LStemplate :: assign('LSform_action',$_SERVER['PHP_SELF']);
$LSform_header = "\t<input type='hidden' name='validate' value='LSform'/>\n
\t<input type='hidden' name='idForm' id='LSform_idform' value='".$this -> idForm."'/>\n
\t<input type='hidden' name='LSform_objecttype' id='LSform_objecttype' value='".$this -> ldapObject -> getType()."'/>\n
@ -111,14 +111,14 @@ class LSform {
'type' => $this -> ldapObject -> getType(),
'dn' => $this -> ldapObject -> getValue('dn')
);
$GLOBALS['Smarty'] -> assign('LSform_object',$LSform_object);
LStemplate :: assign('LSform_object',$LSform_object);
$layout_config=LSconfig :: get("LSobjects.".$LSform_object['type'].".LSform.layout");
if (!isset($this -> dataEntryFormConfig['disabledLayout']) || $this -> dataEntryFormConfig['disabledLayout']==false) {
if (is_array($layout_config)) {
$GLOBALS['Smarty'] -> assign('LSform_layout',$layout_config);
$GLOBALS['Smarty'] -> assign('LSform_layout_nofield_label',_('No field.'));
LStemplate :: assign('LSform_layout',$layout_config);
LStemplate :: assign('LSform_layout_nofield_label',_('No field.'));
}
}
@ -164,9 +164,9 @@ class LSform {
if ($this -> maxFileSize) {
$LSform_header.="\t<input type='hidden' name='MAX_FILE_SIZE' value='".$this -> maxFileSize."'/>\n";
}
$GLOBALS['Smarty'] -> assign('LSform_header',$LSform_header);
LStemplate :: assign('LSform_header',$LSform_header);
$GLOBALS['Smarty'] -> assign('LSform_fields',$fields);
LStemplate :: assign('LSform_fields',$fields);
$JSconfig = array (
'ajaxSubmit' => ((isset($this -> config['LSform']['ajaxSubmit']))?$this -> config['LSform']['ajaxSubmit']:1)
@ -179,7 +179,7 @@ class LSform {
LSsession :: addJSconfigParam('LSform_'.$this -> idForm,$JSconfig);
if($this -> can_validate) {
$GLOBALS['Smarty'] -> assign('LSform_submittxt',$this -> submit);
LStemplate :: assign('LSform_submittxt',$this -> submit);
}
}
@ -237,18 +237,18 @@ class LSform {
'type' => $this -> ldapObject -> getType(),
'dn' => $this -> ldapObject -> getDn()
);
$GLOBALS['Smarty'] -> assign('LSform_object',$LSform_object);
LStemplate :: assign('LSform_object',$LSform_object);
$fields = array();
foreach($this -> elements as $element) {
$field = $element -> getDisplay();
$fields[$element -> name] = $field;
}
$GLOBALS['Smarty'] -> assign('LSform_fields',$fields);
LStemplate :: assign('LSform_fields',$fields);
$layout_config=LSconfig :: get("LSobjects.".$LSform_object['type'].".LSform.layout");
if (is_array($layout_config)) {
$GLOBALS['Smarty'] -> assign('LSform_layout',$layout_config);
$GLOBALS['Smarty'] -> assign('LSform_layout_nofield_label',_('No field.'));
LStemplate :: assign('LSform_layout',$layout_config);
LStemplate :: assign('LSform_layout_nofield_label',_('No field.'));
}
}

View file

@ -62,16 +62,16 @@ class LSformElement_image extends LSformElement {
if (!empty($this -> values[0])) {
$img_path = LSsession :: getTmpFile($this -> values[0]);
$GLOBALS['Smarty'] -> assign('LSformElement_image',array(
LStemplate :: assign('LSformElement_image',array(
'img' => $img_path,
'id' => $id,
));
if (!$this -> isFreeze()) {
$GLOBALS['Smarty'] -> assign('LSformElement_image_actions','delete');
LStemplate :: assign('LSformElement_image_actions','delete');
}
if ($this -> form -> definedError($this -> name)) {
$GLOBALS['Smarty'] -> assign('LSformElement_image_errors',true);
LStemplate :: assign('LSformElement_image_errors',true);
}
if (LSsession :: loadLSclass('LSsmoothbox')) {
LSsmoothbox :: loadDependenciesDisplay();

View file

@ -50,17 +50,17 @@ class LSmail {
$subject = $_REQUEST['subject'];
}
$GLOBALS['Smarty'] -> assign('LSmail_msg',$msg);
$GLOBALS['Smarty'] -> assign('LSmail_subject',$subject);
LStemplate :: assign('LSmail_msg',$msg);
LStemplate :: assign('LSmail_subject',$subject);
if (is_array($_REQUEST['mails'])) {
$GLOBALS['Smarty'] -> assign('LSmail_mails',$_REQUEST['mails']);
LStemplate :: assign('LSmail_mails',$_REQUEST['mails']);
}
else if(empty($_REQUEST['mails'])) {
$GLOBALS['Smarty'] -> assign('LSmail_mails',array($_REQUEST['mails']));
LStemplate :: assign('LSmail_mails',array($_REQUEST['mails']));
}
$GLOBALS['Smarty'] -> assign('LSmail_mail_label',_('Email'));
$GLOBALS['Smarty'] -> assign('LSmail_subject_label',_('Title'));
$GLOBALS['Smarty'] -> assign('LSmail_msg_label',_('Message'));
LStemplate :: assign('LSmail_mail_label',_('Email'));
LStemplate :: assign('LSmail_subject_label',_('Title'));
LStemplate :: assign('LSmail_msg_label',_('Message'));
$data = array(
'html' => LSsession :: fetchTemplate('LSmail.tpl')

View file

@ -123,7 +123,7 @@ class LSrelation {
}
}
$GLOBALS['Smarty'] -> assign('LSrelations',$LSrelations);
LStemplate :: assign('LSrelations',$LSrelations);
LSsession :: addJSconfigParam('LSrelations',$LSrelations_JSparams);
}
}

View file

@ -132,48 +132,19 @@ class LSsession {
* @retval true si tout c'est bien passé, false sinon
*/
private static function startLStemplate() {
if ( self :: includeFile(LSconfig :: get('Smarty')) ) {
$GLOBALS['Smarty'] = new Smarty();
$GLOBALS['Smarty'] -> template_dir = LS_TEMPLATES_DIR;
$GLOBALS['Smarty'] -> compile_dir = LS_TMP_DIR;
if ( ! is_writable(LS_TMP_DIR) ) {
die('Smarty compile directory is not writable (dir : '.LS_TMP_DIR.')');
}
if (LSdebug) {
$GLOBALS['Smarty'] -> caching = 0;
// cache files are always regenerated
$GLOBALS['Smarty'] -> force_compile = TRUE;
// recompile template if it is changed
$GLOBALS['Smarty'] -> compile_check = TRUE;
if (isset($_REQUEST['debug_smarty'])) {
// debug smarty
$GLOBALS['Smarty'] -> debugging = true;
}
}
if (method_exists($GLOBALS['Smarty'],'register_function')) {
define('SMARTY3',False);
$GLOBALS['Smarty'] -> register_function('getFData','smarty_getFData');
$GLOBALS['Smarty'] -> register_function('tr','smarty_tr');
}
elseif (method_exists($GLOBALS['Smarty'],'registerPlugin')) {
define('SMARTY3',True);
$GLOBALS['Smarty'] -> registerPlugin("function","getFData", "smarty_getFData");
$GLOBALS['Smarty'] -> registerPlugin("function","tr", "smarty_tr");
}
else {
die("Smarty : Can't register getFData fonction");
}
$GLOBALS['Smarty'] -> assign('LS_CSS_DIR',LS_CSS_DIR);
$GLOBALS['Smarty'] -> assign('LS_IMAGES_DIR',LS_IMAGES_DIR);
if ( self :: loadLSclass('LStemplate') ) {
self :: addJSconfigParam('LS_IMAGES_DIR',LS_IMAGES_DIR);
return true;
return LStemplate :: start(
array(
'smarty_path' => LSconfig :: get('Smarty'),
'template_dir' => LS_TEMPLATES_DIR,
'compile_dir' => LS_TMP_DIR,
'debug' => LSdebug,
'debug_smarty' => (isset($_REQUEST['LStemplate_debug'])),
)
);
}
die("ERROR : Can't load Smarty.");
return;
return False;
}
/**
@ -557,7 +528,7 @@ class LSsession {
self :: loadLSaccess();
}
$GLOBALS['Smarty'] -> assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());
LStemplate :: assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());
if (isset ($_POST['LSsession_topDn']) && $_POST['LSsession_topDn']) {
if (self :: validSubDnLdapServer($_POST['LSsession_topDn'])) {
@ -614,7 +585,7 @@ class LSsession {
self :: $rdn = $LSuserObject->getValue('rdn');
self :: loadLSprofiles();
self :: loadLSaccess();
$GLOBALS['Smarty'] -> assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());
LStemplate :: assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());
$_SESSION['LSsession']=self :: getContextInfos();
return true;
}
@ -625,9 +596,9 @@ class LSsession {
}
if (self :: $ldapServerId) {
$GLOBALS['Smarty'] -> assign('ldapServerId',self :: $ldapServerId);
LStemplate :: assign('ldapServerId',self :: $ldapServerId);
}
$GLOBALS['Smarty'] -> assign('topDn',self :: $topDn);
LStemplate :: assign('topDn',self :: $topDn);
if (isset($_GET['LSsession_recoverPassword'])) {
self :: displayRecoverPasswordForm($recoveryPasswordInfos);
}
@ -1159,31 +1130,31 @@ class LSsession {
* @retval void
*/
public static function displayLoginForm() {
$GLOBALS['Smarty'] -> assign('pagetitle',_('Connection'));
LStemplate :: assign('pagetitle',_('Connection'));
if (isset($_GET['LSsession_logout'])) {
$GLOBALS['Smarty'] -> assign('loginform_action','index.php');
LStemplate :: assign('loginform_action','index.php');
}
else {
$GLOBALS['Smarty'] -> assign('loginform_action',$_SERVER['REQUEST_URI']);
LStemplate :: assign('loginform_action',$_SERVER['REQUEST_URI']);
}
if (count(LSconfig :: get('ldap_servers'))==1) {
$GLOBALS['Smarty'] -> assign('loginform_ldapserver_style','style="display: none"');
LStemplate :: assign('loginform_ldapserver_style','style="display: none"');
}
$GLOBALS['Smarty'] -> assign('loginform_label_ldapserver',_('LDAP server'));
LStemplate :: assign('loginform_label_ldapserver',_('LDAP server'));
$ldapservers_name=array();
$ldapservers_index=array();
foreach(LSconfig :: get('ldap_servers') as $id => $infos) {
$ldapservers_index[]=$id;
$ldapservers_name[]=__($infos['name']);
}
$GLOBALS['Smarty'] -> assign('loginform_ldapservers_name',$ldapservers_name);
$GLOBALS['Smarty'] -> assign('loginform_ldapservers_index',$ldapservers_index);
LStemplate :: assign('loginform_ldapservers_name',$ldapservers_name);
LStemplate :: assign('loginform_ldapservers_index',$ldapservers_index);
$GLOBALS['Smarty'] -> assign('loginform_label_level',_('Level'));
$GLOBALS['Smarty'] -> assign('loginform_label_user',_('Identifier'));
$GLOBALS['Smarty'] -> assign('loginform_label_pwd',_('Password'));
$GLOBALS['Smarty'] -> assign('loginform_label_submit',_('Connect'));
$GLOBALS['Smarty'] -> assign('loginform_label_recoverPassword',_('Forgot your password ?'));
LStemplate :: assign('loginform_label_level',_('Level'));
LStemplate :: assign('loginform_label_user',_('Identifier'));
LStemplate :: assign('loginform_label_pwd',_('Password'));
LStemplate :: assign('loginform_label_submit',_('Connect'));
LStemplate :: assign('loginform_label_recoverPassword',_('Forgot your password ?'));
self :: setTemplate('login.tpl');
self :: addJSscript('LSsession_login.js');
@ -1201,26 +1172,26 @@ class LSsession {
* @retval void
*/
public static function displayRecoverPasswordForm($recoveryPasswordInfos) {
$GLOBALS['Smarty'] -> assign('pagetitle',_('Recovery of your credentials'));
$GLOBALS['Smarty'] -> assign('recoverpasswordform_action','index.php?LSsession_recoverPassword');
LStemplate :: assign('pagetitle',_('Recovery of your credentials'));
LStemplate :: assign('recoverpasswordform_action','index.php?LSsession_recoverPassword');
if (count(LSconfig :: get('ldap_servers'))==1) {
$GLOBALS['Smarty'] -> assign('recoverpasswordform_ldapserver_style','style="display: none"');
LStemplate :: assign('recoverpasswordform_ldapserver_style','style="display: none"');
}
$GLOBALS['Smarty'] -> assign('recoverpasswordform_label_ldapserver',_('LDAP server'));
LStemplate :: assign('recoverpasswordform_label_ldapserver',_('LDAP server'));
$ldapservers_name=array();
$ldapservers_index=array();
foreach(LSconfig :: get('ldap_servers') as $id => $infos) {
$ldapservers_index[]=$id;
$ldapservers_name[]=$infos['name'];
}
$GLOBALS['Smarty'] -> assign('recoverpasswordform_ldapservers_name',$ldapservers_name);
$GLOBALS['Smarty'] -> assign('recoverpasswordform_ldapservers_index',$ldapservers_index);
LStemplate :: assign('recoverpasswordform_ldapservers_name',$ldapservers_name);
LStemplate :: assign('recoverpasswordform_ldapservers_index',$ldapservers_index);
$GLOBALS['Smarty'] -> assign('recoverpasswordform_label_user',_('Identifier'));
$GLOBALS['Smarty'] -> assign('recoverpasswordform_label_submit',_('Validate'));
$GLOBALS['Smarty'] -> assign('recoverpasswordform_label_back',_('Back'));
LStemplate :: assign('recoverpasswordform_label_user',_('Identifier'));
LStemplate :: assign('recoverpasswordform_label_submit',_('Validate'));
LStemplate :: assign('recoverpasswordform_label_back',_('Back'));
$recoverpassword_msg = _('Please fill the identifier field to proceed recovery procedure');
@ -1239,7 +1210,7 @@ class LSsession {
);
}
$GLOBALS['Smarty'] -> assign('recoverpassword_msg',$recoverpassword_msg);
LStemplate :: assign('recoverpassword_msg',$recoverpassword_msg);
self :: setTemplate('recoverpassword.tpl');
self :: addJSscript('LSsession_recoverPassword.js');
@ -1342,7 +1313,7 @@ class LSsession {
self :: addJSconfigParam('keepLSsessionActive',ini_get('session.gc_maxlifetime'));
}
$GLOBALS['Smarty'] -> assign('LSjsConfig',json_encode(self :: $_JSconfigParams));
LStemplate :: assign('LSjsConfig',json_encode(self :: $_JSconfigParams));
if (LSdebug) {
$JSscript_txt.="<script type='text/javascript'>LSdebug_active = 1;</script>\n";
@ -1351,7 +1322,7 @@ class LSsession {
$JSscript_txt.="<script type='text/javascript'>LSdebug_active = 0;</script>\n";
}
$GLOBALS['Smarty'] -> assign('LSsession_js',$JSscript_txt);
LStemplate :: assign('LSsession_js',$JSscript_txt);
// Css
self :: addCssFile("LSdefault.css");
@ -1362,37 +1333,37 @@ class LSsession {
}
$Css_txt.="<link rel='stylesheet' type='text/css' href='".$file['path'].$file['file']."' />\n";
}
$GLOBALS['Smarty'] -> assign('LSsession_css',$Css_txt);
LStemplate :: assign('LSsession_css',$Css_txt);
if (isset(self :: $LSaccess[self :: $topDn])) {
$GLOBALS['Smarty'] -> assign('LSaccess',self :: $LSaccess[self :: $topDn]);
LStemplate :: assign('LSaccess',self :: $LSaccess[self :: $topDn]);
}
// Niveau
$listTopDn = self :: getSubDnLdapServer();
if (is_array($listTopDn)) {
asort($listTopDn);
$GLOBALS['Smarty'] -> assign('label_level',self :: getSubDnLabel());
$GLOBALS['Smarty'] -> assign('_refresh',_('Refresh'));
LStemplate :: assign('label_level',self :: getSubDnLabel());
LStemplate :: assign('_refresh',_('Refresh'));
$LSsession_topDn_index = array();
$LSsession_topDn_name = array();
foreach($listTopDn as $index => $name) {
$LSsession_topDn_index[] = $index;
$LSsession_topDn_name[] = $name;
}
$GLOBALS['Smarty'] -> assign('LSsession_subDn_indexes',$LSsession_topDn_index);
$GLOBALS['Smarty'] -> assign('LSsession_subDn_names',$LSsession_topDn_name);
$GLOBALS['Smarty'] -> assign('LSsession_subDn',self :: $topDn);
$GLOBALS['Smarty'] -> assign('LSsession_subDnName',self :: getSubDnName());
LStemplate :: assign('LSsession_subDn_indexes',$LSsession_topDn_index);
LStemplate :: assign('LSsession_subDn_names',$LSsession_topDn_name);
LStemplate :: assign('LSsession_subDn',self :: $topDn);
LStemplate :: assign('LSsession_subDnName',self :: getSubDnName());
}
$GLOBALS['Smarty'] -> assign('LSlanguages',self :: getLangList());
$GLOBALS['Smarty'] -> assign('LSlang',self :: $lang);
$GLOBALS['Smarty'] -> assign('LSencoding',self :: $encoding);
$GLOBALS['Smarty'] -> assign('lang_label',_('Language'));
LStemplate :: assign('LSlanguages',self :: getLangList());
LStemplate :: assign('LSlang',self :: $lang);
LStemplate :: assign('LSencoding',self :: $encoding);
LStemplate :: assign('lang_label',_('Language'));
$GLOBALS['Smarty'] -> assign('displayLogoutBtn',LSauth :: displayLogoutBtn());
$GLOBALS['Smarty'] -> assign('displaySelfAccess',LSauth :: displaySelfAccess());
LStemplate :: assign('displayLogoutBtn',LSauth :: displayLogoutBtn());
LStemplate :: assign('displaySelfAccess',LSauth :: displaySelfAccess());
// Infos
if((!empty($_SESSION['LSsession_infos']))&&(is_array($_SESSION['LSsession_infos']))) {
@ -1401,13 +1372,13 @@ class LSsession {
$txt_infos.="<li>$info</li>\n";
}
$txt_infos.="</ul>\n";
$GLOBALS['Smarty'] -> assign('LSinfos',$txt_infos);
LStemplate :: assign('LSinfos',$txt_infos);
$_SESSION['LSsession_infos']=array();
}
if (self :: $ajaxDisplay) {
$GLOBALS['Smarty'] -> assign('LSerror_txt',LSerror :: getErrors());
$GLOBALS['Smarty'] -> assign('LSdebug_txt',LSdebug_print(true));
LStemplate :: assign('LSerror_txt',LSerror :: getErrors());
LStemplate :: assign('LSdebug_txt',LSdebug_print(true));
}
else {
LSerror :: display();
@ -1416,9 +1387,9 @@ class LSsession {
if (!self :: $template)
self :: setTemplate('empty.tpl');
$GLOBALS['Smarty'] -> assign('connected_as',_("Connected as"));
LStemplate :: assign('connected_as',_("Connected as"));
$GLOBALS['Smarty'] -> display(self :: $template);
LStemplate :: display(self :: $template);
}
/**
@ -1481,9 +1452,9 @@ class LSsession {
*/
public static function fetchTemplate($template,$variables=array()) {
foreach($variables as $name => $val) {
$GLOBALS['Smarty'] -> assign($name,$val);
LStemplate :: assign($name,$val);
}
return $GLOBALS['Smarty'] -> fetch($template);
return LStemplate :: fetch($template);
}
/**
@ -2131,8 +2102,8 @@ class LSsession {
* @retval void
*/
public static function redirect($url,$exit=true) {
$GLOBALS['Smarty'] -> assign('url',$url);
$GLOBALS['Smarty'] -> display('redirect.tpl');
LStemplate :: assign('url',$url);
LStemplate :: display('redirect.tpl');
if ($exit) {
exit();
}

View file

@ -0,0 +1,207 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* 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.
******************************************************************************/
/**
* Manage template
*
* This class is use to manage template in LdapSaisie.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LStemplate {
/**
* LStemplate configuration
*
* array(
* 'smarty_path' => '/path/to/Smarty.php',
* 'template_dir' => '/path/to/template/directory',
* 'compile_dir' => '/path/to/compile/directory',
* 'debug' => True,
* 'debug_smarty' => True
* )
*
**/
private static $config = NULL;
// Smarty object
public static $_smarty = NULL;
// Smarty version
private static $_smarty_version = NULL;
/**
* Start LStemplate
*
* Set configuration from parameter $config and initialize
* Smarty object.
*
* @param[in] $config array LStemplate configuration
*
* @retval boolean True on success, False instead
**/
public static function start($config) {
self :: $config = $config;
if (LSsession :: includeFile($config['smarty_path'])) {
self :: $_smarty = new Smarty();
self :: $_smarty -> template_dir = $config['template_dir'];
if ( ! is_writable($config['compile_dir']) ) {
die(_('LStemplate : compile directory is not writable (dir : '.$config['compile_dir'].')'));
}
self :: $_smarty -> compile_dir = $config['compile_dir'];
if ($config['debug']) {
self :: $_smarty -> caching = 0;
// cache files are always regenerated
self :: $_smarty -> force_compile = TRUE;
// recompile template if it is changed
self :: $_smarty -> compile_check = TRUE;
if ($config['debug_smarty']) {
// debug smarty
self :: $_smarty -> debugging = true;
}
}
if (method_exists(self :: $_smarty,'register_function')) {
self :: $_smarty_version=2;
if (!LSsession :: loadLSclass('LStemplate_smarty2_support')) {
die(_("LStemplate : Can't load Smarty 2 support file"));
}
}
elseif (method_exists(self :: $_smarty,'registerPlugin')) {
self :: $_smarty_version=3;
if (!LSsession :: loadLSclass('LStemplate_smarty3_support')) {
die(_("LStemplate : Can't load Smarty 2 support file"));
}
}
else {
die(_("LStemplate : Smarty version not recognized."));
}
self :: $_smarty -> assign('LS_CSS_DIR',LS_CSS_DIR);
self :: $_smarty -> assign('LS_IMAGES_DIR',LS_IMAGES_DIR);
return True;
}
else {
die(_("LStemplate : Can't load Smarty."));
return False;
}
}
/**
* Return the path of the Smarty template file to use
*
* @param[in] string $template The template name (eg: top.tpl)
*
* @retval string The path of the Smarty template file
**/
public static function getTemplatePath($template) {
$directories=array(
'local',
LS_THEME
);
foreach($directories as $dir) {
if (file_exists(self :: $config['template_dir'].'/'.$dir.'/'.$template)) {
return self :: $config['template_dir'].'/'.$dir.'/'.$template;
}
}
return $config['template_dir'].'/default/'.$template;
}
/**
* Return the content of a Smarty template file.
*
* @param[in] string $template The template name (eg: top.tpl)
*
* @retval string The content of the Smarty template file
**/
public static function getTemplateSource($template) {
$tpl_path=self :: getTemplatePath($template);
if (!is_readable($tpl_path)) {
$tpl_path=self :: getTemplatePath('empty.tpl');
LSerror::addErrorCode('LStemplate_01',$template);
}
return implode('',file($tpl_path));
}
/**
* Return the timestamp of the last change of a Smarty
* template file.
*
* @param[in] string $template The template name (eg: top.tpl)
*
* @retval string The timestamp of the last change of the Smarty template file
**/
public static function getTemplateTimestamp($template) {
$tpl_path=self :: getTemplatePath($template);
if (is_file($tpl_path)) {
$time=filemtime($tpl_path);
if ($time)
return $time;
}
return NULL;
}
/**
* Assign template variable
*
* @param[in] string $name The variable name
* @param[in] mixed $value The variable value
*
* @retval void
**/
public static function assign($name,$value) {
return self :: $_smarty -> assign($name,$value);
}
/**
* Display a template
*
* @param[in] string $template The template name (eg: empty.tpl)
*
* @retval void
**/
public static function display($template) {
return self :: $_smarty -> display("ls:$template");
}
/**
* Fetch a template
*
* @param[in] string $template The template name (eg: empty.tpl)
*
* @retval string The template compiled
**/
public static function fetch($template) {
return self :: $_smarty -> fetch("ls:$template");
}
}
// Errors
LSerror :: defineError('LStemplate_01',
_("LStemplate : Template %{file} not found.")
);

View file

@ -0,0 +1,108 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* 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.
*******************************************************************************/
/**
* Support Smarty2 for LStemplate
*
* @author Benjamin Renard <brenard@easter-eggs.com>
**/
/**
* Retrieve a resource
*
* @param[in] $tpl_name string The template name
* @param[in] $tpl_source string Variable passed by reference
* where the result should be stored.
* @param[in] $smarty_obj object The Smarty object
*
* @return bool TRUE if it was able to successfully retrieve
* the resource and FALSE otherwise.
**/
function LStemplate_smarty_get_template ($tpl_name, &$tpl_source, &$smarty_obj) {
$tpl_source=LStemplate :: getTemplateSource($tpl_name);
return True;
}
/**
* Retrieve the last modification timestamp of a template
*
* @param[in] $tpl_name string The template name
* @param[in] $tpl_timestamp int Variable passed by reference
* where the result should be stored.
* @param[in] $smarty_obj object The Smarty object
*
* @return bool TRUE if the timestamp could be succesfully determined,
* or FALSE otherwise
**/
function LStemplate_smarty_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj) {
$time=LStemplate :: getTemplateTimestamp($tpl_name);
if ($time) {
$tpl_timestamp=$time;
return True;
}
return False;
}
/**
* Determine if template is secured or not
*
* This function is used only for template resources but should
* still be defined.
*
* @param[in] $tpl_name string The template name
* @param[in] $smarty_obj object The Smarty object
*
* @return bool TRUE if the template is secured, or FALSE otherwise
**/
function LStemplate_smarty_get_secure($tpl_name, &$smarty_obj) {
return True;
}
The fourth function, trusted() is supposed to return TRUE or FALSE, depending on whether the requested resource is trusted or not. This function is used for only for PHP script components requested by {include_php} tag or {insert} tag with the src attribute. However, it should still be defined even for template resources.
/**
* Determine if template is trusted or not
*
* This function is used for only for PHP script components
* requested by {include_php} tag or {insert} tag with the
* src attribute. However, it should still be defined even
* for template resources.
*
* @param[in] $tpl_name string The template name
* @param[in] $smarty_obj object The Smarty object
*
* @return bool TRUE if the template is trusted, or FALSE otherwise
**/
function LStemplate_smarty_get_trusted($tpl_name, &$smarty_obj) {
return True;
}
// Register 'ls' template ressource
LStemplate :: $_smarty -> register_resource('ls', array(
'LStemplate_smarty_get_template',
'LStemplate_smarty_get_timestamp',
'LStemplate_smarty_get_secure',
'LStemplate_smarty_get_trusted'
)
);
// Register special template functions
LStemplate :: $_smarty -> register_function('getFData','smarty_getFData');
LStemplate :: $_smarty -> register_function('tr','smarty_tr');

View file

@ -0,0 +1,66 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* 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.
******************************************************************************/
/**
* Smarty ressource for LdapSaisie template
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class Smarty_Resource_LdapSaisie extends Smarty_Resource_Custom {
// prepared fetch() statement
protected $fetch;
// prepared fetchTimestamp() statement
protected $mtime;
/**
* Fetch a template and its modification time from database
*
* @param string $name template name
* @param string $source template source
* @param integer $mtime template modification timestamp (epoch)
* @return void
*/
protected function fetch($name, &$source, &$mtime) {
$source = LStemplate :: getTemplateSource($name);
$mtime = LStemplate :: getTemplateTimestamp($name);
}
/**
* Fetch a template's modification time from database
*
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the comple template source.
* @param string $name template name
* @return integer timestamp (epoch) the template was modified
*/
protected function fetchTimestamp($name) {
return LStemplate :: getTemplateTimestamp($name);
}
}
// Register 'ls' template ressource
LStemplate :: $_smarty -> registerResource('ls', new Smarty_Resource_LdapSaisie());
// Register special template functions
LStemplate :: $_smarty -> registerPlugin("function","getFData", "smarty_getFData");
LStemplate :: $_smarty -> registerPlugin("function","tr", "smarty_tr");

View file

@ -241,7 +241,7 @@ function LSdebug_print($return=false,$ul=true) {
}
}
if ($ul) $txt.='</ul>';
$GLOBALS['Smarty'] -> assign('LSdebug',$txt);
LStemplate :: assign('LSdebug',$txt);
if ($return) {
return $txt;
}

View file

@ -25,7 +25,7 @@ require_once 'core.php';
if(LSsession :: startLSsession()) {
// Définition du Titre de la page
$GLOBALS['Smarty'] -> assign('pagetitle',_('Home'));
LStemplate :: assign('pagetitle',_('Home'));
// Template
LSsession :: setTemplate('accueil.tpl');

View file

@ -51,7 +51,7 @@ if(LSsession :: startLSsession()) {
$object = new $LSobject();
if ($object -> loadData($dn)) {
// Définition du Titre de la page
$GLOBALS['Smarty'] -> assign('pagetitle',_('Modify').' : '.$object -> getDisplayName());
LStemplate :: assign('pagetitle',_('Modify').' : '.$object -> getDisplayName());
$form = $object -> getForm('modify');
if ($form->validate()) {
// MàJ des données de l'objet LDAP
@ -114,7 +114,7 @@ if(LSsession :: startLSsession()) {
);
}
$GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions);
LStemplate :: assign('LSview_actions',$LSview_actions);
LSsession :: setTemplate('modify.tpl');
$form -> display();
LSsession :: displayTemplate();

View file

@ -34,7 +34,7 @@ if(LSsession :: startLSsession()) {
if ($object -> loadData($dn)) {
if (isset($_GET['valid'])) {
$objectname=$object -> getDisplayName();
$GLOBALS['Smarty'] -> assign('pagetitle',_('Deleting').' : '.$objectname);
LStemplate :: assign('pagetitle',_('Deleting').' : '.$objectname);
if ($object -> remove()) {
LSsession :: addInfo($objectname.' '._('has been deleted successfully').'.');
LSsession :: redirect('view.php?LSobject='.$LSobject.'&refresh');
@ -45,10 +45,10 @@ if(LSsession :: startLSsession()) {
}
else {
// Définition du Titre de la page
$GLOBALS['Smarty'] -> assign('pagetitle',_('Deleting').' : '.$object -> getDisplayName());
$GLOBALS['Smarty'] -> assign('question',_('Do you really want to delete').' <strong>'.$object -> getDisplayName().'</strong> ?');
$GLOBALS['Smarty'] -> assign('validation_url','remove.php?LSobject='.$LSobject.'&amp;dn='.urlencode($dn).'&amp;valid');
$GLOBALS['Smarty'] -> assign('validation_label',_('Validate'));
LStemplate :: assign('pagetitle',_('Deleting').' : '.$object -> getDisplayName());
LStemplate :: assign('question',_('Do you really want to delete').' <strong>'.$object -> getDisplayName().'</strong> ?');
LStemplate :: assign('validation_url','remove.php?LSobject='.$LSobject.'&amp;dn='.urlencode($dn).'&amp;valid');
LStemplate :: assign('validation_label',_('Validate'));
}
LSsession :: setTemplate('question.tpl');
}

View file

@ -29,7 +29,7 @@ if(LSsession :: startLSsession()) {
if ( LSsession ::loadLSobject($LSobject) ) {
if (LSsession :: loadLSclass('LSsearch')) {
$object = new $LSobject();
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
LStemplate :: assign('pagetitle',$object -> getLabel());
$LSsearch = new LSsearch($LSobject,'LSselect');
$LSsearch -> setParamsFormPostData();
@ -80,7 +80,7 @@ if(LSsession :: startLSsession()) {
)
)
);
$GLOBALS['Smarty']->assign('searchForm',$searchForm);
LStemplate :: assign('searchForm',$searchForm);
$LSview_actions=array(
array (
@ -89,15 +89,15 @@ if(LSsession :: startLSsession()) {
'action' => 'refresh'
)
);
$GLOBALS['Smarty']->assign('LSview_actions',$LSview_actions);
LStemplate :: assign('LSview_actions',$LSview_actions);
$LSsearch -> run();
$page=(isset($_REQUEST['page'])?(int)$_REQUEST['page']:0);
$page = $LSsearch -> getPage($page);
$GLOBALS['Smarty']->assign('page',$page);
$GLOBALS['Smarty']->assign('LSsearch',$LSsearch);
LStemplate :: assign('page',$page);
LStemplate :: assign('LSsearch',$LSsearch);
$GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
LStemplate :: assign('LSobject_list_objectname',$object -> getLabel());
if (isset($_REQUEST['ajax'])) {
LSsession :: setTemplate('select_table.tpl');

View file

@ -1,8 +1,8 @@
<ul class='LSform{if $multiple && !$freeze} LSformElement_multiple'{/if}' id='{$attr_name}'>
{foreach from=$values item=value}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{foreachelse}
{assign var=value value=""}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{/foreach}
</ul>

View file

@ -1,8 +1,8 @@
<ul class='LSform' id='{$attr_name}'>
{foreach from=$values item=value}
<li{if !$freeze} class='LSformElement_boolean'{/if}>{include file=$fieldTemplate}</li>
<li{if !$freeze} class='LSformElement_boolean'{/if}>{include file="ls:$fieldTemplate"}</li>
{foreachelse}
{assign var=value value=""}
<li{if !$freeze} class='LSformElement_boolean'{/if}>{include file=$fieldTemplate}</li>
<li{if !$freeze} class='LSformElement_boolean'{/if}>{include file="ls:$fieldTemplate"}</li>
{/foreach}
</ul>

View file

@ -1,3 +1,3 @@
<ul class='LSform' id='{$attr_name}'>
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
</ul>

View file

@ -5,11 +5,11 @@
{/if}
<ul class='LSform LSformElement_select_object' id='{$attr_name}'>
{foreach from=$values item=txt key=dn}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{foreachelse}
{assign var=dn value=""}
{assign var=txt value=""}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{/foreach}
</ul>
{if !$freeze}

View file

@ -1,7 +1,7 @@
<ul class='LSform{if $multiple && !$freeze} LSformElement_multiple'{/if}' id='{$attr_name}'>
{foreach from=$values_txt item=value}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{foreachelse}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{/foreach}
</ul>

View file

@ -3,19 +3,19 @@
{foreach from=$parseValues item=parseValue}
{if $parseValue.translated}{assign var=value value=$parseValue.translated}{else}{assign var=value value=$parseValue.value}{/if}
{if $parseValue.label!="no"}{assign var=label value=$parseValue.label}{else}{assign var=label value=""}{/if}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{foreachelse}
{assign var=value value=""}
{assign var=parseValue value=""}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{/foreach}
{else}
{foreach from=$values item=value}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{foreachelse}
{assign var=value value=""}
{assign var=parseValue value=""}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{/foreach}
{/if}
</ul>

View file

@ -7,19 +7,19 @@
{if $parseValue.type.label!="no"}{assign var=label_type value=$parseValue.type.label}{else}{assign var=label_type value=""}{/if}
{if $parseValue.code.translated}{assign var=code value=$parseValue.code.translated}{else}{assign var=code value=$parseValue.code.value}{/if}
{if $parseValue.code.label!="no"}{assign var=label_code value=$parseValue.code.label}{else}{assign var=label_code value=""}{/if}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{foreachelse}
{assign var=value value=""}
{assign var=parseValue value=""}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{/foreach}
{else}
{foreach from=$values item=value}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{foreachelse}
{assign var=value value=""}
{assign var=parseValue value=""}
<li>{include file=$fieldTemplate}</li>
<li>{include file="ls:$fieldTemplate"}</li>
{/foreach}
{/if}
</ul>

View file

@ -1,3 +1,3 @@
{include file='top.tpl'}
{include file='ls:top.tpl'}
<h1>{$pagetitle}</h1>
{include file='bottom.tpl'}
{include file='ls:bottom.tpl'}

View file

@ -12,7 +12,7 @@
</head>
<body>
{include file='LSdefault.tpl'}
{include file='ls:LSdefault.tpl'}
{$LSsession_js}

View file

@ -1,4 +1,4 @@
{include file='top.tpl'}
{include file='ls:top.tpl'}
{if $pagetitle != ''}<h1 id='LSform_title'>{$pagetitle}</h1>{/if}
{if !empty($listAvailableDataEntryForm)}
@ -10,5 +10,5 @@
</label>
{/if}
{include file='LSform.tpl'}
{include file='bottom.tpl'}
{include file='ls:LSform.tpl'}
{include file='ls:bottom.tpl'}

View file

@ -1,2 +1,2 @@
{include file='top.tpl'}
{include file='bottom.tpl'}
{include file='ls:top.tpl'}
{include file='ls:bottom.tpl'}

View file

@ -11,7 +11,7 @@
</head>
<body>
{include file='LSdefault.tpl'}
{include file='ls:LSdefault.tpl'}
<div class='loginform'>
<img src='{$LS_IMAGES_DIR}/logo.png' alt='Logo' id='loginform_logo' />

View file

@ -1,4 +1,4 @@
{include file='top.tpl'}
{include file='ls:top.tpl'}
{if $pagetitle != ''}<h1 id='LSform_title'>{$pagetitle}</h1>{/if}
{if $LSview_actions != ''}
<ul class='LSview-actions'>
@ -8,6 +8,6 @@
</ul>
{/if}
{include file='LSform.tpl'}
{include file='ls:LSform.tpl'}
{include file='bottom.tpl'}
{include file='ls:bottom.tpl'}

View file

@ -1,4 +1,4 @@
{include file='top.tpl'}
{include file='ls:top.tpl'}
{if $pagetitle != ''}<h1>{$pagetitle}</h1>{/if}
{if $LSview_actions != ''}
<p class='LSview-actions'>
@ -10,4 +10,4 @@
<p class='question'>{$question}</p>
<a href='{$validation_url}' class='question'>{$validation_label}</a>
{include file='bottom.tpl'}
{include file='ls:bottom.tpl'}

View file

@ -10,7 +10,7 @@
</head>
<body>
{include file='LSdefault.tpl'}
{include file='ls:LSdefault.tpl'}
<div class='recoverpasswordform'>
<img src='{$LS_IMAGES_DIR}/logo.png' alt='Logo' id='recoverpasswordform_logo' />

View file

@ -26,7 +26,7 @@
</div>
</form>
<div id='content'>
{include file='select_table.tpl'}
{include file='ls:select_table.tpl'}
</div>
</div>
<script type='text/javascript'>

View file

@ -12,7 +12,7 @@
</head>
<body>
{include file='LSdefault.tpl'}
{include file='ls:LSdefault.tpl'}
<table id='main'>
<tr>

View file

@ -1,4 +1,4 @@
{include file='top.tpl'}
{include file='ls:top.tpl'}
{if $pagetitle != ''}<h1 id='LSview_title'>{$pagetitle}</h1>{/if}
{if $LSview_actions != ''}
<ul class='LSview-actions'>
@ -10,11 +10,11 @@
</ul>
{/if}
{include file='LSform_view.tpl'}
{include file='ls:LSform_view.tpl'}
{if $LSrelations!=''}
{foreach from=$LSrelations item=item}
{include file='LSrelations.tpl'}
{include file='ls:LSrelations.tpl'}
{/foreach}
{/if}
{include file='bottom.tpl'}
{include file='ls:bottom.tpl'}

View file

@ -1,4 +1,4 @@
{include file='top.tpl'}
{include file='ls:top.tpl'}
<form action='{$searchForm.action}' method='post' class='LSview_search' id='LSsearch_form'>
<div class='LSview_search'>
@ -122,4 +122,4 @@
{/if}
</p>
{/if}
{include file='bottom.tpl'}
{include file='ls:bottom.tpl'}

View file

@ -81,11 +81,11 @@ if(LSsession :: startLSsession()) {
if (LSsession :: getLSuserObjectDn() != $dn) {
$object = new $LSobject();
$object -> loadData($dn);
$GLOBALS['Smarty'] -> assign('pagetitle',$object -> getDisplayName());
LStemplate :: assign('pagetitle',$object -> getDisplayName());
}
else {
$object = LSsession :: getLSuserObject();
$GLOBALS['Smarty'] -> assign('pagetitle',_('My account'));
LStemplate :: assign('pagetitle',_('My account'));
}
$view = $object -> getView();
@ -96,7 +96,7 @@ if(LSsession :: startLSsession()) {
LSrelation :: displayInLSview($object);
}
$GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions);
LStemplate :: assign('LSview_actions',$LSview_actions);
LSsession :: setTemplate('view.tpl');
}
else {
@ -106,7 +106,7 @@ if(LSsession :: startLSsession()) {
// Affichage d'une liste d'un type d'objet
elseif (LSsession :: loadLSclass('LSsearch')) {
$object = new $LSobject();
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
LStemplate :: assign('pagetitle',$object -> getLabel());
$LSsearch = new LSsearch($LSobject,'LSview');
$LSsearch -> setParamsFormPostData();
@ -130,7 +130,7 @@ if(LSsession :: startLSsession()) {
'hiddenFields' => $LSsearch -> getHiddenFieldForm(),
'predefinedFilter' => $LSsearch->getParam('predefinedFilter')
);
$GLOBALS['Smarty']->assign('searchForm',$searchForm);
LStemplate :: assign('searchForm',$searchForm);
$LSview_actions=array();
if(LSsession :: canCreate($LSobject)) {
@ -150,7 +150,7 @@ if(LSsession :: startLSsession()) {
'url' => 'view.php?LSobject='.$LSobject.'&amp;LSsearchPurgeSession',
'action' => 'delete'
);*/
$GLOBALS['Smarty']->assign('LSview_actions',$LSview_actions);
LStemplate :: assign('LSview_actions',$LSview_actions);
$LSsearch -> run();
@ -158,8 +158,8 @@ if(LSsession :: startLSsession()) {
$page=(isset($_REQUEST['page'])?(int)$_REQUEST['page']:0);
$page = $LSsearch -> getPage($page);
$GLOBALS['Smarty']->assign('page',$page);
$GLOBALS['Smarty']->assign('LSsearch',$LSsearch);
LStemplate :: assign('page',$page);
LStemplate :: assign('LSsearch',$LSsearch);
if (LSsession :: loadLSclass('LSform')) {
LSform :: loadDependenciesDisplayView();