Subversion Repositories ALCASAR

Rev

Rev 1838 | Rev 1895 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
324 richard 1
<?php
508 richard 2
 
1805 clement.si 3
if (!isset ($create)) $create=0;
4
if (!isset ($login)) $login='';
5
if (!isset ($selected)) $selected=array();
6
 
7
/*if(!isset($selected))
8
{
9
	$selected['username'] = '';
10
	$selected['name'] = '';
11
	$selected['department'] = '';
12
	$selected['radius'] = '';
13
	$selected['Expiration'] = '';
14
	$selected['Max-All-Session'] = '';
15
	$selected['Session-Timeout'] = '';
16
	$selected['Max-Daily-Session'] = '';
17
	$selected['Max-Monthly-Session'] = '';
18
	$selected['Simultaneous-Use'] = '';
19
	$selected['Login-Time'] = '';
20
	$selected['ChilliSpot-Max-Input-Octets'] = '';
21
	$selected['ChilliSpot-Max-Total-Octets'] = '';
22
	$selected['ChilliSpot-Bandwidth-Max-Up'] = '';
23
	$selected['ChilliSpot-Bandwidth-Max-Down'] = '';
24
	$selected['ChilliSpot-Max-Output-Octets'] = '';
25
	$selected['WISPr-Redirection-URL'] = '';
26
}*/
27
 
508 richard 28
//Gestion de la langue
29
if (is_file("../lib/langues.php"))
30
	include("../lib/langues.php");
324 richard 31
require('/etc/freeradius-web/config.php');
32
 
1805 clement.si 33
if ($config['general_lib_type'] != 'sql'){
324 richard 34
	echo <<<EOM
35
<title>$l_title</title>
1840 raphael.pi 36
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
324 richard 37
<link rel="stylesheet" href="style.css">
38
</head>
39
<body>
40
<center>
41
<b>This page is only available if you are using sql as general library type</b>
42
</body>
43
</html>
44
EOM;
45
        exit();
46
}
47
 
48
require('../lib/attrshow.php');
49
require('../lib/defaults.php');
50
require("../lib/$config[general_lib_type]/group_info.php");
51
 
1805 clement.si 52
if ($config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){
324 richard 53
	$colspan=2;
54
	$show_ops=1;
1805 clement.si 55
	include_once("../lib/operators.php");
56
	if(!isset($selected[$op_eq])) $selected[$op_eq] = '';
324 richard 57
}else{
58
	$show_ops = 0;
59
	$colspan=1;
60
}
61
?>
62
 
911 richard 63
<html><head><title>New group</title>
1840 raphael.pi 64
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
324 richard 65
<link rel="stylesheet" href="/css/style.css">
508 richard 66
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
509 richard 67
<script type="text/javascript" src="/js/epoch_classes.js"></script>
68
<script type="text/javascript" src="/js/fonctions.js"></script>
324 richard 69
<script language="javascript" type="text/javascript">
508 richard 70
/*Insertion du calendrier*/
1805 clement.si 71
	var dp_cal;
508 richard 72
window.onload = function () {
73
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
74
};
75
/*Fin calendrier*/
324 richard 76
</script>
77
</head>
78
<body>
79
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
911 richard 80
	<tr><th><? echo "$l_groups_managment"; ?></th></tr>
1805 clement.si 81
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
324 richard 82
height="2"></td></tr>
83
</TABLE>
84
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
85
	<tr bgcolor="#666666"><td>
86
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
87
		<tr><td valign="middle" align="left">
88
<center>
1377 richard 89
<table border=0 width=750 cellpadding=1 cellspacing=1>
324 richard 90
<tr valign=top>
91
<td width=340></td>
92
<td bgcolor="black" width=200>
93
	<table border=0 width=100% cellpadding=2 cellspacing=0>
94
	<tr bgcolor="#907030" align=right valign=top><th>
95
	<font color="white"><? echo "$l_group_create"; ?></font>
96
	</th></tr>
97
	</table>
98
</td></tr>
99
<tr bgcolor="black" valign=top><td colspan=2>
100
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
101
	<tr><td>
1805 clement.si 102
 
324 richard 103
<?php
104
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
105
	include("../lib/$config[general_lib_type]/group_info.php");
