Project

General

Profile

Download (17.9 KB) Statistics
| Branch: | Tag: | Revision:
1 4c291f4c Renato Botelho
<?php
2 fab7ff44 Bill Marquette
/*
3 4c291f4c Renato Botelho
	$Id: system_groupmanager.php
4 d88c6a9f Scott Ullrich
	part of m0n0wall (http://m0n0.ch/wall)
5
6 6b07c15a Matthew Grooms
	Copyright (C) 2008 Shrew Soft Inc.
7 4c291f4c Renato Botelho
	All rights reserved.
8 6b07c15a Matthew Grooms
9 d88c6a9f Scott Ullrich
	Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
10 4c291f4c Renato Botelho
	All rights reserved.
11 d88c6a9f Scott Ullrich
12
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
13
	All rights reserved.
14 4c291f4c Renato Botelho
15 d88c6a9f Scott Ullrich
	Redistribution and use in source and binary forms, with or without
16
	modification, are permitted provided that the following conditions are met:
17 4c291f4c Renato Botelho
18 d88c6a9f Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
19
	   this list of conditions and the following disclaimer.
20 4c291f4c Renato Botelho
21 d88c6a9f Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
22
	   notice, this list of conditions and the following disclaimer in the
23
	   documentation and/or other materials provided with the distribution.
24 4c291f4c Renato Botelho
25 d88c6a9f Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
26
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
29
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
	POSSIBILITY OF SUCH DAMAGE.
35 fab7ff44 Bill Marquette
*/
36 1d333258 Scott Ullrich
/*
37
	pfSense_MODULE:	auth
38
*/
39 fab7ff44 Bill Marquette
40 6b07c15a Matthew Grooms
##|+PRIV
41
##|*IDENT=page-system-groupmanager
42
##|*NAME=System: Group manager page
43
##|*DESCR=Allow access to the 'System: Group manager' page.
44
##|*MATCH=system_groupmanager.php*
45
##|-PRIV
46 fab7ff44 Bill Marquette
47 3fa86ecd sullrich
require("guiconfig.inc");
48 d88c6a9f Scott Ullrich
49 bbf825ab Vinicius Coque
$pgtitle = array(gettext("System"), gettext("Group manager"));
50 fab7ff44 Bill Marquette
51 6b07c15a Matthew Grooms
if (!is_array($config['system']['group']))
52
	$config['system']['group'] = array();
53 d81c2ad1 Scott Ullrich
54 6b07c15a Matthew Grooms
$a_group = &$config['system']['group'];
55 d81c2ad1 Scott Ullrich
56 7ea27b0d Renato Botelho
unset($id);
57
if (isset($_POST['groupid']) && is_numericint($_POST['groupid']))
58
	$id = $_POST['groupid'];
