Started converting the groups programs over to templates

This commit is contained in:
jengo 2000-08-20 04:11:43 +00:00
parent d18a59685c
commit f46021313e
4 changed files with 58 additions and 59 deletions

View File

@ -56,7 +56,7 @@
$t->set_var("lang_app_name",lang_admin("application name"));
$t->set_var("lang_app_title",lang_admin("application title"));
$t->set_var("lang_enabled",lang_admin("enabled"));
$t->set_var("lang_add",lang_common("add"));
$t->set_var("lang_submit_button",lang_common("edit"));
$t->set_var("app_name_value",$phpgw->db->f("app_name"));
$t->set_var("app_title_value",$phpgw->db->f("app_title"));

View File

@ -44,6 +44,12 @@
case "installed applications":
$s = "Installed applications"; break;
case "select permissions this group will have":
$s = "Select permissions this group will have"; break;
case "sorry, that group name has already been taking.":
$s = "Sorry, that group name has already been taking."; break;
case "add new application":
$s = "Add new application"; break;

View File

@ -52,7 +52,7 @@
$t->set_var("lang_app_name",lang_admin("application name"));
$t->set_var("lang_app_title",lang_admin("application title"));
$t->set_var("lang_enabled",lang_admin("enabled"));
$t->set_var("lang_add",lang_common("add"));
$t->set_var("lang_submit_button",lang_common("add"));
$t->set_var("app_name_value","");
$t->set_var("app_title_value","");

View File

@ -18,16 +18,19 @@
$phpgw_flags["currentapp"] = "admin";
include("../header.inc.php");
$t = new Template($phpgw_info["server"]["template_dir"]);
$t->set_file(array("form" => "groups_form.tpl"));
if ($submit) {
$phpgw->db->query("select count(*) from groups where group_name='" . $n_group . "'");
$phpgw->db->next_record();
if ($phpgw->db->f(0) != 0) {
$error = "<p><center>" . lang_admin("Sorry, that group name has already been taking.") . "</center>";
$error = lang_admin("Sorry, that group name has already been taking.");
}
if (! $error) {
//$phpgw->db->lock(array("accounts","groups"));
$phpgw->db->lock(array("accounts","groups"));
$phpgw->db->query("INSERT INTO groups (group_name,group_apps) VALUES "
. "('$n_group','"
@ -55,7 +58,7 @@
if (! mkdir ($basedir . $n_group, 0707)) $cd = 37;
//$phpgw->db->unlock();
$phpgw->db->unlock();
Header("Location: " . $phpgw->link("groups.php","cd=$cd"));
exit;
@ -65,28 +68,26 @@
if ($error) {
$phpgw->common->header();
$phpgw->common->navbar();
echo "<p><center>$error</center>";
$t->set_var("error","<p><center>$error</center>");
} else {
$t->set_var("error","");
}
?>
<center>
<table border="0" width="50%">
<form action="newgroup.php">
<?php
echo $phpgw->session->hidden_var() . "<tr><td>" . lang_admin("New group name")
. '</td> <td><input name="n_group" value="' . $n_group . '"></td></tr>';
$t->set_var("form_action","newgroup.php");
$t->set_var("hidden_vars",$phpgw->session->hidden_var());
$t->set_var("lang_group_name",lang_admin("New group name"));
$t->set_var("group_name_value","");
$phpgw->db->query("select count(*) from accounts where status !='L'");
$phpgw->db->next_record();
if ($phpgw->db->f(0) < 5) {
$size = $phpgw->db->f(0);
$t->set_var("select_size",$phpgw->db->f(0));
} else {
$size = 5;
$t->set_var("select_size","5");
}
echo "<tr><td>" . lang_admin("Select users for inclusion") . "</td> <td>"
. "<select name=\"n_users[]\" multiple size=$size>\n";
$t->set_var("lang_include_user",lang_admin("Select users for inclusion"));
for ($i=0; $i<count($n_users); $i++) {
$selected_users[$n_users[$i]] = " selected";
}
@ -94,37 +95,29 @@
$phpgw->db->query("SELECT con,firstname,lastname, loginid FROM accounts where "
. "status != 'L' ORDER BY lastname,firstname,loginid asc");
while ($phpgw->db->next_record()) {
echo "<option value=\"" . $phpgw->db->f("con") . "\""
$user_list .= "<option value=\"" . $phpgw->db->f("con") . "\""
. $selected_users[$phpgw->db->f("con")] . ">"
. $phpgw->common->display_fullname($phpgw->db->f("loginid"),
$phpgw->db->f("firstname"),
$phpgw->db->f("lastname")) . "</option>";
}
echo "</select></td></tr>\n";
$t->set_var("user_list",$user_list);
$t->set_var("lang_permissions",lang_admin("Select permissions this group will have"));
for ($i=0; $i<count($n_group_permissions); $i++) {
$selected_permissions[$n_group_permissions[$i]] = " selected";
}
echo "<tr><td>" . lang_admin("Select permissions this group will have") . "</td> <td>"
. "<select name=\"n_group_permissions[]\" multiple size=5>\n";
while ($permission = each($phpgw_info["apps"])) {
if ($permission[1]["enabled"]) {
echo "<option value=\"" . $permission[0] . "\""
$permissions_list .= "<option value=\"" . $permission[0] . "\""
. $selected_permissions[$permission[0]] . ">"
. $permission[1]["title"] . "</option>";
}
}
echo "</select></td></tr>";
$t->set_var("permissions_list",$permissions_list);
$t->set_var("lang_submit_button",lang_admin("Create Group"));
$t->pparse("out","form");
?>
<tr>
<td colspan="2" align="center">
<input type="submit" name="submit" value="<?php echo lang_admin("Create Group"); ?>">
</td>
</tr>
</center>
</form>
</table>
<?php
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");