Add extra placeholder 'categories' for expanded categories with path

This commit is contained in:
Nathan Gray 2011-02-16 17:47:31 +00:00
parent 077122e03f
commit 0c97c3bd10
2 changed files with 17 additions and 1 deletions

View File

@ -144,6 +144,12 @@ class addressbook_merge extends bo_merge
}
if (!($n&1)) echo '<tr>';
echo '<td>$$'.$name.'$$</td><td>'.$label.'</td>';
if($name == 'cat_id')
{
if ($n&1) echo "</tr>\n";
echo '<td>$$categories$$</td><td>'.lang('Category path').'</td>';
$n++;
}
if ($n&1) echo "</tr>\n";
$n++;
}

View File

@ -226,6 +226,16 @@ abstract class bo_merge
}
$replacements['$$'.($prefix ? $prefix.'/':'').$name.'$$'] = $value;
}
// Add in extra cat field
$cats = array();
foreach(is_array($contact['cat_id']) ? $contact['cat_id'] : explode(',',$contact['cat_id']) as $cat_id)
{
if(!$cat_id) continue;
$cats[] = $GLOBALS['egw']->categories->id2name($cat_id,'path');
}
$replacements['$$'.($prefix ? $prefix.'/':'').'categories$$'] = implode("\n",$cats);
return $replacements;
}
@ -425,7 +435,7 @@ abstract class bo_merge
{
$content = preg_replace('/\$\$[a-z0-9_\/]+\$\$/i','',$content);
}
if ($contentrepeat) $contentrep[$id] = $content;
if ($contentrepeat) $contentrep[is_array($id) ? implode(':',$id) : $id] = $content;
}
if ($Labelrepeat)
{