59 d81c2ad1 Scott Ullrich
60 7ea27b0d Renato Botelho
$act = (isset($_POST['act']) ? $_POST['act'] : '');
61 31b53653 Scott Ullrich
62 7ea27b0d Renato Botelho
if ($act == "delgroup") {
63
64
	if (!isset($id) || !isset($_POST['groupname']) || !isset($a_group[$id]) || ($_POST['groupname'] != $a_group[$id]['name'])) {
65 6b07c15a Matthew Grooms
		pfSenseHeader("system_groupmanager.php");
66
		exit;
67
	}
68 31b53653 Scott Ullrich
69 920dbb26 Renato Botelho
	conf_mount_rw();
70 7ea27b0d Renato Botelho
	local_group_del($a_group[$id]);
71 920dbb26 Renato Botelho
	conf_mount_ro();
72 7ea27b0d Renato Botelho
	$groupdeleted = $a_group[$id]['name'];
73
	unset($a_group[$id]);
74 6b07c15a Matthew Grooms
	write_config();
75
	$savemsg = gettext("Group")." {$groupdeleted} ".
76 7ea27b0d Renato Botelho
		gettext("successfully deleted")."<br />";
77 fab7ff44 Bill Marquette
}
78 d88c6a9f Scott Ullrich
79 7ea27b0d Renato Botelho
if ($act == "delpriv") {
80 fab7ff44 Bill Marquette
81 7ea27b0d Renato Botelho
	if (!isset($id) || !isset($a_group[$id])) {
82 6b07c15a Matthew Grooms
		pfSenseHeader("system_groupmanager.php");
83
		exit;
84
	}
85 fab7ff44 Bill Marquette
86 7ea27b0d Renato Botelho
	$privdeleted = $priv_list[$a_group[$id]['priv'][$_POST['privid']]]['name'];
87
	unset($a_group[$id]['priv'][$_POST['privid']]);
88 6b07c15a Matthew Grooms
89 2ee08031 Erik Fonnesbeck
	if (is_array($a_group[$id]['member'])) {
90
		foreach ($a_group[$id]['member'] as $uid) {
91
			$user = getUserEntryByUID($uid);
92
			if ($user)
93
				local_user_set($user);
94
		}
95 d88c6a9f Scott Ullrich
	}
96 6b07c15a Matthew Grooms
97
	write_config();
98 7ea27b0d Renato Botelho
	$act = "edit";
99 6b07c15a Matthew Grooms
	$savemsg = gettext("Privilege")." {$privdeleted} ".
100 8cd558b6 ayvis
				gettext("successfully deleted")."<br />";
101 6b07c15a Matthew Grooms
}
102 45ee90ed Matthew Grooms
103 7ea27b0d Renato Botelho
if ($act == "edit") {
104
	if (isset($id) && isset($a_group[$id])) {
105 45ee90ed Matthew Grooms
		$pconfig['name'] = $a_group[$id]['name'];
106 6b07c15a Matthew Grooms
		$pconfig['gid'] = $a_group[$id]['gid'];
107
		$pconfig['gtype'] = $a_group[$id]['scope'];
108 45ee90ed Matthew Grooms
		$pconfig['description'] = $a_group[$id]['description'];
109 6b07c15a Matthew Grooms
		$pconfig['members'] = $a_group[$id]['member'];
110
		$pconfig['priv'] = $a_group[$id]['priv'];
111 45ee90ed Matthew Grooms
	}
112
}
113 6b07c15a Matthew Grooms
114 7ea27b0d Renato Botelho
if (isset($_POST['save'])) {
115 fab7ff44 Bill Marquette
116 d88c6a9f Scott Ullrich
	unset($input_errors);
117
	$pconfig = $_POST;
118
119
	/* input validation */
120
	$reqdfields = explode(" ", "groupname");
121 b4fd804b Carlos Eduardo Ramos
	$reqdfieldsn = array(gettext("Group Name"));
122 4c291f4c Renato Botelho
123 1e9b4611 Renato Botelho
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
124 4c291f4c Renato Botelho
125 d88c6a9f Scott Ullrich
	if (preg_match("/[^a-zA-Z0-9\.\-_ ]/", $_POST['groupname']))
126 bbf825ab Vinicius Coque
		$input_errors[] = gettext("The group name contains invalid characters.");
127 4c291f4c Renato Botelho
128 3db408b3 PiBa-NL
	if (strlen($_POST['groupname']) > 16)
129
		$input_errors[] = gettext("The group name is longer than 16 characters.");
130 4c291f4c Renato Botelho
131 d88c6a9f Scott Ullrich
	if (!$input_errors && !(isset($id) && $a_group[$id])) {
132
		/* make sure there are no dupes */
133
		foreach ($a_group as $group) {
134
			if ($group['name'] == $_POST['groupname']) {
135 bbf825ab Vinicius Coque
				$input_errors[] = gettext("Another entry with the same group name already exists.");
136 d88c6a9f Scott Ullrich
				break;
137
			}
138
		}
139
	}
140 4c291f4c Renato Botelho
141 d88c6a9f Scott Ullrich
	if (!$input_errors) {
142 45ee90ed Matthew Grooms
		$group = array();
143 d88c6a9f Scott Ullrich
		if (isset($id) && $a_group[$id])
144
			$group = $a_group[$id];
145 4c291f4c Renato Botelho
146 d88c6a9f Scott Ullrich
		$group['name'] = $_POST['groupname'];
147
		$group['description'] = $_POST['description'];
148 45ee90ed Matthew Grooms
149 70d6b5c4 Ermal
		if (empty($_POST['members']))
150
			unset($group['member']);
151
		else if ($group['gid'] != 1998) // all group
152 6b07c15a Matthew Grooms
			$group['member'] = $_POST['members'];
153 45ee90ed Matthew Grooms
154 d88c6a9f Scott Ullrich
		if (isset($id) && $a_group[$id])
155
			$a_group[$id] = $group;
156 45ee90ed Matthew Grooms
		else {
157
			$group['gid'] = $config['system']['nextgid']++;
158 d88c6a9f Scott Ullrich
			$a_group[] = $group;
159 45ee90ed Matthew Grooms
		}
160
161 920dbb26 Renato Botelho
		conf_mount_rw();
162 659fa7f2 Matthew Grooms
		local_group_set($group);
163 920dbb26 Renato Botelho
		conf_mount_ro();
164 2a0e8512 jim-p
165
		/* Refresh users in this group since their privileges may have changed. */
166 5709072a jim-p
		if (is_array($group['member'])) {
167
			$a_user = &$config['system']['user'];
168
			foreach ($a_user as & $user) {
169
				if (in_array($user['uid'], $group['member']))
170
					local_user_set($user);
171
			}
172 2a0e8512 jim-p
		}
173
174 d88c6a9f Scott Ullrich
		write_config();
175 4c291f4c Renato Botelho
176 d88c6a9f Scott Ullrich
		header("Location: system_groupmanager.php");
177
		exit;
178
	}
179 fab7ff44 Bill Marquette
}
180
181
include("head.inc");
182
183
?>
184 45ee90ed Matthew Grooms
185
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
186 6b07c15a Matthew Grooms
<?php include("fbegin.inc"); ?>
187 9dfaf533 Colin Fleming
<script type="text/javascript">
188
//<![CDATA[
189 6b07c15a Matthew Grooms
190
function setall_selected(id) {
191
	selbox = document.getElementById(id);
192
	count = selbox.options.length;
193
	for (index = 0; index<count; index++)
194
		selbox.options[index].selected = true;
195
}
196
197
function clear_selected(id) {
198
	selbox = document.getElementById(id);
199
	count = selbox.options.length;
200
	for (index = 0; index<count; index++)
201
		selbox.options[index].selected = false;
202
}
203
204
function remove_selected(id) {
205
	selbox = document.getElementById(id);
206
	index = selbox.options.length - 1;
207
	for (; index >= 0; index--)
208
		if (selbox.options[index].selected)
209
			selbox.remove(index);
210
}
211
212
function copy_selected(srcid, dstid) {
213
	src_selbox = document.getElementById(srcid);
214
	dst_selbox = document.getElementById(dstid);
215 4c4c59b9 Renato Botelho
	count = dst_selbox.options.length;
216
	for (index = count - 1; index >= 0; index--) {
217
		if (dst_selbox.options[index].value == '') {
218
			dst_selbox.remove(index);
219
		}
220
	}
221 6b07c15a Matthew Grooms
	count = src_selbox.options.length;
222
	for (index = 0; index < count; index++) {
223
		if (src_selbox.options[index].selected) {
224
			option = document.createElement('option');
225
			option.text = src_selbox.options[index].text;
226
			option.value = src_selbox.options[index].value;
227
			dst_selbox.add(option, null);
228
		}
229
	}
230
}
231
232
function move_selected(srcid, dstid) {
233
	copy_selected(srcid, dstid);
234
	remove_selected(srcid);
235
}
236
237
function presubmit() {
238
	clear_selected('notmembers');
239
	setall_selected('members');
240
}
241
242 9dfaf533 Colin Fleming
//]]>
243 6b07c15a Matthew Grooms
</script>
244 fab7ff44 Bill Marquette
<?php
245 45ee90ed Matthew Grooms
	if ($input_errors)
