DataObjects/core.sql
[Pman.Core] / Pman.Dialog.CoreMailingListMessage.js
index 5582f42..c9091d4 100644 (file)
@@ -164,9 +164,22 @@ Pman.Dialog.CoreMailingListMessage = {
                             {
                                 xtype: 'ComboBox',
                                 xns: Roo.form,
+                                listeners : {
+                                    select : function (combo, record, index)
+                                    {
+                                        Roo.log(record);
+                                    /*
+                                        (function() { 
+                                            combo.setValue('');
+                                        }).defer(100);
+                                    */    
+                                        _this.form.findField('bodytext').setValue(record.data.content);
+                                    
+                                    }
+                                },
                                 allowBlank : true,
                                 alwaysQuery : true,
-                                displayField : 'name',
+                                displayField : 'file',
                                 editable : false,
                                 emptyText : "Select Template",
                                 fieldLabel : 'Template',
@@ -179,10 +192,10 @@ Pman.Dialog.CoreMailingListMessage = {
                                 pageSize : 20,
                                 qtip : "Select Template",
                                 selectOnFocus : true,
-                                tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
+                                tpl : '<div class="x-grid-cell-text x-btn button"><b>{file}</b> </div>',
                                 triggerAction : 'all',
                                 typeAhead : true,
-                                valueField : 'name',
+                                valueField : 'file',
                                 width : 200,
                                 store : {
                                     xtype: 'Store',
@@ -195,7 +208,7 @@ Pman.Dialog.CoreMailingListMessage = {
                                         }
                                     },
                                     remoteSort : true,
-                                    sortInfo : { direction : 'DESC', field: 'name' },
+                                    sortInfo : { direction : 'DESC', field: 'file' },
                                     proxy : {
                                         xtype: 'HttpProxy',
                                         xns: Roo.data,
@@ -208,7 +221,7 @@ Pman.Dialog.CoreMailingListMessage = {
                                         id : 'name',
                                         root : 'data',
                                         totalProperty : 'total',
-                                        fields : [{"name":"name","type":"string"},{"name":"body","type":"string"}]
+                                        fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}]
                                     }
                                 }
                             },
@@ -547,11 +560,11 @@ Pman.Dialog.CoreMailingListMessage = {
                                                                                         
                                                                                             var id = _this.form.findField('id').getValue() * 1;    
                                                                                             if (!id) {
-                                                                                                Roo.MessageBox.alert("Error", "Save press release first");
+                                                                                                Roo.MessageBox.alert("Error", "Save email template first");
                                                                                                 return false;
                                                                                             }
                                                                                             o.params.onid = id
-                                                                                            o.params.ontable = 'crm_mailing_list_message';
+                                                                                            o.params.ontable = 'core_mailing_list_message';
                                                                                             
                                                                                            // o.params.imgtype = 'PressRelease';
                                                                                             //o.params['query[imagesize]'] = '150x150';