From 1a1f77468098771e6f3201dcd680a2599fd4ca10 Mon Sep 17 00:00:00 2001 From: jengo Date: Tue, 7 Nov 2000 20:37:02 +0000 Subject: [PATCH] Started cleaning up the templates --- admin/accounts.php | 61 +++++++++++++++++++-------------------- admin/currentusers.php | 52 ++++++++++++++++----------------- admin/editapplication.php | 41 +++++++++++++------------- admin/editgroup.php | 36 +++++++++++------------ admin/newaccount.php | 53 +++++++++++++++++----------------- admin/newapplication.php | 41 +++++++++++++------------- admin/newgroup.php | 31 ++++++++++---------- login.php | 8 ++--- 8 files changed, 158 insertions(+), 165 deletions(-) diff --git a/admin/accounts.php b/admin/accounts.php index 1a420c0b3a..6d0561f1a4 100755 --- a/admin/accounts.php +++ b/admin/accounts.php @@ -18,30 +18,29 @@ include($phpgw_info["server"]["server_root"] . "/admin/inc/accounts_" . $phpgw_info["server"]["auth_type"] . ".inc.php"); - $t = $phpgw->template; // Just temp (jengo) - $t->set_file(array("header" => "accounts.tpl", + $phpgw->template->set_file(array("header" => "accounts.tpl", "row" => "accounts.tpl", "footer" => "accounts.tpl")); - $t->set_block("header","row","footer"); + $phpgw->template->set_block("header","row","footer"); - $total = account_total(); + $phpgw->templateotal = account_total(); - $t->set_var("bg_color",$phpgw_info["theme"]["bg_color"]); - $t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); + $phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_color"]); + $phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); - $t->set_var("left_next_matchs",$phpgw->nextmatchs->left("accounts.php",$start,$total)); - $t->set_var("lang_user_accounts",lang("user accounts")); - $t->set_var("right_next_matchs",$phpgw->nextmatchs->right("accounts.php",$start,$total)); + $phpgw->template->set_var("left_next_matchs",$phpgw->nextmatchs->left("accounts.php",$start,$phpgw->templateotal)); + $phpgw->template->set_var("lang_user_accounts",lang("user accounts")); + $phpgw->template->set_var("right_next_matchs",$phpgw->nextmatchs->right("accounts.php",$start,$phpgw->templateotal)); - $t->set_var("lang_lastname",$phpgw->nextmatchs->show_sort_order($sort,"account_lastname",$order,"accounts.php",lang("last name"))); - $t->set_var("lang_firstname",$phpgw->nextmatchs->show_sort_order($sort,"account_firstname",$order,"accounts.php",lang("first name"))); + $phpgw->template->set_var("lang_lastname",$phpgw->nextmatchs->show_sort_order($sort,"account_lastname",$order,"accounts.php",lang("last name"))); + $phpgw->template->set_var("lang_firstname",$phpgw->nextmatchs->show_sort_order($sort,"account_firstname",$order,"accounts.php",lang("first name"))); - $t->set_var("lang_edit",lang("Edit")); - $t->set_var("lang_delete",lang("Delete")); - $t->set_var("lang_view",lang("View")); + $phpgw->template->set_var("lang_edit",lang("Edit")); + $phpgw->template->set_var("lang_delete",lang("Delete")); + $phpgw->template->set_var("lang_view",lang("View")); - $t->parse("out","header"); + $phpgw->template->parse("out","header"); $account_info = account_read($method,$start,$sort,$order); @@ -57,8 +56,8 @@ $account_id = $account["account_id"]; $loginid = $account["account_lid"]; - $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - $t->set_var("tr_color",$tr_color); + $phpgw->templater_color = $phpgw->nextmatchs->alternate_row_color($phpgw->templater_color); + $phpgw->template->set_var("tr_color",$phpgw->templater_color); // $lastname = $account["account_lastname"]; // $firstname = $account["account_firstname"]; @@ -66,34 +65,34 @@ if (! $lastname) $lastname = ' '; if (! $firstname) $firstname = ' '; - $t->set_var("row_firstname",$firstname); - $t->set_var("row_lastname",$lastname); - $t->set_var("row_edit",'template->set_var("row_lastname",$lastname); + $phpgw->template->set_var("row_edit",' ' . lang("Edit") . ' '); if ($phpgw_info["user"]["userid"] != $account["account_lid"]) { - $t->set_var("row_delete",' '.lang("Delete").' '); } else { - $t->set_var("row_delete"," "); + $phpgw->template->set_var("row_delete"," "); } - $t->set_var("row_view",' ' . lang("View") . ' '); - if ($total == 1) { - $t->set_var("output",""); + if ($phpgw->templateotal == 1) { + $phpgw->template->set_var("output",""); } - if ($total != ++$i) { - $t->parse("output","row",True); + if ($phpgw->templateotal != ++$i) { + $phpgw->template->parse("output","row",True); } } - $t->set_var("actionurl",$phpgw->link("newaccount.php")); - $t->set_var("lang_add",lang("add")); - $t->set_var("lang_search",lang("search")); + $phpgw->template->set_var("actionurl",$phpgw->link("newaccount.php")); + $phpgw->template->set_var("lang_add",lang("add")); + $phpgw->template->set_var("lang_search",lang("search")); - $t->pparse("out","footer"); + $phpgw->template->pparse("out","footer"); $phpgw->common->phpgw_footer(); diff --git a/admin/currentusers.php b/admin/currentusers.php index 8a88e59d90..5a3c619f16 100755 --- a/admin/currentusers.php +++ b/admin/currentusers.php @@ -14,12 +14,12 @@ $phpgw_info["flags"]["currentapp"] = "admin"; include("../header.inc.php"); - $t = new Template($phpgw_info["server"]["template_dir"]); - $t->set_file(array( "header" => "currentusers.tpl", + $phpgw->template = new Template($phpgw_info["server"]["template_dir"]); + $phpgw->template->set_file(array( "header" => "currentusers.tpl", "row" => "currentusers.tpl", "footer" => "currentusers.tpl" )); - $t->set_block("header","row","footer","output"); + $phpgw->template->set_block("header","row","footer","output"); if (! $start) $start = 0; @@ -28,26 +28,26 @@ $phpgw->db->query("select count(*) from sessions"); $phpgw->db->next_record(); - $total = $phpgw->db->f(0); + $phpgw->templateotal = $phpgw->db->f(0); $limit = $phpgw->nextmatchs->sql_limit($start); - $t->set_var("lang_current_users",lang("List of current users")); - $t->set_var("bg_color",$phpgw_info["theme"][bg_color]); - $t->set_var("left_next_matchs",$phpgw->nextmatchs->left("currentusers.php",$start,$total)); - $t->set_var("right_next_matchs",$phpgw->nextmatchs->right("currentusers.php",$start,$total)); - $t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); + $phpgw->template->set_var("lang_current_users",lang("List of current users")); + $phpgw->template->set_var("bg_color",$phpgw_info["theme"][bg_color]); + $phpgw->template->set_var("left_next_matchs",$phpgw->nextmatchs->left("currentusers.php",$start,$phpgw->templateotal)); + $phpgw->template->set_var("right_next_matchs",$phpgw->nextmatchs->right("currentusers.php",$start,$phpgw->templateotal)); + $phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); - $t->set_var("sort_loginid",$phpgw->nextmatchs->show_sort_order($sort,"session_lid",$order, + $phpgw->template->set_var("sort_loginid",$phpgw->nextmatchs->show_sort_order($sort,"session_lid",$order, "currentusers.php",lang("LoginID"))); - $t->set_var("sort_ip",$phpgw->nextmatchs->show_sort_order($sort,"session_ip",$order, + $phpgw->template->set_var("sort_ip",$phpgw->nextmatchs->show_sort_order($sort,"session_ip",$order, "currentusers.php",lang("IP"))); - $t->set_var("sort_login_time",$phpgw->nextmatchs->show_sort_order($sort,"session_logintime",$order, + $phpgw->template->set_var("sort_login_time",$phpgw->nextmatchs->show_sort_order($sort,"session_logintime",$order, "currentusers.php",lang("Login Time"))); - $t->set_var("sort_idle",$phpgw->nextmatchs->show_sort_order($sort,"session_dla",$order, + $phpgw->template->set_var("sort_idle",$phpgw->nextmatchs->show_sort_order($sort,"session_dla",$order, "currentusers.php",lang("idle"))); - $t->set_var("lang_kill",lang("Kill")); + $phpgw->template->set_var("lang_kill",lang("Kill")); - $t->parse("out","header"); + $phpgw->template->parse("out","header"); if ($order) { @@ -60,29 +60,29 @@ $i = 0; while ($phpgw->db->next_record()) { - $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - $t->set_var("tr_color",$tr_color); + $phpgw->templater_color = $phpgw->nextmatchs->alternate_row_color($phpgw->templater_color); + $phpgw->template->set_var("tr_color",$phpgw->templater_color); - $t->set_var("row_loginid",$phpgw->db->f("session_lid")); - $t->set_var("row_ip",$phpgw->db->f("session_ip")); - $t->set_var("row_logintime",$phpgw->common->show_date($phpgw->db->f("session_logintime"))); - $t->set_var("row_idle",gmdate("G:i:s",(time() - $phpgw->db->f("session_dla")))); + $phpgw->template->set_var("row_loginid",$phpgw->db->f("session_lid")); + $phpgw->template->set_var("row_ip",$phpgw->db->f("session_ip")); + $phpgw->template->set_var("row_logintime",$phpgw->common->show_date($phpgw->db->f("session_logintime"))); + $phpgw->template->set_var("row_idle",gmdate("G:i:s",(time() - $phpgw->db->f("session_dla")))); if ($phpgw->db->f("session_id") != $phpgw_info["user"]["sessionid"]) { - $t->set_var("row_kill",'" . lang("Kill")).''); } else { - $t->set_var("row_kill"," "); + $phpgw->template->set_var("row_kill"," "); } if ($phpgw->db->num_rows() == 1) { - $t->set_var("output",""); + $phpgw->template->set_var("output",""); } if ($phpgw->db->num_rows() != ++$i) { - $t->parse("output","row",True); + $phpgw->template->parse("output","row",True); } } - $t->pparse("out","footer"); + $phpgw->template->pparse("out","footer"); $phpgw->common->phpgw_footer(); ?> diff --git a/admin/editapplication.php b/admin/editapplication.php index 514ed66537..e0ea98cce7 100644 --- a/admin/editapplication.php +++ b/admin/editapplication.php @@ -20,17 +20,16 @@ $phpgw_info["flags"]["currentapp"] = "admin"; include("../header.inc.php"); - $t = new Template($phpgw_info["server"]["template_dir"]); - $t->set_file(array("form" => "application_form.tpl")); + $phpgw->template->set_file(array("form" => "application_form.tpl")); if ($submit) { - $totalerrors = 0; + $phpgw->templateotalerrors = 0; if (! $n_app_name) - $error[$totalerrors++] = lang("You must enter an application name."); + $error[$phpgw->templateotalerrors++] = lang("You must enter an application name."); if (! $n_app_title) - $error[$totalerrors++] = lang("You must enter an application title."); + $error[$phpgw->templateotalerrors++] = lang("You must enter an application title."); if ($old_app_name != $n_app_name) { $phpgw->db->query("select count(*) from applications where app_name='" @@ -38,11 +37,11 @@ $phpgw->db->next_record(); if ($phpgw->db->f(0) != 0) { - $error[$totalerrors++] = lang("That application name already exsists."); + $error[$phpgw->templateotalerrors++] = lang("That application name already exsists."); } } - if (! $totalerrors) { + 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'"); @@ -54,13 +53,13 @@ $phpgw->db->query("select * from applications where app_name='$app_name'"); $phpgw->db->next_record(); - if ($totalerrors) { + if ($phpgw->templateotalerrors) { $phpgw->common->phpgw_header(); $phpgw->common->navbar(); - $t->set_var("error","

