summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps/addressbook/func.inc
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-02-06 22:35:39 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-02-06 22:35:39 +0000
commit9c684b7e40dfbb61a4490e5f56b43fb9aaf05234 (patch)
treec52b4078c66f5266fe2cc096d029236e87bfa2d5 /roundcubemail/program/steps/addressbook/func.inc
parenta556142342d27fc7990aaaf17c994f10f6443a15 (diff)
Localize contact property subtypes; better name for contact section
git-svn-id: https://svn.roundcube.net/trunk@4499 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps/addressbook/func.inc')
-rw-r--r--roundcubemail/program/steps/addressbook/func.inc20
1 files changed, 18 insertions, 2 deletions
diff --git a/roundcubemail/program/steps/addressbook/func.inc b/roundcubemail/program/steps/addressbook/func.inc
index be0c82d8b..7597fa75a 100644
--- a/roundcubemail/program/steps/addressbook/func.inc
+++ b/roundcubemail/program/steps/addressbook/func.inc
@@ -281,6 +281,20 @@ function rcmail_get_rowcount_text()
}
+function rcmail_get_type_label($type)
+{
+ $label = 'type'.$type;
+ if (rcube_label_exists($label))
+ return rcube_label($label);
+ else if (preg_match('/\w+(\d+)$/', $label, $m)
+ && ($label = preg_replace('/(\d+)$/', '', $label))
+ && rcube_label_exists($label))
+ return rcube_label($label) . ' ' . $m[1];
+
+ return ucfirst($type);
+}
+
+
function rcmail_contact_form($form, $record, $attrib = null)
{
global $RCMAIL, $CONFIG;
@@ -324,6 +338,7 @@ function rcmail_contact_form($form, $record, $attrib = null)
if ($section == 'head') {
$content = '';
+ // TODO: use the save name composition function as in save.inc
$names_arr = array($record['prefix'], $record['firstname'], $record['middlename'], $record['surname'], $record['suffix']);
if ($record['name'] == join(' ', array_filter($names_arr)))
unset($record['name']);
@@ -384,8 +399,9 @@ function rcmail_contact_form($form, $record, $attrib = null)
// prepare subtype selector in edit mode
if ($edit_mode && is_array($colprop['subtypes'])) {
+ $subtype_names = array_map('rcmail_get_type_label', $colprop['subtypes']);
$select_subtype = new html_select(array('name' => '_subtype_'.$col.'[]', 'class' => 'contactselectsubtype'));
- $select_subtype->add($colprop['subtypes']);
+ $select_subtype->add($subtype_names, $colprop['subtypes']);
}
else
$select_subtype = null;
@@ -474,7 +490,7 @@ function rcmail_contact_form($form, $record, $attrib = null)
// use subtype as label
if ($colprop['subtypes'])
- $label = $subtype;
+ $label = rcmail_get_type_label($subtype);
// add delete button/link
if ($edit_mode && !($colprop['visible'] && $colprop['limit'] == 1))