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

This commit is contained in:
ceb 2002-10-12 18:01:39 +00:00
parent aac6b5e5f4
commit 22ff2988c7
4 changed files with 14 additions and 12 deletions

View File

@ -135,11 +135,11 @@
{ {
if ($data['global_cats']) if ($data['global_cats'])
{ {
return $this->cats->formated_list($data['select'],$data['all'],$data['cat_parent'],True); return $this->cats->formated_list($data['select'],$data['all'],$data['parent'],True);
} }
else else
{ {
return $this->cats->formated_list($data['select'],$data['all'],$data['cat_parent']); return $this->cats->formated_list($data['select'],$data['all'],$data['parent']);
} }
} }

View File

@ -341,6 +341,8 @@
$values['access'] = 'public'; $values['access'] = 'public';
} }
//_debug_array($values);
$error = $this->bo->check_values($values); $error = $this->bo->check_values($values);
if (is_array($error)) if (is_array($error))
{ {
@ -377,7 +379,7 @@
$GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats['descr'])); $GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats['descr']));
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->formatted_list(array('select' => 'select', $GLOBALS['phpgw']->template->set_var('category_list',$this->bo->formatted_list(array('select' => 'select',
'all' => 'all', 'all' => 'all',
'cat_parent' => $cats['parent'], 'parent' => $cats['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');

View File

@ -52,7 +52,7 @@
<table width="50%" border="0" cellspacing="2" cellpadding="2"> <table width="50%" border="0" cellspacing="2" cellpadding="2">
<tr valign="bottom"> <tr valign="bottom">
<td height="50" align="center"> <td height="50" align="center">
<input type="hidden" name="values[old_parent]" value="{cat_parent}"> <input type="hidden" name="values[old_parent]" value="{old_parent}">
<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">
<form method="POST" action="{deleteurl}"> <form method="POST" action="{deleteurl}">

View File

@ -395,8 +395,8 @@
{ {
for ($i=0;$i<count($cats);$i++) for ($i=0;$i<count($cats);$i++)
{ {
$s .= '<option value="' . $cats[$i]['id'] . '"'; $s .= '<option value="' . $cats[$i]['cat_id'] . '"';
if (in_array($cats[$i]['id'],$selected)) if (in_array($cats[$i]['cat_id'],$selected))
{ {
$s .= ' selected'; $s .= ' selected';
} }
@ -432,12 +432,12 @@
{ {
$image_set = '&nbsp;'; $image_set = '&nbsp;';
if (in_array($cats[$i]['id'],$selected)) if (in_array($cats[$i]['cat_id'],$selected))
{ {
$image_set = '<img src="' . $GLOBALS['phpgw']->common->image('phpgwapi','roter_pfeil') . '">'; $image_set = '<img src="' . $GLOBALS['phpgw']->common->image('phpgwapi','roter_pfeil') . '">';
} }
if (($cats[$i]['level'] == 0) && !in_array($cats[$i]['id'],$selected)) if (($cats[$i]['level'] == 0) && !in_array($cats[$i]['cat_id'],$selected))
{ {
$image_set = '<img src="' . $GLOBALS['phpgw']->common->image('phpgwapi','grauer_pfeil') . '">'; $image_set = '<img src="' . $GLOBALS['phpgw']->common->image('phpgwapi','grauer_pfeil') . '">';
} }
@ -446,7 +446,7 @@
$s .= '<tr>' . "\n"; $s .= '<tr>' . "\n";
$s .= '<td width="8">' . $image_set . '</td>' . "\n"; $s .= '<td width="8">' . $image_set . '</td>' . "\n";
$s .= '<td>' . $space_set . '<a href="' . $GLOBALS['phpgw']->link($site_link,'cat_id=' . $cats[$i]['id']) . '">' $s .= '<td>' . $space_set . '<a href="' . $GLOBALS['phpgw']->link($site_link,'cat_id=' . $cats[$i]['cat_id']) . '">'
. $GLOBALS['phpgw']->strip_html($cats[$i]['name']) . $GLOBALS['phpgw']->strip_html($cats[$i]['name'])
. '</a></td>' . "\n" . '</a></td>' . "\n"
. '</tr>' . "\n"; . '</tr>' . "\n";
@ -487,7 +487,7 @@
while (is_array($cats) && list(,$cat) = each($cats)) while (is_array($cats) && list(,$cat) = each($cats))
{ {
$sel_cat = ''; $sel_cat = '';
if (in_array($cat['id'],$selected)) if (in_array($cat['cat_id'],$selected))
{ {
$sel_cat = 'selected'; $sel_cat = 'selected';
} }
@ -510,7 +510,7 @@
$cat_list[] = array $cat_list[] = array
( (
'id' => $cat['id'], 'cat_id' => $cat['cat_id'],
'name' => $name, 'name' => $name,
'selected' => $sel_cat 'selected' => $sel_cat
); );
@ -546,7 +546,7 @@
$values['descr'] = $this->db->db_addslashes($values['descr']); $values['descr'] = $this->db->db_addslashes($values['descr']);
$values['name'] = $this->db->db_addslashes($values['name']); $values['name'] = $this->db->db_addslashes($values['name']);
if (isset($values['id'])) if (isset($values['cat_id']))
{ {
$id_col = 'cat_id,'; $id_col = 'cat_id,';
$id_val = $values['cat_id'].','; $id_val = $values['cat_id'].',';