[Svn] r4840 - in trunk/roundcubemail: . program/js program/steps/addressbook

trac at roundcube.net trac at roundcube.net
Sat Jun 4 00:37:47 CEST 2011


Author: thomasb
Date: 2011-06-03 17:37:47 -0500 (Fri, 03 Jun 2011)
New Revision: 4840

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/steps/addressbook/edit.inc
Log:
Use address_template config when adding a new address block (#1487944)

Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2011-06-03 13:31:55 UTC (rev 4839)
+++ trunk/roundcubemail/CHANGELOG	2011-06-03 22:37:47 UTC (rev 4840)
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Use 'address_template' config option when adding a new address block (#1487944)
 - Added addressbook advanced search
 - Add popup with basic fields selection for addressbook search
 - Case-insensitive matching in autocompletion (#1487933)

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2011-06-03 13:31:55 UTC (rev 4839)
+++ trunk/roundcubemail/program/js/app.js	2011-06-03 22:37:47 UTC (rev 4840)
@@ -4109,14 +4109,27 @@
           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;
           }

Modified: trunk/roundcubemail/program/steps/addressbook/edit.inc
===================================================================
--- trunk/roundcubemail/program/steps/addressbook/edit.inc	2011-06-03 13:31:55 UTC (rev 4839)
+++ trunk/roundcubemail/program/steps/addressbook/edit.inc	2011-06-03 22:37:47 UTC (rev 4840)
@@ -90,6 +90,10 @@
 
     // 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;

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list