2008-02-26 18:40:05 +01:00
|
|
|
<?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.
|
|
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
2009-03-25 13:26:32 +01:00
|
|
|
require_once 'core.php';
|
2008-02-26 18:40:05 +01:00
|
|
|
|
2009-01-24 18:45:14 +01:00
|
|
|
if(LSsession :: startLSsession()) {
|
2008-02-26 18:40:05 +01:00
|
|
|
if (isset($_REQUEST['LSobject'])) {
|
|
|
|
$LSobject = $_REQUEST['LSobject'];
|
|
|
|
|
2009-01-24 18:45:14 +01:00
|
|
|
if ( LSsession ::loadLSobject($LSobject) ) {
|
2009-10-30 01:03:17 +01:00
|
|
|
if (LSsession :: loadLSclass('LSsearch')) {
|
|
|
|
$object = new $LSobject();
|
|
|
|
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
|
2008-02-26 18:40:05 +01:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
$LSsearch = new LSsearch($LSobject,'LSselect');
|
|
|
|
$LSsearch -> setParamsFormPostData();
|
|
|
|
$LSsearch -> setParam('nbObjectsByPage',NB_LSOBJECT_LIST_SELECT);
|
2008-06-18 14:27:35 +02:00
|
|
|
|
2009-11-11 20:58:28 +01:00
|
|
|
$selectablly=((isset($_REQUEST['selectablly']))?$_REQUEST['selectablly']:0);
|
|
|
|
|
|
|
|
if (is_string($_REQUEST['editableAttr'])) {
|
|
|
|
$LSsearch -> setParam(
|
|
|
|
'customInfos',
|
|
|
|
array (
|
|
|
|
'selectablly' => array (
|
|
|
|
'function' => array('LSselect','selectablly'),
|
|
|
|
'args' => $_REQUEST['editableAttr']
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$selectablly=1;
|
|
|
|
}
|
2009-10-30 01:03:17 +01:00
|
|
|
$multiple = ((isset($_REQUEST['multiple']))?1:0);
|
|
|
|
|
|
|
|
$searchForm = array (
|
|
|
|
'action' => $_SERVER['PHP_SELF'],
|
2009-10-31 03:21:12 +01:00
|
|
|
'recursive' => (! LSsession :: isSubDnLSobject($LSobject) && LSsession :: subDnIsEnabled() ),
|
2009-10-30 01:03:17 +01:00
|
|
|
'multiple' => $multiple,
|
2009-11-11 20:58:28 +01:00
|
|
|
'selectablly' => $selectablly,
|
2009-10-30 01:03:17 +01:00
|
|
|
'labels' => array (
|
|
|
|
'submit' => _('Search'),
|
|
|
|
'approx' => _('Approximative search'),
|
|
|
|
'recursive' => _('Recursive search'),
|
|
|
|
'level' => _('Level')
|
2008-06-18 14:27:35 +02:00
|
|
|
),
|
2009-10-30 01:03:17 +01:00
|
|
|
'values' => array (
|
|
|
|
'pattern' => $LSsearch->getParam('pattern'),
|
|
|
|
'approx' => $LSsearch->getParam('approx'),
|
|
|
|
'recursive' => $LSsearch->getParam('recursive'),
|
|
|
|
'basedn' => $LSsearch->getParam('basedn')
|
|
|
|
),
|
|
|
|
'names' => array (
|
|
|
|
'submit' => 'LSsearch_submit'
|
|
|
|
),
|
|
|
|
'hiddenFields' => array_merge(
|
|
|
|
$LSsearch -> getHiddenFieldForm(),
|
|
|
|
array(
|
|
|
|
'ajax' => 1,
|
2009-11-11 20:58:28 +01:00
|
|
|
'selectablly' => $selectablly,
|
2009-10-30 01:03:17 +01:00
|
|
|
'multiple' => $multiple
|
|
|
|
)
|
|
|
|
)
|
2008-06-18 14:27:35 +02:00
|
|
|
);
|
2009-10-30 01:03:17 +01:00
|
|
|
$GLOBALS['Smarty']->assign('searchForm',$searchForm);
|
2008-06-18 14:27:35 +02:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
$LSview_actions=array(
|
|
|
|
array (
|
|
|
|
'label' => 'Refresh',
|
|
|
|
'url' => 'view.php?LSobject='.$LSobject.'&refresh',
|
|
|
|
'action' => 'refresh'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$GLOBALS['Smarty']->assign('LSview_actions',$LSview_actions);
|
2008-06-18 14:27:35 +02:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
$LSsearch -> run();
|
|
|
|
$page=(int)$_REQUEST['page'];
|
|
|
|
$page = $LSsearch -> getPage($page);
|
|
|
|
$GLOBALS['Smarty']->assign('page',$page);
|
|
|
|
$GLOBALS['Smarty']->assign('LSsearch',$LSsearch);
|
2008-06-18 14:27:35 +02:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
|
|
|
|
|
|
|
|
if (isset($_REQUEST['ajax'])) {
|
|
|
|
LSsession :: setTemplate('select_table.tpl');
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
else {
|
2009-10-30 01:03:17 +01:00
|
|
|
LSsession :: setTemplate('select.tpl');
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
2009-10-30 01:03:17 +01:00
|
|
|
|
|
|
|
LSsession :: setAjaxDisplay();
|
2008-06-18 14:27:35 +02:00
|
|
|
}
|
|
|
|
else {
|
2009-10-30 01:03:17 +01:00
|
|
|
LSsession :: addErrorCode('LSsession_05','LSsearch');
|
2008-06-18 14:27:35 +02:00
|
|
|
}
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSsession_12');
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSsession :: setTemplate('login.tpl');
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Affichage des retours d'erreurs
|
2009-01-24 18:45:14 +01:00
|
|
|
LSsession :: displayTemplate();
|
2009-10-30 01:03:17 +01:00
|
|
|
|
|
|
|
if (isset($LSsearch)) {
|
|
|
|
$LSsearch->afterUsingResult();
|
|
|
|
}
|
2008-02-26 18:40:05 +01:00
|
|
|
?>
|