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 ******************************************************************************/
26 * Méthode chargeant les dépendances d'affichage
30 public static function loadDependenciesDisplay() {
31 if (LSsession :: loadLSclass('LSsmoothbox')) {
32 LSsmoothbox :: loadDependenciesDisplay();
34 LSsession :: addJSscript('LSselect.js');
35 LSsession :: addCssFile('LSselect.css');
38 public static function ajax_addItem(&$data) {
39 if ((isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['multiple']))) {
40 if (!$_REQUEST['multiple']) {
41 $_SESSION['LSselect'][$_REQUEST['objecttype']]=array($_REQUEST['objectdn']);
43 else if (is_array($_SESSION['LSselect'][$_REQUEST['objecttype']])) {
44 if (!in_array($_REQUEST['objectdn'],$_SESSION['LSselect'][$_REQUEST['objecttype']])) {
45 $_SESSION['LSselect'][$_REQUEST['objecttype']][]=$_REQUEST['objectdn'];
49 $_SESSION['LSselect'][$_REQUEST['objecttype']][]=$_REQUEST['objectdn'];
54 public static function ajax_dropItem(&$data) {
55 if ((isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn']))) {
56 if (is_array($_SESSION['LSselect'][$_REQUEST['objecttype']])) {
58 foreach ($_SESSION['LSselect'][$_REQUEST['objecttype']] as $val) {
59 if ($val!=$_REQUEST['objectdn']) {
63 $_SESSION['LSselect'][$_REQUEST['objecttype']]=$result;
68 public static function ajax_refreshSession(&$data) {
69 if ((isset($_REQUEST['objecttype'])) && (isset($_REQUEST['values'])) ) {
70 $_SESSION['LSselect'][$_REQUEST['objecttype']]=array();
71 $values=json_decode($_REQUEST['values'],false);
72 if (is_array($values)) {
73 foreach($values as $val) {
74 $_SESSION['LSselect'][$_REQUEST['objecttype']][]=$val;
82 LSerror :: addErrorCode('LSsession_12');
86 public static function selectablly($obj,$args) {
87 return (LSsession::canEdit($obj->type,$obj->dn,$args))?1:0;