update the applcations section to handle apps that aren't display on the navbar

This commit is contained in:
jengo 2000-11-13 12:00:47 +00:00
parent 8e765f2af7
commit f514d209db
4 changed files with 31 additions and 17 deletions

View File

@ -30,7 +30,7 @@
. lang("Edit") . "</td> <td> " . lang("Delete") . " </td> <td> " . lang("Edit") . "</td> <td> " . lang("Delete") . " </td> <td> "
. lang("Enabled") . " </td> <td></tr>"; . lang("Enabled") . " </td> <td></tr>";
$phpgw->db->query("select * from applications $ordermethod"); $phpgw->db->query("select * from applications $ordermethod",__LINE__,__FILE__);
while ($phpgw->db->next_record()) { while ($phpgw->db->next_record()) {
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
@ -48,7 +48,7 @@
. " </a></td>"; . " </a></td>";
echo "<td width=5%>"; echo "<td width=5%>";
if ($phpgw->db->f("app_enabled") == 1) { if ($phpgw->db->f("app_enabled") != 0) {
echo lang("Yes"); echo lang("Yes");
} else { } else {
echo "<b>" . lang("No") . "</b>"; echo "<b>" . lang("No") . "</b>";

View File

@ -33,7 +33,7 @@
if ($old_app_name != $n_app_name) { if ($old_app_name != $n_app_name) {
$phpgw->db->query("select count(*) from applications where app_name='" $phpgw->db->query("select count(*) from applications where app_name='"
. addslashes($n_app_name) . "'"); . addslashes($n_app_name) . "'",__LINE__,__FILE__);
$phpgw->db->next_record(); $phpgw->db->next_record();
if ($phpgw->db->f(0) != 0) { if ($phpgw->db->f(0) != 0) {
@ -44,13 +44,13 @@
if (! $phpgw->templateotalerrors) { if (! $phpgw->templateotalerrors) {
$phpgw->db->query("update applications set app_name='" . addslashes($n_app_name) . "'," $phpgw->db->query("update applications set app_name='" . addslashes($n_app_name) . "',"
. "app_title='" . addslashes($n_app_title) . "', app_enabled='" . "app_title='" . addslashes($n_app_title) . "', app_enabled='"
. "$n_app_enabled' where app_name='$old_app_name'"); . "$n_app_status' where app_name='$old_app_name'",__LINE__,__FILE__);
Header("Location: " . $phpgw->link("applications.php")); Header("Location: " . $phpgw->link("applications.php"));
exit; exit;
} }
} }
$phpgw->db->query("select * from applications where app_name='$app_name'"); $phpgw->db->query("select * from applications where app_name='$app_name'",__LINE__,__FILE__);
$phpgw->db->next_record(); $phpgw->db->next_record();
if ($phpgw->templateotalerrors) { if ($phpgw->templateotalerrors) {
@ -61,10 +61,10 @@
} else { } else {
$phpgw->template->set_var("error",""); $phpgw->template->set_var("error","");
$n_app_name = $phpgw->db->f("app_name"); $n_app_name = $phpgw->db->f("app_name");
$n_app_title = $phpgw->db->f("app_title"); $n_app_title = $phpgw->db->f("app_title");
$n_app_enabled = $phpgw->db->f("app_enabled"); $n_app_status = $phpgw->db->f("app_enabled");
$old_app_name = $phpgw->db->f("app_name"); $old_app_name = $phpgw->db->f("app_name");
} }
$phpgw->template->set_var("lang_header",lang("Edit application")); $phpgw->template->set_var("lang_header",lang("Edit application"));
@ -73,12 +73,17 @@
$phpgw->template->set_var("form_action",$phpgw->link("editapplication.php")); $phpgw->template->set_var("form_action",$phpgw->link("editapplication.php"));
$phpgw->template->set_var("lang_app_name",lang("application name")); $phpgw->template->set_var("lang_app_name",lang("application name"));
$phpgw->template->set_var("lang_app_title",lang("application title")); $phpgw->template->set_var("lang_app_title",lang("application title"));
$phpgw->template->set_var("lang_enabled",lang("enabled")); $phpgw->template->set_var("lang_status",lang("Status"));
$phpgw->template->set_var("lang_submit_button",lang("edit")); $phpgw->template->set_var("lang_submit_button",lang("edit"));
$phpgw->template->set_var("app_name_value",$n_app_name); $phpgw->template->set_var("app_name_value",$n_app_name);
$phpgw->template->set_var("app_title_value",$n_app_title); $phpgw->template->set_var("app_title_value",$n_app_title);
$phpgw->template->set_var("app_enabled_checked",($n_app_enabled?" checked":""));
$selected[$n_app_status] = " selected";
$status_html = '<option value="0"' . $selected[0] . '>' . lang("Disabled") . '</option>'
. '<option value="1"' . $selected[1] . '>' . lang("Enabled") . '<option>'
. '<option value="2"' . $selected[2] . '>' . lang("Enabled - Hidden from navbar") . '</option>';
$phpgw->template->set_var("select_status",$status_html);
$phpgw->template->pparse("out","form"); $phpgw->template->pparse("out","form");

View File

@ -25,7 +25,7 @@
$phpgw->templateotalerrors = 0; $phpgw->templateotalerrors = 0;
$phpgw->db->query("select count(*) from applications where app_name='" $phpgw->db->query("select count(*) from applications where app_name='"
. addslashes($n_app_name) . "'"); . addslashes($n_app_name) . "'",__LINE__,__FILE__);
$phpgw->db->next_record(); $phpgw->db->next_record();
if ($phpgw->db->f(0) != 0) { if ($phpgw->db->f(0) != 0) {
@ -41,7 +41,7 @@
if (! $phpgw->templateotalerrors) { if (! $phpgw->templateotalerrors) {
$phpgw->db->query("insert into applications (app_name,app_title,app_enabled) values('" $phpgw->db->query("insert into applications (app_name,app_title,app_enabled) values('"
. addslashes($n_app_name) . "','" . addslashes($n_app_title) . "'," . addslashes($n_app_name) . "','" . addslashes($n_app_title) . "',"
. "$n_app_enabled)"); . "$n_app_status)",__LINE__,__FILE__);
Header("Location: " . $phpgw->link("applications.php")); Header("Location: " . $phpgw->link("applications.php"));
exit; exit;
@ -60,12 +60,17 @@
$phpgw->template->set_var("form_action",$phpgw->link("newapplication.php")); $phpgw->template->set_var("form_action",$phpgw->link("newapplication.php"));
$phpgw->template->set_var("lang_app_name",lang("application name")); $phpgw->template->set_var("lang_app_name",lang("application name"));
$phpgw->template->set_var("lang_app_title",lang("application title")); $phpgw->template->set_var("lang_app_title",lang("application title"));
$phpgw->template->set_var("lang_enabled",lang("enabled")); $phpgw->template->set_var("lang_status",lang("Status"));
$phpgw->template->set_var("lang_submit_button",lang("add")); $phpgw->template->set_var("lang_submit_button",lang("add"));
$phpgw->template->set_var("app_name_value",$n_app_name); $phpgw->template->set_var("app_name_value",$n_app_name);
$phpgw->template->set_var("app_title_value",$n_app_value); $phpgw->template->set_var("app_title_value",$n_app_value);
$phpgw->template->set_var("app_enabled_checked",($n_app_enabled?" checked":""));
$selected[$n_app_status] = " selected";
$status_html = '<option value="0"' . $selected[0] . '>' . lang("Disabled") . '</option>'
. '<option value="1"' . $selected[1] . '>' . lang("Enabled") . '<option>'
. '<option value="2"' . $selected[2] . '>' . lang("Enabled - Hidden from navbar") . '</option>';
$phpgw->template->set_var("select_status",$status_html);
$phpgw->template->pparse("out","form"); $phpgw->template->pparse("out","form");

View File

@ -16,8 +16,12 @@
</tr> </tr>
<tr> <tr>
<td>{lang_enabled}</td> <td>{lang_status}</td>
<td><input type="checkbox" name="n_app_enabled" value="1"{app_enabled_checked}></td> <td>
<select name="n_app_status">
{select_status}
</select>
</td>
</tr> </tr>
<tr> <tr>