From 2bec31eacd5cfbc4fada8479cd4ce6f3bc420f21 Mon Sep 17 00:00:00 2001 From: bettina Date: Mon, 2 Apr 2001 00:29:26 +0000 Subject: [PATCH] update data field to only show if extra exists --- preferences/addcategory.php | 16 +++++++-- preferences/categories.php | 34 ++++++++++++------- preferences/deletecategory.php | 9 ++--- preferences/editcategory.php | 27 +++++++++------ .../templates/default/category_form.tpl | 12 +++---- preferences/templates/default/listcats.tpl | 20 ++++++----- 6 files changed, 75 insertions(+), 43 deletions(-) diff --git a/preferences/addcategory.php b/preferences/addcategory.php index 9394936c74..f7bf41668d 100644 --- a/preferences/addcategory.php +++ b/preferences/addcategory.php @@ -23,6 +23,7 @@ . "\n" . "\n" . "\n" + . "\n" . "\n"; @@ -62,19 +63,28 @@ $t->set_var('hidden_vars',$hidden_vars); $t->set_var('user_name',$phpgw_info["user"]["fullname"]); $t->set_var('doneurl',$phpgw->link('/preferences/categories.php')); - $t->set_var('title_categories',lang('Add category for')); + $t->set_var('title_categories',lang("Add $cats_app category for")); $t->set_var('actionurl',$phpgw->link('/preferences/addcategory.php')); $t->set_var('lang_parent',lang('Parent category')); $t->set_var('lang_select_parent',lang('Select parent category')); $t->set_var('lang_access',lang('Private')); - $t->set_var('lang_data',lang('Data')); + if ($access) { $t->set_var('access', ''); } else { $t->set_var('access', 'set_var('lang_name',lang('Name')); $t->set_var('lang_descr',lang('Description')); $t->set_var('cat_name',$cat_name); $t->set_var('cat_description',$cat_description); - $t->set_var('cat_data',$cat_data); + + if ($extra) { + $t->set_var('td_data',''); + $t->set_var('lang_data',lang($extra)); + } + else { + $t->set_var('cat_data',''); + $t->set_var('lang_data',''); + } + $t->set_var('lang_add',lang('Add')); $t->set_var('lang_reset',lang('Clear Form')); $t->set_var('lang_done',lang('Done')); diff --git a/preferences/categories.php b/preferences/categories.php index 19d96615bd..ce2b181c1c 100644 --- a/preferences/categories.php +++ b/preferences/categories.php @@ -29,16 +29,17 @@ . "\n" . "\n" . "\n" + . "\n" . "\n"; $t->set_var('font',$phpgw_info["theme"]["font"]); $t->set_var('user_name',$phpgw_info["user"]["fullname"]); - $t->set_var('title_categories',lang('Categories for')); + $t->set_var('title_categories',lang('categories for')); $t->set_var('lang_action',lang('Category list')); - $t->set_var('add_action',$phpgw->link('/preferences/addcategory.php',"cats_app=$cats_app")); + $t->set_var('add_action',$phpgw->link('/preferences/addcategory.php',"cats_app=$cats_app&extra=$extra")); $t->set_var('lang_add',lang('Add')); $t->set_var('lang_search',lang('Search')); - $t->set_var('actionurl',$phpgw->link('/preferences/categories.php',"cats_app=$cats_app")); + $t->set_var('actionurl',$phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra")); $t->set_var('lang_done',lang('Done')); $t->set_var('doneurl',$phpgw->link('/preferences/')); @@ -55,8 +56,8 @@ //--------------------------------- nextmatch -------------------------------------------- - $left = $phpgw->nextmatchs->left('/preferneces/categories.php',$start,$c->total_records,"&cats_app=$cats_app"); - $right = $phpgw->nextmatchs->right('/preferences/categories.php',$start,$c->total_records,"&cats_app=$cats_app"); + $left = $phpgw->nextmatchs->left('/preferneces/categories.php',$start,$c->total_records,"&cats_app=$cats_app&extra=$extra"); + $right = $phpgw->nextmatchs->right('/preferences/categories.php',$start,$c->total_records,"&cats_app=$cats_app&extra=$extra"); $t->set_var('left',$left); $t->set_var('right',$right); @@ -70,9 +71,14 @@ //------------------- list header variable template-declarations ------------------------- $t->set_var('th_bg',$phpgw_info["theme"][th_bg]); - $t->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,'cat_name',$order,'/preferences/categories.php',lang('Name'),"&cats_app=$cats_app")); - $t->set_var('sort_description',$phpgw->nextmatchs->show_sort_order($sort,'cat_description',$order,'/preferences/categories.php',lang('Description'),"&cats_app=$cats_app")); - $t->set_var('sort_data',$phpgw->nextmatchs->show_sort_order($sort,'cat_data',$order,'/preferences/categories.php',lang('Data'),"&cats_app=$cats_app")); + $t->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,'cat_name',$order,'/preferences/categories.php',lang('Name'),"&cats_app=$cats_app&extra=$extra")); + $t->set_var('sort_description',$phpgw->nextmatchs->show_sort_order($sort,'cat_description',$order,'/preferences/categories.php',lang('Description'),"&cats_app=$cats_app&extra=$extra")); + if ($extra) { + $t->set_var('sort_data','' + . $phpgw->nextmatchs->show_sort_order($sort,'cat_data',$order,'/preferences/categories.php',lang($extra),"&cats_app=$cats_app&extra=$extra") . ''); + } + else { $t->set_var('sort_data',''); } + $t->set_var('lang_app',lang($cats_app)); $t->set_var('lang_edit',lang('Edit')); $t->set_var('lang_delete',lang('Delete')); @@ -92,8 +98,13 @@ $descr = $phpgw->strip_html($categories[$i]['description']); if (! $descr) { $descr = ' '; } + + if ($extra) { $data = $categories[$i]['data']; if (! $data) { $data = ' '; } + $t->set_var('td_data','' . $data . ''); + } + else { $t->set_var('td_data',''); } if ($categories[$i]['parent'] == 0) { $name = '' . $phpgw->strip_html($categories[$i]['name']) . ''; @@ -104,14 +115,13 @@ //-------------------------- template declaration for list records --------------------------- $t->set_var(array('name' => $name, - 'descr' => $descr, - 'data' => $data)); + 'descr' => $descr)); $t->set_var('app_url',$phpgw->link('/' . $phpgw_info['flags']['currentapp'] . '/index.php',"cat_id=$cat_id")); if ($categories[$i]["owner"] == $phpgw_info["user"]["account_id"]) { - $t->set_var('edit',$phpgw->link('/preferences/editcategory.php',"cat_id=$cat_id&cats_app=$cats_app")); + $t->set_var('edit',$phpgw->link('/preferences/editcategory.php',"cat_id=$cat_id&cats_app=$cats_app&extra=$extra")); $t->set_var('lang_edit_entry',lang('Edit')); } else { @@ -119,7 +129,7 @@ $t->set_var('lang_edit_entry',' '); } if ($categories[$i]["owner"] == $phpgw_info["user"]["account_id"]) { - $t->set_var('delete',$phpgw->link('/preferences/deletecategory.php',"cat_id=$cat_id&cats_app=$cats_app")); + $t->set_var('delete',$phpgw->link('/preferences/deletecategory.php',"cat_id=$cat_id&cats_app=$cats_app&extra=$extra")); $t->set_var('lang_delete_entry',lang('Delete')); } else { diff --git a/preferences/deletecategory.php b/preferences/deletecategory.php index 0acdb56b88..431bbf90cc 100644 --- a/preferences/deletecategory.php +++ b/preferences/deletecategory.php @@ -26,22 +26,23 @@ $c->app_name = $cats_app; if (! $cat_id) { - Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app")); + Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra")); } if ($confirm) { $c->delete($cat_id); - Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app")); + Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra")); } else { $hidden_vars = "\n" - . $hidden_vars = "\n"; + . $hidden_vars = "\n" + . $hidden_vars = "\n"; $t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences')); $t->set_file(array('category_delete' => 'delete.tpl')); $t->set_var('deleteheader',lang('Are you sure you want to delete this category ?')); $t->set_var('font',$phpgw_info["theme"]["font"]); - $nolinkf = $phpgw->link('/preferences/categories.php',"cat_id=$cat_id&cats_app=$cats_app"); + $nolinkf = $phpgw->link('/preferences/categories.php',"cat_id=$cat_id&cats_app=$cats_app&extra=$extra"); $nolink = "" . lang('No') .""; $t->set_var("nolink",$nolink); diff --git a/preferences/editcategory.php b/preferences/editcategory.php index f846f4df63..7175e5d788 100644 --- a/preferences/editcategory.php +++ b/preferences/editcategory.php @@ -11,11 +11,10 @@ \**************************************************************************/ /* $Id$ */ - $phpgw_flags = array('currentapp' => $cats_app, - 'noappheader' => True, - 'noappfooter' => True); + $phpgw_info['flags']['currentapp'] = $cats_app; + $phpgw_info['flags']['noappheader'] = True; + $phpgw_info['flags']['noappfooter'] = True; - $phpgw_info['flags'] = $phpgw_flags; include('../header.inc.php'); $hidden_vars = "\n" @@ -23,11 +22,13 @@ . "\n" . "\n" . "\n" + . "\n" + . "\n" . "\n"; if (! $cat_id) { Header('Location: ' . $phpgw->link('/preferences/categories.php',"sort=$sort&order=$order&query=$query&start=$start" - . "&filter=$filter&cats_app=$cats_app")); + . "&filter=$filter&cats_app=$cats_app&extra=$extra")); } $t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences')); @@ -56,7 +57,7 @@ if ($access) { $cat_access = 'private'; } else { $cat_access = 'public'; } - if (! $error) { $c->edit($cat_id,$cat_parent,$cat_name,$cat_description,$cat_data,$cat_access); } + if (! $error) { $c->edit($cat_id,$cat_parent,$cat_name,$cat_description,$cat_data,$cat_access); } } if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); } @@ -69,8 +70,7 @@ $t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False')); $t->set_var('font',$phpgw_info["theme"]["font"]); $t->set_var('user_name',$phpgw_info["user"]["fullname"]); - $t->set_var('title_categories',lang('Edit category for')); - $t->set_var('lang_action',lang('Edit category')); + $t->set_var('title_categories',lang("Edit $cats_app category for")); $t->set_var('doneurl',$phpgw->link('/preferences/categories.php')); $t->set_var('actionurl',$phpgw->link('/preferences/editcategory.php')); $t->set_var('deleteurl',$phpgw->link('/preferences/deletecategory.php')); @@ -78,7 +78,6 @@ $t->set_var('lang_parent',lang('Parent category')); $t->set_var('lang_name',lang('Name')); $t->set_var('lang_descr',lang('Description')); - $t->set_var('lang_data',lang('Data')); $t->set_var('lang_select_parent',lang('Select parent category')); $t->set_var('lang_access',lang('Private')); if ($cats[0]['access']=='private') { $t->set_var('access', ''); } @@ -88,7 +87,15 @@ $t->set_var('cat_name',$phpgw->strip_html($cats[0]['name'])); $t->set_var('cat_description',$phpgw->strip_html($cats[0]['description'])); - $t->set_var('cat_data',$cats[0]['data']); + + if ($extra) { + $t->set_var('td_data',''); + $t->set_var('lang_data',lang($extra)); + } + else { + $t->set_var('td_data',''); + $t->set_var('lang_data',''); + } $t->set_var('lang_edit',lang('Edit')); $t->set_var('lang_delete',lang('Delete')); diff --git a/preferences/templates/default/category_form.tpl b/preferences/templates/default/category_form.tpl index 24535a9adf..58cc50d18f 100644 --- a/preferences/templates/default/category_form.tpl +++ b/preferences/templates/default/category_form.tpl @@ -10,23 +10,23 @@ - + - + - + - - + + - +
{lang_parent}:{lang_parent}
{lang_name}:{lang_name}
{lang_descr}:{lang_descr}
{lang_data}:{lang_data}{td_data}
{lang_access}:{lang_access} {access}
diff --git a/preferences/templates/default/listcats.tpl b/preferences/templates/default/listcats.tpl index e82f39e5be..e59afc42a0 100644 --- a/preferences/templates/default/listcats.tpl +++ b/preferences/templates/default/listcats.tpl @@ -1,11 +1,11 @@
- +
- + -
{title_categories}: {user_name}{lang_app} {title_categories}: {user_name}
+ {left} @@ -17,15 +17,17 @@ - +
  +  
+ - + {sort_data} @@ -35,21 +37,23 @@ - + {td_data} +
{sort_name} {sort_description}{sort_data}{lang_app} {lang_edit} {lang_delete}
{name} {descr}{data}{lang_app} {lang_edit_entry} {lang_delete_entry}
+ - -
+
{hidden_vars}
+
{hidden_vars}