Subversion Repositories ALCASAR

Rev

Rev 632 | Rev 907 | 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
 
3
//Gestion de la langue
4
$origine='group_new';
5
if (is_file("../lib/langues.php"))
6
	include("../lib/langues.php");
7
 
324 richard 8
require('/etc/freeradius-web/config.php');
9
if ($show == 1){
10
	header("Location: group_admin.php?login=$login");
11
	exit;
12
}
13
 
14
if ($config[general_lib_type] != 'sql'){
15
	echo <<<EOM
16
<title>$l_title</title>
17
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
18
<link rel="stylesheet" href="style.css">
19
</head>
20
<body>
21
<center>
22
<b>This page is only available if you are using sql as general library type</b>
23
</body>
24
</html>
25
EOM;
26
        exit();
27
}
28
 
29
require('../lib/attrshow.php');
30
require('../lib/defaults.php');
31
require("../lib/$config[general_lib_type]/group_info.php");
32
 
33
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
34
	$colspan=2;
35
	$show_ops=1;
36
}else{
37
	$show_ops = 0;
38
	$colspan=1;
39
}
40
echo "<html><head><title>$l_title</title>";
41
 
42
?>
43
 
44
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
45
<link rel="stylesheet" href="/css/style.css">
508 richard 46
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
509 richard 47
<script type="text/javascript" src="/js/epoch_classes.js"></script>
48
<script type="text/javascript" src="/js/fonctions.js"></script>
324 richard 49
<script language="javascript" type="text/javascript">
508 richard 50
/*Insertion du calendrier*/
51
	var dp_cal;      
52
window.onload = function () {
53
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
54
};
55
/*Fin calendrier*/
324 richard 56
</script>
57
</head>
58
<body>
59
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
60
	<tr><th><? echo "$l_frame_top"; ?></th></tr>
61
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
62
height="2"></td></tr>
63
</TABLE>
64
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
65
	<tr bgcolor="#666666"><td>
66
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
67
		<tr><td valign="middle" align="left">
68
<center>
69
<table border=0 width=550 cellpadding=1 cellspacing=1>
70
<tr valign=top>
71
<td width=340></td>
72
<td bgcolor="black" width=200>
73
	<table border=0 width=100% cellpadding=2 cellspacing=0>
74
	<tr bgcolor="#907030" align=right valign=top><th>
75
	<font color="white"><? echo "$l_group_create"; ?></font>
76
	</th></tr>
77
	</table>
78
</td></tr>
79
<tr bgcolor="black" valign=top><td colspan=2>
80
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
81
	<tr><td>
82
 
83
<?php
84
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
85
	include("../lib/$config[general_lib_type]/group_info.php");
86
if ($create == 1){
87
	if ($group_exists != "no"){
88
		echo <<<EOM
89
<b>Le groupe <i>$login</i> existe d&eacute;j&agrave;.</b>
90
EOM;
91
	}
92
	else{
93
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
94
			include("../lib/$config[general_lib_type]/create_group.php");
95
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
96
			include("../lib/$config[general_lib_type]/group_info.php");
97
	}
98
}
99
?>
100
   <form name="newgroup" method=post>
101
      <input type=hidden name=create value="0">
102
      <input type=hidden name=show value="0">
103
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
104
<?php
105
	echo <<<EOM
106
	<tr>
508 richard 107
		<td class="etiquette" colspan=$colspan>
324 richard 108
		Groupe(s) d&eacute;j&agrave; cr&eacute;&eacute;(s)
109
		</td><td>
110
EOM;
111
		if (!isset($existing_groups))
112
			echo "<b>Aucun groupe d&eacute;j&agrave; cr&eacute;&eacute;</b>\n";
113
		else{
114
			echo "<select name=\"existing_groups\">\n";	
115
			foreach ($existing_groups as $group => $count)
116
				echo "<option value=\"$group\">$group\n";
117
			echo "</select>\n";
118
		}
119
	echo <<<EOM
120
		</td>
121
	</tr>
122
	<tr>
508 richard 123
		<td class="etiquette" colspan=$colspan>
324 richard 124
		Nom du groupe
125
		</td><td>
126
		<input type=text name="login" value="$login" size=35>
127
		</td>
128
	</tr>
129
	<tr>
508 richard 130
		<td class="etiquette" colspan=$colspan>
324 richard 131
		Membres du groupe : s&eacute;par&eacute;s par un espace ou un 'retour chariot'.
132
		</td><td>
133
		<textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea>
134
		</td>
135
	</tr>
136
 
