summaryrefslogtreecommitdiff
path: root/roundcubemail/program
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-06-03 22:37:47 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-06-03 22:37:47 +0000
commit9eacff7b8b0741aeb209260312cfeb18dd85dd7a (patch)
tree3ccb2ea41d0a1555a9a1354cd6a1ff1359582f3b /roundcubemail/program
parent0cb29804cfcb357358e81cbb6a4d32845842dbb9 (diff)
Use address_template config when adding a new address block (#1487944)
git-svn-id: https://svn.roundcube.net/trunk@4840 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
-rw-r--r--roundcubemail/program/js/app.js21
-rw-r--r--roundcubemail/program/steps/addressbook/edit.inc4
2 files changed, 21 insertions, 4 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js
index 48f058eaf..c81c511a9 100644
--- a/roundcubemail/program/js/app.js
+++ b/roundcubemail/program/js/app.js
@@ -4109,14 +4109,27 @@ function rcube_webmail()
this.init_edit_field(col, input);
}
else if (colprop.type == 'composite') {
- var childcol, cp, first;
- for (childcol in colprop.childs) {
+ var childcol, cp, first, templ, cols = [], suffices = [];
+ // read template for composite field order
+ if ((templ = this.env[col+'_template'])) {
+ for (var j=0; j < templ.length; j++) {
+ cols.push(templ[j][1]);
+ suffices.push(templ[j][2]);
+ }
+ }
+ else { // list fields according to appearance in colprop
+ for (childcol in colprop.childs)
+ cols.push(childcol);
+ }
+
+ for (var i=0; i < cols.length; i++) {
+ childcol = cols[i];
cp = colprop.childs[childcol];
input = $('<input>')
.addClass('ff_'+childcol)
- .attr({type: 'text', name: '_'+childcol+name_suffix, size: cp.size})
+ .attr({ type: 'text', name: '_'+childcol+name_suffix, size: cp.size })
.appendTo(cell);
- cell.append(" ");
+ cell.append(suffices[i] || " ");
this.init_edit_field(childcol, input);
if (!first) first = input;
}
diff --git a/roundcubemail/program/steps/addressbook/edit.inc b/roundcubemail/program/steps/addressbook/edit.inc
index cf6beba68..96c48704a 100644
--- a/roundcubemail/program/steps/addressbook/edit.inc
+++ b/roundcubemail/program/steps/addressbook/edit.inc
@@ -90,6 +90,10 @@ function rcmail_contact_editform($attrib)
// add some labels to client
$RCMAIL->output->add_label('noemailwarning', 'nonamewarning');
+
+ // copy (parsed) address template to client
+ if (preg_match_all('/\{([a-z0-9]+)\}([^{]*)/i', $RCMAIL->config->get('address_template', ''), $templ, PREG_SET_ORDER))
+ $RCMAIL->output->set_env('address_template', $templ);
$i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
$t_rows = !empty($attrib['textarearows']) ? $attrib['textarearows'] : 10;