update edit_cats to move the subtree with the cat if the parent changes

This commit is contained in:
ceb 2002-10-12 20:45:27 +00:00
parent 31825455e7
commit 6b1588ada5
3 changed files with 31 additions and 15 deletions

View File

@ -133,7 +133,7 @@
function formatted_list($data)
{
if ($data['global_cats'])
if ($data['globals'])
{
return $this->cats->formated_list($data['select'],$data['all'],$data['parent'],True);
}

View File

@ -152,9 +152,8 @@
$tr_color = $this->nextmatchs->alternate_row_color($tr_color);
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
$id = $categories[$i]['cat_id'];
$level = $categories[$i]['level'];
$cat_name = $GLOBALS['phpgw']->strip_html($categories[$i]['name']);
$level = $categories[$i]['level'];
$cat_name = $GLOBALS['phpgw']->strip_html($categories[$i]['name']);
if ($level > 0)
{
@ -188,7 +187,7 @@
));
$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('lang_sub_entry',lang('Add sub'));
@ -207,7 +206,7 @@
if ($show_edit_del)
{
$link_data['cat_id'] = $id;
$link_data['cat_id'] = $categories[$i]['cat_id'];
$link_data['menuaction'] = 'admin.uicategories.edit';
$GLOBALS['phpgw']->template->set_var('edit',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('lang_edit_entry',lang('Edit'));
@ -227,7 +226,7 @@
}
$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));
$this->save_sessiondata();
@ -236,7 +235,8 @@
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
(
@ -289,10 +289,15 @@
$link_data['menuaction'] = 'admin.uicategories.add';
$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',
'all' => 'all',
'parent' => $values['parent'],
'global_cats' => $global_cats)));
if ($values['parent'])
{
$parent = $values['parent'];
}
$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_description',$values['descr']);
@ -348,7 +353,7 @@
else
{
$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']));
}
}

View File

@ -218,6 +218,7 @@
if ($cats[$i]['owner'] == $this->account || $cats[$i]['app_name'] == 'phpgw')
{
$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('lang_sub_entry',lang('Add sub'));
}
@ -250,6 +251,7 @@
$GLOBALS['phpgw']->template->fp('rows','cat_row',True);
}
$link_data['menuaction'] = 'preferences.uicategories.add';
$link_data['parent'] = '';
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
$this->save_sessiondata($cats_app);
@ -273,6 +275,7 @@
);
$values = get_var('values',array('POST'));
$parent = get_var('parent',array('GET'));
$cat_data = get_var('cat_data',array('POST'));
if (get_var('submit',Array('POST')))
@ -328,7 +331,15 @@
$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_description',$values['descr']);
@ -339,7 +350,7 @@
$edata = explode(',',$extra);
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->fp('rows','data_row',True);
}