mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-13 05:53:03 +01:00
192 lines
7 KiB
PHP
192 lines
7 KiB
PHP
<?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.
|
|
|
|
******************************************************************************/
|
|
|
|
require_once 'core.php';
|
|
|
|
if(LSsession :: startLSsession()) {
|
|
if (isset($_REQUEST['LSobject'])) {
|
|
$LSobject = $_REQUEST['LSobject'];
|
|
$dn = isset($_REQUEST['dn'])?urldecode($_REQUEST['dn']):null;
|
|
|
|
if (LSsession :: in_menu($LSobject)) {
|
|
|
|
if ( $LSobject == 'SELF' ) {
|
|
$LSobject = LSsession :: getLSuserObject() -> getType();
|
|
$dn = LSsession :: getLSuserObjectDn();
|
|
}
|
|
|
|
if ( LSsession :: loadLSobject($LSobject) ) {
|
|
// Affichage d'un objet
|
|
if ( $dn!='' ) {
|
|
if (LSsession :: canAccess($LSobject,$dn)) {
|
|
if ( LSsession :: canEdit($LSobject,$dn) ) {
|
|
$LSview_actions[] = array(
|
|
'label' => _('Modify'),
|
|
'url' =>'modify.php?LSobject='.$LSobject.'&dn='.urlencode($dn),
|
|
'action' => 'modify'
|
|
);
|
|
}
|
|
|
|
if (LSsession :: canCreate($LSobject)) {
|
|
$LSview_actions[] = array(
|
|
'label' => _('Copy'),
|
|
'url' =>'create.php?LSobject='.$LSobject.'&load='.urlencode($dn),
|
|
'action' => 'copy'
|
|
);
|
|
}
|
|
|
|
if (LSsession :: canRemove($LSobject,$dn)) {
|
|
$LSview_actions[] = array(
|
|
'label' => _('Delete'),
|
|
'url' => 'remove.php?LSobject='.$LSobject.'&dn='.urlencode($dn),
|
|
'action' => 'delete'
|
|
);
|
|
}
|
|
|
|
// Custum Actions
|
|
$customActionsConfig = LSconfig :: get('LSobjects.'.$LSobject.'.customActions');
|
|
if (is_array($customActionsConfig)) {
|
|
foreach($customActionsConfig as $name => $config) {
|
|
if (LSsession :: canExecuteCustomAction($dn,$LSobject,$name)) {
|
|
$LSview_actions[] = array (
|
|
'label' => ((isset($config['label']))?__($config['label']):__($name)),
|
|
'url' => 'custom_action.php?LSobject='.$LSobject.'&dn='.$dn.'&customAction='.$name,
|
|
'action' => ((isset($config['icon']))?$config['icon']:'generate'),
|
|
'class' => 'LScustomActions'.(($config['noConfirmation'])?' LScustomActions_noConfirmation':'')
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (LSsession :: getLSuserObjectDn() != $dn) {
|
|
$object = new $LSobject();
|
|
$object -> loadData($dn);
|
|
$GLOBALS['Smarty'] -> assign('pagetitle',$object -> getDisplayName());
|
|
}
|
|
else {
|
|
$object = LSsession :: getLSuserObject();
|
|
$GLOBALS['Smarty'] -> assign('pagetitle',_('My account'));
|
|
}
|
|
|
|
$view = $object -> getView();
|
|
$view -> displayView();
|
|
|
|
// LSrelations
|
|
if (LSsession :: loadLSclass('LSrelation')) {
|
|
LSrelation :: displayInLSview($object);
|
|
}
|
|
|
|
$GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions);
|
|
LSsession :: setTemplate('view.tpl');
|
|
}
|
|
else {
|
|
LSerror :: addErrorCode('LSsession_11');
|
|
}
|
|
}
|
|
// Affichage d'une liste d'un type d'objet
|
|
elseif (LSsession :: loadLSclass('LSsearch')) {
|
|
$object = new $LSobject();
|
|
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
|
|
|
|
$LSsearch = new LSsearch($LSobject,'LSview');
|
|
$LSsearch -> setParamsFormPostData();
|
|
|
|
$searchForm = array (
|
|
'action' => $_SERVER['PHP_SELF'],
|
|
'recursive' => (! LSsession :: isSubDnLSobject($LSobject) && LSsession :: subDnIsEnabled() ),
|
|
'labels' => array (
|
|
'submit' => _('Search'),
|
|
'approx' => _('Approximative search'),
|
|
'recursive' => _('Recursive search')
|
|
),
|
|
'values' => array (
|
|
'pattern' => $LSsearch->getParam('pattern'),
|
|
'approx' => $LSsearch->getParam('approx'),
|
|
'recursive' => $LSsearch->getParam('recursive')
|
|
),
|
|
'names' => array (
|
|
'submit' => 'LSsearch_submit'
|
|
),
|
|
'hiddenFields' => $LSsearch -> getHiddenFieldForm(),
|
|
'predefinedFilter' => $LSsearch->getParam('predefinedFilter')
|
|
);
|
|
$GLOBALS['Smarty']->assign('searchForm',$searchForm);
|
|
|
|
$LSview_actions=array();
|
|
if(LSsession :: canCreate($LSobject)) {
|
|
$LSview_actions['create'] = array (
|
|
'label' => 'New',
|
|
'url' => 'create.php?LSobject='.$LSobject,
|
|
'action' => 'create'
|
|
);
|
|
}
|
|
$LSview_actions['refresh'] = array (
|
|
'label' => 'Refresh',
|
|
'url' => 'view.php?LSobject='.$LSobject.'&refresh',
|
|
'action' => 'refresh'
|
|
);
|
|
/*$LSview_actions['purge'] = array (
|
|
'label' => 'Purge the cache',
|
|
'url' => 'view.php?LSobject='.$LSobject.'&LSsearchPurgeSession',
|
|
'action' => 'delete'
|
|
);*/
|
|
$GLOBALS['Smarty']->assign('LSview_actions',$LSview_actions);
|
|
|
|
$LSsearch -> run();
|
|
|
|
$LSsearch -> redirectWhenOnlyOneResult();
|
|
|
|
$page=(isset($_REQUEST['page'])?(int)$_REQUEST['page']:0);
|
|
$page = $LSsearch -> getPage($page);
|
|
$GLOBALS['Smarty']->assign('page',$page);
|
|
$GLOBALS['Smarty']->assign('LSsearch',$LSsearch);
|
|
|
|
if (LSsession :: loadLSclass('LSform')) {
|
|
LSform :: loadDependenciesDisplayView();
|
|
}
|
|
|
|
LSsession :: setTemplate('viewSearch.tpl');
|
|
}
|
|
else {
|
|
LSsession :: addErrorCode('LSsession_05','LSsearch');
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
LSerror :: addErrorCode('LSsession_11');
|
|
}
|
|
}
|
|
else {
|
|
LSerror :: addErrorCode('LSsession_12');
|
|
}
|
|
}
|
|
else {
|
|
LSsession :: setTemplate('login.tpl');
|
|
}
|
|
// Affichage des retours d'erreurs
|
|
LSsession :: displayTemplate();
|
|
|
|
if (isset($LSsearch)) {
|
|
$LSsearch->afterUsingResult();
|
|
}
|
|
|
|
?>
|