forked from extern/egroupware
update edit_cats to move the subtree with the cat if the parent changes
This commit is contained in:
parent
31825455e7
commit
6b1588ada5
@ -133,7 +133,7 @@
|
|||||||
|
|
||||||
function formatted_list($data)
|
function formatted_list($data)
|
||||||
{
|
{
|
||||||
if ($data['global_cats'])
|
if ($data['globals'])
|
||||||
{
|
{
|
||||||
return $this->cats->formated_list($data['select'],$data['all'],$data['parent'],True);
|
return $this->cats->formated_list($data['select'],$data['all'],$data['parent'],True);
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,6 @@
|
|||||||
$tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
$tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
||||||
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
|
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
|
||||||
|
|
||||||
$id = $categories[$i]['cat_id'];
|
|
||||||
$level = $categories[$i]['level'];
|
$level = $categories[$i]['level'];
|
||||||
$cat_name = $GLOBALS['phpgw']->strip_html($categories[$i]['name']);
|
$cat_name = $GLOBALS['phpgw']->strip_html($categories[$i]['name']);
|
||||||
|
|
||||||
@ -188,7 +187,7 @@
|
|||||||
));
|
));
|
||||||
|
|
||||||
$link_data['menuaction'] = 'admin.uicategories.add';
|
$link_data['menuaction'] = 'admin.uicategories.add';
|
||||||
$link_data['cat_parent'] = $id;
|
$link_data['parent'] = $categories[$i]['cat_id'];
|
||||||
$GLOBALS['phpgw']->template->set_var('add_sub',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
$GLOBALS['phpgw']->template->set_var('add_sub',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_sub_entry',lang('Add sub'));
|
$GLOBALS['phpgw']->template->set_var('lang_sub_entry',lang('Add sub'));
|
||||||
|
|
||||||
@ -207,7 +206,7 @@
|
|||||||
|
|
||||||
if ($show_edit_del)
|
if ($show_edit_del)
|
||||||
{
|
{
|
||||||
$link_data['cat_id'] = $id;
|
$link_data['cat_id'] = $categories[$i]['cat_id'];
|
||||||
$link_data['menuaction'] = 'admin.uicategories.edit';
|
$link_data['menuaction'] = 'admin.uicategories.edit';
|
||||||
$GLOBALS['phpgw']->template->set_var('edit',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
$GLOBALS['phpgw']->template->set_var('edit',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_edit_entry',lang('Edit'));
|
$GLOBALS['phpgw']->template->set_var('lang_edit_entry',lang('Edit'));
|
||||||
@ -227,7 +226,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$link_data['menuaction'] = 'admin.uicategories.add';
|
$link_data['menuaction'] = 'admin.uicategories.add';
|
||||||
$link_data['cat_parent'] = '';
|
$link_data['parent'] = '';
|
||||||
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||||
|
|
||||||
$this->save_sessiondata();
|
$this->save_sessiondata();
|
||||||
@ -237,6 +236,7 @@
|
|||||||
function add()
|
function add()
|
||||||
{
|
{
|
||||||
$global_cats = get_var('global_cats',array('POST','GET'));
|
$global_cats = get_var('global_cats',array('POST','GET'));
|
||||||
|
$parent = get_var('parent',array('GET'));
|
||||||
|
|
||||||
$link_data = array
|
$link_data = array
|
||||||
(
|
(
|
||||||
@ -289,10 +289,15 @@
|
|||||||
$link_data['menuaction'] = 'admin.uicategories.add';
|
$link_data['menuaction'] = 'admin.uicategories.add';
|
||||||
$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('category_list',$this->bo->formatted_list(array('select' => 'select',
|
if ($values['parent'])
|
||||||
'all' => 'all',
|
{
|
||||||
'parent' => $values['parent'],
|
$parent = $values['parent'];
|
||||||
'global_cats' => $global_cats)));
|
}
|
||||||
|
|
||||||
|
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formated_list(array('format' => 'select',
|
||||||
|
'type' => 'all',
|
||||||
|
'selected' => $parent,
|
||||||
|
'globals' => $global_cats)));
|
||||||
|
|
||||||
$GLOBALS['phpgw']->template->set_var('cat_name',$values['name']);
|
$GLOBALS['phpgw']->template->set_var('cat_name',$values['name']);
|
||||||
$GLOBALS['phpgw']->template->set_var('cat_description',$values['descr']);
|
$GLOBALS['phpgw']->template->set_var('cat_description',$values['descr']);
|
||||||
@ -348,7 +353,7 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->cat_id = $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 !',$values['name']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,6 +218,7 @@
|
|||||||
if ($cats[$i]['owner'] == $this->account || $cats[$i]['app_name'] == 'phpgw')
|
if ($cats[$i]['owner'] == $this->account || $cats[$i]['app_name'] == 'phpgw')
|
||||||
{
|
{
|
||||||
$link_data['menuaction'] = 'preferences.uicategories.add';
|
$link_data['menuaction'] = 'preferences.uicategories.add';
|
||||||
|
$link_data['parent'] = $cats[$i]['cat_id'];
|
||||||
$GLOBALS['phpgw']->template->set_var('add_sub',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
$GLOBALS['phpgw']->template->set_var('add_sub',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_sub_entry',lang('Add sub'));
|
$GLOBALS['phpgw']->template->set_var('lang_sub_entry',lang('Add sub'));
|
||||||
}
|
}
|
||||||
@ -250,6 +251,7 @@
|
|||||||
$GLOBALS['phpgw']->template->fp('rows','cat_row',True);
|
$GLOBALS['phpgw']->template->fp('rows','cat_row',True);
|
||||||
}
|
}
|
||||||
$link_data['menuaction'] = 'preferences.uicategories.add';
|
$link_data['menuaction'] = 'preferences.uicategories.add';
|
||||||
|
$link_data['parent'] = '';
|
||||||
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||||
$this->save_sessiondata($cats_app);
|
$this->save_sessiondata($cats_app);
|
||||||
|
|
||||||
@ -273,6 +275,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
$values = get_var('values',array('POST'));
|
$values = get_var('values',array('POST'));
|
||||||
|
$parent = get_var('parent',array('GET'));
|
||||||
$cat_data = get_var('cat_data',array('POST'));
|
$cat_data = get_var('cat_data',array('POST'));
|
||||||
|
|
||||||
if (get_var('submit',Array('POST')))
|
if (get_var('submit',Array('POST')))
|
||||||
@ -328,7 +331,15 @@
|
|||||||
$type = 'mains';
|
$type = 'mains';
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formated_list('select',$type,$values['parent'],$global_cats));
|
if ($values['parent'])
|
||||||
|
{
|
||||||
|
$parent = $values['parent'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formatted_list(array('format' => 'select',
|
||||||
|
'type' => $type,
|
||||||
|
'selected' => $parent,
|
||||||
|
'globals' => $global_cats)));
|
||||||
$GLOBALS['phpgw']->template->set_var('cat_name',$values['name']);
|
$GLOBALS['phpgw']->template->set_var('cat_name',$values['name']);
|
||||||
$GLOBALS['phpgw']->template->set_var('cat_description',$values['descr']);
|
$GLOBALS['phpgw']->template->set_var('cat_description',$values['descr']);
|
||||||
|
|
||||||
@ -339,7 +350,7 @@
|
|||||||
$edata = explode(',',$extra);
|
$edata = explode(',',$extra);
|
||||||
for($i=0;$i<count($edata);$i++)
|
for($i=0;$i<count($edata);$i++)
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->template->set_var('td_data','<input name="cat_data[' . $edata[$i] . ']" size="50" value="' . $cat_data[$edata[$i]] . '">');
|
$GLOBALS['phpgw']->template->set_var('td_data$categories[$i]['cat_id']$categories[$i]['cat_id']','<input name="cat_data[' . $edata[$i] . ']" size="50" value="' . $cat_data[$edata[$i]] . '">');
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_data',lang($edata[$i]));
|
$GLOBALS['phpgw']->template->set_var('lang_data',lang($edata[$i]));
|
||||||
$GLOBALS['phpgw']->template->fp('rows','data_row',True);
|
$GLOBALS['phpgw']->template->fp('rows','data_row',True);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user