2
# IRM - The Information Resource Manager
3
# Copyright (C) 2006 Martin Stevens
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License (in file COPYING) for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
################################################################################
23
function setupTemplates()
25
$this->ID = $_REQUEST['ID'];
27
switch($_REQUEST['action']){
51
'templname' => $_REQUEST['templname'],
52
'name' => $_REQUEST['name'],
53
'type' => $_REQUEST['type'],
54
'flags_server' => $_REQUEST['flags_server'],
55
'os' => $_REQUEST['os'],
56
'osver' => $_REQUEST['osver'],
57
'processor' => $_REQUEST['processor'],
58
'processor_speed' => $_REQUEST['processor_speed'],
59
'location' => $_REQUEST['location'],
60
'serial' => $_REQUEST['serial'],
61
'otherserial' => $_REQUEST['otherserial'],
62
'ramtype' => $_REQUEST['ramtype'],
63
'ram' => $_REQUEST['ram'],
64
'network' => $_REQUEST['network'],
65
'ip' => $_REQUEST['ip'],
66
'mac' => $_REQUEST['mac'],
67
'hdspace' => $_REQUEST['hdspace'],
68
'contact' => $_REQUEST['contact'],
69
'contact_num' => $_REQUEST['contact_num'],
70
'comments' => $_REQUEST['comments'],
71
'iface' => $_REQUEST['iface'],
72
'flags_surplus' => $_REQUEST['flags_surplus']
79
$flags_server = Computer::Flags(@$flags_server);
80
$flags_surplus = Computer::Flags(@$flags_surplus);
84
$DB = Config::Database();
85
$ID = $DB->getTextValue($ID);
86
$DB->UpdateQuery('templates', $this->vals, "ID=$this->ID");
93
commonHeader(_("Setup") . " - " . _("Templates Editor"));
95
$DB = Config::Database();
96
$qID = $DB->getTextValue($this->ID);
97
$query = "SELECT * FROM templates WHERE (ID = $qID)";
98
$DB = Config::Database();
99
$result = $DB->getRow($query);
101
$templname = $result["templname"];
102
$name = $result["name"];
103
$type = $result["type"];
105
$osver = $result["osver"];
106
$processor = $result["processor"];
107
$processor_speed = $result["processor_speed"];
108
$location = $result["location"];
109
$serial = $result["serial"];
110
$otherserial = $result["otherserial"];
111
$ramtype = $result["ramtype"];
112
$ram = $result["ram"];
113
$network = $result["network"];
115
$mac = $result["mac"];
116
$hdspace = $result["hdspace"];
117
$contact = $result["contact"];
118
$contact_num = $result["contact_num"];
119
$comments = $result["comments"];
120
$flags_server = $result["flags_server"];
121
$flags_surplus = $result["flags_surplus"];
122
$new_date = date("Y-m-d H:i:s");
123
$iface = $result["iface"];
129
'flags_server' => $flags_server,
130
'flags_surplus' => $flags_surplus,
133
'processor' => $processor,
134
'processor_speed' => $processor_speed,
135
'location' => $location,
137
'otherserial' => $otherserial,
138
'ramtype' => $ramtype,
140
'network' => $network,
143
'hdspace' => $hdspace,
144
'contact' => $contact,
145
'contact_num' => $contact_num,
146
'comments' => $comments,
147
'date_mod' => $date_mod
150
$new_date = date("Y-m-d H:i:s");
161
printf(_('Use this form to edit template "%s".'), $templname);
162
PRINT '<a href="'.Config::AbsLoc('users/setup-templates-index.php').'">'._("Back to Templates").'</a><br>';
164
PRINT '<form method=post action="'.Config::AbsLoc('users/setup-templates-index.php').'">';
165
PRINT '<input type="hidden" name="action" value="update">';
166
PRINT '<tr class="setupheader">';
167
PRINT '<th colspan=2>';
168
PRINT _("Editing Template");
169
PRINT "<input type=hidden name=ID value=\"$ID\">";
170
PRINT "<input type=text name=templname value=\"$templname\" size=40>";
174
PRINT '<tr class="setupdetail">';
175
#PRINT "<td>"._("Name:")."<br><input type=text name=name value=\"$name\" size=24></td>";
176
#PRINT "<td>"._("Type").":<br>";
177
#PRINT Dropdown_value("dropdown_type", "type", $type);
181
Computer::computerForm($vals);
183
PRINT '<tr class="setupupdate">';
184
PRINT "<td><input type=submit value=\""._("Update")."\"></td>";
185
PRINT "<td><input type=Reset value=\""._("Reset")."\"></form></td>";
189
templcompsoftShow($ID);
196
# $flags_server = serverFlags(@$flags_server);
197
# $flags_surplus = surplusFlags(@$flags_surplus);
198
if ($flags_server = "")
206
$DB = Config::Database();
207
$DB->InsertQuery('templates', $this->vals);
213
$DB = Config::Database();
214
$ID = $DB->getTextValue($this->ID);
215
$query = "DELETE FROM templates WHERE (ID = $ID)";
217
$query = "DELETE FROM templ_inst_software WHERE (cID = $ID)";
224
commonHeader(_("Setup - Computer Templates"));
225
$this->templatesList();
232
commonHeader(_("Setup") . " - " . _("Templates Add Form"));
237
__("Template Added Successfuly");
239
PRINT "<hr noshade>";
242
$new_date = date("Y-m-d H:i:s");
244
__("Use this form to add a template.");
245
PRINT '<a href="'.Config::AbsLoc('users/setup-templates-index.php').'">' . _("Back to Templates") . '</a>';
248
PRINT '<form method=post action="'.Config::AbsLoc('users/setup-templates-index.php').'">';
249
PRINT '<input type="hidden" name="action" value="add">';
250
PRINT '<tr class="computerheader">';
251
PRINT '<td colspan=2>';
254
PRINT "<input type=text name=templname value=\"$templname\" size=40></strong>";
258
PRINT '<tr class="setupdetail">';
259
#PRINT "<td>" ._("Name:") . "<br><input type=text name=name value=\"$name\" size=24></td>";
260
#PRINT "<td>" . _("Type") . ":<br>";
261
#PRINT Dropdown_value("dropdown_type", "type", $type);
265
Computer::computerForm("");
267
PRINT '<tr class="setupdetail">';
268
PRINT "<td><input type=submit value=Add></td>";
269
PRINT "<td><input type=Reset value=Reset></form></td>";
272
__("If you wish to add software to this template, you must do so by editing it.");
277
function templatesList()
279
printf(_("Please select a template below to edit, delete, or <a href=\"%s\">add one</a>."),Config::AbsLoc('users/setup-templates-index.php?action=addform'));
281
$query = "SELECT * FROM templates";
282
$DB = Config::Database();
283
$data = $DB->getAll($query);
285
$data = orderTemplateList($data);
289
PRINT "<th colspan=2>" . _("Computer Templates") . "</th>";
292
foreach ($data as $result)
295
$name = $result["templname"];
296
PRINT '<tr class="setupdetail">';
297
PRINT '<td><a href="' . Config::AbsLoc("users/setup-templates-index.php?action=edit&ID=$ID") . "\">$name</a></td>";
298
PRINT '<td><a href="' . Config::AbsLoc("users/setup-templates-index.php?action=delete&ID=$ID") . '">['. _("Delete"). ']</a></td>';