From 0c97c3bd1085ffaffd91a834a98c1c5b522a91ac Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 16 Feb 2011 17:47:31 +0000 Subject: [PATCH] Add extra placeholder 'categories' for expanded categories with path --- addressbook/inc/class.addressbook_merge.inc.php | 6 ++++++ etemplate/inc/class.bo_merge.inc.php | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/addressbook/inc/class.addressbook_merge.inc.php b/addressbook/inc/class.addressbook_merge.inc.php index dd30daf847..cab9ed2ad2 100644 --- a/addressbook/inc/class.addressbook_merge.inc.php +++ b/addressbook/inc/class.addressbook_merge.inc.php @@ -144,6 +144,12 @@ class addressbook_merge extends bo_merge } if (!($n&1)) echo ''; echo '$$'.$name.'$$'.$label.''; + if($name == 'cat_id') + { + if ($n&1) echo "\n"; + echo '$$categories$$'.lang('Category path').''; + $n++; + } if ($n&1) echo "\n"; $n++; } diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php index 3cfdc8a200..92f8dd9aa6 100644 --- a/etemplate/inc/class.bo_merge.inc.php +++ b/etemplate/inc/class.bo_merge.inc.php @@ -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) {