mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-12 17:08:34 +01:00
update cats
This commit is contained in:
parent
76daa312c3
commit
8bc7d387ce
@ -93,17 +93,19 @@
|
||||
function get_list()
|
||||
{
|
||||
if($this->debug) { echo '<br>querying: "' . $this->query . '"'; }
|
||||
return $this->cats->return_array('all',$this->start,True,$this->query,$this->sort,$this->order,True);
|
||||
return $this->cats->return_sorted_array($this->start,True,$this->query,$this->sort,$this->order,True);
|
||||
}
|
||||
|
||||
function edit($data)
|
||||
function save_cat($values)
|
||||
{
|
||||
return $this->cats->edit($data);
|
||||
}
|
||||
|
||||
function add($data)
|
||||
{
|
||||
return $this->cats->add($data);
|
||||
if ($values['id'] && $values['id'] != 0)
|
||||
{
|
||||
return $this->cats->edit($values);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->cats->add($values);
|
||||
}
|
||||
}
|
||||
|
||||
function exists($data)
|
||||
@ -122,4 +124,48 @@
|
||||
{
|
||||
return $this->cats->delete($cat_id,$subs);
|
||||
}
|
||||
|
||||
function check_values($values)
|
||||
{
|
||||
if (strlen($values['descr']) >= 255)
|
||||
{
|
||||
$error[] = lang('Description can not exceed 255 characters in length !');
|
||||
}
|
||||
|
||||
if (!$values['name'])
|
||||
{
|
||||
$error[] = lang('Please enter a name');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$values['cat_parent'])
|
||||
{
|
||||
$exists = $this->exists(array
|
||||
(
|
||||
'type' => 'appandmains',
|
||||
'cat_name' => $values['name'],
|
||||
'cat_id' => $values['id']
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$exists = $this->exists(array
|
||||
(
|
||||
'type' => 'appandsubs',
|
||||
'cat_name' => $values['name'],
|
||||
'cat_id' => $values['id']
|
||||
));
|
||||
}
|
||||
|
||||
if ($exists == True)
|
||||
{
|
||||
$error[] = lang('That name has been used already');
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($error))
|
||||
{
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class uicategories
|
||||
@ -24,24 +23,25 @@
|
||||
var $cat_id;
|
||||
var $debug = False;
|
||||
|
||||
var $public_functions = array(
|
||||
var $public_functions = array
|
||||
(
|
||||
'index' => True,
|
||||
'add' => True,
|
||||
'edit' => True,
|
||||
'delete' => True
|
||||
);
|
||||
|
||||
|
||||
function uicategories()
|
||||
{
|
||||
$this->bo = CreateObject('admin.bocategories');
|
||||
$this->template = $GLOBALS['phpgw']->template;
|
||||
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||
$this->bo = CreateObject('admin.bocategories');
|
||||
$this->template = $GLOBALS['phpgw']->template;
|
||||
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||
|
||||
$this->start = $this->bo->start;
|
||||
$this->query = $this->bo->query;
|
||||
$this->sort = $this->bo->sort;
|
||||
$this->order = $this->bo->order;
|
||||
$this->cat_id = $this->bo->cat_id;
|
||||
$this->start = $this->bo->start;
|
||||
$this->query = $this->bo->query;
|
||||
$this->sort = $this->bo->sort;
|
||||
$this->order = $this->bo->order;
|
||||
$this->cat_id = $this->bo->cat_id;
|
||||
if($this->debug) { $this->_debug_sqsof(); }
|
||||
}
|
||||
|
||||
@ -74,33 +74,38 @@
|
||||
$this->bo->save_sessiondata($data);
|
||||
}
|
||||
|
||||
function set_langs()
|
||||
{
|
||||
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
|
||||
$this->template->set_var('lang_save',lang('Save'));
|
||||
$this->template->set_var('lang_search',lang('Search'));
|
||||
$this->template->set_var('lang_sub',lang('Add sub'));
|
||||
$this->template->set_var('lang_edit',lang('Edit'));
|
||||
$this->template->set_var('lang_delete',lang('Delete'));
|
||||
$this->template->set_var('lang_parent',lang('Parent category'));
|
||||
$this->template->set_var('lang_none',lang('None'));
|
||||
$this->template->set_var('lang_name',lang('Name'));
|
||||
$this->template->set_var('lang_descr',lang('Description'));
|
||||
$this->template->set_var('lang_add',lang('Add'));
|
||||
$this->template->set_var('lang_reset',lang('Clear Form'));
|
||||
$this->template->set_var('lang_done',lang('Done'));
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$this->template->set_file(array(
|
||||
'cat_list_t' => 'listcats.tpl',
|
||||
'cat_list' => 'listcats.tpl'
|
||||
));
|
||||
$this->template->set_file(array('cat_list_t' => 'listcats.tpl'));
|
||||
$this->template->set_block('cat_list_t','cat_list','list');
|
||||
|
||||
/*
|
||||
$common_hidden_vars = '<input type="hidden" name="sort" value="' . $this->sort . '">' . "\n"
|
||||
. '<input type="hidden" name="order" value="' . $this->order . '">' . "\n"
|
||||
. '<input type="hidden" name="query" value="' . $this->query . '">' . "\n"
|
||||
. '<input type="hidden" name="start" value="' . $this->start . '">' . "\n"
|
||||
. '<input type="hidden" name="filter" value="' . $this->filter . '">' . "\n";
|
||||
*/
|
||||
$this->set_langs();
|
||||
|
||||
$this->template->set_var('lang_action',lang('Category list'));
|
||||
$this->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.add'));
|
||||
$this->template->set_var('lang_add',lang('Add'));
|
||||
$this->template->set_var('title_categories',lang('Global categories'));
|
||||
$this->template->set_var('lang_search',lang('Search'));
|
||||
$this->template->set_var('query',$this->query);
|
||||
$this->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'));
|
||||
$this->template->set_var('lang_done',lang('Done'));
|
||||
$this->template->set_var('doneurl',$GLOBALS['phpgw']->link('/admin/index.php'));
|
||||
|
||||
if(!$start)
|
||||
@ -118,12 +123,8 @@
|
||||
|
||||
$this->template->set_var('lang_showing',$this->nextmatchs->show_hits($this->bo->cats->total_records,$this->start));
|
||||
|
||||
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
|
||||
$this->template->set_var('sort_name',$this->nextmatchs->show_sort_order($this->sort,'cat_name',$this->order,'/index.php',lang('Name'),'&menuaction=admin.uicategories.index'));
|
||||
$this->template->set_var('sort_description',$this->nextmatchs->show_sort_order($this->sort,'cat_description',$this->order,'/index.php',lang('Description'),'&menuaction=admin.uicategories.index'));
|
||||
$this->template->set_var('lang_sub',lang('Add sub'));
|
||||
$this->template->set_var('lang_edit',lang('Edit'));
|
||||
$this->template->set_var('lang_delete',lang('Delete'));
|
||||
|
||||
for ($i=0;$i<count($categories);$i++)
|
||||
{
|
||||
@ -159,13 +160,11 @@
|
||||
$this->template->set_var('delete',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.delete&cat_id=' . $id));
|
||||
$this->template->set_var('lang_delete_entry',lang('Delete'));
|
||||
|
||||
$this->template->parse('list','cat_list',True);
|
||||
$this->template->fp('list','cat_list',True);
|
||||
}
|
||||
|
||||
$this->save_sessiondata();
|
||||
|
||||
$this->template->parse('out','cat_list_t',True);
|
||||
$this->template->p('out');
|
||||
$this->template->pfp('out','cat_list_t',True);
|
||||
}
|
||||
|
||||
function add()
|
||||
@ -173,6 +172,8 @@
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$this->set_langs();
|
||||
|
||||
$new_parent = $GLOBALS['HTTP_POST_VARS']['new_parent'];
|
||||
$submit = $GLOBALS['HTTP_POST_VARS']['submit'];
|
||||
$cat_parent = $GLOBALS['HTTP_POST_VARS']['cat_parent'] ? $GLOBALS['HTTP_POST_VARS']['cat_parent'] : $GLOBALS['HTTP_GET_VARS']['cat_parent'];
|
||||
@ -192,83 +193,39 @@
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$errorcount = 0;
|
||||
$values = array
|
||||
(
|
||||
'id' => '',
|
||||
'parent' => $cat_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'access' => 'public'
|
||||
);
|
||||
|
||||
if (!$cat_name)
|
||||
$error = $this->bo->check_values($values);
|
||||
if (is_array($error))
|
||||
{
|
||||
$error[$errorcount++] = lang('Please enter a name');
|
||||
$this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
else
|
||||
{
|
||||
if (!$cat_parent)
|
||||
{
|
||||
$exists = $this->bo->exists(array(
|
||||
'type' => 'appandmains',
|
||||
'cat_name' => $cat_name,
|
||||
'cat_id' => ''
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$exists = $this->bo->exists(array(
|
||||
'type' => 'appandsubs',
|
||||
'cat_name' => $cat_name,
|
||||
'cat_id' => ''
|
||||
));
|
||||
}
|
||||
|
||||
if ($exists == True)
|
||||
{
|
||||
$error[$errorcount++] = lang('That name has been used already');
|
||||
}
|
||||
$this->bo->save_cat($values);
|
||||
$this->template->set_var('message',lang('Category x has been added !', $cat_name));
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$this->bo->add(array(
|
||||
'parent' => $cat_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'access' => 'public'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if ($errorcount)
|
||||
{
|
||||
$this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
|
||||
}
|
||||
|
||||
if (($submit) && (! $error) && (! $errorcount))
|
||||
{
|
||||
$this->template->set_var('message',lang('Category x has been added !', $cat_name));
|
||||
}
|
||||
|
||||
if ((! $submit) && (! $error) && (! $errorcount))
|
||||
{
|
||||
$this->template->set_var('message','');
|
||||
}
|
||||
|
||||
$this->template->set_var('title_categories',lang('Add global category'));
|
||||
$this->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.add'));
|
||||
$this->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'));
|
||||
$this->template->set_var('hidden_vars','<input type="hidden" name="cat_id" value="' . $this->cat_id . '">');
|
||||
$this->template->set_var('lang_parent',lang('Parent category'));
|
||||
$this->template->set_var('lang_none',lang('None'));
|
||||
$this->template->set_var('category_list',$this->bo->formatted_list(array('select' => 'select','all' => 'all','cat_parent' => $cat_parent)));
|
||||
$this->template->set_var('lang_name',lang('Name'));
|
||||
$this->template->set_var('lang_descr',lang('Description'));
|
||||
$this->template->set_var('cat_name',$cat_name);
|
||||
$this->template->set_var('cat_description',$cat_description);
|
||||
$this->template->set_var('lang_add',lang('Add'));
|
||||
$this->template->set_var('lang_reset',lang('Clear Form'));
|
||||
$this->template->set_var('lang_done',lang('Done'));
|
||||
|
||||
$this->template->set_var('edithandle','');
|
||||
$this->template->set_var('addhandle','');
|
||||
$this->template->pparse('out','form');
|
||||
$this->template->pparse('addhandle','add');
|
||||
$this->template->pfp('out','form');
|
||||
$this->template->pfp('addhandle','add');
|
||||
}
|
||||
|
||||
function edit()
|
||||
@ -281,6 +238,8 @@
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$this->set_langs();
|
||||
|
||||
$new_parent = $GLOBALS['HTTP_POST_VARS']['new_parent'];
|
||||
$submit = $GLOBALS['HTTP_POST_VARS']['submit'];
|
||||
$cat_parent = $GLOBALS['HTTP_POST_VARS']['cat_parent'];
|
||||
@ -302,79 +261,34 @@
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$errorcount = 0;
|
||||
$values = array
|
||||
(
|
||||
'id' => $this->cat_id,
|
||||
'parent' => $cat_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'access' => 'public'
|
||||
);
|
||||
|
||||
if (!$cat_name)
|
||||
$error = $this->bo->check_values($values);
|
||||
if (is_array($error))
|
||||
{
|
||||
$error[$errorcount++] = lang('Please enter a name');
|
||||
$this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
else
|
||||
{
|
||||
if (!$cat_parent)
|
||||
{
|
||||
$exists = $this->bo->exists(array(
|
||||
'type' => 'appandmains',
|
||||
'cat_name' => $cat_name,
|
||||
'cat_id' => $this->cat_id
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$exists = $this->bo->exists(array(
|
||||
'type' => 'appandsubs',
|
||||
'cat_name' => $cat_name,
|
||||
'cat_id' => $this->cat_id
|
||||
));
|
||||
}
|
||||
|
||||
if ($exists == True)
|
||||
{
|
||||
$error[$errorcount++] = lang('That name has been used already');
|
||||
}
|
||||
$this->bo->save_cat($values);
|
||||
$this->template->set_var('message',lang('Category x has been updated !',$cat_name));
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$this->bo->cats->edit(array(
|
||||
'access' => 'public',
|
||||
'parent' => $cat_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'id' => $this->cat_id
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if ($errorcount)
|
||||
{
|
||||
$this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
|
||||
}
|
||||
|
||||
if (($submit) && (!$error) && (!$errorcount))
|
||||
{
|
||||
$this->template->set_var('message',lang('Category x has been updated !',$cat_name));
|
||||
}
|
||||
|
||||
if ((!$submit) && (!$error) && (!$errorcount))
|
||||
{
|
||||
$this->template->set_var('message','');
|
||||
}
|
||||
|
||||
$cats = $this->bo->cats->return_single($this->cat_id);
|
||||
|
||||
$this->template->set_var('title_categories',lang('Edit global category'));
|
||||
$this->template->set_var('lang_parent',lang('Parent category'));
|
||||
$this->template->set_var('lang_none',lang('None'));
|
||||
$this->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.edit'));
|
||||
$this->template->set_var('deleteurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.delete&cat_id=' . $this->cat_id));
|
||||
$this->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'));
|
||||
$this->template->set_var('hidden_vars',$hidden_vars);
|
||||
$this->template->set_var('lang_name',lang('Name'));
|
||||
$this->template->set_var('lang_descr',lang('Description'));
|
||||
$this->template->set_var('lang_done',lang('Done'));
|
||||
$this->template->set_var('lang_edit',lang('Edit'));
|
||||
$this->template->set_var('lang_delete',lang('Delete'));
|
||||
|
||||
$this->template->set_var('cat_name',$GLOBALS['phpgw']->strip_html($cats[0]['name']));
|
||||
$this->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats[0]['description']));
|
||||
@ -382,8 +296,8 @@
|
||||
|
||||
$this->template->set_var('edithandle','');
|
||||
$this->template->set_var('addhandle','');
|
||||
$this->template->pparse('out','form');
|
||||
$this->template->pparse('edithandle','edit');
|
||||
$this->template->pfp('out','form');
|
||||
$this->template->pfp('edithandle','edit');
|
||||
}
|
||||
|
||||
function delete()
|
||||
@ -434,11 +348,10 @@
|
||||
$this->template->set_var('lang_subs','');
|
||||
$this->template->set_var('subs','');
|
||||
$this->template->set_var('nolink',$nolink);
|
||||
$this->template->set_var('lang_done',lang('Done'));
|
||||
$this->template->set_var('deletehandle','');
|
||||
$this->template->set_var('donehandle','');
|
||||
$this->template->pparse('out','category_delete');
|
||||
$this->template->pparse('donehandle','done');
|
||||
$this->template->pfp('out','category_delete');
|
||||
$this->template->pfp('donehandle','done');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -467,8 +380,8 @@
|
||||
$this->template->set_var('lang_yes',lang('Yes'));
|
||||
$this->template->set_var('deletehandle','');
|
||||
$this->template->set_var('donehandle','');
|
||||
$this->template->pparse('out','category_delete');
|
||||
$this->template->pparse('deletehandle','delete');
|
||||
$this->template->pfp('out','category_delete');
|
||||
$this->template->pfp('deletehandle','delete');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,65 +2,65 @@
|
||||
|
||||
<!-- BEGIN form -->
|
||||
|
||||
<div align="center">
|
||||
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
||||
<tr>
|
||||
<td colspan="1" align="center" bgcolor="#c9c9c9"><b>{title_categories}<b/></td>
|
||||
</tr>
|
||||
</table>
|
||||
{message}
|
||||
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
||||
<form name="form" action="{actionurl}" method="POST">
|
||||
<tr>
|
||||
<td>{lang_parent}</td>
|
||||
<td><select name="new_parent"><option value="">{lang_none}</option>{category_list}</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{lang_name}:</td>
|
||||
<td><input name="cat_name" size="50" value="{cat_name}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{lang_descr}:</td>
|
||||
<td colspan=2><textarea name="cat_description" rows="4" cols="50" wrap="virtual">{cat_description}</textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div align="center">
|
||||
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
||||
<tr>
|
||||
<td colspan="1" align="center" bgcolor="#c9c9c9"><b>{title_categories}<b/></td>
|
||||
</tr>
|
||||
</table>
|
||||
{message}
|
||||
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
||||
<form name="form" action="{actionurl}" method="POST">
|
||||
<tr>
|
||||
<td>{lang_parent}</td>
|
||||
<td><select name="new_parent"><option value="">{lang_none}</option>{category_list}</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{lang_name}:</td>
|
||||
<td><input name="cat_name" size="50" value="{cat_name}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{lang_descr}:</td>
|
||||
<td colspan="2"><textarea name="cat_description" rows="4" cols="50" wrap="virtual">{cat_description}</textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- BEGIN add -->
|
||||
|
||||
<table width="50%" border="0" cellspacing="2" cellpadding="2">
|
||||
<tr valign="bottom">
|
||||
<td height="50" align="center">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="submit" value="{lang_add}"></td>
|
||||
<td height="50" align="center">
|
||||
<input type="reset" name="reset" value="{lang_reset}"></form></td>
|
||||
<td height="50" align="center">
|
||||
<form method="POST" action="{doneurl}">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="done" value="{lang_done}"></form></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="50%" border="0" cellspacing="2" cellpadding="2">
|
||||
<tr valign="bottom">
|
||||
<td height="50" align="center">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="submit" value="{lang_save}"></td>
|
||||
<td height="50" align="center">
|
||||
<input type="reset" name="reset" value="{lang_reset}"></form></td>
|
||||
<td height="50" align="center">
|
||||
<form method="POST" action="{doneurl}">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="done" value="{lang_done}"></form></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- END add -->
|
||||
|
||||
<!-- BEGIN edit -->
|
||||
|
||||
<table width="50%" border="0" cellspacing="2" cellpadding="2">
|
||||
<tr valign="bottom">
|
||||
<td height="50" align="center">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="submit" value="{lang_edit}"></form></td>
|
||||
<td height="50" align="center">
|
||||
<form method="POST" action="{deleteurl}">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="delete" value="{lang_delete}"></form></td>
|
||||
<td height="50" align="center">
|
||||
<form method="POST" action="{doneurl}">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="done" value="{lang_done}"></form></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<table width="50%" border="0" cellspacing="2" cellpadding="2">
|
||||
<tr valign="bottom">
|
||||
<td height="50" align="center">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="submit" value="{lang_save}"></form></td>
|
||||
<td height="50" align="center">
|
||||
<form method="POST" action="{deleteurl}">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="delete" value="{lang_delete}"></form></td>
|
||||
<td height="50" align="center">
|
||||
<form method="POST" action="{doneurl}">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="done" value="{lang_done}"></form></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- END edit -->
|
||||
|
||||
|
@ -111,23 +111,13 @@
|
||||
return $this->cats->delete($cat_id,$subs);
|
||||
}
|
||||
|
||||
function check_values($action,$values)
|
||||
function check_values($values)
|
||||
{
|
||||
if ($action == 'add')
|
||||
{
|
||||
$values['id'] = '';
|
||||
}
|
||||
|
||||
if (strlen($values['descr']) >= 255)
|
||||
{
|
||||
$error[] = lang('Description can not exceed 255 characters in length !');
|
||||
}
|
||||
|
||||
if (strlen($values['data']) >= 8000)
|
||||
{
|
||||
$error[] = lang('Data can not exceed 8000 characters in length !');
|
||||
}
|
||||
|
||||
if (!$values['name'])
|
||||
{
|
||||
$error[] = lang('Please enter a name');
|
||||
|
@ -273,14 +273,17 @@
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$values = array();
|
||||
$values['parent'] = $cat_parent;
|
||||
$values['descr'] = $cat_description;
|
||||
$values['name'] = $cat_name;
|
||||
$values['access'] = $cat_access;
|
||||
$values['data'] = $cat_data;
|
||||
$values = array
|
||||
(
|
||||
'id' => '',
|
||||
'parent' => $cat_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'access' => $cat_access,
|
||||
'data' => $cat_data
|
||||
);
|
||||
|
||||
$error = $this->bo->check_values('add',$values);
|
||||
$error = $this->bo->check_values($values);
|
||||
if (is_array($error))
|
||||
{
|
||||
$this->t->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
|
||||
@ -390,15 +393,17 @@
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$values = array();
|
||||
$values['id'] = $cat_id;
|
||||
$values['parent'] = $cat_parent;
|
||||
$values['descr'] = $cat_description;
|
||||
$values['name'] = $cat_name;
|
||||
$values['access'] = $cat_access;
|
||||
$values['data'] = $cat_data;
|
||||
$values = array
|
||||
(
|
||||
'id' => $cat_id,
|
||||
'parent' => $cat_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'access' => $cat_access,
|
||||
'data' => $cat_data
|
||||
);
|
||||
|
||||
$error = $this->bo->check_values('edit',$values);
|
||||
$error = $this->bo->check_values($values);
|
||||
if (is_array($error))
|
||||
{
|
||||
$this->t->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
|
||||
@ -507,7 +512,7 @@
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$this->t->set_var('messages',lang('Are you sure you want to delete this category ?'));
|
||||
$this->t->set_var('deleteheader',lang('Are you sure you want to delete this category ?'));
|
||||
|
||||
$exists = $this->bo->exists(array
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user