Port patch from branch_1_1 to the HEAD
[freeradius.git] / dialup_admin / htdocs / group_new.php3
1 <?php
2 require('../conf/config.php3');
3 if ($show == 1){
4         header("Location: group_admin.php3?login=$login");
5         exit;
6 }
7
8 if ($config[general_lib_type] != 'sql'){
9         echo <<<EOM
10 <title>New group creation page</title>
11 <meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
12 <link rel="stylesheet" href="style.css">
13 </head>
14 <body>
15 <center>
16 <b>This page is only available if you are using sql as general library type</b>
17 </body>
18 </html>
19 EOM;
20         exit();
21 }
22
23 require('../lib/attrshow.php3');
24 require('../lib/defaults.php3');
25 require("../lib/$config[general_lib_type]/group_info.php3");
26
27 if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
28         $colspan=2;
29         $show_ops=1;
30 }else{
31         $show_ops = 0;
32         $colspan=1;
33 }
34
35 ?>
36
37 <html>
38 <head>
39 <title>New group creation page</title>
40 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
41 <link rel="stylesheet" href="style.css">
42 </head>
43 <body>
44 <center>
45 <table border=0 width=550 cellpadding=0 cellspacing=0>
46 <tr valign=top>
47 <td align=center><img src="images/title2.gif"></td>
48 </tr>
49 </table>
50
51 <br>
52 <table border=0 width=540 cellpadding=1 cellspacing=1>
53 <tr valign=top>
54 <td width=340></td>
55 <td bgcolor="black" width=200>
56         <table border=0 width=100% cellpadding=2 cellspacing=0>
57         <tr bgcolor="#907030" align=right valign=top><th>
58         <font color="white">Preferences for new group</font>&nbsp;
59         </th></tr>
60         </table>
61 </td></tr>
62 <tr bgcolor="black" valign=top><td colspan=2>
63         <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
64         <tr><td>
65    
66 <?php
67 if (is_file("../lib/$config[general_lib_type]/group_info.php3"))
68         include("../lib/$config[general_lib_type]/group_info.php3");
69 if ($create == 1){
70         if ($group_exists != "no"){
71                 echo <<<EOM
72 <b>The group <i>$login</i> already exists in the group database</b>
73 EOM;
74         }
75         else{
76                 if (is_file("../lib/$config[general_lib_type]/create_group.php3"))
77                         include("../lib/$config[general_lib_type]/create_group.php3");
78                 if (is_file("../lib/$config[general_lib_type]/group_info.php3"))
79                         include("../lib/$config[general_lib_type]/group_info.php3");
80         }
81 }
82 ?>
83    <form method=post>
84       <input type=hidden name=create value="0">
85       <input type=hidden name=show value="0">
86         <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
87 <?php
88         echo <<<EOM
89         <tr>
90                 <td align=right colspan=$colspan bgcolor="#d0ddb0">
91                 Available Groups
92                 </td><td>
93 EOM;
94                 if (!isset($existing_groups))
95                         echo "<b>No groups available</b>\n";
96                 else{
97                         echo "<select name=\"existing_groups\">\n";     
98                         foreach ($existing_groups as $group => $count)
99                                 echo "<option value=\"$group\">$group\n";
100                         echo "</select>\n";
101                 }
102         echo <<<EOM
103                 </td>
104         </tr>
105         <tr>
106                 <td align=right colspan=$colspan bgcolor="#d0ddb0">
107                 Group name
108                 </td><td>
109                 <input type=text name="login" value="$login" size=35>
110                 </td>
111         </tr>
112         <tr>
113                 <td align=right colspan=$colspan bgcolor="#d0ddb0">
114                 First member(s)<br>Separate group members<br> by whitespace or newline
115                 </td><td>
116                 <textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea>
117                 </td>
118         </tr>
119                 
120 EOM;
121         foreach($show_attrs as $key => $desc){
122                 $name = $attrmap["$key"];
123                 if ($name == 'none')
124                         continue;
125                 $oper_name = $name . '_op';
126                 $val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
127                 print <<<EOM
128 <tr>
129 <td align=right bgcolor="#d0ddb0">
130 $desc
131 </td>
132 EOM;
133
134                 if ($show_ops)
135                         print <<<EOM
136 <td>
137 <select name=$oper_name>
138 <option selected value="=">=
139 <option value=":=">:=
140 <option value="+=">+=
141 <option value="==">==
142 <option value="!=">!=
143 <option value=">">&gt;
144 <option value=">=">&gt;=
145 <option value="<">&lt;
146 <option value="<=">&lt;=
147 <option value="=~">=~
148 <option value="!~">!~
149
150 </select>
151 </td>
152 EOM;
153
154                 print <<<EOM
155 <td>
156 <input type=text name="$name" value="$val" size=35>
157 </td>
158 </tr>
159 EOM;
160         }
161 ?>
162         </table>
163 <br>
164 <input type=submit class=button value="Create" OnClick="this.form.create.value=1">
165 <br><br>
166 <input type=submit class=button value="Show Group" OnClick="this.form.show.value=1">
167 </form>
168         </td></tr>
169 </table>
170 </tr>
171 </table>
172 </body>
173 </html>