137
EOM;
138
	foreach($show_attrs as $key => $desc){
139
		$name = $attrmap["$key"];
140
		if ($name == 'none')
141
			continue;
142
		$oper_name = $name . '_op';
143
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
508 richard 144
		/*
145
		Gestion d'un mode simple ou d'un mode avancé
146
		Définition du mode avancé les attributs concernant la gestion des octets, de la bande passante
147
		*/
148
		switch ($key)
149
		{
150
			case 'ChilliSpot-Max-Input-Octets' :
151
			case 'ChilliSpot-Max-Output-Octets' :
152
			case 'ChilliSpot-Max-Total-Octets' :
153
			case 'ChilliSpot-Bandwidth-Max-Up' :
154
			case 'ChilliSpot-Bandwidth-Max-Down' :
155
			case 'WISPr-Redirection-URL' :
632 richard 156
				$advanced=1; //<-- Valeur à mettre à '0' pour limiter les fonctionnalités
508 richard 157
				break;
158
			default:
159
				$advanced=1;
160
				break;
161
		}
162
		if ($advanced){
163
			print <<<EOM
164
			<tr>
165
				<td class="etiquette">
166
				$desc
167
				</td>
324 richard 168
EOM;
508 richard 169
		}
170
		if ($show_ops && $advanced){
171
			switch ($key)
172
			{
173
				case 'Simultaneous-Use' : 
174
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
175
					break;
176
				case 'Login-Time' : 
177
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
178
					break;
179
				case 'Expiration' :
180
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
181
					break;
890 stephane 182
				case 'Max-All-Session' :
183
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
184
					break;
508 richard 185
				case 'Session-Timeout' :
186
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
187
					break;
188
				case 'Max-Daily-Session' :
189
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
190
					break;
191
				case 'Max-Weekly-Session' :
192
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
193
					break;
194
				case 'Max-Monthly-Session' :
195
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
196
					break;
197
				case 'ChilliSpot-Max-Input-Octets' :
198
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
199
					break;
200
				case 'ChilliSpot-Max-Output-Octets' :
201
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
202
					break;
203
				case 'ChilliSpot-Max-Total-Octets' :
204
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
205
					break;
206
				case 'ChilliSpot-Bandwidth-Max-Up' :
207
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
208
					break;
209
				case 'ChilliSpot-Bandwidth-Max-Down' :
210
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
211
					break;
212
				case 'WISPr-Redirection-URL' :
213
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
214
					break;
215
				default :
216
					print <<<EOM
217
					<td>
218
					<select name=$oper_name>
219
					<option $selected[$op_eq] value="=">=
220
					<option $selected[$op_set] value=":=">:=
221
					<option $selected[$op_add] value="+=">+=
222
					<option $selected[$op_eq2] value="==">==
223
					<option $selected[$op_ne] value="!=">!=
224
					<option $selected[$op_gt] value=">">&gt;
225
					<option $selected[$op_ge] value=">=">&gt;=
226
					<option $selected[$op_lt] value="<">&lt;
227
					<option $selected[$op_le] value="<=">&lt;=
228
					<option $selected[$op_regeq] value="=~">=~
229
					<option $selected[$op_regne] value="!~">!~
230
					<option $selected[$op_exst] value="=*">=*
231
					<option $selected[$op_nexst] value="!*">!*
232
					</select>
233
					</td>
324 richard 234
EOM;
508 richard 235
					break;
236
			}
324 richard 237
		}
508 richard 238
/* 
239
Ajout du choix d'unité (pour les durées limites de session, journée et de mois) 
240
et d'un calendrier pour la date d'expiration
241
Sauf dans le cas de la visualisation
242
*/
243
	if ($advanced){echo "<td>";}
244
	if ($create==0 ){
245
		switch ($name){
246
			/*
247
			Choix de l'unité heures, minutes ou secondes 
248
			pour les durées limites de session,journée et de mois	
249
			*/	
250
			case 'Session-Timeout' :
251
			case 'Max-Daily-Session' :
252
			case 'Max-Monthly-Session' :
253
				/*valeur d'origine de durée limite */
254
				echo"<input id =\"$name\" type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
255
				/* Choix d'unité*/
256
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
257
						<option value=\"s\" selected>s</option>
258
						<option value=\"m\" >m</option>
259
						<option value=\"H\" >H</option>
260
					</select>";
261
				break;
262
			case 'Expiration' :
263
				/*Ajout du calendrier pour choisir la date*/
264
				echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
265
				break;
266
			default :
267
				if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
268
				break;
269
			}
270
	}else{
271
		/*Pas de gestion de remplissage lors de la visualisation*/
272
		if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
324 richard 273
	}
508 richard 274
/*fin Ajout*/
275
}
324 richard 276
echo "</table><BR>";
277
if ($create == 1)
278
	echo "<input type=submit class=button value=\"Afficher le groupe\" OnClick=\"this.form.show.value=1\">";
279
	else
508 richard 280
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"return formControl('newgroup');\">";
324 richard 281
?>
282
<br><br>
283
</form>
284
	</td></tr>
285
</table>
286
</tr>
287
</table>
288
</TD></TR>
289
</TABLE>
290
</td></tr>
291
</TABLE>
292
</body>
293
</html>