From f514d209db99268a307f62f7942ccdccdba2dd7a Mon Sep 17 00:00:00 2001 From: jengo Date: Mon, 13 Nov 2000 12:00:47 +0000 Subject: [PATCH] update the applcations section to handle apps that aren't display on the navbar --- admin/applications.php | 4 ++-- admin/editapplication.php | 23 ++++++++++++-------- admin/newapplication.php | 13 +++++++---- admin/templates/default/application_form.tpl | 8 +++++-- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/admin/applications.php b/admin/applications.php index f66904a1fa..b114a4f4f4 100644 --- a/admin/applications.php +++ b/admin/applications.php @@ -30,7 +30,7 @@ . lang("Edit") . " " . lang("Delete") . " " . lang("Enabled") . " "; - $phpgw->db->query("select * from applications $ordermethod"); + $phpgw->db->query("select * from applications $ordermethod",__LINE__,__FILE__); while ($phpgw->db->next_record()) { $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); @@ -48,7 +48,7 @@ . " "; echo ""; - if ($phpgw->db->f("app_enabled") == 1) { + if ($phpgw->db->f("app_enabled") != 0) { echo lang("Yes"); } else { echo "" . lang("No") . ""; diff --git a/admin/editapplication.php b/admin/editapplication.php index e0ea98cce7..a8a624bf77 100644 --- a/admin/editapplication.php +++ b/admin/editapplication.php @@ -33,7 +33,7 @@ if ($old_app_name != $n_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(); if ($phpgw->db->f(0) != 0) { @@ -44,13 +44,13 @@ if (! $phpgw->templateotalerrors) { $phpgw->db->query("update applications set app_name='" . addslashes($n_app_name) . "'," . "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")); 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(); if ($phpgw->templateotalerrors) { @@ -61,10 +61,10 @@ } else { $phpgw->template->set_var("error",""); - $n_app_name = $phpgw->db->f("app_name"); - $n_app_title = $phpgw->db->f("app_title"); - $n_app_enabled = $phpgw->db->f("app_enabled"); - $old_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_status = $phpgw->db->f("app_enabled"); + $old_app_name = $phpgw->db->f("app_name"); } $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("lang_app_name",lang("application name")); $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("app_name_value",$n_app_name); $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 = '' + . ''; + $phpgw->template->set_var("select_status",$status_html); $phpgw->template->pparse("out","form"); diff --git a/admin/newapplication.php b/admin/newapplication.php index 88c9c93725..ae7a31e2e7 100644 --- a/admin/newapplication.php +++ b/admin/newapplication.php @@ -25,7 +25,7 @@ $phpgw->templateotalerrors = 0; $phpgw->db->query("select count(*) from applications where app_name='" - . addslashes($n_app_name) . "'"); + . addslashes($n_app_name) . "'",__LINE__,__FILE__); $phpgw->db->next_record(); if ($phpgw->db->f(0) != 0) { @@ -41,7 +41,7 @@ if (! $phpgw->templateotalerrors) { $phpgw->db->query("insert into applications (app_name,app_title,app_enabled) values('" . addslashes($n_app_name) . "','" . addslashes($n_app_title) . "'," - . "$n_app_enabled)"); + . "$n_app_status)",__LINE__,__FILE__); Header("Location: " . $phpgw->link("applications.php")); exit; @@ -60,12 +60,17 @@ $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_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("app_name_value",$n_app_name); $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 = '' + . ''; + $phpgw->template->set_var("select_status",$status_html); $phpgw->template->pparse("out","form"); diff --git a/admin/templates/default/application_form.tpl b/admin/templates/default/application_form.tpl index 3d8ae37b77..1ef57ba0c1 100644 --- a/admin/templates/default/application_form.tpl +++ b/admin/templates/default/application_form.tpl @@ -16,8 +16,12 @@ - {lang_enabled} - + {lang_status} + + +