forked from extern/egroupware
fix for bug 1286
This commit is contained in:
parent
d9815720e3
commit
0ae563ca08
@ -340,15 +340,13 @@
|
|||||||
$cat_parent = $GLOBALS['HTTP_POST_VARS']['cat_parent'];
|
$cat_parent = $GLOBALS['HTTP_POST_VARS']['cat_parent'];
|
||||||
$cat_name = $GLOBALS['HTTP_POST_VARS']['cat_name'];
|
$cat_name = $GLOBALS['HTTP_POST_VARS']['cat_name'];
|
||||||
$cat_description = $GLOBALS['HTTP_POST_VARS']['cat_description'];
|
$cat_description = $GLOBALS['HTTP_POST_VARS']['cat_description'];
|
||||||
|
$old_parent = $GLOBALS['HTTP_POST_VARS']['old_parent'];
|
||||||
|
|
||||||
$GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl'));
|
$GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl'));
|
||||||
$GLOBALS['phpgw']->template->set_block('cat_form','add');
|
$GLOBALS['phpgw']->template->set_block('cat_form','add');
|
||||||
$GLOBALS['phpgw']->template->set_block('cat_form','edit');
|
$GLOBALS['phpgw']->template->set_block('cat_form','edit');
|
||||||
$GLOBALS['phpgw']->template->set_block('cat_form','form');
|
$GLOBALS['phpgw']->template->set_block('cat_form','form');
|
||||||
|
|
||||||
|
|
||||||
$hidden_vars = '<input type="hidden" name="cat_id" value="' . $this->cat_id . '">' . "\n";
|
|
||||||
$GLOBALS['phpgw']->template->set_var('hidden_vars',$hidden_vars);
|
|
||||||
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||||
|
|
||||||
if ($new_parent)
|
if ($new_parent)
|
||||||
@ -361,6 +359,7 @@
|
|||||||
$values = array
|
$values = array
|
||||||
(
|
(
|
||||||
'id' => $this->cat_id,
|
'id' => $this->cat_id,
|
||||||
|
'old_parent' => $old_parent,
|
||||||
'parent' => $cat_parent,
|
'parent' => $cat_parent,
|
||||||
'descr' => $cat_description,
|
'descr' => $cat_description,
|
||||||
'name' => $cat_name,
|
'name' => $cat_name,
|
||||||
@ -374,7 +373,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->bo->save_cat($values);
|
$this->cat_id = $this->bo->save_cat($values);
|
||||||
$GLOBALS['phpgw']->template->set_var('message',lang('Category x has been updated !',$cat_name));
|
$GLOBALS['phpgw']->template->set_var('message',lang('Category x has been updated !',$cat_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,6 +389,10 @@
|
|||||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global category'));
|
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global category'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hidden_vars = '<input type="hidden" name="cat_id" value="' . $this->cat_id . '">' . "\n"
|
||||||
|
. '<input type="hidden" name="old_parent" value="' . $cats[0]['parent'] . '">' . "\n";
|
||||||
|
$GLOBALS['phpgw']->template->set_var('hidden_vars',$hidden_vars);
|
||||||
|
|
||||||
$link_data['menuaction'] = 'admin.uicategories.edit';
|
$link_data['menuaction'] = 'admin.uicategories.edit';
|
||||||
$link_data['cat_id'] = $this->cat_id;
|
$link_data['cat_id'] = $this->cat_id;
|
||||||
$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));
|
||||||
@ -398,13 +401,10 @@
|
|||||||
|
|
||||||
$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']));
|
||||||
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->formatted_list(array(
|
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->formatted_list(array('select' => 'select',
|
||||||
'select' => 'select',
|
|
||||||
'all' => 'all',
|
'all' => 'all',
|
||||||
'cat_parent' => $cats[0]['parent'],
|
'cat_parent' => $cats[0]['parent'],
|
||||||
'global_cats' => $global_cats
|
'global_cats' => $global_cats)));
|
||||||
)));
|
|
||||||
|
|
||||||
$GLOBALS['phpgw']->template->parse('buttons','edit');
|
$GLOBALS['phpgw']->template->parse('buttons','edit');
|
||||||
$GLOBALS['phpgw']->template->fp('phpgw_body','form');
|
$GLOBALS['phpgw']->template->fp('phpgw_body','form');
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</SCRIPT>
|
</SCRIPT>
|
||||||
<div style="width: 100%; height: 100%; overflow: auto;">
|
|
||||||
<table width="75%" border="0" cellspacing="0" cellpadding="0">
|
<table width="75%" border="0" cellspacing="0" cellpadding="0">
|
||||||
{rows}
|
{rows}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
<!-- END list -->
|
<!-- END list -->
|
||||||
|
|
||||||
<!-- BEGIN app_row -->
|
<!-- BEGIN app_row -->
|
||||||
|
@ -649,26 +649,35 @@
|
|||||||
*/
|
*/
|
||||||
function edit($cat_values)
|
function edit($cat_values)
|
||||||
{
|
{
|
||||||
if ($cat_values['parent'] && ($cat_values['parent'] != 0))
|
if (intval($cat_values['old_parent']) != $cat_values['parent'])
|
||||||
{
|
{
|
||||||
$cat_values['main'] = $this->id2name($cat_values['parent'],'main');
|
$this->delete(array('cat_id' => $cat_values['id'],'drop_subs' => False,'modify_subs' => True));
|
||||||
$cat_values['level'] = $this->id2name($cat_values['parent'],'level')+1;
|
return $this->add($cat_values);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cat_values['main'] = $cat_values['id'];
|
if ($cat_values['parent'] && ($cat_values['parent'] != 0))
|
||||||
|
{
|
||||||
|
$cat_values['main'] = intval($this->id2name($cat_values['parent'],'main'));
|
||||||
|
$cat_values['level'] = intval($this->id2name($cat_values['parent'],'level')+1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cat_values['main'] = intval($cat_values['id']);
|
||||||
$cat_values['level'] = 0;
|
$cat_values['level'] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$cat_values['descr'] = $this->db->db_addslashes($cat_values['descr']);
|
$cat_values['descr'] = $this->db->db_addslashes($cat_values['descr']);
|
||||||
$cat_values['name'] = $this->db->db_addslashes($cat_values['name']);
|
$cat_values['name'] = $this->db->db_addslashes($cat_values['name']);
|
||||||
|
|
||||||
$sql = "UPDATE phpgw_categories SET cat_name='" . $cat_values['name'] . "', cat_description='" . $cat_values['descr']
|
$sql = "UPDATE phpgw_categories SET cat_name='" . $cat_values['name'] . "', cat_description='" . $cat_values['descr']
|
||||||
. "', cat_data='" . $cat_values['data'] . "', cat_parent='" . $cat_values['parent'] . "', cat_access='"
|
. "', cat_data='" . $cat_values['data'] . "', cat_parent=" . $cat_values['parent'] . ", cat_access='"
|
||||||
. $cat_values['access'] . "', cat_main='" . $cat_values['main'] . "', cat_level='" . $cat_values['level'] . "' "
|
. $cat_values['access'] . "', cat_main=" . $cat_values['main'] . ", cat_level=" . $cat_values['level']
|
||||||
. "WHERE cat_appname='" . $this->app_name . "' AND cat_id='" . $cat_values['id'] . "'";
|
. " WHERE cat_appname='" . $this->app_name . "' AND cat_id=" . intval($cat_values['id']);
|
||||||
|
|
||||||
$this->db->query($sql,__LINE__,__FILE__);
|
$this->db->query($sql,__LINE__,__FILE__);
|
||||||
|
return intval($cat_values['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function name2id($cat_name)
|
function name2id($cat_name)
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
class uicategories
|
class uicategories
|
||||||
{
|
{
|
||||||
var $bo;
|
var $bo;
|
||||||
var $t;
|
|
||||||
|
|
||||||
var $start;
|
var $start;
|
||||||
var $query;
|
var $query;
|
||||||
@ -32,6 +31,7 @@
|
|||||||
|
|
||||||
function uicategories()
|
function uicategories()
|
||||||
{
|
{
|
||||||
|
$cats_app = get_var('cats_app',array('POST','GET'));
|
||||||
|
|
||||||
$this->bo = CreateObject('preferences.bocategories',$cats_app);
|
$this->bo = CreateObject('preferences.bocategories',$cats_app);
|
||||||
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||||
@ -398,6 +398,7 @@
|
|||||||
$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'));
|
||||||
|
$old_parent = get_var('old_parent',array('POST'));
|
||||||
|
|
||||||
if ($new_parent)
|
if ($new_parent)
|
||||||
{
|
{
|
||||||
@ -412,6 +413,7 @@
|
|||||||
(
|
(
|
||||||
'id' => $cat_id,
|
'id' => $cat_id,
|
||||||
'parent' => $cat_parent,
|
'parent' => $cat_parent,
|
||||||
|
'old_parent' => $old_parent,
|
||||||
'descr' => $cat_description,
|
'descr' => $cat_description,
|
||||||
'name' => $cat_name,
|
'name' => $cat_name,
|
||||||
'access' => $cat_access,
|
'access' => $cat_access,
|
||||||
@ -425,7 +427,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->bo->save_cat($values);
|
$cat_id = $this->bo->save_cat($values);
|
||||||
$message = lang('Category x has been updated !',$cat_name);
|
$message = lang('Category x has been updated !',$cat_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -442,6 +444,8 @@
|
|||||||
|
|
||||||
$cats = $this->bo->cats->return_single($cat_id);
|
$cats = $this->bo->cats->return_single($cat_id);
|
||||||
|
|
||||||
|
$GLOBALS['phpgw']->template->set_var('hidden_vars','<input type="hidden" name="old_parent" value="' . $cats[0]['parent'] . '">');
|
||||||
|
|
||||||
$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('message',$message);
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_app',lang($cats_app));
|
$GLOBALS['phpgw']->template->set_var('lang_app',lang($cats_app));
|
||||||
|
@ -28,6 +28,3 @@ time format preferences en Time format
|
|||||||
your current theme is: x preferences en </b>
|
your current theme is: x preferences en </b>
|
||||||
you must enter a password preferences en You must enter a password
|
you must enter a password preferences en You must enter a password
|
||||||
your preferences preferences en Your Preferences
|
your preferences preferences en Your Preferences
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
<table width="80%" border="0" cellspacing="2" cellpadding="2">
|
<table width="80%" border="0" cellspacing="2" cellpadding="2">
|
||||||
<tr valign="bottom">
|
<tr valign="bottom">
|
||||||
<td height="50">
|
<td height="50">
|
||||||
|
{hidden_vars}
|
||||||
<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>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<!-- BEGIN list -->
|
<!-- BEGIN list -->
|
||||||
<div style="width: 100%; height: 100%; overflow: auto;">
|
|
||||||
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left">{tabs}</td>
|
<td align="left">{tabs}</td>
|
||||||
@ -9,7 +8,6 @@
|
|||||||
<table width="75%" border="0" cellspacing="0" cellpadding="0">
|
<table width="75%" border="0" cellspacing="0" cellpadding="0">
|
||||||
{rows}
|
{rows}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
<!-- END list -->
|
<!-- END list -->
|
||||||
|
|
||||||
<!-- BEGIN app_row -->
|
<!-- BEGIN app_row -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user