2 /*******************************************************************************
3 * Copyright (C) 2007 Easter-eggs
4 * http://ldapsaisie.labs.libre-entreprise.org
6 * Author: See AUTHORS file in top-level directory.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ******************************************************************************/
23 require_once 'core.php';
25 if(LSsession :: startLSsession()) {
26 if (isset($_REQUEST['LSobject'])) {
27 $LSobject = $_REQUEST['LSobject'];
29 if ( LSsession ::loadLSobject($LSobject) ) {
30 if (LSsession :: loadLSclass('LSsearch')) {
31 $object = new $LSobject();
32 $GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
34 $LSsearch = new LSsearch($LSobject,'LSselect');
35 $LSsearch -> setParamsFormPostData();
36 $LSsearch -> setParam('nbObjectsByPage',NB_LSOBJECT_LIST_SELECT);
38 $selectablly=((isset($_REQUEST['selectablly']))?$_REQUEST['selectablly']:0);
40 if (is_string($_REQUEST['editableAttr'])) {
41 $LSsearch -> setParam(
44 'selectablly' => array (
45 'function' => array('LSselect','selectablly'),
46 'args' => $_REQUEST['editableAttr']
52 $multiple = ((isset($_REQUEST['multiple']))?1:0);
55 'action' => $_SERVER['PHP_SELF'],
56 'recursive' => (! LSsession :: isSubDnLSobject($LSobject) && LSsession :: subDnIsEnabled() ),
57 'multiple' => $multiple,
58 'selectablly' => $selectablly,
60 'submit' => _('Search'),
61 'approx' => _('Approximative search'),
62 'recursive' => _('Recursive search'),
66 'pattern' => $LSsearch->getParam('pattern'),
67 'approx' => $LSsearch->getParam('approx'),
68 'recursive' => $LSsearch->getParam('recursive'),
69 'basedn' => $LSsearch->getParam('basedn')
72 'submit' => 'LSsearch_submit'
74 'hiddenFields' => array_merge(
75 $LSsearch -> getHiddenFieldForm(),
78 'selectablly' => $selectablly,
79 'multiple' => $multiple
83 $GLOBALS['Smarty']->assign('searchForm',$searchForm);
85 $LSview_actions=array(
88 'url' => 'view.php?LSobject='.$LSobject.'&refresh',
92 $GLOBALS['Smarty']->assign('LSview_actions',$LSview_actions);
95 $page=(int)$_REQUEST['page'];
96 $page = $LSsearch -> getPage($page);
97 $GLOBALS['Smarty']->assign('page',$page);
98 $GLOBALS['Smarty']->assign('LSsearch',$LSsearch);
100 $GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
102 if (isset($_REQUEST['ajax'])) {
103 LSsession :: setTemplate('select_table.tpl');
106 LSsession :: setTemplate('select.tpl');
109 LSsession :: setAjaxDisplay();
112 LSsession :: addErrorCode('LSsession_05','LSsearch');
117 LSerror :: addErrorCode('LSsession_12');
121 LSsession :: setTemplate('login.tpl');
124 // Affichage des retours d'erreurs
125 LSsession :: displayTemplate();
127 if (isset($LSsearch)) {
128 $LSsearch->afterUsingResult();