diff --git a/admin/inc/class.uicategories.inc.php b/admin/inc/class.uicategories.inc.php index a80010b46a..c7a783a1a9 100644 --- a/admin/inc/class.uicategories.inc.php +++ b/admin/inc/class.uicategories.inc.php @@ -94,7 +94,7 @@ function index() { - $global_cats = $GLOBALS['HTTP_POST_VARS']['global_cats'] ? $GLOBALS['HTTP_POST_VARS']['global_cats'] : $GLOBALS['HTTP_GET_VARS']['global_cats']; + $global_cats = get_var('global_cats',array('POST','GET')); $GLOBALS['phpgw']->common->phpgw_header(); @@ -236,7 +236,7 @@ function add() { - $global_cats = $GLOBALS['HTTP_POST_VARS']['global_cats'] ? $GLOBALS['HTTP_POST_VARS']['global_cats'] : $GLOBALS['HTTP_GET_VARS']['global_cats']; + $global_cats = get_var('global_cats',array('POST','GET')); $link_data = array ( @@ -317,7 +317,7 @@ function edit() { - $global_cats = $GLOBALS['HTTP_POST_VARS']['global_cats'] ? $GLOBALS['HTTP_POST_VARS']['global_cats'] : $GLOBALS['HTTP_GET_VARS']['global_cats']; + $global_cats = get_var('global_cats',array('POST','GET')); $link_data = array ( @@ -411,7 +411,7 @@ function delete() { - $global_cats = $GLOBALS['HTTP_POST_VARS']['global_cats'] ? $GLOBALS['HTTP_POST_VARS']['global_cats'] : $GLOBALS['HTTP_GET_VARS']['global_cats']; + $global_cats = get_var('global_cats',array('POST','GET')); $link_data = array ( @@ -449,9 +449,18 @@ $GLOBALS['phpgw']->template->set_var('error_msg',$error_msg); $nolink = $GLOBALS['phpgw']->link('/index.php',$link_data); + if ($GLOBALS['appname']) + { + $type = 'noglobalapp'; + } + else + { + $type = 'noglobal'; + } + $apps_cats = $this->bo->exists(array ( - 'type' => 'noapp', + 'type' => $type, 'cat_name' => '', 'cat_id' => $this->cat_id )); @@ -461,8 +470,8 @@ if ($apps_cats) { - $GLOBALS['phpgw']->template->set_var('messages',lang('This category is currently being used by applications as a parent category') . '
' - . lang('You will need to remove the subcategories before you can delete this category')); + $GLOBALS['phpgw']->template->set_var('delete_msg',lang('This category is currently being used by applications as a parent category') . '
' + . lang('You will need to reassign these subcategories before you can delete this category')); $GLOBALS['phpgw']->template->set_var('lang_subs',''); $GLOBALS['phpgw']->template->set_var('subs',''); @@ -474,7 +483,7 @@ } else { - $GLOBALS['phpgw']->template->set_var('messages',lang('Are you sure you want to delete this global category ?')); + $GLOBALS['phpgw']->template->set_var('delete_msg',lang('Are you sure you want to delete this global category ?')); $exists = $this->bo->exists(array ( diff --git a/admin/setup/phpgw_de.lang b/admin/setup/phpgw_de.lang index ea0bf8e687..accf212ae7 100644 --- a/admin/setup/phpgw_de.lang +++ b/admin/setup/phpgw_de.lang @@ -24,8 +24,8 @@ are you sure you want to kill this session ? admin de Sind Sie sicher, da change main screen message admin de Nachricht der Startseite ändern create group admin de Erstelle Gruppe display admin de Bezeichnung -do you want to delete all global subcategories ? admin de Wollen Sie alle globalen Unterkategorien löschen ? -do you want to move all global subcategories one level down ? admin de Wollen Sie alle globalen Unterkategorien einen Level nach unten verschieben ? +do you want to delete all global subcategories ? admin de Möchten Sie alle globalen Unterkategorien löschen ? +do you want to move all global subcategories one level down ? admin de Möchten Sie alle globalen Unterkategorien um einen Level nach unten verschieben ? edit application admin de Anwendung bearbeiten edit global category admin de Globale Kategorie bearbeiten edit global category for x admin de Globale Kategorie für %1 bearbeiten @@ -78,8 +78,8 @@ that loginid has already been taken admin de Diese LoginID ist bereits vergeben the login and password can not be the same admin de Login und Passwort dürfen nicht identisch sein the two passwords are not the same admin de Die beiden Paßwörter stimmen nicht überein they must be removed before you can continue admin de Sie müssen zuvor aus dieser entfernt werden -This category is currently being used by applications as a parent category admin de Diese Kategorie wird gegenwärtig als übergeordnete Kategorie benutzt. -You will need to remove the subcategories before you can delete this category admin de Sie müssen erst die Unterkategorien löschen befor Sie diese Kategorie löschen können ! +This category is currently being used by applications as a parent category admin de Diese Kategorie wird gegenwärtig von Anwendungen als übergeordnete Kategorie benutzt. +you will need to reassign these subcategories before you can delete this category admin de Sie müssen die Unterkategorien neu zuordnen, befor Sie diese Kategorie löschen können ! total records admin de Anzahl Datensätze insgesamt user data admin de Benutzerdaten user accounts admin de Benutzerkonten @@ -91,4 +91,4 @@ view user account admin de Benutzerkonto anzeigen you must add at least 1 permission to this account admin de Sie müssen diesem Konto mindestens eine Berechtigung zuteilen you must enter an application name and title. admin de Sie müssen der Anwendung einen Namen und einen Titel geben. you must select a file type admin de Sie müssen einen Filetyp auswählen -userdata admin de Benutzerkonto +userdata admin de Benutzerkonten \ No newline at end of file diff --git a/admin/setup/phpgw_en.lang b/admin/setup/phpgw_en.lang index 400b6ebfd0..8a74e811e4 100644 --- a/admin/setup/phpgw_en.lang +++ b/admin/setup/phpgw_en.lang @@ -209,4 +209,4 @@ you must enter an application name. admin en You must enter an application name. you must enter an application name and title. admin en You must enter an application name and title. you must enter an application title. admin en You must enter an application title. you must select a file type admin en You must select a file type -you will need to remove the subcategories before you can delete this category admin en You will need to remove the subcategories before you can delete this category ! +you will need to reassign these subcategories before you can delete this category admin en You will need to reassign these subcategories before you can delete this category ! diff --git a/admin/templates/default/delete_cat.tpl b/admin/templates/default/delete_cat.tpl index fad370b5bc..a14d1cb60e 100644 --- a/admin/templates/default/delete_cat.tpl +++ b/admin/templates/default/delete_cat.tpl @@ -7,19 +7,19 @@ - + - + - + - + diff --git a/phpgwapi/inc/class.categories.inc.php b/phpgwapi/inc/class.categories.inc.php index 5b1548ee09..44e1c1e0ac 100644 --- a/phpgwapi/inc/class.categories.inc.php +++ b/phpgwapi/inc/class.categories.inc.php @@ -57,7 +57,7 @@ $this->app_name = $app_name; $this->db = $GLOBALS['phpgw']->db; $this->grants = $GLOBALS['phpgw']->acl->get_grants($app_name); - $this->cats = $this->return_array($type,$start,$limit,$query,$sort,$order,$public); + $this->cats = $this->return_array($type,$start,$limit,$query,$sort,$order,$globals,$parent_id); } /*! @@ -74,7 +74,8 @@ case 'mains': $s = " AND cat_parent = '0'"; break; case 'appandmains': $s = " AND cat_appname='" . $this->app_name . "' AND cat_parent ='0'"; break; case 'appandsubs': $s = " AND cat_appname='" . $this->app_name . "' AND cat_parent !='0'"; break; - case 'noapp': $s = " AND cat_appname != '" . $this->app_name . "'"; break; + case 'noglobal': $s = " AND cat_appname != '" . $this->app_name . "'"; break; + case 'noglobalapp': $s = " AND cat_appname = '" . $this->app_name . "' AND cat_owner != '" . $this->account_id . "'"; break; default: return False; } return $s; diff --git a/phpgwapi/setup/phpgw_de.lang b/phpgwapi/setup/phpgw_de.lang index 3b5f6c3002..c6e8db0759 100644 --- a/phpgwapi/setup/phpgw_de.lang +++ b/phpgwapi/setup/phpgw_de.lang @@ -96,7 +96,8 @@ default category common de Standard-Kategorie delete common de Löschen description common de Beschreibung disabled common de Deaktiviert -do you also want to delete all subcategories ? common de Wollen Sie auch alle Unterkategorien löschen ? +do you want to delete all subcategories ? common de Möchten Sie alle Unterkategorien löschen ? +do you want to move all subcategories one level down ? common de Möchten Sie alle Unterkategorien um einen Level nach unten verschieben ? done common de Fertig e-mail common de E-Mail edit common de Editieren diff --git a/phpgwapi/setup/phpgw_en.lang b/phpgwapi/setup/phpgw_en.lang index cb5bf877ea..2bcf2f1251 100644 --- a/phpgwapi/setup/phpgw_en.lang +++ b/phpgwapi/setup/phpgw_en.lang @@ -103,7 +103,8 @@ detail common en Detail details common en Details disabled common en Disabled djibouti common en DJIBOUTI -do you also want to delete all subcategories ? common en Do you also want to delete all subcategories ? +do you want to delete all subcategories ? common en Do you want to delete all subcategories ? +do you want to move all subcategories one level down ? common en Do you want to move all subcategories one level down ? dominica common en DOMINICA dominican republic common en DOMINICAN REPUBLIC done common en Done diff --git a/preferences/inc/class.bocategories.inc.php b/preferences/inc/class.bocategories.inc.php index a174bb71b2..8599c9f673 100644 --- a/preferences/inc/class.bocategories.inc.php +++ b/preferences/inc/class.bocategories.inc.php @@ -96,9 +96,7 @@ function exists($data) { - $data['type'] = $data['type'] ? $data['type'] : ''; - $data['cat_id'] = $data['cat_id'] ? $data['cat_id'] : ''; - return $this->cats->exists($data['type'],$data['cat_name'],$data['cat_id']); + return $this->cats->exists($data); } function formatted_list($format,$type,$cat_parent,$global_cats) @@ -106,9 +104,9 @@ return $this->cats->formated_list($format,$type,$cat_parent,$global_cats); } - function delete($cat_id,$subs) + function delete($cat_id,$drop_subs,$modify_subs) { - return $this->cats->delete($cat_id,$subs); + $this->cats->delete($cat_id,$drop_subs,$modify_subs); } function check_values($values) diff --git a/preferences/inc/class.uicategories.inc.php b/preferences/inc/class.uicategories.inc.php index 944c5cf1a3..3526cfa722 100644 --- a/preferences/inc/class.uicategories.inc.php +++ b/preferences/inc/class.uicategories.inc.php @@ -32,6 +32,7 @@ function uicategories() { + $this->bo = CreateObject('preferences.bocategories',$cats_app); $this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); $this->account = $GLOBALS['phpgw_info']['user']['account_id']; @@ -85,7 +86,11 @@ function index() { - global $cats_app, $extra, $global_cats, $cats_level; + $cats_app = get_var('cats_app',array('POST','GET')); + $extra = get_var('extra',array('POST','GET')); + $global_cats = get_var('global_cats',array('POST','GET')); + $cats_level = get_var('cats_level',array('POST','GET')); + $cat_id = get_var('cat_id',array('POST','GET')); $link_data = array ( @@ -258,7 +263,11 @@ function add() { - global $cats_app, $extra, $global_cats, $cats_level; + $cats_app = get_var('cats_app',array('POST','GET')); + $extra = get_var('extra',array('POST','GET')); + $global_cats = get_var('global_cats',array('POST','GET')); + $cats_level = get_var('cats_level',array('POST','GET')); + $cat_id = get_var('cat_id',array('POST','GET')); $link_data = array ( @@ -269,37 +278,19 @@ 'cats_level' => $cats_level ); - $GLOBALS['phpgw']->common->phpgw_header(); - $new_parent = get_var('new_parent',Array('POST')); - $submit = get_var('submit',Array('POST')); $cat_parent = get_var('cat_parent',Array('GET','POST')); $cat_name = get_var('cat_name',Array('POST')); $cat_description = get_var('cat_description',Array('POST')); $cat_data = get_var('cat_data',Array('POST')); $cat_access = get_var('cat_access',Array('POST')); - $GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl')); - $GLOBALS['phpgw']->template->set_block('cat_form','data_row'); - $GLOBALS['phpgw']->template->set_block('cat_form','add'); - $GLOBALS['phpgw']->template->set_block('cat_form','edit'); - $GLOBALS['phpgw']->template->set_block('cat_form','form'); - - $this->set_langs(); - - $this->bo->cats->app_name = $cats_app; - if ($new_parent) { $cat_parent = $new_parent; } - if (!$global_cats) - { - $global_cats = False; - } - - if ($submit) + if (get_var('submit',Array('POST'))) { $data = serialize($cat_data); @@ -315,19 +306,35 @@ $error = $this->bo->check_values($values); if (is_array($error)) { - $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); + $message = $GLOBALS['phpgw']->common->error_list($error); } else { $this->bo->save_cat($values); - $GLOBALS['phpgw']->template->set_var('message',lang('Category x has been added !', $cat_name)); + $message = lang('Category x has been added !', $cat_name); } } + $GLOBALS['phpgw']->common->phpgw_header(); + + $GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl')); + $GLOBALS['phpgw']->template->set_block('cat_form','data_row'); + $GLOBALS['phpgw']->template->set_block('cat_form','add'); + $GLOBALS['phpgw']->template->set_block('cat_form','edit'); + $GLOBALS['phpgw']->template->set_block('cat_form','form'); + + $this->set_langs(); + $GLOBALS['phpgw']->template->set_var('title_categories',lang('Add x category for',lang($cats_app))); + $GLOBALS['phpgw']->template->set_var('message',$message); $GLOBALS['phpgw']->template->set_var('lang_app',lang($cats_app)); $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data)); + if (!$global_cats) + { + $global_cats = False; + } + if ($cats_level) { $type = 'all'; @@ -342,7 +349,7 @@ $GLOBALS['phpgw']->template->set_var('cat_description',$cat_description); $GLOBALS['phpgw']->template->set_var('access',''); + . ($cat_access == True ?' checked':'') . '>'); if ($extra) { @@ -364,7 +371,11 @@ function edit() { - global $cats_app, $extra, $global_cats, $cats_level, $cat_id; + $cats_app = get_var('cats_app',array('POST','GET')); + $extra = get_var('extra',array('POST','GET')); + $global_cats = get_var('global_cats',array('POST','GET')); + $cats_level = get_var('cats_level',array('POST','GET')); + $cat_id = get_var('cat_id',array('POST','GET')); $link_data = array ( @@ -381,37 +392,19 @@ Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',$link_data)); } - $GLOBALS['phpgw']->common->phpgw_header(); - $new_parent = get_var('new_parent',Array('POST')); - $submit = get_var('submit',Array('POST')); $cat_parent = get_var('cat_parent',Array('POST')); $cat_name = get_var('cat_name',Array('POST')); $cat_description = get_var('cat_description',Array('POST')); $cat_data = get_var('cat_data',Array('POST')); $cat_access = get_var('cat_access',Array('POST')); - $GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl')); - $GLOBALS['phpgw']->template->set_block('cat_form','data_row'); - $GLOBALS['phpgw']->template->set_block('cat_form','add'); - $GLOBALS['phpgw']->template->set_block('cat_form','edit'); - $GLOBALS['phpgw']->template->set_block('cat_form','form'); - - $this->set_langs(); - $GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data)); - $this->bo->cats->app_name = $cats_app; - if ($new_parent) { $cat_parent = $new_parent; } - if (!$global_cats) - { - $global_cats = False; - } - - if ($submit) + if (get_var('submit',Array('POST'))) { $data = serialize($cat_data); @@ -428,25 +421,43 @@ $error = $this->bo->check_values($values); if (is_array($error)) { - $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); + $message = $GLOBALS['phpgw']->common->error_list($error); } else { $this->bo->save_cat($values); - $GLOBALS['phpgw']->template->set_var('message',lang('Category x has been updated !',$cat_name)); + $message = lang('Category x has been updated !',$cat_name); } } + $GLOBALS['phpgw']->common->phpgw_header(); + + $GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl')); + $GLOBALS['phpgw']->template->set_block('cat_form','data_row'); + $GLOBALS['phpgw']->template->set_block('cat_form','add'); + $GLOBALS['phpgw']->template->set_block('cat_form','edit'); + $GLOBALS['phpgw']->template->set_block('cat_form','form'); + + $this->set_langs(); + $cats = $this->bo->cats->return_single($cat_id); $GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit x category for',lang($cats_app))); + $GLOBALS['phpgw']->template->set_var('message',$message); $GLOBALS['phpgw']->template->set_var('lang_app',lang($cats_app)); + $GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data)); + $link_data['menuaction'] = 'preferences.uicategories.edit'; $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data)); $GLOBALS['phpgw']->template->set_var('cat_name',$GLOBALS['phpgw']->strip_html($cats[0]['name'])); $GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats[0]['description'])); + if (!$global_cats) + { + $global_cats = False; + } + if ($cats_level) { $type = 'all'; @@ -459,7 +470,7 @@ $GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formated_list('select',$type,$cats[0]['parent'],$global_cats)); $GLOBALS['phpgw']->template->set_var('access',''); + . ($cats[0]['access'] == private ?' checked':'') . '>'); if ($extra) { @@ -478,7 +489,7 @@ { $link_data['menuaction'] = 'preferences.uicategories.delete'; $GLOBALS['phpgw']->template->set_var('delete',''); + . '">'); } else { @@ -491,7 +502,11 @@ function delete() { - global $cats_app, $extra, $global_cats, $cats_level, $cat_id; + $cats_app = get_var('cats_app',array('POST','GET')); + $extra = get_var('extra',array('POST','GET')); + $global_cats = get_var('global_cats',array('POST','GET')); + $cats_level = get_var('cats_level',array('POST','GET')); + $cat_id = get_var('cat_id',array('POST','GET')); $link_data = array ( @@ -510,53 +525,51 @@ $this->bo->cats->app_name = $cats_app; - if(get_var('confirm',Array('POST'))) + if (get_var('confirm',array('POST'))) { - if(get_var('subs',Array('POST'))) + switch (get_var('subs',array('POST'))) { - $this->bo->delete($cat_id,True); + case 'move': + $this->bo->delete($this->cat_id,False,True); + Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',$link_data)); + break; + case 'drop': + $this->bo->delete($this->cat_id,True); + Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',$link_data)); + break; + default: + $error_msg = lang('Please choose one of the methods to handle the subcategories'); + break; } - else - { - $this->bo->delete($cat_id,False); - } - Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',$link_data)); } - else + + $GLOBALS['phpgw']->common->phpgw_header(); + $GLOBALS['phpgw']->template->set_file(array('category_delete' => 'delete.tpl')); + + $GLOBALS['phpgw']->template->set_var('error_msg',$error_msg); + $GLOBALS['phpgw']->template->set_var('deleteheader',lang('Are you sure you want to delete this category ?')); + + $exists = $this->bo->exists(array + ( + 'type' => 'subs', + 'cat_name' => '', + 'cat_id' => $cat_id + )); + + if ($exists) { - $GLOBALS['phpgw']->template->set_file(array('category_delete' => 'delete.tpl')); - - $nolink = $GLOBALS['phpgw']->link('/index.php',$link_data); - - $GLOBALS['phpgw']->common->phpgw_header(); - - $GLOBALS['phpgw']->template->set_var('deleteheader',lang('Are you sure you want to delete this category ?')); - - $exists = $this->bo->exists(array - ( - 'type' => 'subs', - 'cat_name' => '', - 'cat_id' => $cat_id - )); - - if ($exists) - { - $GLOBALS['phpgw']->template->set_var('lang_subs',lang('Do you also want to delete all subcategories ?')); - $GLOBALS['phpgw']->template->set_var('subs',''); - } - else - { - $GLOBALS['phpgw']->template->set_var('lang_subs',''); - $GLOBALS['phpgw']->template->set_var('subs', ''); - } - - $GLOBALS['phpgw']->template->set_var('nolink',$nolink); - $GLOBALS['phpgw']->template->set_var('lang_no',lang('No')); - $link_data['menuaction'] = 'preferences.uicategories.delete'; - $GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data)); - $GLOBALS['phpgw']->template->set_var('lang_yes',lang('Yes')); - $GLOBALS['phpgw']->template->fp('phpgw_body','category_delete'); + $sub_select = '' . lang('Do you want to move all subcategories one level down ?') . '
'; + $sub_select .= '' . lang('Do you want to delete all subcategories ?'); + $GLOBALS['phpgw']->template->set_var('sub_select',$sub_select); } + + $GLOBALS['phpgw']->template->set_var('nolink',$GLOBALS['phpgw']->link('/index.php',$link_data)); + $GLOBALS['phpgw']->template->set_var('lang_no',lang('No')); + + $link_data['menuaction'] = 'preferences.uicategories.delete'; + $GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data)); + $GLOBALS['phpgw']->template->set_var('lang_yes',lang('Yes')); + $GLOBALS['phpgw']->template->fp('phpgw_body','category_delete'); } } ?> diff --git a/preferences/templates/default/category_form.tpl b/preferences/templates/default/category_form.tpl index 21c5a3561e..2d7b597da8 100644 --- a/preferences/templates/default/category_form.tpl +++ b/preferences/templates/default/category_form.tpl @@ -5,7 +5,7 @@
{messages}{delete_msg}
{sub_select}{sub_select}
- + +
-
- +
{title_categories}: {user_name}{title_categories}: {user_name}
{message} @@ -16,19 +16,19 @@ - {lang_name} + {lang_name} {lang_descr} - + {rows} {lang_access} - {access} + {access} @@ -40,13 +40,13 @@ - +
- - @@ -56,13 +56,13 @@ -
+ +
+
- - diff --git a/preferences/templates/default/delete.tpl b/preferences/templates/default/delete.tpl index ea0e99253d..979da2b9fc 100644 --- a/preferences/templates/default/delete.tpl +++ b/preferences/templates/default/delete.tpl @@ -3,23 +3,23 @@
+{error_msg}
+ {delete} +
+ - + - - + - + - +
{deleteheader}{deleteheader}
{lang_subs}{subs}{sub_select}
- - + +
-