Changeset 477
- Timestamp:
- 10/04/07 17:16:55 (4 years ago)
- Location:
- trunk/openmct/packages/system/owi/src
- Files:
-
- 8 modified
-
group.c (modified) (15 diffs)
-
includes/language.h (modified) (3 diffs)
-
includes/modules.h (modified) (2 diffs)
-
includes/sysinfo.h (modified) (1 diff)
-
includes/user.h (modified) (1 diff)
-
owi.c (modified) (3 diffs)
-
sysinfo.c (modified) (2 diffs)
-
user.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/openmct/packages/system/owi/src/group.c
r465 r477 89 89 90 90 /* Start form / external table / scroll area / internal table*/ 91 printf("<form action=\"%s\" method=\"post\">\n" 91 printf("<h3>%s</h3>\n" 92 "<form action=\"%s\" method=\"post\">\n" 92 93 "<input type=\"hidden\" name=\"module\" value=\"%s\" />\n" 93 94 "<input type=\"hidden\" name=\"command\" value=\"\" />\n" 94 "<table class=\" %s\">\n"95 "<table class=\"outside\">\n" 95 96 "<tr>\n" 96 97 "<td>\n" 97 "<h1>%s</h1>\n" 98 "<br />%s<br /><br />\n" 99 "<table width=\"100%%\">\n" 100 "<tr>\n" 101 "<td align=\"right\">" 102 "<div class=\"searchbar\">\n" 103 "<input class=\"searchbox\" type=\"text\" name=\"search\" value=\"%s\" /><a href=\"#\" onclick=\"javascript:document.forms[0].reset()\" class=\"searchreset\" title=\"Löschen\"><img src=\"images/reset.gif\" id=\"searchreset\" border=\"0\" alt=\"\" /></a>\n" 104 "</div>\n" 105 "</td>\n" 106 "</tr>\n" 107 "</table>\n" 108 "<table class=\"%s\" cellpadding=\"0\" cellspacing=\"0\">\n" 98 "<table class=\"list\">\n" 109 99 "<thead>\n" 110 100 "<tr>\n" … … 112 102 "<th>%s</th>\n" 113 103 "<th>%s</th>\n" 114 "<th>%s</th>\n"115 104 "</tr>\n" 116 105 "</thead>\n" 117 106 "<tbody>", 107 GROUP_HEADLINE, 118 108 getenv("SCRIPT_NAME"), 119 109 variable_get("module"), 120 CONTENT_TABLE_CLASS,121 GROUP_HEADLINE,122 GROUP_DESCRIPTION,123 variable_get("search"),124 CONTENT_TABLE_LIST_CLASS,125 110 GROUP_TABLE_DESCRIPTION, 126 GROUP_TABLE_GID,127 111 GROUP_TABLE_MEMBERS, 128 112 GROUP_TABLE_ACTION); … … 136 120 strstr(argument_get_part(group, 1), search)))) { 137 121 /* Print entry */ 138 printf("<tr onmouseover=\"this.style.backgroundColor='%s';\"" 139 " onmouseout=\"this.style.backgroundColor='%s';\">\n" 140 "<td>%s</td>\n" 141 "<td>%s</td>\n" 142 "<td>%s</td>\n" 143 "<td><input type=\"button\" onClick=\"location='%s?module=%s&command=detail&id=%s'\" value=\"%s\" /> <input type=\"button\" onClick=\"location='%s?command=delete&id=%s'\" value=\"%s\" /></td>\n" 122 printf("<tr onmouseover=\"this.className='mover';\"" 123 " onmouseout=\"this.className='mout';\">\n" 124 "<td width=\"200\">%s</td>\n" 125 "<td width=\"212\">%s</td>\n" 126 "<td width=\"100\"><input type=\"button\" onClick=\"location='%s?module=%s&command=detail&id=%s'\" value=\"%s\" /> <input type=\"button\" onClick=\"location='%s?module=%s&command=delete&id=%s'\" value=\"%s\" /></td>\n" 144 127 "</tr>\n", 145 CONTENT_TABLE_CLASS_MOUSEOVER, 146 CONTENT_TABLE_CLASS_MOUSEOUT, 147 argument_get_part(group, 0), 148 argument_get_part(group, 2), 128 argument_get_part(group, 0), 149 129 argument_get_part(group, 3), 150 130 getenv("SCRIPT_NAME"), … … 153 133 GROUP_BUTTON_MODIFY, 154 134 getenv("SCRIPT_NAME"), 135 variable_get("module"), 155 136 argument_get_part(group, 0), 156 137 GROUP_BUTTON_DELETE); … … 167 148 "<tr>\n" 168 149 "<td colspan=\"7\" align=\"right\">\n" 169 "< a class=\"%s\" href=\"#\" onClick=\"location='%s?module=%s&command=new'\"><div class=\"%s\">%s</div></a>\n"150 "<input type=\"button\" onClick=\"location='%s?module=%s&command=new'\" value=\"%s\" />\n" 170 151 "</td>\n" 171 152 "</tr>\n" … … 175 156 "</table>\n" 176 157 "</form>\n", 177 CONTENT_LINK_AQUA_CLASS,178 158 getenv("SCRIPT_NAME"), 179 159 variable_get("module"), 180 CONTENT_BUTTON_AQUA_CLASS,181 160 GROUP_BUTTON_NEW); 182 161 } … … 192 171 193 172 /* Print external table for design */ 194 printf("<table class=\"%s\">\n" 195 "<tr>\n" 196 "<td>\n" 197 "<h1>%s</h1>\n" 198 "<br />%s<br /><br />\n", 199 CONTENT_TABLE_CLASS, 200 GROUP_HEADLINE, 201 GROUP_DETAIL); 173 printf("<h3>%s</h3>\n", 174 GROUP_HEADLINE); 202 175 203 176 /* Loop through passwd database */ … … 211 184 "<input type=\"hidden\" name=\"command\" value=\"update\">\n" 212 185 "<input type=\"hidden\" name=\"id\" value=\"%s\">\n" 213 "<table class=\" %s\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%%\">\n"186 "<table class=\"detail\">\n" 214 187 "<tr>\n" 215 188 "<td>%s</td>\n" 216 189 "<td>%s</td>\n" 217 "</tr>\n"218 "<tr>\n"219 "<td>%s</td>\n"220 "<td><input type=\"group_password\" /></td>\n"221 "</tr>\n"222 "<tr>\n"223 "<td>%s</td>\n"224 "<td>%s</td>\n"225 "</tr>\n"226 190 "<tr>\n" 227 191 "<td>%s</td>\n" … … 232 196 "<tr>\n" 233 197 "<td colspan=\"2\" align=\"right\">\n" 234 "< a class=\"%s\" href=\"#\" onClick=\"javascript:document.forms[0].submit()\"><div class=\"%s\">%s</div></a>\n"198 "<input type=\"button\" onClick=\"javascript:document.forms[0].submit()\" value=\"%s\" />\n" 235 199 "</td>\n" 236 200 "</table>\n" … … 240 204 variable_get("module"), 241 205 argument_get_part(group, 0), 242 CONTENT_TABLE_BOX_CLASS,243 206 GROUP_TABLE_DESCRIPTION, 244 207 argument_get_part(group, 0), 245 GROUP_TABLE_NEW_PASSWORD,246 GROUP_TABLE_GID,247 argument_get_part(group, 2),248 208 GROUP_TABLE_MEMBERS, 249 209 argument_get_part(group, 3), 250 CONTENT_LINK_AQUA_CLASS,251 CONTENT_BUTTON_AQUA_CLASS,252 210 GROUP_BUTTON_UPDATE); 253 211 … … 265 223 if (!group_found) { 266 224 /* Print information screen */ 267 owi_headline(2, "Group not found");225 owi_headline(2, GROUP_NOT_FOUND); 268 226 } 269 227 … … 304 262 file_save(GROUP_FILE); 305 263 306 /* Display group */307 group_ detail(groupname);264 /* Display group list */ 265 group_list(); 308 266 } 309 267 … … 332 290 file_save(GROUP_FILE); 333 291 334 /* Display user*/292 /* Display group list */ 335 293 group_list(); 336 294 } … … 394 352 void group_new() { 395 353 /* Print external table for design */ 396 printf("<table class=\"%s\">\n" 354 printf("<h3>%s</h3>\n" 355 "<table class=\"outside\">\n" 397 356 "<tr>\n" 398 357 "<td>\n" 399 "<h1>%s</h1>"400 "<br />%s<br /><br />\n"401 358 "<form action=\"%s\" method=\"post\">\n" 402 359 "<input type=\"hidden\" name=\"module\" value=\"%s\" />\n" 403 360 "<input type=\"hidden\" name=\"command\" value=\"add\" />\n" 404 "<table class=\"%s\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%%\">\n" 405 "<tr>\n" 406 "<td width=\"250\">%s</td>\n" 407 "<td><input type=\"text\" name=\"id\" /></td>\n" 408 "</tr>\n" 409 "<tr>\n" 410 "<td>%s</td>\n" 411 "<td><input type=\"password\" /></td>\n" 412 "</tr>\n" 413 "<tr>\n" 414 "<td>%s</td>\n" 415 "<td><input type=\"text\" name=\"members\" /></td>\n" 416 "</tr>\n" 417 "</table>\n" 418 "<table width=\"100%%\">\n" 419 "<tr>\n" 420 "<td colspan=\"2\" align=\"right\">\n" 421 "<a class=\"%s\" href=\"#\" onClick=\"javascript:document.forms[0].submit()\"><div class=\"%s\">%s</div></a>\n" 361 "<table class=\"detail\">\n" 362 "<tr>\n" 363 "<td class=\"description\">%s</td>\n" 364 "<td class=\"value\"><input type=\"text\" name=\"id\" /></td>\n" 365 "</tr>\n" 366 "<tr>\n" 367 "<td class=\"description\">%s</td>\n" 368 "<td class=\"value\"><input type=\"text\" name=\"members\" /></td>\n" 369 "</tr>\n" 370 "<tr>\n" 371 "<td></td>\n" 372 "<td>\n" 373 "<input type=\"button\" onClick=\"javascript:document.forms[0].submit()\" value=\"%s\" />\n" 422 374 "</td>\n" 423 375 "</table>\n" … … 426 378 "</tr>\n" 427 379 "</table>\n", 428 CONTENT_TABLE_CLASS,429 380 GROUP_HEADLINE, 430 GROUP_NEW,431 381 getenv("SCRIPT_NAME"), 432 382 variable_get("module"), 433 CONTENT_TABLE_BOX_CLASS,434 383 GROUP_TABLE_DESCRIPTION, 435 GROUP_TABLE_NEW_PASSWORD,436 384 GROUP_TABLE_MEMBERS, 437 CONTENT_LINK_AQUA_CLASS,438 CONTENT_BUTTON_AQUA_CLASS,439 385 GROUP_BUTTON_ADD); 440 386 } -
trunk/openmct/packages/system/owi/src/includes/language.h
r468 r477 3 3 /* user */ 4 4 5 #define USER_TABLE_DESCRIPTION "Kennung" 6 #define USER_TABLE_NEW_PASSWORD "Neues Passwort" 7 #define USER_TABLE_UID "User ID" 8 #define USER_TABLE_GID "Gruppen ID" 9 #define USER_TABLE_GECOS "Bemerkung" 10 #define USER_TABLE_DIRECTORY "Heimatverzeichnis" 11 #define USER_TABLE_SHELL "Loginprogramm" 12 #define USER_TABLE_ACTION "Aktion" 13 #define USER_HEADLINE "Benutzerverwaltung" 14 #define USER_DESCRIPTION "Die nachfolgende Liste führt Ihre System Kennungen an. Hier können Sie alle Kennungen (auch das Administrator Konto) einsehen und Änderungen durchführen. Für mehr Informationen zu einer Kennung verwenden Sie bitte den <i>Bearbeiten</i> Button in der entsprechenden Zeile." 15 #define USER_DETAIL "Sie befinden Sich nun im Detailbereich für eine Kennung. Hier können Sie sowohl das Kennwort als auch das Heimatverzeichnis sowies diverse andere Einstellungen (Beschreibung, Loginprogramm) aktualisieren. Die Einstellungen werden mit dem Betätigen des <i>Speichern</i> Buttons sofort übernommen." 16 #define USER_NEW "In diesem Bereich können Sie eine neue System Kennung erstellen. Bitte geben Sie dazu alle Felder an um sicherzustellen, dass die Kennung dann ordnungsgemäß funktioniert. Sobald alle Daten eingegeben worden sind kann die Aktion mit dem Klicken auf den <i>Neu</i> Button abgeschlossen werden." 17 #define USER_FILE_FAILED "Benutzerdatenbank konnte nicht geöffnet werden" 18 #define USER_NOT_FOUND "Kennung konnte nicht gefunden werden" 19 #define USER_BUTTON_NEW "Neu" 20 #define USER_BUTTON_DELETE "Entfernen" 21 #define USER_BUTTON_MODIFY "Bearbeiten" 22 #define USER_BUTTON_UPDATE "Speichern" 23 #define USER_BUTTON_ADD "Anlegen" 24 #define USER_NAV_DESCRIPTION "Kennung" 5 #define USER_TABLE_DESCRIPTION "Login" 6 #define USER_TABLE_NEW_PASSWORD "Password" 7 #define USER_TABLE_GECOS "Full Name" 8 #define USER_TABLE_ACTION "Action" 9 #define USER_HEADLINE "Access: Users" 10 #define USER_FILE_FAILED "Can't open user database" 11 #define USER_NOT_FOUND "Can't find user" 12 #define USER_BUTTON_NEW "New" 13 #define USER_BUTTON_DELETE "Delete" 14 #define USER_BUTTON_MODIFY "Edit" 15 #define USER_BUTTON_UPDATE "Save" 16 #define USER_BUTTON_ADD "Add" 17 #define USER_NAV_DESCRIPTION "User" 18 #define USER_LOGIN_DESCRIPTION "Unique login name of user." 19 #define USER_GECOS_DESCRIPTION "User full name." 20 #define USER_PASSWORD_DESCRIPTION "User password." 21 #define USER_ALREADY_EXISTS "User already exists" 22 #define USER_TABLE_SHELL "Full Shell" 23 #define USER_SHELL_DESCRIPTION "Give full shell to user" 25 24 26 25 /* group */ 27 26 28 #define GROUP_TABLE_DESCRIPTION "Gruppe" 29 #define GROUP_TABLE_NEW_PASSWORD "Neues Passwort" 30 #define GROUP_TABLE_GID "Gruppen ID" 31 #define GROUP_TABLE_MEMBERS "Mitglieder" 32 #define GROUP_TABLE_ACTION "Aktion" 33 #define GROUP_BUTTON_DELETE "Entfernen" 34 #define GROUP_BUTTON_NEW "Neu" 35 #define GROUP_BUTTON_MODIFY "Bearbeiten" 36 #define GROUP_BUTTON_ADD "Anlegen" 37 #define GROUP_BUTTON_UPDATE "Speichern" 38 #define GROUP_HEADLINE "Gruppenverwaltung" 39 #define GROUP_FILE_FAILED "Gruppendatenbank konnte nicht geöffnet werden" 40 #define GROUP_DESCRIPTION "Die nachfolgende Liste führt Ihre System Gruppen an. Hier können Sie alle Gruppen einsehen und Änderungen durchführen. Für mehr Informationen zu einer Gruppe verwenden Sie bitte den <i>Bearbeiten</i> Button in der entsprechenden Zeile." 41 #define GROUP_DETAIL "Sie befinden Sich nun im Detailbereich für eine Gruppe. Hier können Sie sowohl das Kennwort als auch die Mitglieder dieser Gruppe anpassen. Die Einstellungen werden mit dem Betätigen des <i>Speichern</i> Buttons sofort übernommen." 42 #define GROUP_NEW "In diesem Bereich können Sie eine neue System Gruppe erstellen. Bitte geben Sie dazu alle Felder an um sicherzustellen, dass die Gruppe dann ordnungsgemäß funktioniert. Sobald alle Daten eingegeben worden sind kann die Aktion mit dem Klicken auf den <i>Neu</i> Button abgeschlossen werden." 43 #define GROUP_NAV_DESCRIPTION "Gruppe" 27 #define GROUP_TABLE_DESCRIPTION "Group" 28 #define GROUP_TABLE_MEMBERS "Members" 29 #define GROUP_TABLE_ACTION "Action" 30 #define GROUP_BUTTON_DELETE "Delete" 31 #define GROUP_BUTTON_NEW "New" 32 #define GROUP_BUTTON_MODIFY "Edit" 33 #define GROUP_BUTTON_ADD "Add" 34 #define GROUP_BUTTON_UPDATE "Save" 35 #define GROUP_HEADLINE "Access: Groups" 36 #define GROUP_NAV_DESCRIPTION "Group" 37 #define GROUP_FILE_FAILED "Can't open group database" 38 #define GROUP_NOT_FOUND "Can't find group" 44 39 45 40 /* sysinfo */ … … 48 43 #define SYSINFO_NAV_SYSTEM "System" 49 44 #define SYSINFO_NAV_DESCRIPTION "DESC" 45 #define SYSINFO_PROCESS_HEADLINE "Status: Processes" 46 #define SYSTEM_NAV_DESCRIPTION "System" 47 #define STATUS_NAV_DESCRIPTION "Status" 48 #define PROCESS_NAV_DESCRIPTION "Process" 50 49 51 50 /* nfs */ … … 121 120 #define INTERFACE_NAV_DESCRIPTION "Netzwerk" 122 121 122 #define ACCESS_NAV_DESCRIPTION "System" 123 123 124 #endif -
trunk/openmct/packages/system/owi/src/includes/modules.h
r468 r477 16 16 int level; 17 17 } modules[] = { 18 /* 18 19 { "system", NULL, SYSINFO_NAV_SYSTEM, 0 }, 19 20 { "sysinfo", sysinfo_main, SYSINFO_NAV_DESCRIPTION, 1}, … … 25 26 #ifdef SECURITY 26 27 { "shell", shell_main, SHELL_NAV_DESCRIPTION, 1 }, 27 #endif 28 #endif */ 29 { "access", NULL, ACCESS_NAV_DESCRIPTION, 0 }, 30 { "user", user_main, USER_NAV_DESCRIPTION, 1 }, 31 { "group", group_main, GROUP_NAV_DESCRIPTION, 1 }, 32 { "status", NULL, STATUS_NAV_DESCRIPTION, 0 }, 33 { "system", sysinfo_main, SYSTEM_NAV_DESCRIPTION, 1 }, 34 { "system&command=process", sysinfo_main, PROCESS_NAV_DESCRIPTION, 1 }, 28 35 { NULL, NULL, NULL, 0 } 29 36 }; -
trunk/openmct/packages/system/owi/src/includes/sysinfo.h
r419 r477 1 1 int sysinfo_main(int argc, char **); 2 2 void sysinfo_list(); 3 void sysinfo_process(); 3 4 void sysinfo_general(); 4 5 void sysinfo_filesystems(); -
trunk/openmct/packages/system/owi/src/includes/user.h
r423 r477 1 1 #define USER_FILE "/etc/passwd" 2 3 #define USER_SHELL_FALSE "/bin/false" 4 #define USER_SHELL_DEFAULT "/bin/sh" 2 5 3 6 int user_main(int argc, char **arv); -
trunk/openmct/packages/system/owi/src/owi.c
r468 r477 34 34 /* Loop counter */ 35 35 int i = 0; 36 int j = 0; 36 37 37 38 printf("Content-Type: text/html\n\n"); … … 58 59 for (i = 0; modules[i].description != NULL; i++) { 59 60 printf("<tr><td>\n"); 61 for (j = 0; j < modules[i].level * 5; j++) { 62 printf(" "); 63 } 60 64 if (modules[i].main) { 61 65 printf("<a href=\"%s?module=%s\">%s</a>\n", … … 102 106 103 107 if (!strcmp(module, "")) { 104 variable_set("module", " sysinfo");108 variable_set("module", "user"); 105 109 module = variable_get("module"); 106 110 } -
trunk/openmct/packages/system/owi/src/sysinfo.c
r468 r477 58 58 /* Just print user list */ 59 59 sysinfo_list(); 60 } else if (!strcmp(command, "process")) { 61 sysinfo_process(); 60 62 } 61 63 … … 134 136 "0"); 135 137 } 138 139 /* \fn sysinfo_process() 140 * Show process 141 */ 142 void sysinfo_process() { 143 int i = 0; 144 145 printf("<h3>%s</h3>\n" 146 "<table class=\"box\">\n" 147 "<tr>\n" 148 "<td>\n" 149 "<pre>\n", 150 SYSINFO_PROCESS_HEADLINE); 151 152 /* Execute command now */ 153 proc_open("/bin/ps"); 154 /* Loop through results */ 155 for (i = 0; i < file_line_counter; i++) { 156 printf("%s\n", file_line_get(i)); 157 } 158 file_free(); 159 160 printf("</pre>\n" 161 "</td>\n" 162 "</tr>\n" 163 "</table>\n"); 164 165 166 167 } -
trunk/openmct/packages/system/owi/src/user.c
r468 r477 89 89 90 90 /* Start form / external table / scroll area / internal table*/ 91 printf("<form action=\"%s\" method=\"post\">\n" 91 printf("<h3>%s</h3>\n" 92 "<form action=\"%s\" method=\"post\">\n" 92 93 "<input type=\"hidden\" name=\"module\" value=\"%s\" />\n" 93 94 "<input type=\"hidden\" name=\"command\" value=\"\" />\n" 94 "<table class=\"%s\">\n"95 "<tr>\n"95 "<table class=\"outside\">\n" 96 "<tr>\n" 96 97 "<td>\n" 97 "<h1>%s</h1>\n" 98 "<br />%s<br /><br />\n" 99 "<table width=\"100%%\">\n" 100 "<tr>\n" 101 "<td align=\"right\">" 102 "<div class=\"searchbar\">\n" 103 "<input class=\"searchbox\" type=\"text\" name=\"search\" value=\"%s\" /><a href=\"#\" onclick=\"javascript:document.forms[0].reset()\" class=\"searchreset\" title=\"Löschen\"><img src=\"images/reset.gif\" id=\"searchreset\" border=\"0\" alt=\"\" /></a>\n" 104 "</div>\n" 105 "</td>\n" 106 "</tr>\n" 107 "</table>\n" 108 "<table class=\"%s\" cellpadding=\"0\" cellspacing=\"0\">\n" 98 "<table class=\"list\">\n" 109 99 "<thead>\n" 110 100 "<tr>\n" 111 101 "<th>%s</th>\n" 112 102 "<th>%s</th>\n" 103 "<th>%s</th>\n" 113 104 "</tr>\n" 114 105 "</thead>\n" 115 106 "<tbody>", 107 USER_HEADLINE, 116 108 getenv("SCRIPT_NAME"), 117 109 variable_get("module"), 118 CONTENT_TABLE_CLASS,119 USER_HEADLINE,120 USER_DESCRIPTION,121 variable_get("search"),122 CONTENT_TABLE_LIST_CLASS,123 110 USER_TABLE_DESCRIPTION, 111 USER_TABLE_GECOS, 124 112 USER_TABLE_ACTION); 125 113 … … 138 126 strstr(argument_get_part(passwd, 5), search)))) { 139 127 /* Print entry */ 140 printf("<tr onmouseover=\"this.className='%s';\"" 141 " onmouseout=\"this.className='%s';\">\n" 142 "<td width=\"80\">%s</td>\n" 143 "<td width=\"160\">" 144 "<input type=\"button\" onClick=\"location='%s?module=%s&command=detail&id=%s'\" value=\"%s\" /> " 145 "<input type=\"button\" onClick=\"location='%s?module=%s&command=delete&id=%s'\" value=\"%s\" />" 128 printf("<tr onmouseover=\"this.className='mover';\"" 129 " onmouseout=\"this.className='mout';\">\n" 130 "<td width=\"200\">%s</td>\n" 131 "<td width=\"212\">%s</td>\n" 132 "<td width=\"100\">" 133 "<input type=\"button\" onClick=\"location='%s?module=%s&command=detail&id=%s'\" value=\"%s\" /> " 134 "<input type=\"button\" onClick=\"location='%s?module=%s&command=delete&id=%s'\" value=\"%s\" />" 146 135 "</td>\n" 147 136 "</tr>\n", 148 CONTENT_TABLE_CLASS_MOUSEOVER,149 CONTENT_TABLE_CLASS_MOUSEOUT,150 137 argument_get_part(passwd, 0), 138 argument_get_part(passwd, 4), 151 139 getenv("SCRIPT_NAME"), 152 140 variable_get("module"), … … 169 157 "<tr>\n" 170 158 "<td colspan=\"7\" align=\"right\">\n" 171 "< a class=\"%s\" href=\"#\" onClick=\"location='%s?module=%s&command=new'\"><div class=\"%s\">%s</div></a>\n"159 "<input type=\"button\" onClick=\"location='%s?module=%s&command=new'\" value=\"%s\" />\n" 172 160 "</td>\n" 173 161 "</tr>\n" 174 162 "</table>\n" 175 "</td>\n"176 "</tr>\n"163 "</td>\n" 164 "</tr>\n" 177 165 "</table>\n" 178 166 "</form>\n", 179 CONTENT_LINK_AQUA_CLASS,180 167 getenv("SCRIPT_NAME"), 181 168 variable_get("module"), 182 CONTENT_BUTTON_AQUA_CLASS,183 169 USER_BUTTON_NEW); 184 170 } … … 195 181 196 182 /* Print external table for design */ 197 printf("<table class=\"%s\">\n" 198 "<tr>\n" 199 "<td>\n" 200 "<h1>%s</h1>\n" 201 "<br />%s<br /><br />\n", 202 CONTENT_TABLE_CLASS, 203 USER_HEADLINE, 204 USER_DETAIL); 183 printf("<h3>%s</h3>\n" 184 "<table class=\"outside\">\n" 185 "<tr>\n" 186 "<td>\n", 187 USER_HEADLINE); 205 188 206 189 /* Loop through all user entries in /etc/passwd */ … … 214 197 "<input type=\"hidden\" name=\"command\" value=\"update\" />\n" 215 198 "<input type=\"hidden\" name=\"id\" value=\"%s\" />\n" 216 "<table class=\" %s\" width=\"100%%\">\n"199 "<table class=\"detail\">\n" 217 200 "<tr>\n" 218 "<td width=\"2 50\">%s</td>\n"219 "<td >%s</td>\n"201 "<td width=\"200\" class=\"description\">%s</td>\n" 202 "<td width=\"312\" class=\"value\">%s</td>\n" 220 203 "</tr>\n" 221 204 "<tr>\n" 222 "<td >%s</td>\n"223 "<td ><input type=\"password\" /></td>\n"205 "<td class=\"description\">%s</td>\n" 206 "<td class=\"value\"><input type=\"password\" name=\"password\" /><br />%s</td>\n" 224 207 "</tr>\n" 225 208 "<tr>\n" 226 "<td >%s</td>\n"227 "<td >%s</td>\n"209 "<td class=\"description\">%s</td>\n" 210 "<td class=\"value\"><input type=\"text\" name=\"gecos\" value=\"%s\" /><br />%s</td>\n" 228 211 "</tr>\n" 229 212 "<tr>\n" 230 "<td >%s</td>\n"231 "<td >%s</td>\n"213 "<td class=\"description\">%s</td>\n" 214 "<td class=\"value\"><input type=\"checkbox\" name=\"shell\" value=\"y\" %s /><br />%s</td>\n" 232 215 "</tr>\n" 233 216 "<tr>\n" 234 "<td>%s</td>\n" 235 "<td><input type=\"text\" name=\"gecos\" value=\"%s\" /></td>\n" 236 "</tr>\n" 237 "<tr>\n" 238 "<td>%s</td>\n" 239 "<td><input type=\"text\" name=\"directory\" value=\"%s\" /></td>\n" 240 "</tr>\n" 241 "<tr>\n" 242 "<td>%s</td>\n" 243 "<td><input type=\"text\" name=\"shell\" value=\"%s\" /></td>\n" 244 "</tr>\n" 245 "</table>\n" 246 "<table width=\"100%%\">\n" 247 "<tr>\n" 248 "<td colspan=\"2\" align=\"right\">\n" 249 "<a href=\"#\" onClick=\"javascript:document.forms[0].submit()\" class=\"%s\"><div class=\"%s\">%s</div></a>\n" 217 "<td></td>\n" 218 "<td>\n" 219 "<input type=\"button\" onClick=\"javascript:document.forms[0].submit()\" value=\"%s\" />\n" 250 220 "</td>\n" 251 221 "</tr>\n" … … 256 226 variable_get("module"), 257 227 argument_get_part(passwd, 0), 258 CONTENT_TABLE_BOX_CLASS,259 228 USER_TABLE_DESCRIPTION, 260 229 argument_get_part(passwd, 0), 261 230 USER_TABLE_NEW_PASSWORD, 262 USER_TABLE_UID, 263 argument_get_part(passwd, 2), 264 USER_TABLE_GID, 265 argument_get_part(passwd, 3), 231 USER_PASSWORD_DESCRIPTION, 266 232 USER_TABLE_GECOS, 267 233 argument_get_part(passwd, 4), 268 USER_TABLE_DIRECTORY, 269 argument_get_part(passwd, 5), 234 USER_GECOS_DESCRIPTION, 270 235 USER_TABLE_SHELL, 271 argument_get_part(passwd, 6), 272 CONTENT_LINK_AQUA_CLASS, 273 CONTENT_BUTTON_AQUA_CLASS, 236 strcmp(argument_get_part(passwd, 6), USER_SHELL_FALSE) == 0 ? "" : "checked", 237 USER_SHELL_DESCRIPTION, 274 238 USER_BUTTON_UPDATE); 275 239 … … 290 254 } 291 255 292 /* Close external table */293 256 printf("</td>\n" 294 257 "</tr>\n" … … 317 280 argument_get_part(passwd, 2), 318 281 argument_get_part(passwd, 3), 319 variable_ltrim(variable_filter(variable_get("gecos"), ":")),320 variable_ltrim(variable_filter(variable_get("directory"), ":")),321 variable_ltrim(variable_filter(variable_get("shell"), ":")));282 variable_get("gecos"), 283 argument_get_part(passwd, 5), 284 argument_get_part(passwd, 6)); 322 285 } 323 286 /* Free passwd entry */ … … 328 291 file_save(USER_FILE); 329 292 330 /* Display user */331 user_ detail(username);293 /* Display user list */ 294 user_list(); 332 295 } 333 296 … … 372 335 /* Add new passwd line in memory */ 373 336 file_line_action(FILE_LINE_ADD, i, 374 "%s:%s:%d:%d:%s: %s:%s",337 "%s:%s:%d:%d:%s:/home/%s:%s", 375 338 variable_ltrim(variable_filter(username, ":")), 376 339 crypt(variable_get("password"), "OM"), … … 378 341 start_uid, 379 342 variable_ltrim(variable_filter(variable_get("gecos"), ":")), 380 variable_ltrim(variable_filter(variable_get("directory"), ":")),381 variable_ltrim(variable_filter(variable_get("shell"), ":")));343 variable_ltrim(variable_filter(username, ":")), 344 strcmp(variable_get("shell"), "y") == 0 ? USER_SHELL_DEFAULT : USER_SHELL_FALSE); 382 345 /* Save result in user file */ 383 346 file_save(USER_FILE); 384 } 385 386 /* Display new user*/ 387 user_detail(username); 347 /* Display user list */ 348 user_list(); 349 } else { 350 variable_set("error", USER_ALREADY_EXISTS); 351 /* Display user add page with error */ 352 user_new(); 353 } 388 354 } 389 355 … … 412 378 file_save(USER_FILE); 413 379 414 /* Display user */380 /* Display user list */ 415 381 user_list(); 416 382 } … … 421 387 void user_new() { 422 388 /* Print external table for design */ 423 printf("<table class=\"%s\">\n" 424 "<tr>\n" 425 "<td>\n" 426 "<h1>%s</h1>" 427 "<br />%s<br /><br />\n" 428 "<form action=\"%s\" method=\"post\">\n" 389 printf("<h3>%s</h3>", 390 USER_HEADLINE); 391 392 if (strcmp(variable_get("error"), "")) { 393 printf("<div class=\"error\">%s</div>\n", 394 variable_get("error")); 395 } 396 397 printf("<form action=\"%s\" method=\"post\">\n" 429 398 "<input type=\"hidden\" name=\"module\" value=\"%s\" />\n" 430 399 "<input type=\"hidden\" name=\"command\" value=\"add\" />\n" 431 "<table class=\"%s\" width=\"100%%\">\n" 432 "<tr>\n" 433 "<td width=\"250\">%s</td>\n" 434 "<td><input type=\"text\" name=\"id\" /></td>\n" 435 "</tr>\n" 436 "<tr>\n" 437 "<td>%s</td>\n" 438 "<td><input type=\"password\" /></td>\n" 439 "</tr>\n" 440 "<tr>\n" 441 "<td>%s</td>\n" 442 "<td><input type=\"text\" name=\"gecos\" /></td>\n" 443 "</tr>\n" 444 "<tr>\n" 445 "<td>%s</td>\n" 446 "<td><input type=\"text\" name=\"directory\" /></td>\n" 447 "</tr>\n" 448 "<tr>\n" 449 "<td>%s</td>\n" 450 "<td><input type=\"text\" name=\"shell\" /></td>\n" 451 "</tr>\n" 452 "</table>\n" 453 "<table width=\"100%%\">\n" 454 "<tr>\n" 455 "<td colspan=\"2\" align=\"right\">\n" 456 "<a href=\"#\" onClick=\"javascript:document.forms[0].submit()\" class=\"%s\"><div class=\"%s\">%s</div></a>\n" 400 "<table class=\"outside\">\n" 401 "<tr>\n" 402 "<td>\n" 403 "<table class=\"detail\">\n" 404 "<tr>\n" 405 "<td class=\"description\">%s</td>\n" 406 "<td class=\"value\"><input type=\"text\" name=\"id\" value=\"%s\" /><br />%s</td>\n" 407 "</tr>\n" 408 "<tr>\n" 409 "<td class=\"description\">%s</td>\n" 410 "<td class=\"value\"><input type=\"password\" name=\"password\" value=\"%s\" /><br />%s</td>\n" 411 "</tr>\n" 412 "<tr>\n" 413 "<td class=\"description\">%s</td>\n" 414 "<td class=\"value\"><input type=\"text\" name=\"gecos\" value=\"%s\" /><br />%s</td>\n" 415 "</tr>\n" 416 "<tr>\n" 417 "<td class=\"description\">%s</td>\n" 418 "<td class=\"value\"><input type=\"checkbox\" name=\"shell\" value=\"y\" %s /><br />%s</td>\n" 419 "</tr>\n" 420 "<tr>\n" 421 "<td></td>\n" 422 "<td>\n" 423 "<input type=\"button\" onClick=\"javascript:document.forms[0].submit()\" value=\"%s\" />\n" 457 424 "</td>\n" 458 425 "</tr>\n" 459 426 "</table>\n" 460 "</form>\n" 461 "</td>\n" 462 "</tr>\n" 463 "</table>\n", 464 CONTENT_TABLE_CLASS, 465 USER_HEADLINE, 466 USER_NEW, 427 "</form>\n", 467 428 getenv("SCRIPT_NAME"), 468 429 variable_get("module"), 469 CONTENT_TABLE_BOX_CLASS,470 430 USER_TABLE_DESCRIPTION, 431 variable_get("id"), 432 USER_LOGIN_DESCRIPTION, 471 433 USER_TABLE_NEW_PASSWORD, 434 variable_get("password"), 435 USER_PASSWORD_DESCRIPTION, 472 436 USER_TABLE_GECOS, 473 USER_TABLE_DIRECTORY, 474 USER_TABLE_SHELL, 475 CONTENT_LINK_AQUA_CLASS, 476 CONTENT_BUTTON_AQUA_CLASS, 437 variable_get("gecos"), 438 USER_GECOS_DESCRIPTION, 439 USER_TABLE_SHELL, 440 strcmp(variable_get("shell"), "y") == 0 ? "checked" : "", 441 USER_SHELL_DESCRIPTION, 477 442 USER_BUTTON_ADD); 478 443 }
