From 36d417cbaab8e493aa76cd6229a152addfd70702 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Thu, 29 Mar 2001 10:45:29 +0000 Subject: [PATCH] Clean up a lot of GET/POST nonsense, moving to POST where possible --- addressbook/add.php | 2 +- addressbook/delete.php | 6 +++--- addressbook/edit.php | 7 +++--- addressbook/inc/functions.inc.php | 4 ++-- addressbook/index.php | 18 ++++++++-------- addressbook/templates/default/add.tpl | 7 ++++++ addressbook/templates/default/edit.tpl | 17 +++++++-------- addressbook/templates/default/footer.tpl | 27 +++++++++++++++++++++--- addressbook/templates/default/header.tpl | 6 ++++++ addressbook/templates/default/view.tpl | 5 ++++- addressbook/view.php | 17 +++++++-------- 11 files changed, 75 insertions(+), 41 deletions(-) diff --git a/addressbook/add.php b/addressbook/add.php index 79fb0ad370..1dd8b0af3b 100755 --- a/addressbook/add.php +++ b/addressbook/add.php @@ -164,7 +164,7 @@ $t->set_var("lang_ok",lang("ok")); $t->set_var("lang_clear",lang("clear")); $t->set_var("lang_cancel",lang("cancel")); - $t->set_var("cancel_url",$phpgw->link("/addressbook/index.php","sort=$sort&order=$order&filter=$filter&start=$start&cat_id=$cat_id")); + $t->set_var("cancel_url",$phpgw->link("/addressbook/index.php")); $t->parse("out","add"); $t->pparse("out","add"); diff --git a/addressbook/delete.php b/addressbook/delete.php index b9738ba2ff..b493afa81c 100755 --- a/addressbook/delete.php +++ b/addressbook/delete.php @@ -32,7 +32,7 @@ if (! $this->check_perms($this->grants[$fields[0]['owner']],PHPGW_ACL_DELETE) && $fields[0]['owner'] != $phpgw_info['user']['account_id']) { Header('Location: ' - . $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); + . $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&ncat_id=$cat_id")); $phpgw->common->phpgw_exit(); } @@ -45,7 +45,7 @@ $t->set_var(lang_sure,lang("Are you sure you want to delete this entry ?")); $t->set_var(no_link,$phpgw->link("/addressbook/index.php", - "ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); + "ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&ncat_id=$cat_id")); $t->set_var(lang_no,lang("NO")); $t->set_var(yes_link,$phpgw->link("/addressbook/delete.php", "ab_id=$ab_id&confirm=true&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); @@ -57,6 +57,6 @@ $this->account_id=$phpgw_info["user"]["account_id"]; $this->delete($ab_id); @Header("Location: " . $phpgw->link("/addressbook/index.php", - "cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); + "cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&ncat_id=$cat_id")); } ?> diff --git a/addressbook/edit.php b/addressbook/edit.php index db42706756..ec2db7d020 100755 --- a/addressbook/edit.php +++ b/addressbook/edit.php @@ -180,12 +180,11 @@ $t->set_var("lang_clear",lang("clear")); $t->set_var("lang_cancel",lang("cancel")); $t->set_var("lang_submit",lang("submit")); - $t->set_var("cancel_link",'
'); + $t->set_var("cancel_link",''); - if ($this->grants[$check[0]['owner']] & PHPGW_ACL_DELETE || $check[0]['owner'] == $phpgw_info['user']['account_id']) + if (($this->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || $check[0]['owner'] == $phpgw_info['user']['account_id']) { - $t->set_var('delete_link',''); + $t->set_var('delete_link',''); $t->set_var('delete_button',''); } diff --git a/addressbook/inc/functions.inc.php b/addressbook/inc/functions.inc.php index 1c4de70cd0..f03f8f094c 100755 --- a/addressbook/inc/functions.inc.php +++ b/addressbook/inc/functions.inc.php @@ -34,7 +34,7 @@ } // Return a select form element with the categories option dialog in it - function cat_option($cat_id='',$name='cat_id',$notall=False,$java=True) { + function cat_option($cat_id='',$name='ncat_id',$notall=False,$java=False) { global $phpgw_info; if ($java) { $jselect = " onChange=\"this.form.submit();\""; @@ -264,7 +264,7 @@ $cat_id = $fields["cat_id"]; } - $cats_link = cat_option($cat_id,'ncat_id',True,False); + $cats_link = cat_option($cat_id,'ncat_id',True); if ($access == 'private') { $access_check = ' checked'; diff --git a/addressbook/index.php b/addressbook/index.php index a5dd69582e..6c40351313 100755 --- a/addressbook/index.php +++ b/addressbook/index.php @@ -44,6 +44,9 @@ if ($cat_id=='') { $cat_id = $phpgw_info["user"]["preferences"]["addressbook"]["default_category"]; } + if($ncat_id || ($ncat_id==0)) { + $cat_id = $ncat_id; + } if ($phpgw_info["user"]["preferences"]["addressbook"]["autosave_category"]) { $phpgw->preferences->delete("addressbook","default_category"); @@ -184,22 +187,21 @@ $t->set_var(lang_showing,$lang_showing); $t->set_var(search_filter,$search_filter); $t->set_var(cats,lang('Category')); - $t->set_var(cats_url,$phpgw->link("/addressbook/index.php", - "sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); - $t->set_var(cats_link,cat_option($cat_id,'cat_id',False,False)); + $t->set_var(cats_url,$phpgw->link("/addressbook/index.php")); + $t->set_var(cats_link,cat_option($cat_id)); $t->set_var(lang_cats,lang('Select')); $t->set_var("lang_addressbook",lang("Address book")); $t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); $t->set_var("th_font",$phpgw_info["theme"]["font"]); $t->set_var("th_text",$phpgw_info["theme"]["th_text"]); $t->set_var("lang_add",lang("Add")); + $t->set_var("add_url",$phpgw->link("/addressbook/add.php")); $t->set_var("lang_addvcard",lang("AddVCard")); + $t->set_var("vcard_url",$phpgw->link("/addressbook/vcardin.php")); $t->set_var("lang_import",lang("Import Contacts")); - $t->set_var("import_url",$phpgw->link("/addressbook/import.php", - "sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); + $t->set_var("import_url",$phpgw->link("/addressbook/import.php")); $t->set_var("lang_export",lang("Export Contacts")); - $t->set_var("export_url",$phpgw->link("/addressbook/export.php", - "sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); + $t->set_var("export_url",$phpgw->link("/addressbook/export.php")); $t->set_var("start",$start); $t->set_var("sort",$sort); $t->set_var("order",$order); @@ -208,8 +210,6 @@ $t->set_var("cat_id",$cat_id); $t->set_var("qfield",$qfield); $t->set_var("query",$query); - $t->set_var("actionurl",$phpgw->link("/addressbook/add.php", - "sort=$sort&order=$order&query=$query&filter=$filter&start=$start&cat_id=$cat_id")); $t->set_var("start",$start); $t->set_var("filter",$filter); $t->set_var("cols",$cols); diff --git a/addressbook/templates/default/add.tpl b/addressbook/templates/default/add.tpl index ba0448e531..bfa07ff808 100644 --- a/addressbook/templates/default/add.tpl +++ b/addressbook/templates/default/add.tpl @@ -18,6 +18,13 @@ + + + + + + +
diff --git a/addressbook/templates/default/edit.tpl b/addressbook/templates/default/edit.tpl index 16857dc300..5edf0fd79c 100644 --- a/addressbook/templates/default/edit.tpl +++ b/addressbook/templates/default/edit.tpl @@ -1,11 +1,11 @@ - + @@ -14,14 +14,13 @@
{cancel_link} - - - - - - - - + + + + + + + {delete_link} diff --git a/addressbook/templates/default/footer.tpl b/addressbook/templates/default/footer.tpl index 8e2903df76..320c25cdd3 100644 --- a/addressbook/templates/default/footer.tpl +++ b/addressbook/templates/default/footer.tpl @@ -1,15 +1,26 @@
-
@@ -21,14 +32,24 @@ diff --git a/addressbook/templates/default/header.tpl b/addressbook/templates/default/header.tpl index f5170d7151..fca9dad20d 100644 --- a/addressbook/templates/default/header.tpl +++ b/addressbook/templates/default/header.tpl @@ -5,6 +5,12 @@
{searchreturn} {cats}{cats_link} + + + + + + {search_filter} diff --git a/addressbook/templates/default/view.tpl b/addressbook/templates/default/view.tpl index 2649f950bb..2152d1433e 100644 --- a/addressbook/templates/default/view.tpl +++ b/addressbook/templates/default/view.tpl @@ -11,6 +11,7 @@ @@ -21,6 +22,7 @@ + @@ -31,16 +33,17 @@ + diff --git a/addressbook/view.php b/addressbook/view.php index 68fc496008..274eb11aa6 100755 --- a/addressbook/view.php +++ b/addressbook/view.php @@ -115,10 +115,12 @@ $cat = CreateObject('phpgwapi.categories'); $catinfo = $cat->return_single($fields[0]['cat_id']); $catname = $catinfo[0]["name"]; + if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; } $cat->app_name = "phpgw"; $catinfo = $cat->return_single($fields[0]['cat_id']); $catname .= $catinfo[0]["name"]; + if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; } if (!$catname) { $catname = lang('none'); } @@ -133,19 +135,15 @@ $sfields = rawurlencode(serialize($fields[0])); - if ($this->grants[$record_owner] & PHPGW_ACL_EDIT || $record_owner == $phpgw_info['user']['account_id']) + if (($this->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $phpgw_info['user']['account_id'])) { - $t->set_var('edit_link',''); + $t->set_var('edit_link',''); $t->set_var('edit_button',''); } - $copylink = ''; - $vcardlink = ''; - $donelink = ''; + $copylink = ''; + $vcardlink = ''; + $donelink = ''; $t->set_var("access_link",$access_link); $t->set_var("ab_id",$ab_id); @@ -153,6 +151,7 @@ $t->set_var("order",$order); $t->set_var("filter",$filter); $t->set_var("start",$start); + $t->set_var("cat_id",$cat_id); $t->set_var("view_header",$view_header); $t->set_var("cols",$columns_html); $t->set_var("lang_ok",lang("ok"));
+ + + + + +
+ + + + + +
- + + + + + +
- + + + + + +
{edit_link} + {edit_button} {done_link} - +