ryxeo-glpi-git / ajax / dropdownMassiveActionField.php @ b67d8923
Historique | Voir | Annoter | Télécharger (6,42 ko)
1 | b67d8923 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | * @version $Id: dropdownMassiveActionField.php 7763 2009-01-06 18:44:50Z moyo $
|
||
4 | -------------------------------------------------------------------------
|
||
5 | GLPI - Gestionnaire Libre de Parc Informatique
|
||
6 | Copyright (C) 2003-2009 by the INDEPNET Development Team.
|
||
7 | |||
8 | http://indepnet.net/ http://glpi-project.org
|
||
9 | -------------------------------------------------------------------------
|
||
10 | |||
11 | LICENSE
|
||
12 | |||
13 | This file is part of GLPI.
|
||
14 | |||
15 | GLPI is free software; you can redistribute it and/or modify
|
||
16 | it under the terms of the GNU General Public License as published by
|
||
17 | the Free Software Foundation; either version 2 of the License, or
|
||
18 | (at your option) any later version.
|
||
19 | |||
20 | GLPI is distributed in the hope that it will be useful,
|
||
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
23 | GNU General Public License for more details.
|
||
24 | |||
25 | You should have received a copy of the GNU General Public License
|
||
26 | along with GLPI; if not, write to the Free Software
|
||
27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
28 | --------------------------------------------------------------------------
|
||
29 | */
|
||
30 | |||
31 | // ----------------------------------------------------------------------
|
||
32 | // Original Author of file: Julien Dombre
|
||
33 | // Purpose of file:
|
||
34 | // ----------------------------------------------------------------------
|
||
35 | |||
36 | |||
37 | define('GLPI_ROOT','..'); |
||
38 | $NEEDED_ITEMS=array("search","contract","infocom","enterprise"); |
||
39 | include (GLPI_ROOT."/inc/includes.php"); |
||
40 | header("Content-Type: text/html; charset=UTF-8"); |
||
41 | header_nocache(); |
||
42 | |||
43 | switch ($_POST["device_type"]){ |
||
44 | case TRACKING_TYPE : |
||
45 | checkTypeRight("update_ticket","1"); |
||
46 | break;
|
||
47 | default :
|
||
48 | if (in_array($_POST["device_type"],$CFG_GLPI["infocom_types"])){ |
||
49 | checkSeveralRightsOr(array($_POST["device_type"]=>"w","contract_infocom"=>"w")); |
||
50 | } else {
|
||
51 | checkTypeRight($_POST["device_type"],"w"); |
||
52 | } |
||
53 | break;
|
||
54 | } |
||
55 | |||
56 | if (isset($_POST["device_type"])&&isset($_POST["id_field"])&&$_POST["id_field"]){ |
||
57 | $search=$SEARCH_OPTION[$_POST["device_type"]][$_POST["id_field"]]; |
||
58 | |||
59 | // Specific budget case
|
||
60 | if ($_POST["id_field"]==50) $search["linkfield"]="budget"; |
||
61 | |||
62 | $FIELDNAME_PRINTED=false; |
||
63 | |||
64 | |||
65 | if ($search["table"]==$LINK_ID_TABLE[$_POST["device_type"]]){ // field type |
||
66 | switch ($search["table"].".".$search["linkfield"]){ |
||
67 | case "glpi_software.helpdesk_visible": |
||
68 | case "glpi_users.active": |
||
69 | dropdownYesNo($search["linkfield"]); |
||
70 | break;
|
||
71 | case "glpi_cartridges_type.alarm": |
||
72 | case "glpi_consumables_type.alarm": |
||
73 | dropdownInteger($search["linkfield"],0,-1,100); |
||
74 | break;
|
||
75 | case "glpi_contracts.duration": |
||
76 | case "glpi_contracts.notice": |
||
77 | dropdownInteger($search["field"],0,0,120); |
||
78 | echo " ".$LANG["financial"][57]; |
||
79 | break;
|
||
80 | case "glpi_contracts.begin_date": |
||
81 | showCalendarForm("massiveaction_form",$search["field"]); |
||
82 | break;
|
||
83 | case "glpi_contracts.alert": |
||
84 | dropdownContractAlerting($search["linkfield"],0); |
||
85 | break;
|
||
86 | case "glpi_tracking.status": |
||
87 | dropdownStatus($search["linkfield"]); |
||
88 | break;
|
||
89 | case "glpi_tracking.priority": |
||
90 | dropdownPriority($search["linkfield"]); |
||
91 | break;
|
||
92 | default :
|
||
93 | // Specific plugin Type case
|
||
94 | $plugdisplay=false; |
||
95 | if ($_POST["device_type"]>1000){ |
||
96 | if (isset($PLUGIN_HOOKS['plugin_types'][$_POST["device_type"]])){ |
||
97 | $function='plugin_'.$PLUGIN_HOOKS['plugin_types'][$_POST["device_type"]].'_MassiveActionsFieldsDisplay'; |
||
98 | if (function_exists($function)){ |
||
99 | $plugdisplay=$function($_POST["device_type"],$search["table"],$search["field"],$search["linkfield"]); |
||
100 | } |
||
101 | } |
||
102 | } |
||
103 | if (!$plugdisplay){ |
||
104 | autocompletionTextField($search["linkfield"],$search["table"],$search["field"],'',30,$_SESSION["glpiactive_entity"]); |
||
105 | } |
||
106 | |||
107 | break;
|
||
108 | } |
||
109 | } else {
|
||
110 | switch ($search["table"]){ |
||
111 | |||
112 | case "glpi_infocoms": // infocoms case |
||
113 | switch ($search["field"]){ |
||
114 | case "alert": |
||
115 | dropdownAlertInfocoms($search["field"]); |
||
116 | break;
|
||
117 | |||
118 | case "buy_date" : |
||
119 | case "use_date" : |
||
120 | showCalendarForm("massiveaction_form",$search["field"]); |
||
121 | echo " "; |
||
122 | break;
|
||
123 | case "amort_type" : |
||
124 | dropdownAmortType("amort_type");
|
||
125 | break;
|
||
126 | case "amort_time" : |
||
127 | dropdownInteger("amort_time",0,0,15); |
||
128 | break;
|
||
129 | case "warranty_duration" : |
||
130 | dropdownInteger("warranty_duration",0,0,120); |
||
131 | echo " ".$LANG["financial"][57]." "; |
||
132 | break;
|
||
133 | default :
|
||
134 | autocompletionTextField($search["field"],$search["table"],$search["field"],'',30,$_SESSION["glpiactive_entity"]); |
||
135 | break;
|
||
136 | } |
||
137 | break;
|
||
138 | case "glpi_enterprises_infocoms": // Infocoms enterprises |
||
139 | dropdown("glpi_enterprises","FK_enterprise",1,$_SESSION["glpiactive_entity"]); |
||
140 | echo "<input type='hidden' name='field' value='FK_enterprise'>"; |
||
141 | $FIELDNAME_PRINTED=true; |
||
142 | break;
|
||
143 | case "glpi_dropdown_budget": // Infocoms budget |
||
144 | dropdown("glpi_dropdown_budget","budget"); |
||
145 | break;
|
||
146 | case "glpi_ocs_link": // auto_update ocs_link |
||
147 | dropdownYesNo("_auto_update_ocs");
|
||
148 | echo "<input type='hidden' name='field' value='_auto_update_ocs'>"; |
||
149 | $FIELDNAME_PRINTED=true; |
||
150 | break;
|
||
151 | case "glpi_users": // users |
||
152 | switch ($search["linkfield"]){ |
||
153 | case "assign": |
||
154 | dropdownUsers($search["linkfield"],0,"own_ticket",0,1,$_SESSION["glpiactive_entity"]); |
||
155 | break;
|
||
156 | case "tech_num": |
||
157 | dropdownUsersID($search["linkfield"],0,"interface",1,$_SESSION["glpiactive_entity"]); |
||
158 | break;
|
||
159 | default:
|
||
160 | dropdownAllUsers($search["linkfield"],0,1,$_SESSION["glpiactive_entity"]); |
||
161 | break;
|
||
162 | } |
||
163 | break;
|
||
164 | break;
|
||
165 | |||
166 | |||
167 | default : // dropdown case |
||
168 | // Specific plugin Type case
|
||
169 | $plugdisplay=false; |
||
170 | if ($_POST["device_type"]>1000){ |
||
171 | if (isset($PLUGIN_HOOKS['plugin_types'][$_POST["device_type"]])){ |
||
172 | $function='plugin_'.$PLUGIN_HOOKS['plugin_types'][$_POST["device_type"]].'_MassiveActionsFieldsDisplay'; |
||
173 | if (function_exists($function)){ |
||
174 | $plugdisplay=$function($_POST["device_type"],$search["table"],$search["field"],$search["linkfield"]); |
||
175 | } |
||
176 | } |
||
177 | } |
||
178 | if (!$plugdisplay){ |
||
179 | dropdown($search["table"],$search["linkfield"],1,$_SESSION["glpiactive_entity"]); |
||
180 | } |
||
181 | break;
|
||
182 | } |
||
183 | } |
||
184 | if (!$FIELDNAME_PRINTED){ |
||
185 | if (empty($search["linkfield"])) |
||
186 | echo "<input type='hidden' name='field' value='".$search["field"]."'>"; |
||
187 | else {
|
||
188 | echo "<input type='hidden' name='field' value='".$search["linkfield"]."'>"; |
||
189 | } |
||
190 | } |
||
191 | |||
192 | echo " <input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"".$LANG["buttons"][2]."\" >"; |
||
193 | } |
||
194 | |||
195 | ?> |