246
		print_input_errors($input_errors);
247
	if ($savemsg)
248
		print_info_box($savemsg);
249 fab7ff44 Bill Marquette
?>
250 9dfaf533 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="group manager">
251 45ee90ed Matthew Grooms
	<tr>
252 e30001cf Matthew Grooms
		<td>
253 4c291f4c Renato Botelho
<?php
254
			$tab_array = array();
255
			$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
256
			$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
257
			$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
258
			$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
259
			display_top_tabs($tab_array);
260
?>
261 45ee90ed Matthew Grooms
		</td>
262 4c291f4c Renato Botelho
	</tr>
263 45ee90ed Matthew Grooms
	<tr>
264 e30001cf Matthew Grooms
		<td id="mainarea">
265
			<div class="tabcont">
266
267 4c291f4c Renato Botelho
<?php
268 7ea27b0d Renato Botelho
			if($act == "new" || $act == "edit"):
269 4c291f4c Renato Botelho
?>
270 e30001cf Matthew Grooms
				<form action="system_groupmanager.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
271 7ea27b0d Renato Botelho
					<input type="hidden" id="act" name="act" value="" />
272
					<input type="hidden" id="groupid" name="groupid" value="<?=(isset($id) ? $id : '');?>" />
273
					<input type="hidden" id="privid" name="privid" value="" />
