diff --git a/preferences/addcategory.php b/preferences/addcategory.php
index fbff2b9543..c16ec8e887 100644
--- a/preferences/addcategory.php
+++ b/preferences/addcategory.php
@@ -24,6 +24,7 @@
. "\n"
. "\n"
. "\n"
+ . "\n"
. "\n";
@@ -59,27 +60,34 @@
}
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
- if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang("Category x has been added !",$cat_name)); }
+ if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang('Category x has been added !',$cat_name)); }
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
-
+ $t->set_var('actionurl',$phpgw->link('/preferences/addcategory.php'));
+ $t->set_var('title_categories',lang('Add x category for',$cats_app));
+ $t->set_var('doneurl',$phpgw->link('/preferences/categories.php'));
+ $t->set_var('user_name',$phpgw_info['user']['fullname']);
+ $t->set_var('hidden_vars',$hidden_vars);
+ $t->set_var('font',$phpgw_info['theme']['font']);
$t->set_var('lang_main',lang('Main category'));
$t->set_var('lang_new_main',lang('New main category'));
- $t->set_var('font',$phpgw_info['theme']['font']);
$t->set_var('main_category_list',$c->formated_list('select','mains',$cat_main));
- $t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
- $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 x category for",$cats_app));
- $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'));
+ if ($cats_level) {
+ $category_list = $c->formated_list('select','all',$cat_parent);
+ $t->set_var('category_select','');
+ $t->set_var('lang_parent',lang('Parent category'));
+ }
+ else {
+ $t->set_var('lang_parent','');
+ $t->set_var('category_select','');
+ }
+
+ $t->set_var('lang_access',lang('Private'));
if ($access) { $t->set_var('access', ''); }
else { $t->set_var('access', ''); }
+
$t->set_var('lang_name',lang('Name'));
$t->set_var('lang_descr',lang('Description'));
$t->set_var('cat_name',$cat_name);
@@ -103,4 +111,4 @@
$t->pparse('addhandle','add');
$phpgw->common->phpgw_footer();
-?>
+?>
\ No newline at end of file
diff --git a/preferences/categories.php b/preferences/categories.php
index da684573d2..7e7ea9f96f 100644
--- a/preferences/categories.php
+++ b/preferences/categories.php
@@ -30,23 +30,24 @@
. "\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('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('lang_action',lang('Category list'));
- $t->set_var('add_action',$phpgw->link('/preferences/addcategory.php',"cats_app=$cats_app&extra=$extra"));
+ $t->set_var('add_action',$phpgw->link('/preferences/addcategory.php',"cats_app=$cats_app&extra=$extra&cats_level=$cats_level"));
$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&extra=$extra"));
+ $t->set_var('actionurl',$phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra&cats_level=$cats_level"));
$t->set_var('lang_done',lang('Done'));
$t->set_var('doneurl',$phpgw->link('/preferences/'));
if (! $start) { $start = 0; }
- if($phpgw_info["user"]["preferences"]["common"]["maxmatchs"] && $phpgw_info["user"]["preferences"]["common"]["maxmatchs"] > 0) {
- $limit = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];
+ if($phpgw_info['user']['preferences']['common']['maxmatchs'] && $phpgw_info['user']['preferences']['common']['maxmatchs'] > 0) {
+ $limit = $phpgw_info['user']['preferences']['common']['maxmatchs'];
}
else { $limit = 15; }
@@ -56,26 +57,26 @@
//--------------------------------- nextmatch --------------------------------------------
- $left = $phpgw->nextmatchs->left('/preferences/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");
+ $left = $phpgw->nextmatchs->left('/preferences/categories.php',$start,$c->total_records,"&cats_app=$cats_app&extra=$extra&cats_level=$cats_level");
+ $right = $phpgw->nextmatchs->right('/preferences/categories.php',$start,$c->total_records,"&cats_app=$cats_app&extra=$extra&cats_level=$cats_level");
$t->set_var('left',$left);
$t->set_var('right',$right);
if ($c->total_records > $limit) {
- $t->set_var('lang_showing',lang("showing x - x of x",($start + 1),($start + $limit),$c->total_records));
+ $t->set_var('lang_showing',lang('showing x - x of x',($start + 1),($start + $limit),$c->total_records));
}
- else { $t->set_var('lang_showing',lang("showing x",$c->total_records)); }
+ else { $t->set_var('lang_showing',lang('showing x',$c->total_records)); }
// ------------------------------ end nextmatch ------------------------------------------
//------------------- 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&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"));
+ $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&extra=$extra&cats_level=$cats_level"));
+ $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&cats_level=$cats_level"));
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") . ' | ');
+ $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&cats_level=$cats_level") . ' | ');
}
else { $t->set_var('sort_data',''); }
@@ -88,7 +89,7 @@
for ($i=0;$inextmatchs->alternate_row_color($tr_color);
- $t->set_var(tr_color,$tr_color);
+ $t->set_var('tr_color',$tr_color);
$cat_id = $categories[$i]['id'];
$owner = $categories[$i]['owner'];
@@ -106,7 +107,7 @@
if ($extra) {
$data = $categories[$i]['data'];
if (! $data) { $data = ' '; }
- $t->set_var('td_data','' . $data . ' | ');
+ $t->set_var('td_data','' . $data . ' | ');
}
else { $t->set_var('td_data',''); }
@@ -124,16 +125,16 @@
$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&extra=$extra"));
+ 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&extra=$extra&cats_level=$cats_level"));
$t->set_var('lang_edit_entry',lang('Edit'));
}
else {
$t->set_var('edit','');
$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&extra=$extra"));
+ 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&extra=$extra&cats_level=$cats_level"));
$t->set_var('lang_delete_entry',lang('Delete'));
}
else {
diff --git a/preferences/deletecategory.php b/preferences/deletecategory.php
index 2b19fe7a91..11b4544d0d 100644
--- a/preferences/deletecategory.php
+++ b/preferences/deletecategory.php
@@ -26,23 +26,24 @@
$c->app_name = $cats_app;
if (! $cat_id) {
- Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra"));
+ Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra&cats_level=$cats_level"));
}
if ($confirm) {
if ($subs) { $c->delete($cat_id,'True'); }
else { $c->delete($cat_id); }
- Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra"));
+ Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra&cats_level=$cats_level"));
}
else {
$hidden_vars = "\n"
. "\n"
+ . "\n"
. "\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"]);
+ $t->set_var('font',$phpgw_info['theme']['font']);
$t->set_var('hidden_vars',$hidden_vars);
$exists = $c->exists('subs',$cat_name='',$cat_id);
@@ -55,10 +56,10 @@
$t->set_var('subs', '');
}
- $t->set_var('nolink',$phpgw->link('/preferences/categories.php',"cat_id=$cat_id&cats_app=$cats_app&extra=$extra"));
+ $t->set_var('nolink',$phpgw->link('/preferences/categories.php',"cat_id=$cat_id&cats_app=$cats_app&extra=$extra&cats_level=$cats_level"));
$t->set_var('lang_no',lang('No'));
- $t->set_var('action_url',$phpgw->link('/preferences/deletecategory.php',"cat_id=$cat_id$cats_app=$cats_app&extra=$extra"));
+ $t->set_var('action_url',$phpgw->link('/preferences/deletecategory.php',"cat_id=$cat_id$cats_app=$cats_app&extra=$extra&cats_level=$cats_level"));
$t->set_var('lang_yes',lang('Yes'));
$t->pparse('out','category_delete');
diff --git a/preferences/editcategory.php b/preferences/editcategory.php
index 4a764e50df..4d9d09b27c 100644
--- a/preferences/editcategory.php
+++ b/preferences/editcategory.php
@@ -24,11 +24,12 @@
. "\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&extra=$extra"));
+ . "&filter=$filter&cats_app=$cats_app&extra=$extra&cats_level=$cats_level"));
}
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences'));
@@ -65,8 +66,18 @@
$t->set_var('lang_main',lang('Main category'));
$t->set_var('lang_new_main',lang('New main category'));
$t->set_var('main_category_list',$c->formated_list('select','mains',$cat_main));
- $cat_parent = $cats[0]['parent'];
- $t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
+
+ if ($cats_level) {
+ $cat_parent = $cats[0]['parent'];
+ $category_list = $c->formated_list('select','all',$cat_parent);
+ $t->set_var('category_select','');
+ $t->set_var('lang_parent',lang('Parent category'));
+ }
+ else {
+ $t->set_var('lang_parent','');
+ $t->set_var('category_select','');
+ }
+
$t->set_var('font',$phpgw_info['theme']['font']);
$t->set_var('user_name',$phpgw_info['user']['fullname']);
$t->set_var('title_categories',lang('Edit x category for',$cats_app));
@@ -74,10 +85,8 @@
$t->set_var('actionurl',$phpgw->link('/preferences/editcategory.php'));
$t->set_var('deleteurl',$phpgw->link('/preferences/deletecategory.php'));
$t->set_var('hidden_vars',$hidden_vars);
- $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_select_parent',lang('Select parent category'));
$t->set_var('lang_access',lang('Private'));
if ($cats[0]['access']=='private') { $t->set_var('access', ''); }
else { $t->set_var('access', 'pparse('edithandle','edit');
$phpgw->common->phpgw_footer();
-?>
+?>
\ No newline at end of file
diff --git a/preferences/templates/default/category_form.tpl b/preferences/templates/default/category_form.tpl
index dbe5b78906..f9a4f15ddd 100644
--- a/preferences/templates/default/category_form.tpl
+++ b/preferences/templates/default/category_form.tpl
@@ -15,7 +15,7 @@
{lang_parent} |
- |
+ {category_select} |
{lang_name} |