106
if ($create == 1){
107
	if ($group_exists != "no"){
108
		echo <<<EOM
907 richard 109
<b><i>$login</i> $l_already_exist</b>
324 richard 110
EOM;
111
	}
112
	else{
113
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
114
			include("../lib/$config[general_lib_type]/create_group.php");
115
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
116
			include("../lib/$config[general_lib_type]/group_info.php");
117
	}
118
}
1377 richard 119
if ($create == 0){
324 richard 120
?>
121
   <form name="newgroup" method=post>
122
      <input type=hidden name=create value="0">
123
      <input type=hidden name=show value="0">
124
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
125
<?php
126
	echo <<<EOM
127
	<tr>
508 richard 128
		<td class="etiquette" colspan=$colspan>
907 richard 129
		$l_created_groups
324 richard 130
		</td><td>
131
EOM;
132
		if (!isset($existing_groups))
907 richard 133
			echo "<b>$l_group_empty</b>\n";
324 richard 134
		else{
1805 clement.si 135
			echo "<select name=\"existing_groups\">\n";
324 richard 136
			foreach ($existing_groups as $group => $count)
137
				echo "<option value=\"$group\">$group\n";
138
			echo "</select>\n";
139
		}
140
	echo <<<EOM
141
		</td>
142
	</tr>
143
	<tr>
508 richard 144
		<td class="etiquette" colspan=$colspan>
907 richard 145
		$l_group_name
324 richard 146
		</td><td>
147
		<input type=text name="login" value="$login" size=35>
148
		</td>
149
	</tr>
150
	<tr>
508 richard 151
		<td class="etiquette" colspan=$colspan>
907 richard 152
		$l_group_members
324 richard 153
		</td><td>
1377 richard 154
		<textarea name=members cols="50" wrap="PHYSICAL" rows=5></textarea>
324 richard 155
		</td>
156
	</tr>
1805 clement.si 157
 
324 richard 158
EOM;
159
	foreach($show_attrs as $key => $desc){
160
		$name = $attrmap["$key"];
161
		if ($name == 'none')
162
			continue;
163
		$oper_name = $name . '_op';
1805 clement.si 164
		if(isset($item_vals["$key"][0]) && $item_vals["$key"][0] != ''){
165
			$val = $item_vals["$key"][0];
166
		} else if(isset($default_vals["$key"][0])) {
167
			$val = $default_vals["$key"][0];
168
		} else {
169
			$val = '';
170
		}
508 richard 171
		switch ($key)
172
		{
1805 clement.si 173
		// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.)
174
			case 'Simultaneous-Use' :
907 richard 175
				$advanced=1;
176
				$help_link="help/simultaneous_use_help.html";
177
				$desc=$l_simultaneous_use;
178
				break;
179
			case 'Max-All-Session' :
180
				$advanced=1;
181
				$help_link="help/max_all_session_help.html";
182
				$desc=$l_max_all_session;
183
				break;
1805 clement.si 184
			case 'Session-Timeout' :
907 richard 185
				$advanced=1;
186
				$help_link="help/session_timeout_help.html";
187
				$desc=$l_session_timeout;
188
				break;
189
			case 'Max-Daily-Session' :
190
				$advanced=1;
191
				$help_link="help/session_timeout_help.html";
192
				$desc=$l_daily_timeout;
193
				break;
194
			case 'Max-Monthly-Session' :
195
				$advanced=1;
196
				$help_link="help/session_timeout_help.html";
197
				$desc=$l_monthly_timeout;
198
				break;
1805 clement.si 199
			case 'Login-Time' :
907 richard 200
				$advanced=1;
201
				$help_link="help/login_time_help.html";
202
				$desc=$l_login_time;
203
				break;
204
			case 'Expiration' :
205
				$advanced=1;
206
				$help_link="help/expiration_help.html";
207
				$desc=$l_expiration;
208
				break;
508 richard 209
			case 'ChilliSpot-Max-Input-Octets' :
907 richard 210
				$advanced=1;
211
				$help_link="help/chillispot_max_input_octets_help.html";
212
				$desc=$l_max_input_octets;
213
				break;
508 richard 214
			case 'ChilliSpot-Max-Output-Octets' :
907 richard 215
				$advanced=1;
216
				$help_link="help/chillispot_max_output_octets_help.html";
217
				$desc=$l_max_output_octets;
218
				break;
508 richard 219
			case 'ChilliSpot-Max-Total-Octets' :
907 richard 220
				$advanced=1;
221
				$help_link="help/chillispot_max_total_octets_help.html";
222
				$desc=$l_max_total_octets;
223
				break;
508 richard 224
			case 'ChilliSpot-Bandwidth-Max-Up' :
907 richard 225
				$advanced=1;
226
				$help_link="help/chillispot_bandwidth_max_up_help.html";
227
				$desc=$l_max_bandwidth_up;
228
				break;
508 richard 229
			case 'ChilliSpot-Bandwidth-Max-Down' :
907 richard 230
				$advanced=1;
231
				$help_link="help/chillispot_bandwidth_max_down_help.html";
232
				$desc=$l_max_bandwidth_down;
233
				break;
508 richard 234
			case 'WISPr-Redirection-URL' :
907 richard 235
				$advanced=1;
236
				$help_link="help/wispr_redirection_url_help.html";
237
				$desc=$l_wispr_redirection;
508 richard 238
				break;
1377 richard 239
			case 'Filter-Id' :
240
				$advanced=1;
241
				$help_link="help/filtering_help.html";
242
				$desc=$l_filtering;
243
				break;
508 richard 244
			default:
245
				$advanced=1;
246
				break;
247
		}
907 richard 248
//		if ($advanced){
249
//			print <<<EOM
250
//			<tr>
251
//				<td class="etiquette">
252
//				$desc
253
//				</td>
254
//EOM;
255
//		}
256
		if ($show_ops && $advanced){
257
		print <<<EOM
508 richard 258
			<tr>
907 richard 259
			<td class="etiquette">
260
			<a href="$help_link" target=help onclick=window.open("$help_link","help","width=600,height=250,toolbar=no,scrollbars=no,resizable=yes") title="$l_click_for_help"><font color="blue">$desc</font></a>
261
			</td>
324 richard 262
EOM;
907 richard 263
			switch ($key){
1805 clement.si 264
				case 'Simultaneous-Use' :
890 stephane 265
				case 'Max-All-Session' :
508 richard 266
				case 'Max-Daily-Session' :
267
				case 'Max-Weekly-Session' :
268
				case 'Max-Monthly-Session' :
1805 clement.si 269
				case 'Login-Time' :
907 richard 270
				case 'Expiration' :
508 richard 271
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
272
					break;
1377 richard 273
				case 'Filter-Id' :
274
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
275
					break;
907 richard 276
				case 'Session-Timeout' :
508 richard 277
				case 'ChilliSpot-Max-Input-Octets' :
278
				case 'ChilliSpot-Max-Output-Octets' :
279
				case 'ChilliSpot-Max-Total-Octets' :
280
				case 'ChilliSpot-Bandwidth-Max-Up' :
281
				case 'ChilliSpot-Bandwidth-Max-Down' :
282
				case 'WISPr-Redirection-URL' :
283
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
284
					break;
285
				default :
286
					print <<<EOM
287
					<td>
907 richard 288
						<select name=$oper_name>
289
							<option $selected[$op_eq] value="=">=
290
							<option $selected[$op_set] value=":=">:=
291
							<option $selected[$op_add] value="+=">+=
292
							<option $selected[$op_eq2] value="==">==
293
							<option $selected[$op_ne] value="!=">!=
294
							<option $selected[$op_gt] value=">">&gt;
295
							<option $selected[$op_ge] value=">=">&gt;=
296
							<option $selected[$op_lt] value="<">&lt;
297
							<option $selected[$op_le] value="<=">&lt;=
298
							<option $selected[$op_regeq] value="=~">=~
299
							<option $selected[$op_regne] value="!~">!~
300
							<option $selected[$op_exst] value="=*">=*
301
							<option $selected[$op_nexst] value="!*">!*
302
						</select>
508 richard 303
					</td>
324 richard 304
EOM;
508 richard 305
					break;
306
			}
324 richard 307
		}
1805 clement.si 308
 
309
/*
310
Ajout du choix d'unité (pour les durées limites de session, journée et de mois)
508 richard 311
et d'un calendrier pour la date d'expiration
312
Sauf dans le cas de la visualisation
313
*/
314
	if ($advanced){echo "<td>";}
315
	if ($create==0 ){
316
		switch ($name){
317
			/*
1805 clement.si 318
			Choix de l'unité heures, minutes ou secondes
319
			pour les durées limites de session,journée et de mois
320
			*/
508 richard 321
			case 'Session-Timeout' :
322
			case 'Max-Daily-Session' :
323
			case 'Max-Monthly-Session' :
907 richard 324
			case 'Max-All-Session' :
508 richard 325
				/*valeur d'origine de durée limite */
326
				echo"<input id =\"$name\" type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
327
				/* Choix d'unité*/
328
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
329
						<option value=\"s\" selected>s</option>
330
						<option value=\"m\" >m</option>
331
						<option value=\"H\" >H</option>
332
					</select>";
333
				break;
334
			case 'Expiration' :
335
				/*Ajout du calendrier pour choisir la date*/
336
				echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
337
				break;
1377 richard 338
			case 'Filter-Id' :
339
				echo "<select name='Filter-Id'>";
1566 richard 340
				echo "<option value=\"\">$l_filtering_none</option>";
1377 richard 341
				echo "<option value=\"00000001\">$l_filtering_havp</option>";
342
				echo "<option value=\"00000011\">$l_filtering_havp_bl</option>";
343
				echo "<option value=\"00000101\">$l_filtering_havp_wl</option>";
344
				echo "</select>";
345
				break;
508 richard 346
			default :
347
				if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
348
				break;
349
			}
324 richard 350
	}
508 richard 351
/*fin Ajout*/
352
}
324 richard 353
echo "</table><BR>";
1377 richard 354
}
324 richard 355
if ($create == 1)
1377 richard 356
	echo "<br/><center><a href=\"group_admin.php?login=$login\">$l_show_profile</a></center>";
357
else
907 richard 358
	echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newgroup');\">";
324 richard 359
?>
360
<br><br>
361
</form>
362
	</td></tr>
363
</table>
364
</tr>
365
</table>
366
</TD></TR>
367
</TABLE>
368
</td></tr>
369
</TABLE>
370
</body>
371
</html>