274 9dfaf533 Colin Fleming
					<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
275 4c291f4c Renato Botelho
<?php
276
						$ro = "";
277
						if ($pconfig['gtype'] == "system")
278
							$ro = "readonly=\"readonly\"";
279
?>
280 e30001cf Matthew Grooms
						<tr>
281
							<td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
282
							<td width="78%" class="vtable">
283
								<strong><?=strtoupper($pconfig['gtype']);?></strong>
284 dd5bf424 Scott Ullrich
								<input name="gtype" type="hidden" value="<?=htmlspecialchars($pconfig['gtype'])?>"/>
285 e30001cf Matthew Grooms
							</td>
286
						</tr>
287 4c291f4c Renato Botelho
						<tr>
288 bbf825ab Vinicius Coque
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Group name");?></td>
289 4c291f4c Renato Botelho
							<td width="78%" class="vtable">
290 3db408b3 PiBa-NL
								<input name="groupname" type="text" class="formfld group" id="groupname" size="20" maxlength="16" value="<?=htmlspecialchars($pconfig['name']);?>" <?=$ro;?> />
291 e30001cf Matthew Grooms
							</td>
292
						</tr>
293 4c291f4c Renato Botelho
						<tr>
294 bbf825ab Vinicius Coque
							<td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
295 4c291f4c Renato Botelho
							<td width="78%" class="vtable">
296 9dfaf533 Colin Fleming
								<input name="description" type="text" class="formfld unknown" id="description" size="20" value="<?=htmlspecialchars($pconfig['description']);?>" />
297 8cd558b6 ayvis
								<br />
298 bbf825ab Vinicius Coque
								<?=gettext("Group description, for your own information only");?>
299 e30001cf Matthew Grooms
							</td>
300
						</tr>
301 4c291f4c Renato Botelho
<?php
302
					if ($pconfig['gid'] != 1998): // all users group
303
?>
304 e30001cf Matthew Grooms
						<tr>
305
							<td width="22%" valign="top" class="vncell"><?=gettext("Group Memberships");?></td>
306
							<td width="78%" class="vtable" align="center">
307 9dfaf533 Colin Fleming
								<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="membership">
308 e30001cf Matthew Grooms
									<tr>
309
										<td align="center" width="50%">
