forked from extern/egroupware
update categories
This commit is contained in:
parent
dea0ac49a9
commit
da44fa8c19
@ -9,74 +9,101 @@
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info['flags']['currentapp'] = 'admin';
|
||||
include('../header.inc.php');
|
||||
$phpgw_info['flags']['currentapp'] = 'admin';
|
||||
include('../header.inc.php');
|
||||
|
||||
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$t->set_file(array('form' => 'category_form.tpl'));
|
||||
$t->set_block('form','add','addhandle');
|
||||
$t->set_block('form','edit','edithandle');
|
||||
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$t->set_file(array('form' => 'category_form.tpl'));
|
||||
$t->set_block('form','add','addhandle');
|
||||
$t->set_block('form','edit','edithandle');
|
||||
|
||||
$c = CreateObject('phpgwapi.categories');
|
||||
$c->categories($phpgw_info['user']['account_id'],'phpgw');
|
||||
$c = CreateObject('phpgwapi.categories');
|
||||
$c->app_name = 'phpgw';
|
||||
|
||||
if ($submit)
|
||||
if ($submit)
|
||||
{
|
||||
$errorcount = 0;
|
||||
|
||||
if (!$cat_name)
|
||||
{
|
||||
$errorcount = 0;
|
||||
|
||||
if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); }
|
||||
if (!$error)
|
||||
{
|
||||
if (!$cat_parent) { $exists = $c->exists('mains',$cat_name,$cat_id=''); }
|
||||
else { $exists = $c->exists('subs',$cat_name,$cat_id=''); }
|
||||
if ($exists == True) { $error[$errorcount++] = lang('That category name has been used already !'); }
|
||||
}
|
||||
|
||||
if ($cat_main && $cat_parent)
|
||||
{
|
||||
$main = $c->return_main($cat_parent);
|
||||
if ($main != $cat_main) { $error[$errorcount++] = lang('You selected an invalid main category !'); }
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$cat_name = addslashes($cat_name);
|
||||
$cat_description = addslashes($cat_description);
|
||||
$cat_access = 'public';
|
||||
|
||||
$c->add($cat_name,$cat_parent,$cat_description,$cat_data,$cat_access,$cat_main);
|
||||
}
|
||||
$error[$errorcount++] = lang('Please enter a name for that category !');
|
||||
}
|
||||
|
||||
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',''); }
|
||||
if (!$error)
|
||||
{
|
||||
if (!$cat_parent)
|
||||
{
|
||||
$exists = $c->exists('appandmains',$cat_name,$cat_id='');
|
||||
}
|
||||
else
|
||||
{
|
||||
$exists = $c->exists('appandsubs',$cat_name,$cat_id='');
|
||||
}
|
||||
|
||||
$t->set_var('title_categories',lang('Add global category'));
|
||||
$t->set_var('actionurl',$phpgw->link('/admin/addcategory.php'));
|
||||
$t->set_var('doneurl',$phpgw->link('/admin/categories.php'));
|
||||
$t->set_var('hidden_vars','<input type="hidden" name="cat_id" value="' . $cat_id . '">');
|
||||
if ($exists == True)
|
||||
{
|
||||
$error[$errorcount++] = lang('That category name has been used already !');
|
||||
}
|
||||
}
|
||||
|
||||
$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));
|
||||
$t->set_var('lang_parent',lang('Parent category'));
|
||||
$t->set_var('lang_select_parent',lang('Select parent category'));
|
||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
|
||||
$t->set_var('lang_name',lang('Category name'));
|
||||
$t->set_var('lang_descr',lang('Category description'));
|
||||
$t->set_var('cat_name',$cat_name);
|
||||
$t->set_var('cat_description',$cat_description);
|
||||
$t->set_var('lang_add',lang('Add'));
|
||||
$t->set_var('lang_reset',lang('Clear Form'));
|
||||
$t->set_var('lang_done',lang('Done'));
|
||||
if ($cat_main && $cat_parent)
|
||||
{
|
||||
$main = $c->return_main($cat_parent);
|
||||
if ($main != $cat_main)
|
||||
{
|
||||
$error[$errorcount++] = lang('You selected an invalid main category !');
|
||||
}
|
||||
}
|
||||
|
||||
$t->set_var('edithandle','');
|
||||
$t->set_var('addhandle','');
|
||||
$t->pparse('out','form');
|
||||
$t->pparse('addhandle','add');
|
||||
if (!$error)
|
||||
{
|
||||
$cat_name = addslashes($cat_name);
|
||||
$cat_description = addslashes($cat_description);
|
||||
$cat_access = 'public';
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
$c->add($cat_name,$cat_parent,$cat_description,$cat_data,$cat_access,$cat_main);
|
||||
}
|
||||
}
|
||||
|
||||
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','');
|
||||
}
|
||||
|
||||
$t->set_var('title_categories',lang('Add global category'));
|
||||
$t->set_var('actionurl',$phpgw->link('/admin/addcategory.php'));
|
||||
$t->set_var('doneurl',$phpgw->link('/admin/categories.php'));
|
||||
$t->set_var('hidden_vars','<input type="hidden" name="cat_id" value="' . $cat_id . '">');
|
||||
$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));
|
||||
$t->set_var('lang_parent',lang('Parent category'));
|
||||
$t->set_var('lang_select_parent',lang('Select parent category'));
|
||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
|
||||
$t->set_var('lang_name',lang('Category name'));
|
||||
$t->set_var('lang_descr',lang('Category description'));
|
||||
$t->set_var('cat_name',$cat_name);
|
||||
$t->set_var('cat_description',$cat_description);
|
||||
$t->set_var('lang_add',lang('Add'));
|
||||
$t->set_var('lang_reset',lang('Clear Form'));
|
||||
$t->set_var('lang_done',lang('Done'));
|
||||
|
||||
$t->set_var('edithandle','');
|
||||
$t->set_var('addhandle','');
|
||||
$t->pparse('out','form');
|
||||
$t->pparse('addhandle','add');
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
@ -11,137 +11,138 @@
|
||||
\**************************************************************************/
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info['flags'] = array(
|
||||
'currentapp' => 'admin',
|
||||
'enable_nextmatchs_class' => True
|
||||
);
|
||||
$phpgw_info['flags'] = array('currentapp' => 'admin',
|
||||
'enable_nextmatchs_class' => True);
|
||||
|
||||
include('../header.inc.php');
|
||||
include('../header.inc.php');
|
||||
|
||||
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
|
||||
$t->set_file(array(
|
||||
'cat_list_t' => 'listcats.tpl',
|
||||
'cat_list' => 'listcats.tpl'
|
||||
));
|
||||
$t->set_block('cat_list_t','cat_list','list');
|
||||
$t->set_file(array('cat_list_t' => 'listcats.tpl',
|
||||
'cat_list' => 'listcats.tpl'));
|
||||
$t->set_block('cat_list_t','cat_list','list');
|
||||
|
||||
$common_hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n"
|
||||
$common_hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n"
|
||||
. "<input type=\"hidden\" name=\"order\" value=\"$order\">\n"
|
||||
. "<input type=\"hidden\" name=\"query\" value=\"$query\">\n"
|
||||
. "<input type=\"hidden\" name=\"start\" value=\"$start\">\n"
|
||||
. "<input type=\"hidden\" name=\"filter\" value=\"$filter\">\n";
|
||||
|
||||
$t->set_var('lang_action',lang('Category list'));
|
||||
$t->set_var('add_action',$phpgw->link('/admin/addcategory.php'));
|
||||
$t->set_var('lang_add',lang('Add'));
|
||||
$t->set_var('title_categories',lang('Global categories'));
|
||||
$t->set_var('lang_search',lang('Search'));
|
||||
$t->set_var('actionurl',$phpgw->link('/admin/categories.php'));
|
||||
$t->set_var('lang_done',lang('Done'));
|
||||
$t->set_var('doneurl',$phpgw->link('/admin/index.php'));
|
||||
$t->set_var('lang_action',lang('Category list'));
|
||||
$t->set_var('add_action',$phpgw->link('/admin/addcategory.php'));
|
||||
$t->set_var('lang_add',lang('Add'));
|
||||
$t->set_var('title_categories',lang('Global categories'));
|
||||
$t->set_var('lang_search',lang('Search'));
|
||||
$t->set_var('actionurl',$phpgw->link('/admin/categories.php'));
|
||||
$t->set_var('lang_done',lang('Done'));
|
||||
$t->set_var('doneurl',$phpgw->link('/admin/index.php'));
|
||||
|
||||
if (! $start) { $start = 0; }
|
||||
if (! $start) { $start = 0; }
|
||||
|
||||
if($phpgw_info['user']['preferences']['common']['maxmatchs'] && $phpgw_info['user']['preferences']['common']['maxmatchs'] > 0)
|
||||
if($phpgw_info['user']['preferences']['common']['maxmatchs'] && $phpgw_info['user']['preferences']['common']['maxmatchs'] > 0)
|
||||
{
|
||||
$limit = $phpgw_info['user']['preferences']['common']['maxmatchs'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$limit = 15;
|
||||
}
|
||||
|
||||
$c = CreateObject('phpgwapi.categories');
|
||||
$c->categories($phpgw_info['user']['account_id'],'phpgw');
|
||||
$categories = $c->return_array('all',$start,$limit,$query,$sort,$order);
|
||||
|
||||
//--------------------------------- nextmatch --------------------------------------------
|
||||
|
||||
$left = $phpgw->nextmatchs->left('/admin/categories.php',$start,$c->total_records);
|
||||
$right = $phpgw->nextmatchs->right('/admin/categories.php',$start,$c->total_records);
|
||||
$t->set_var('left',$left);
|
||||
$t->set_var('right',$right);
|
||||
|
||||
if ($c->total_records > $limit)
|
||||
{
|
||||
$lang_showing=lang('showing x - x of x',($start + 1),($start + $limit),$c->total_records);
|
||||
}
|
||||
else
|
||||
{
|
||||
$lang_showing=lang('showing x',$c->total_records);
|
||||
}
|
||||
$t->set_var('lang_showing',$lang_showing);
|
||||
|
||||
// ------------------------------ 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,'/admin/categories.php',lang('Name')));
|
||||
$t->set_var('sort_description',$phpgw->nextmatchs->show_sort_order($sort,'cat_description',$order,'/admin/categories.php',lang('Description')));
|
||||
$t->set_var('lang_edit',lang('Edit'));
|
||||
$t->set_var('lang_delete',lang('Delete'));
|
||||
|
||||
// -------------------------- end header declaration --------------------------------------
|
||||
|
||||
for ($i=0;$i<count($categories);$i++)
|
||||
{
|
||||
if ($categories[$i]['owner'] == $phpgw_info['user']['account_id'] && $categories[$i]['app_name'] == 'phpgw')
|
||||
{
|
||||
$limit = $phpgw_info['user']['preferences']['common']['maxmatchs'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$limit = 15;
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
$t->set_var(tr_color,$tr_color);
|
||||
|
||||
$cat_id = $categories[$i]['id'];
|
||||
$owner = $categories[$i]['owner'];
|
||||
$space = ' ';
|
||||
$level = $categories[$i]['level'];
|
||||
|
||||
if ($level > 0)
|
||||
{
|
||||
$spaceset = str_repeat($space,$level);
|
||||
$name = $spaceset . $phpgw->strip_html($categories[$i]['name']);
|
||||
}
|
||||
|
||||
$descr = $phpgw->strip_html($categories[$i]['description']);
|
||||
if (!$descr) { $descr = ' '; }
|
||||
|
||||
if ($level == 0)
|
||||
{
|
||||
$name = '<font color="FF0000"><b>' . $phpgw->strip_html($categories[$i]['name']) . '</b></font>';
|
||||
$descr = '<font color="FF0000"><b>' . $descr . '</b></font>';
|
||||
}
|
||||
|
||||
//-------------------------- template declaration for list records ---------------------------
|
||||
|
||||
$t->set_var(array('name' => $name,
|
||||
'descr' => $descr));
|
||||
|
||||
if ($categories[$i]['owner'] == $phpgw_info['user']['account_id'])
|
||||
{
|
||||
$t->set_var('edit',$phpgw->link('/admin/editcategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
||||
$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('/admin/deletecategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
||||
$t->set_var('lang_delete_entry',lang('Delete'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('delete','');
|
||||
$t->set_var('lang_delete_entry',' ');
|
||||
}
|
||||
|
||||
$t->parse('list','cat_list',True);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------- end record declaration -----------------------------------------
|
||||
|
||||
$c = CreateObject('phpgwapi.categories');
|
||||
$c->categories($phpgw_info['user']['account_id'],'phpgw');
|
||||
$categories = $c->return_array('all',$start,$limit,$query,$sort,$order);
|
||||
$t->parse('out','cat_list_t',True);
|
||||
$t->p('out');
|
||||
|
||||
//--------------------------------- nextmatch --------------------------------------------
|
||||
$left = $phpgw->nextmatchs->left('/admin/categories.php',$start,$c->total_records);
|
||||
$right = $phpgw->nextmatchs->right('/admin/categories.php',$start,$c->total_records);
|
||||
$t->set_var('left',$left);
|
||||
$t->set_var('right',$right);
|
||||
|
||||
if ($c->total_records > $limit)
|
||||
{
|
||||
$lang_showing=lang('showing x - x of x',($start + 1),($start + $limit),$c->total_records);
|
||||
}
|
||||
else
|
||||
{
|
||||
$lang_showing=lang('showing x',$c->total_records);
|
||||
}
|
||||
$t->set_var('lang_showing',$lang_showing);
|
||||
|
||||
// ------------------------------ 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,'/admin/categories.php',lang('Name')));
|
||||
$t->set_var('sort_description',$phpgw->nextmatchs->show_sort_order($sort,'cat_description',$order,'/admin/categories.php',lang('Description')));
|
||||
$t->set_var('lang_edit',lang('Edit'));
|
||||
$t->set_var('lang_delete',lang('Delete'));
|
||||
// -------------------------- end header declaration --------------------------------------
|
||||
|
||||
for ($i=0;$i<count($categories);$i++)
|
||||
{
|
||||
if ($categories[$i]['owner'] == $phpgw_info['user']['account_id'] && $categories[$i]['app_name'] == 'phpgw')
|
||||
{
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
$t->set_var(tr_color,$tr_color);
|
||||
|
||||
$cat_id = $categories[$i]['id'];
|
||||
$owner = $categories[$i]['owner'];
|
||||
$space = ' ';
|
||||
$level = $categories[$i]['level'];
|
||||
|
||||
if ($level > 0)
|
||||
{
|
||||
$spaceset = str_repeat($space,$level);
|
||||
$name = $spaceset . $phpgw->strip_html($categories[$i]['name']);
|
||||
}
|
||||
|
||||
$descr = $phpgw->strip_html($categories[$i]['description']);
|
||||
if (!$descr) { $descr = ' '; }
|
||||
|
||||
if ($level == 0)
|
||||
{
|
||||
$name = '<font color="FF0000"><b>' . $phpgw->strip_html($categories[$i]['name']) . '</b></font>';
|
||||
$descr = '<font color="FF0000"><b>' . $descr . '</b></font>';
|
||||
}
|
||||
|
||||
//-------------------------- template declaration for list records ---------------------------
|
||||
$t->set_var(array(
|
||||
'name' => $name,
|
||||
'descr' => $descr
|
||||
));
|
||||
|
||||
if ($categories[$i]["owner"] == $phpgw_info['user']['account_id'])
|
||||
{
|
||||
$t->set_var('edit',$phpgw->link('/admin/editcategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
||||
$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('/admin/deletecategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
||||
$t->set_var('lang_delete_entry',lang('Delete'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('delete','');
|
||||
$t->set_var('lang_delete_entry',' ');
|
||||
}
|
||||
$t->parse('list','cat_list',True);
|
||||
}
|
||||
}
|
||||
// ---------------------------- end record declaration -----------------------------------------
|
||||
|
||||
$t->parse('out','cat_list_t',True);
|
||||
$t->p('out');
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
@ -11,91 +11,117 @@
|
||||
\**************************************************************************/
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info['flags']['currentapp'] = 'admin';
|
||||
include('../header.inc.php');
|
||||
if (! $cat_id)
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('/admin/categories.php',"sort=$sort&order=$order&query=$query&start=$start"
|
||||
. "&filter=$filter"));
|
||||
}
|
||||
|
||||
if (! $cat_id)
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('/admin/categories.php',"sort=$sort&order=$order&query=$query&start=$start"
|
||||
. "&filter=$filter"));
|
||||
}
|
||||
$phpgw_info['flags']['currentapp'] = 'admin';
|
||||
include('../header.inc.php');
|
||||
|
||||
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$t->set_file(array('form' => 'category_form.tpl'));
|
||||
$t->set_block('form','add','addhandle');
|
||||
$t->set_block('form','edit','edithandle');
|
||||
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$t->set_file(array('form' => 'category_form.tpl'));
|
||||
$t->set_block('form','add','addhandle');
|
||||
$t->set_block('form','edit','edithandle');
|
||||
|
||||
$c = CreateObject('phpgwapi.categories');
|
||||
$c->categories($phpgw_info['user']['account_id'],'phpgw');
|
||||
$c = CreateObject('phpgwapi.categories');
|
||||
$c->app_name = 'phpgw';
|
||||
|
||||
$hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n"
|
||||
$hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n"
|
||||
. "<input type=\"hidden\" name=\"order\" value=\"$order\">\n"
|
||||
. "<input type=\"hidden\" name=\"query\" value=\"$query\">\n"
|
||||
. "<input type=\"hidden\" name=\"start\" value=\"$start\">\n"
|
||||
. "<input type=\"hidden\" name=\"filter\" value=\"$filter\">\n"
|
||||
. "<input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\">\n";
|
||||
|
||||
if ($submit)
|
||||
if ($submit)
|
||||
{
|
||||
$errorcount = 0;
|
||||
|
||||
if (!$cat_name)
|
||||
{
|
||||
$errorcount = 0;
|
||||
|
||||
if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); }
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$cat_parent) { $exists = $c->exists('mains',$cat_name,$cat_id); }
|
||||
else { $exists = $c->exists('subs',$cat_name,$cat_id); }
|
||||
if ($exists == True) { $error[$errorcount++] = lang('That category name has been used already !'); }
|
||||
}
|
||||
|
||||
if ($cat_main && $cat_parent)
|
||||
{
|
||||
$main = $c->return_main($cat_parent);
|
||||
if ($main != $cat_main) { $error[$errorcount++] = lang('You selected an invalid main category !'); }
|
||||
}
|
||||
|
||||
$cat_name = addslashes($cat_name);
|
||||
$cat_description = addslashes($cat_description);
|
||||
$cat_access = 'public';
|
||||
|
||||
if (! $error) { $c->edit($cat_id,$cat_parent,$cat_name,$cat_description,$cat_data,$cat_access,$cat_main); }
|
||||
$error[$errorcount++] = lang('Please enter a name for that category !');
|
||||
}
|
||||
|
||||
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
|
||||
if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang('Category x has been updated !',$cat_name)); }
|
||||
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
|
||||
if (!$error)
|
||||
{
|
||||
if (!$cat_parent)
|
||||
{
|
||||
$exists = $c->exists('appandmains',$cat_name,$cat_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$exists = $c->exists('appandsubs',$cat_name,$cat_id);
|
||||
}
|
||||
|
||||
$cats = $c->return_single($cat_id);
|
||||
if ($exists == True)
|
||||
{
|
||||
$error[$errorcount++] = lang('That category name has been used already !');
|
||||
}
|
||||
}
|
||||
|
||||
$t->set_var('title_categories',lang('Edit global category'));
|
||||
$t->set_var('lang_parent',lang('Parent category'));
|
||||
$t->set_var('lang_select_parent',lang('Select parent category'));
|
||||
$t->set_var('actionurl',$phpgw->link('/admin/editcategory.php'));
|
||||
$t->set_var('deleteurl',$phpgw->link('/admin/deletecategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
||||
$t->set_var('doneurl',$phpgw->link('/admin/categories.php',"start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
||||
if ($cat_main && $cat_parent)
|
||||
{
|
||||
$main = $c->return_main($cat_parent);
|
||||
if ($main != $cat_main)
|
||||
{
|
||||
$error[$errorcount++] = lang('You selected an invalid main category !');
|
||||
}
|
||||
}
|
||||
|
||||
$t->set_var('hidden_vars',$hidden_vars);
|
||||
$t->set_var('lang_name',lang('Category name'));
|
||||
$t->set_var('lang_descr',lang('Category description'));
|
||||
$t->set_var('lang_done',lang('Done'));
|
||||
$t->set_var('lang_edit',lang('Edit'));
|
||||
$t->set_var('lang_delete',lang('Delete'));
|
||||
$cat_name = addslashes($cat_name);
|
||||
$cat_description = addslashes($cat_description);
|
||||
$cat_access = 'public';
|
||||
|
||||
$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',$cats[0]['main']));
|
||||
if (! $error)
|
||||
{
|
||||
$c->edit($cat_id,$cat_parent,$cat_name,$cat_description,$cat_data,$cat_access,$cat_main);
|
||||
}
|
||||
}
|
||||
|
||||
$cat_id = $cats[0]['id'];
|
||||
if ($errorcount)
|
||||
{
|
||||
$t->set_var('message',$phpgw->common->error_list($error));
|
||||
}
|
||||
|
||||
$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('category_list',$c->formated_list('select','all',$cats[0]['parent']));
|
||||
if (($submit) && (! $error) && (! $errorcount))
|
||||
{
|
||||
$t->set_var('message',lang('Category x has been updated !',$cat_name));
|
||||
}
|
||||
|
||||
$t->set_var('edithandle','');
|
||||
$t->set_var('addhandle','');
|
||||
if ((! $submit) && (! $error) && (! $errorcount))
|
||||
{
|
||||
$t->set_var('message','');
|
||||
}
|
||||
|
||||
$t->pparse('out','form');
|
||||
$t->pparse('edithandle','edit');
|
||||
$cats = $c->return_single($cat_id);
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
$t->set_var('title_categories',lang('Edit global category'));
|
||||
$t->set_var('lang_parent',lang('Parent category'));
|
||||
$t->set_var('lang_select_parent',lang('Select parent category'));
|
||||
$t->set_var('actionurl',$phpgw->link('/admin/editcategory.php'));
|
||||
$t->set_var('deleteurl',$phpgw->link('/admin/deletecategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
||||
$t->set_var('doneurl',$phpgw->link('/admin/categories.php',"start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
||||
$t->set_var('hidden_vars',$hidden_vars);
|
||||
$t->set_var('lang_name',lang('Category name'));
|
||||
$t->set_var('lang_descr',lang('Category description'));
|
||||
$t->set_var('lang_done',lang('Done'));
|
||||
$t->set_var('lang_edit',lang('Edit'));
|
||||
$t->set_var('lang_delete',lang('Delete'));
|
||||
$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',$cats[0]['main']));
|
||||
|
||||
$cat_id = $cats[0]['id'];
|
||||
$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('category_list',$c->formated_list('select','all',$cats[0]['parent']));
|
||||
|
||||
$t->set_var('edithandle','');
|
||||
$t->set_var('addhandle','');
|
||||
$t->pparse('out','form');
|
||||
$t->pparse('edithandle','edit');
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user