update cats

This commit is contained in:
ceb 2002-09-08 20:40:12 +00:00
parent aacd03d33f
commit e4044935f0
11 changed files with 160 additions and 137 deletions

View File

@ -94,7 +94,7 @@
function index() 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(); $GLOBALS['phpgw']->common->phpgw_header();
@ -236,7 +236,7 @@
function add() 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 $link_data = array
( (
@ -317,7 +317,7 @@
function edit() 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 $link_data = array
( (
@ -411,7 +411,7 @@
function delete() 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 $link_data = array
( (
@ -449,9 +449,18 @@
$GLOBALS['phpgw']->template->set_var('error_msg',$error_msg); $GLOBALS['phpgw']->template->set_var('error_msg',$error_msg);
$nolink = $GLOBALS['phpgw']->link('/index.php',$link_data); $nolink = $GLOBALS['phpgw']->link('/index.php',$link_data);
if ($GLOBALS['appname'])
{
$type = 'noglobalapp';
}
else
{
$type = 'noglobal';
}
$apps_cats = $this->bo->exists(array $apps_cats = $this->bo->exists(array
( (
'type' => 'noapp', 'type' => $type,
'cat_name' => '', 'cat_name' => '',
'cat_id' => $this->cat_id 'cat_id' => $this->cat_id
)); ));
@ -461,8 +470,8 @@
if ($apps_cats) if ($apps_cats)
{ {
$GLOBALS['phpgw']->template->set_var('messages',lang('This category is currently being used by applications as a parent category') . '<br>' $GLOBALS['phpgw']->template->set_var('delete_msg',lang('This category is currently being used by applications as a parent category') . '<br>'
. lang('You will need to remove the subcategories before you can delete this 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('lang_subs','');
$GLOBALS['phpgw']->template->set_var('subs',''); $GLOBALS['phpgw']->template->set_var('subs','');
@ -474,7 +483,7 @@
} }
else 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 $exists = $this->bo->exists(array
( (

View File

@ -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 change main screen message admin de Nachricht der Startseite ändern
create group admin de Erstelle Gruppe create group admin de Erstelle Gruppe
display admin de Bezeichnung display admin de Bezeichnung
do you want to delete all global subcategories ? admin de Wollen Sie alle globalen Unterkategorien l&ouml;schen ? do you want to delete all global subcategories ? admin de M&ouml;chten Sie alle globalen Unterkategorien l&ouml;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 move all global subcategories one level down ? admin de M&ouml;chten Sie alle globalen Unterkategorien um einen Level nach unten verschieben ?
edit application admin de Anwendung bearbeiten edit application admin de Anwendung bearbeiten
edit global category admin de Globale Kategorie bearbeiten edit global category admin de Globale Kategorie bearbeiten
edit global category for x admin de Globale Kategorie f&uuml;r %1 bearbeiten edit global category for x admin de Globale Kategorie f&uuml;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 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&szlig;w&ouml;rter stimmen nicht &uuml;berein the two passwords are not the same admin de Die beiden Pa&szlig;w&ouml;rter stimmen nicht &uuml;berein
they must be removed before you can continue admin de Sie müssen zuvor aus dieser entfernt werden 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&auml;rtig als &uuml;bergeordnete Kategorie benutzt. This category is currently being used by applications as a parent category admin de Diese Kategorie wird gegenw&auml;rtig von Anwendungen als &uuml;bergeordnete Kategorie benutzt.
You will need to remove the subcategories before you can delete this category admin de Sie m&uuml;ssen erst die Unterkategorien l&ouml;schen befor Sie diese Kategorie l&ouml;schen k&ouml;nnen ! you will need to reassign these subcategories before you can delete this category admin de Sie m&uuml;ssen die Unterkategorien neu zuordnen, befor Sie diese Kategorie l&ouml;schen k&ouml;nnen !
total records admin de Anzahl Datensätze insgesamt total records admin de Anzahl Datensätze insgesamt
user data admin de Benutzerdaten user data admin de Benutzerdaten
user accounts admin de Benutzerkonten 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 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 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 you must select a file type admin de Sie müssen einen Filetyp auswählen
userdata admin de Benutzerkonto userdata admin de Benutzerkonten

View File

@ -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 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 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 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 !

View File

@ -7,19 +7,19 @@
<table border="0" width="65%" cellpadding="2" cellspacing="2"> <table border="0" width="65%" cellpadding="2" cellspacing="2">
<form method="POST" action="{action_url}"> <form method="POST" action="{action_url}">
<tr> <tr>
<td align="center" colspan=2>{messages}</td> <td align="center" colspan="2">{delete_msg}</td>
</tr> </tr>
<tr> <tr>
<td align="center">{sub_select}</td> <td align="center" colspan="2">{sub_select}</td>
</tr> </tr>
<tr> <tr>
<td align="center"> <td>
<input type="submit" name="confirm" value="{lang_yes}"></td> <input type="submit" name="confirm" value="{lang_yes}">
</form> </form>
</td> </td>
<td align="center"> <td align="right">
<form method="POST" action="{nolink}"> <form method="POST" action="{nolink}">
<input type="submit" name="cancel" value="{lang_no}"></td> <input type="submit" name="cancel" value="{lang_no}">
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -57,7 +57,7 @@
$this->app_name = $app_name; $this->app_name = $app_name;
$this->db = $GLOBALS['phpgw']->db; $this->db = $GLOBALS['phpgw']->db;
$this->grants = $GLOBALS['phpgw']->acl->get_grants($app_name); $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 'mains': $s = " AND cat_parent = '0'"; break;
case 'appandmains': $s = " AND cat_appname='" . $this->app_name . "' 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 '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; default: return False;
} }
return $s; return $s;

View File

@ -96,7 +96,8 @@ default category common de Standard-Kategorie
delete common de Löschen delete common de Löschen
description common de Beschreibung description common de Beschreibung
disabled common de Deaktiviert disabled common de Deaktiviert
do you also want to delete all subcategories ? common de Wollen Sie auch alle Unterkategorien l&ouml;schen ? do you want to delete all subcategories ? common de M&ouml;chten Sie alle Unterkategorien l&ouml;schen ?
do you want to move all subcategories one level down ? common de M&ouml;chten Sie alle Unterkategorien um einen Level nach unten verschieben ?
done common de Fertig done common de Fertig
e-mail common de E-Mail e-mail common de E-Mail
edit common de Editieren edit common de Editieren

View File

@ -103,7 +103,8 @@ detail common en Detail
details common en Details details common en Details
disabled common en Disabled disabled common en Disabled
djibouti common en DJIBOUTI 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 dominica common en DOMINICA
dominican republic common en DOMINICAN REPUBLIC dominican republic common en DOMINICAN REPUBLIC
done common en Done done common en Done

View File

@ -96,9 +96,7 @@
function exists($data) function exists($data)
{ {
$data['type'] = $data['type'] ? $data['type'] : ''; return $this->cats->exists($data);
$data['cat_id'] = $data['cat_id'] ? $data['cat_id'] : '';
return $this->cats->exists($data['type'],$data['cat_name'],$data['cat_id']);
} }
function formatted_list($format,$type,$cat_parent,$global_cats) function formatted_list($format,$type,$cat_parent,$global_cats)
@ -106,9 +104,9 @@
return $this->cats->formated_list($format,$type,$cat_parent,$global_cats); 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) function check_values($values)

View File

@ -32,6 +32,7 @@
function uicategories() function uicategories()
{ {
$this->bo = CreateObject('preferences.bocategories',$cats_app); $this->bo = CreateObject('preferences.bocategories',$cats_app);
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
$this->account = $GLOBALS['phpgw_info']['user']['account_id']; $this->account = $GLOBALS['phpgw_info']['user']['account_id'];
@ -85,7 +86,11 @@
function index() 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 $link_data = array
( (
@ -258,7 +263,11 @@
function add() 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 $link_data = array
( (
@ -269,37 +278,19 @@
'cats_level' => $cats_level 'cats_level' => $cats_level
); );
$GLOBALS['phpgw']->common->phpgw_header();
$new_parent = get_var('new_parent',Array('POST')); $new_parent = get_var('new_parent',Array('POST'));
$submit = get_var('submit',Array('POST'));
$cat_parent = get_var('cat_parent',Array('GET','POST')); $cat_parent = get_var('cat_parent',Array('GET','POST'));
$cat_name = get_var('cat_name',Array('POST')); $cat_name = get_var('cat_name',Array('POST'));
$cat_description = get_var('cat_description',Array('POST')); $cat_description = get_var('cat_description',Array('POST'));
$cat_data = get_var('cat_data',Array('POST')); $cat_data = get_var('cat_data',Array('POST'));
$cat_access = get_var('cat_access',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) if ($new_parent)
{ {
$cat_parent = $new_parent; $cat_parent = $new_parent;
} }
if (!$global_cats) if (get_var('submit',Array('POST')))
{
$global_cats = False;
}
if ($submit)
{ {
$data = serialize($cat_data); $data = serialize($cat_data);
@ -315,19 +306,35 @@
$error = $this->bo->check_values($values); $error = $this->bo->check_values($values);
if (is_array($error)) if (is_array($error))
{ {
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); $message = $GLOBALS['phpgw']->common->error_list($error);
} }
else else
{ {
$this->bo->save_cat($values); $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('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('lang_app',lang($cats_app));
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data)); $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
if (!$global_cats)
{
$global_cats = False;
}
if ($cats_level) if ($cats_level)
{ {
$type = 'all'; $type = 'all';
@ -342,7 +349,7 @@
$GLOBALS['phpgw']->template->set_var('cat_description',$cat_description); $GLOBALS['phpgw']->template->set_var('cat_description',$cat_description);
$GLOBALS['phpgw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"' $GLOBALS['phpgw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"'
. ($cat_access == True ?' checked':'') . '>'); . ($cat_access == True ?' checked':'') . '>');
if ($extra) if ($extra)
{ {
@ -364,7 +371,11 @@
function edit() 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 $link_data = array
( (
@ -381,37 +392,19 @@
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',$link_data)); Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',$link_data));
} }
$GLOBALS['phpgw']->common->phpgw_header();
$new_parent = get_var('new_parent',Array('POST')); $new_parent = get_var('new_parent',Array('POST'));
$submit = get_var('submit',Array('POST'));
$cat_parent = get_var('cat_parent',Array('POST')); $cat_parent = get_var('cat_parent',Array('POST'));
$cat_name = get_var('cat_name',Array('POST')); $cat_name = get_var('cat_name',Array('POST'));
$cat_description = get_var('cat_description',Array('POST')); $cat_description = get_var('cat_description',Array('POST'));
$cat_data = get_var('cat_data',Array('POST')); $cat_data = get_var('cat_data',Array('POST'));
$cat_access = get_var('cat_access',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) if ($new_parent)
{ {
$cat_parent = $new_parent; $cat_parent = $new_parent;
} }
if (!$global_cats) if (get_var('submit',Array('POST')))
{
$global_cats = False;
}
if ($submit)
{ {
$data = serialize($cat_data); $data = serialize($cat_data);
@ -428,25 +421,43 @@
$error = $this->bo->check_values($values); $error = $this->bo->check_values($values);
if (is_array($error)) if (is_array($error))
{ {
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); $message = $GLOBALS['phpgw']->common->error_list($error);
} }
else else
{ {
$this->bo->save_cat($values); $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); $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('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('lang_app',lang($cats_app));
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
$link_data['menuaction'] = 'preferences.uicategories.edit'; $link_data['menuaction'] = 'preferences.uicategories.edit';
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data)); $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_name',$GLOBALS['phpgw']->strip_html($cats[0]['name']));
$GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats[0]['description'])); $GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats[0]['description']));
if (!$global_cats)
{
$global_cats = False;
}
if ($cats_level) if ($cats_level)
{ {
$type = 'all'; $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('category_list',$this->bo->cats->formated_list('select',$type,$cats[0]['parent'],$global_cats));
$GLOBALS['phpgw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"' $GLOBALS['phpgw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"'
. ($cats[0]['access'] == private ?' checked':'') . '>'); . ($cats[0]['access'] == private ?' checked':'') . '>');
if ($extra) if ($extra)
{ {
@ -478,7 +489,7 @@
{ {
$link_data['menuaction'] = 'preferences.uicategories.delete'; $link_data['menuaction'] = 'preferences.uicategories.delete';
$GLOBALS['phpgw']->template->set_var('delete','<form method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data) $GLOBALS['phpgw']->template->set_var('delete','<form method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data)
. '"><input type="submit" value="' . lang('Delete') .'"></form>'); . '"><input type="submit" value="' . lang('Delete') .'"></form>');
} }
else else
{ {
@ -491,7 +502,11 @@
function delete() 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 $link_data = array
( (
@ -510,53 +525,51 @@
$this->bo->cats->app_name = $cats_app; $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')); $sub_select = '<input type="radio" name="subs" value="move">' . lang('Do you want to move all subcategories one level down ?') . '<br>';
$sub_select .= '<input type="radio" name="subs" value="drop">' . lang('Do you want to delete all subcategories ?');
$nolink = $GLOBALS['phpgw']->link('/index.php',$link_data); $GLOBALS['phpgw']->template->set_var('sub_select',$sub_select);
$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','<input type="checkbox" name="subs" value="True">');
}
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');
} }
$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');
} }
} }
?> ?>

View File

@ -5,7 +5,7 @@
<center> <center>
<table border="0" width="80%" cellspacing="2" cellpadding="2"> <table border="0" width="80%" cellspacing="2" cellpadding="2">
<tr> <tr>
<td colspan="1" align="center" bgcolor="#c9c9c9"><b>{title_categories}:&nbsp;{user_name}<b/></td> <td align="center" bgcolor="#c9c9c9"><b>{title_categories}:&nbsp;{user_name}<b/></td>
</tr> </tr>
</table> </table>
{message} {message}
@ -16,19 +16,19 @@
<td><select name="new_parent"><option value="">{lang_none}</option>{category_list}</select></td> <td><select name="new_parent"><option value="">{lang_none}</option>{category_list}</select></td>
</tr> </tr>
<tr> <tr>
<td>{lang_name}</font></td> <td>{lang_name}</td>
<td><input name="cat_name" size="50" value="{cat_name}"></td> <td><input name="cat_name" size="50" value="{cat_name}"></td>
</tr> </tr>
<tr> <tr>
<td>{lang_descr}</td> <td>{lang_descr}</td>
<td colspan="2"><textarea name="cat_description" rows="4" cols="50" wrap="virtual">{cat_description}</textarea></td> <td><textarea name="cat_description" rows="4" cols="50" wrap="virtual">{cat_description}</textarea></td>
</tr> </tr>
{rows} {rows}
<tr> <tr>
<td>{lang_access}</td> <td>{lang_access}</td>
<td colspan="2">{access}</td> <td>{access}</td>
</tr> </tr>
</table> </table>
@ -40,13 +40,13 @@
<!-- BEGIN add --> <!-- BEGIN add -->
<table width="50%" border="0" cellspacing="2" cellpadding="2"> <table width="80%" border="0" cellspacing="2" cellpadding="2">
<tr valign="bottom"> <tr valign="bottom">
<td height="50" align="right"> <td height="50">
<input type="submit" name="submit" value="{lang_save}"></td> <input type="submit" name="submit" value="{lang_save}"></td>
<td height="50" align="center"> <td height="50" align="center">
<input type="reset" name="reset" value="{lang_reset}"></form></td> <input type="reset" name="reset" value="{lang_reset}"></form></td>
<td height="50"> <td height="50" align="right">
<form method="POST" action="{doneurl}"> <form method="POST" action="{doneurl}">
<input type="submit" name="done" value="{lang_done}"></form></td> <input type="submit" name="done" value="{lang_done}"></form></td>
</tr> </tr>
@ -56,13 +56,13 @@
<!-- BEGIN edit --> <!-- BEGIN edit -->
<table width="50%" border="0" cellspacing="2" cellpadding="2"> <table width="80%" border="0" cellspacing="2" cellpadding="2">
<tr valign="bottom"> <tr valign="bottom">
<td height="50" align="right"> <td height="50">
<input type="submit" name="submit" value="{lang_save}"></form></td> <input type="submit" name="submit" value="{lang_save}"></form></td>
<td height="50" align="center"> <td height="50" align="center">
{delete}</td> {delete}</td>
<td height="50"> <td height="50" align="right">
<form method="POST" action="{doneurl}"> <form method="POST" action="{doneurl}">
<input type="submit" name="done" value="{lang_done}"></form></td> <input type="submit" name="done" value="{lang_done}"></form></td>
</tr> </tr>

View File

@ -3,23 +3,23 @@
<!-- BEGIN form --> <!-- BEGIN form -->
<center> <center>
{error_msg}
<table border="0" width="65%" cellpadding="2" cellspacing="2"> <table border="0" width="65%" cellpadding="2" cellspacing="2">
<form method="POST" action="{action_url}">
<tr> <tr>
<td align="center" colspan=2>{deleteheader}</td> <td align="center" colspan="2">{deleteheader}</td>
</tr> </tr>
<tr> <tr>
<td align="center">{lang_subs}</td> <td align="center" colspan="2">{sub_select}</td>
<td align="center">{subs}</td>
</tr> </tr>
<tr> <tr>
<td align="center"> <td>
<form method="POST" action="{action_url}"> <input type="submit" name="confirm" value="{lang_yes}">
<input type="submit" name="confirm" value="{lang_yes}"></td>
</form> </form>
</td> </td>
<td align="center"> <td align="right">
<form method="POST" action="{nolink}"> <form method="POST" action="{nolink}">
<input type="submit" name="cancel" value="{lang_no}"></td> <input type="submit" name="cancel" value="{lang_no}">
</form> </form>
</td> </td>
</tr> </tr>