310 8cd558b6 ayvis
											<strong><?=gettext("Not Members");?></strong><br />
311
											<br />
312 9dfaf533 Colin Fleming
												<select size="10" style="width: 75%" name="notmembers[]" class="formselect" id="notmembers" onchange="clear_selected('members')" multiple="multiple">
313 4c291f4c Renato Botelho
<?php
314
											$rowIndex = 0;
315
											foreach ($config['system']['user'] as $user):
316
												if (is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members']))
317
													continue;
318
												$rowIndex++;
319
?>
320 e30001cf Matthew Grooms
												<option value="<?=$user['uid'];?>" <?=$selected;?>>
321
													<?=htmlspecialchars($user['name']);?>
322
												</option>
323 4c291f4c Renato Botelho
<?php
324
											endforeach;
325
											if ($rowIndex == 0)
326
												echo "<option></option>";
327
?>
328 e30001cf Matthew Grooms
											</select>
329 8cd558b6 ayvis
											<br />
330 e30001cf Matthew Grooms
										</td>
331
										<td>
332 8cd558b6 ayvis
											<br />
333 e30001cf Matthew Grooms
											<a href="javascript:move_selected('notmembers','members')">
334 bbf825ab Vinicius Coque
												<img src="/themes/<?= $g['theme'];?>/images/icons/icon_right.gif" title="<?=gettext("Add Members");?>" alt="<?=gettext("Add Members");?>" width="17" height="17" border="0" />
335 e30001cf Matthew Grooms
											</a>
336 8cd558b6 ayvis
											<br /><br />
337 e30001cf Matthew Grooms
											<a href="javascript:move_selected('members','notmembers')">
338 bbf825ab Vinicius Coque
												<img src="/themes/<?= $g['theme'];?>/images/icons/icon_left.gif" title="<?=gettext("Remove Members");?>" alt="<?=gettext("Remove Members");?>" width="17" height="17" border="0" />
339 e30001cf Matthew Grooms
											</a>
340
										</td>
341
										<td align="center" width="50%">
342 8cd558b6 ayvis
											<strong><?=gettext("Members");?></strong><br />
343
											<br />
344 9dfaf533 Colin Fleming
											<select size="10" style="width: 75%" name="members[]" class="formselect" id="members" onchange="clear_selected('notmembers')" multiple="multiple">
345 4c291f4c Renato Botelho
<?php
346
											$rowIndex = 0;
347
											foreach ($config['system']['user'] as $user):
348
												if (!(is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members'])))
349
													continue;
350
												$rowIndex++;
351
?>
352 e30001cf Matthew Grooms
												<option value="<?=$user['uid'];?>">
353
													<?=htmlspecialchars($user['name']);?>
354
												</option>
355 4c291f4c Renato Botelho
<?php
356
											endforeach;
357
											if ($rowIndex == 0)
358
												echo "<option></option>";
359
?>
360 e30001cf Matthew Grooms
											</select>
361 8cd558b6 ayvis
											<br />
362 e30001cf Matthew Grooms
										</td>
363
									</tr>
364
								</table>
365
								<?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
366
							</td>
367
						</tr>
368 4c291f4c Renato Botelho
<?php
369
					endif;
370 7ea27b0d Renato Botelho
					if ($act != "new"):
371 4c291f4c Renato Botelho
?>
372 e30001cf Matthew Grooms
						<tr>
373
							<td width="22%" valign="top" class="vncell"><?=gettext("Assigned Privileges");?></td>
374
							<td width="78%" class="vtable">
375 9dfaf533 Colin Fleming
								<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="privileges">
376 e30001cf Matthew Grooms
									<tr>
377
										<td width="40%" class="listhdrr"><?=gettext("Name");?></td>
378
										<td width="60%" class="listhdrr"><?=gettext("Description");?></td>
379
										<td class="list"></td>
380
									</tr>
381 4c291f4c Renato Botelho
<?php
382
							if(is_array($pconfig['priv'])):
383
								$i = 0;
384
								foreach ($pconfig['priv'] as $priv):
385
?>
386 e30001cf Matthew Grooms
									<tr>
387
										<td class="listr">
388
											<?=htmlspecialchars($priv_list[$priv]['name']);?>
389
										</td>
390
										<td class="listbg">
391 33300c73 Scott Ullrich
											<?=htmlspecialchars($priv_list[$priv]['descr']);?>
392 e30001cf Matthew Grooms
										</td>
393 9dfaf533 Colin Fleming
										<td valign="middle" class="list nowrap">
394 7ea27b0d Renato Botelho
											<input type="image" name="delpriv[]" width="17" height="17" border="0"
395
												src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif"
396
												onclick="document.getElementById('privid').value='<?=$i;?>';
397
													document.getElementById('groupid').value='<?=$id;?>';
398
													document.getElementById('act').value='<?php echo "delpriv";?>';
399
													return confirm('<?=gettext("Do you really want to delete this privilege?");?>');"
400
												title="<?=gettext("delete privilege");?>" />
401 e30001cf Matthew Grooms
										</td>
402
									</tr>
403 4c291f4c Renato Botelho
<?php
404
									$i++;
405
								endforeach;
406
							endif;
407
?>
408 e30001cf Matthew Grooms
									<tr>
409
										<td class="list" colspan="2"></td>
410
										<td class="list">
411 dd5bf424 Scott Ullrich
											<a href="system_groupmanager_addprivs.php?groupid=<?=htmlspecialchars($id)?>">
412 9dfaf533 Colin Fleming
												<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" />
413 e30001cf Matthew Grooms
											</a>
414 4d86a13d Scott Ullrich
415 e30001cf Matthew Grooms
										</td>
416
									</tr>
417 4d86a13d Scott Ullrich
418 e30001cf Matthew Grooms
								</table>
419
							</td>
420
						</tr>
421 4c291f4c Renato Botelho
<?php
422
					endif;
423
?>
424
						<tr>
425 e30001cf Matthew Grooms
							<td width="22%" valign="top">&nbsp;</td>
426 4c291f4c Renato Botelho
							<td width="78%">
427 9dfaf533 Colin Fleming
								<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
428 d83a4264 Renato Botelho
								<input type="button" value="<?=gettext("Cancel");?>" onclick="window.location.href='/system_groupmanager.php'" />
429 e30001cf Matthew Grooms
								<?php if (isset($id) && $a_group[$id]): ?>
430 9dfaf533 Colin Fleming
								<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
431
								<input name="gid" type="hidden" value="<?=htmlspecialchars($pconfig['gid']);?>" />
432 e30001cf Matthew Grooms
								<?php endif; ?>
433
							</td>
434
						</tr>
435
					</table>
436
				</form>
437 4c291f4c Renato Botelho
<?php
438
			else:
439
?>
440 7ea27b0d Renato Botelho
				<form action="system_groupmanager.php" method="post" name="iform2" id="iform2">
441
					<input type="hidden" id="act" name="act" value="" />
442
					<input type="hidden" id="groupid" name="groupid" value="<?=(isset($id) ? $id : '');?>" />
443
					<input type="hidden" id="groupname" name="groupname" value="" />
444
					<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
445
						<thead>
446
							<tr>
447
								<th width="25%" class="listhdrr"><?=gettext("Group name");?></th>
448
								<th width="25%" class="listhdrr"><?=gettext("Description");?></th>
449
								<th width="30%" class="listhdrr"><?=gettext("Member Count");?></th>
450
								<th width="10%" class="list"></th>
451
							</tr>
452
						</thead>
453
						<tfoot>
454
							<tr>
455
								<td class="list" colspan="3"></td>
456
								<td class="list">
457
									<input type="image" name="addcert" width="17" height="17" border="0"
458
										src="/themes/<?=$g['theme'];?>/images/icons/icon_plus.gif"
459
										onclick="document.getElementById('act').value='<?php echo "new";?>';"
460
										title="<?=gettext("add group");?>" />
461
								</td>
462
							</tr>
463
							<tr>
464
								<td colspan="3">
465
									<p>
466
										<?=gettext("Additional webConfigurator groups can be added here.
467
										Group permissions can be assigned which are inherited by users who are members of the group.
468
										An icon that appears grey indicates that it is a system defined object.
469
										Some system object properties can be modified but they cannot be deleted.");?>
470
									</p>
471
								</td>
472
							</tr>
473
						</tfoot>
474
						<tbody>
475 4c291f4c Renato Botelho
<?php
476 7ea27b0d Renato Botelho
						$i = 0;
477
						foreach($a_group as $group):
478
							if($group['scope'] == "system")
479
								$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group-grey.png";
480
							else
481
								$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group.png";
482
							$groupcount = count($group['member']);
483
							if ($group["name"] == "all")
484
								$groupcount = count($config['system']['user']);
485 4c291f4c Renato Botelho
?>
486 7ea27b0d Renato Botelho
							<tr ondblclick="document.getElementById('act').value='<?php echo "edit";?>';
487
								document.getElementById('groupid').value='<?=$i;?>';
488
								document.iform2.submit();">
489
								<td class="listlr">
490
									<table border="0" cellpadding="0" cellspacing="0" summary="">
491
										<tr>
492
											<td align="left" valign="middle">
493
												<img src="<?=$grpimg;?>" alt="<?=gettext("User");?>" title="<?=gettext("User");?>" border="0" height="16" width="16" />
494
											</td>
495
											<td align="left" valign="middle">
496
												<?=htmlspecialchars($group['name']); ?>&nbsp;
497
											</td>
498
										</tr>
499
									</table>
500
								</td>
501
								<td class="listr">
502
									<?=htmlspecialchars($group['description']);?>&nbsp;
503
								</td>
504
								<td class="listbg">
505
									<?=$groupcount;?>
506
								</td>
507
								<td valign="middle" class="list nowrap">
508
									<input type="image" name="editgroup[]" width="17" height="17" border="0"
509
										src="/themes/<?=$g['theme'];?>/images/icons/icon_e.gif"
510
										onclick="document.getElementById('groupid').value='<?=$i;?>';
511
											document.getElementById('act').value='<?php echo "edit";?>';"
512
										title="<?=gettext("edit group");?>" />
513
									&nbsp;
514 4c291f4c Renato Botelho
<?php
515 7ea27b0d Renato Botelho
								if($group['scope'] != "system"):
516 4c291f4c Renato Botelho
?>
517 7ea27b0d Renato Botelho
									<input type="image" name="delgroup[]" width="17" height="17" border="0"
518
										src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif"
519
										onclick="document.getElementById('groupid').value='<?=$i;?>';
520
											document.getElementById('groupname').value='<?=$group['name'];?>';
521
											document.getElementById('act').value='<?php echo "delgroup";?>';
522
											return confirm('<?=gettext("Do you really want to delete this group?");?>');"
523
										title="<?=gettext("delete group");?>" />
524 4c291f4c Renato Botelho
<?php
525 7ea27b0d Renato Botelho
								endif;
526 4c291f4c Renato Botelho
?>
527 7ea27b0d Renato Botelho
								</td>
528
							</tr>
529 4c291f4c Renato Botelho
<?php
530 7ea27b0d Renato Botelho
							$i++;
531
						endforeach;
532 4c291f4c Renato Botelho
?>
533 7ea27b0d Renato Botelho
						</tbody>
534
					</table>
535
				</form>
536 4c291f4c Renato Botelho
<?php
537
			endif;
538
?>
539
			</div>
540 45ee90ed Matthew Grooms
		</td>
541
	</tr>
542
</table>
543 3e321df2 Ermal Luçi
<?php include("fend.inc"); ?>
544 9dfaf533 Colin Fleming
</body>
545
</html>