" . $phpgw->common->error_list($error) . "

"); + $phpgw->template->set_var("error","

" . $phpgw->common->error_list($error) . "

"); } else { - $t->set_var("error",""); + $phpgw->template->set_var("error",""); $n_app_name = $phpgw->db->f("app_name"); $n_app_title = $phpgw->db->f("app_title"); @@ -68,20 +67,20 @@ $old_app_name = $phpgw->db->f("app_name"); } - $t->set_var("lang_header",lang("Edit application")); - $t->set_var("hidden_vars",''); + $phpgw->template->set_var("lang_header",lang("Edit application")); + $phpgw->template->set_var("hidden_vars",''); - $t->set_var("form_action",$phpgw->link("editapplication.php")); - $t->set_var("lang_app_name",lang("application name")); - $t->set_var("lang_app_title",lang("application title")); - $t->set_var("lang_enabled",lang("enabled")); - $t->set_var("lang_submit_button",lang("edit")); + $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_submit_button",lang("edit")); - $t->set_var("app_name_value",$n_app_name); - $t->set_var("app_title_value",$n_app_title); - $t->set_var("app_enabled_checked",($n_app_enabled?" checked":"")); + $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":"")); - $t->pparse("out","form"); + $phpgw->template->pparse("out","form"); $phpgw->common->phpgw_footer(); ?> diff --git a/admin/editgroup.php b/admin/editgroup.php index d6c9957e64..63198ff1a8 100755 --- a/admin/editgroup.php +++ b/admin/editgroup.php @@ -24,9 +24,7 @@ Header("Location: " . $phpgw->link("groups.php")); } - - $t = new Template($phpgw_info["server"]["template_dir"]); - $t->set_file(array("form" => "groups_form.tpl")); + $phpgw->template->set_file(array("form" => "groups_form.tpl")); if ($submit) { $phpgw->db->query("select group_name from groups where group_id=$group_id"); @@ -85,13 +83,13 @@ if ($error) { $phpgw->common->phpgw_header(); $phpgw->common->navbar(); - $t->set_var("error","

$error
"); + $phpgw->template->set_var("error","

$error
"); } else { - $t->set_var("error",""); + $phpgw->template->set_var("error",""); } if ($submit) { - $t->set_var("group_name_value",$n_group_name); + $phpgw->template->set_var("group_name_value",$n_group_name); for ($i=0; $idb->query("select group_name from groups where group_id=$group_id"); $phpgw->db->next_record(); - $t->set_var("group_name_value",$phpgw->db->f("group_name")); + $phpgw->template->set_var("group_name_value",$phpgw->db->f("group_name")); $phpgw->db->query("select account_id from accounts where account_groups like '%,$group_id:%'"); @@ -122,22 +120,22 @@ $phpgw->db->query("select * from groups where group_id=$group_id"); $phpgw->db->next_record(); - $t->set_var("form_action",$phpgw->link("editgroup.php")); - $t->set_var("hidden_vars",""); + $phpgw->template->set_var("form_action",$phpgw->link("editgroup.php")); + $phpgw->template->set_var("hidden_vars",""); - $t->set_var("lang_group_name",lang("group name")); - $t->set_var("group_name_value",$phpgw->db->f("group_name")); + $phpgw->template->set_var("lang_group_name",lang("group name")); + $phpgw->template->set_var("group_name_value",$phpgw->db->f("group_name")); $phpgw->db->query("select count(*) from accounts where account_status !='L'"); $phpgw->db->next_record(); if ($phpgw->db->f(0) < 5) { - $t->set_var("select_size",$phpgw->db->f(0)); + $phpgw->template->set_var("select_size",$phpgw->db->f(0)); } else { - $t->set_var("select_size","5"); + $phpgw->template->set_var("select_size","5"); } - $t->set_var("lang_include_user",lang("Select users for inclusion")); + $phpgw->template->set_var("lang_include_user",lang("Select users for inclusion")); $phpgw->db->query("SELECT account_id,account_firstname,account_lastname,account_lid FROM accounts where " . "account_status != 'L' ORDER BY account_lastname,account_firstname,account_lid asc"); while ($phpgw->db->next_record()) { @@ -147,9 +145,9 @@ $phpgw->db->f("account_firstname"), $phpgw->db->f("account_lastname")) . ""; } - $t->set_var("user_list",$user_list); + $phpgw->template->set_var("user_list",$user_list); - $t->set_var("lang_permissions",lang("Permissions this group has")); + $phpgw->template->set_var("lang_permissions",lang("Permissions this group has")); while ($permission = each($phpgw_info["apps"])) { if ($permission[1]["enabled"]) { $permissions_list .= ""; } - $t->set_var("user_list",$user_list); + $phpgw->template->set_var("user_list",$user_list); - $t->set_var("lang_permissions",lang("Select permissions this group will have")); + $phpgw->template->set_var("lang_permissions",lang("Select permissions this group will have")); for ($i=0; $i"; } } - $t->set_var("permissions_list",$permissions_list); - $t->set_var("lang_submit_button",lang("Create Group")); + $phpgw->template->set_var("permissions_list",$permissions_list); + $phpgw->template->set_var("lang_submit_button",lang("Create Group")); - $t->pparse("out","form"); + $phpgw->template->pparse("out","form"); $phpgw->common->phpgw_footer(); ?> diff --git a/login.php b/login.php index 5dd5f60d1d..c121851b70 100755 --- a/login.php +++ b/login.php @@ -13,10 +13,10 @@ /* $Id$ */ $phpgw_info["flags"] = array("disable_message_class" => True, "disable_send_class" => True, - "disable_nextmatchs_class" => True, "disable_template_class" => True, - "login" => True, "currentapp" => "login", - "noheader" => True - ); + "disable_nextmatchs_class" => True, "disable_template_class" => True, + "login" => True, "currentapp" => "login", + "noheader" => True + ); include("header.inc.php"); // include($phpgw_info["server"]["include_root"] . "/lang/" . "en" . "_login.inc.php");