PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminEmail.js
index 32a617d..65852fc 100644 (file)
@@ -19,15 +19,16 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
   'c4ca4238a0b923820dcc509a6f75849b' :"1",
   '1e6d57e813355689e9c77e947d73ad8f' :"From:",
-  '292f75d54a6892cfe18a93e64230112a' :"Mailout Name:",
   '47a0be8d1015d526a1fbaa56c3102135' :"Subject:",
   '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
+  '292f75d54a6892cfe18a93e64230112a' :"Mailout Name:",
   '7038eac66e387c3b3a0834d786a88757' :"Insert Image",
   'e71c729cd7f3c6b6ebdb447e65952dfd' :"From email address:",
   'edddfc18b2ffb806573a1b3f341832cd' :"BCC to Group:",
   'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version",
   'e44b145bd8b49b06e0ad2ced1ad56466' :"Plain Text",
   'c9cc8cce247e49bae79f15173ce97354' :"Save",
+  'b5a7adde1af5c87d7fd797b6245c2a39' :"Description",
   '49ee3087348e8d44e1feda1917443987' :"Name",
   '28690be026c0bb9003aa58e45e5662ca' :"Enabled - will be sent out",
   'fb981fe689fbec75c6531eb7410971f4' :"To group:",
@@ -35,17 +36,18 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
   '36a65bbd12f7586ea1f9b0be4e8848aa' :"HTML Editor"
  },
  _named_strings : {
+  'description_fieldLabel' : 'b5a7adde1af5c87d7fd797b6245c2a39' /* Description */ ,
   'active_boxLabel' : '28690be026c0bb9003aa58e45e5662ca' /* Enabled - will be sent out */ ,
-  'to_group_id_name_loadingText' : '843627586c62e389041a4d8800143974' /* Searching */ ,
-  'to_group_id_name_fieldLabel' : 'fb981fe689fbec75c6531eb7410971f4' /* To group: */ ,
   'save_html' : 'c9cc8cce247e49bae79f15173ce97354' /* Save */ ,
-  'name_fieldLabel' : '292f75d54a6892cfe18a93e64230112a' /* Mailout Name: */ ,
+  'to_group_id_display_name_loadingText' : '843627586c62e389041a4d8800143974' /* Searching */ ,
   'bcc_group_id_name_placeholder' : '2c466a2c159463f1d9ef5a7b57b52827' /* Select BCC Group */ ,
+  'name_fieldLabel' : '292f75d54a6892cfe18a93e64230112a' /* Mailout Name: */ ,
   'cancel_html' : 'ea4788705e6873b424c65e91c2846b19' /* Cancel */ ,
   'from_email_fieldLabel' : 'e71c729cd7f3c6b6ebdb447e65952dfd' /* From email address: */ ,
-  'to_group_id_name_placeholder' : 'e05f77bdf3f659c1fd354a88526c03da' /* Select Group */ ,
+  'to_group_id_display_name_fieldLabel' : 'fb981fe689fbec75c6531eb7410971f4' /* To group: */ ,
   'preview_html' : '31fde7b05ac8952dacf4af8a704074ec' /* Preview */ ,
   'active_value' : 'c4ca4238a0b923820dcc509a6f75849b' /* 1 */ ,
+  'to_group_id_display_name_placeholder' : 'e05f77bdf3f659c1fd354a88526c03da' /* Select Group */ ,
   'send_html' : '5b8ef4e762c00a15a41cfc26dc3ef99c' /* Send me a test copy */ ,
   'from_name_fieldLabel' : '1e6d57e813355689e9c77e947d73ad8f' /* From: */ ,
   'bcc_group_id_name_loadingText' : '843627586c62e389041a4d8800143974' /* Searching */ ,
@@ -65,7 +67,7 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
 
   this.callback = cb;
   this.data = data;
-  this.dialog.show(this.data._el);
+  this.dialog.show.apply(this.dialog,  Array.prototype.slice.call(arguments).slice(2));
   if (this.form) {
    this.form.reset();
    this.form.setValues(data);
@@ -79,6 +81,7 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
   var _this = this;
   this.dialog = Roo.factory({
     xtype : 'Modal',
+    bodyOverflow : true,
     cls : 'modal-body-enable-overflow-y',
     fitwindow : true,
     title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
@@ -290,8 +293,8 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
                       return;
                   }
                   
-                  this.findField('name').setDisabled(false);
-                  this.findField('test_class').setDisabled(false);
+                  //this.findField('name').setDisabled(false);
+                  //this.findField('test_class').setDisabled(false);
                   
                   this.reset();
                   
@@ -312,6 +315,7 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
               
               if (action.type == 'load') {
                   
+                  /*
                   this.findField('name').setDisabled(false);
                   this.findField('test_class').setDisabled(false);
                   
@@ -319,6 +323,7 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
                       this.findField('name').setDisabled(true);
                       this.findField('test_class').setDisabled(true);
                   }
+                  */
                   
                   _this.dialog.el.unmask();
                   
@@ -332,6 +337,10 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
                   
                   this.findField('_ignore_group_count').setValue('0');
                   
+                  if(!_this.form_data.description.length){
+                      _this.form_data.findField('description').setValue(_this.form_data.name);
+                  }
+                  
                   this.hideshow();
                   
                   return;
@@ -366,15 +375,22 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
                  if(action.result.errors.errcode) {
                      switch (action.result.errors.errcode) {
                          case 100:
-                             Roo.MessageBox.buttonText.yes = "try";
-                             Roo.MessageBox.buttonText.no = "tryno";
-                             Roo.bootstrap.MessageBox.confirm('Confirm Save', 'No member found in To Group: ' + _this.combo_to_group.getRawValue() ,function(ret) {
-                                 if(ret == 'no'){
-                                     return;
+                             
+                             Roo.bootstrap.MessageBox.show({
+                                 title: 'Confirm Save',
+                                 msg: 'No member found in To Group: '+ _this.combo_to_group.getRawValue(),
+                                 buttons: {yes:'OK Save anyway', no:'Change to another group'},
+                                 fn: function(ret){
+                                     
+                                     if(ret == 'no'){
+                                         return;
+                                     }
+                                      
+                                     _this.form.findField('_ignore_group_count').setValue('1');
+                                     _this.form.doAction("submit");                       
                                  }
-                                 _this.form.findField('_ignore_group_count').setValue('1');
-                                 _this.form.doAction("submit");                       
-                             }, this);
+                             });
+                           
                              
                          break;
                          
@@ -421,10 +437,10 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
              {
               xtype : 'Input',
               allowBlank : false,
-              fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
+              fieldLabel : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
               indicatorpos : 'right',
               labelWidth : 3,
-              name : 'name',
+              name : 'description',
               xns : Roo.bootstrap,
               '|xns' : 'Roo.bootstrap'
              }
@@ -532,7 +548,7 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
               xtype : 'ComboBox',
               allowBlank : true,
               alwaysQuery : true,
-              displayField : 'name',
+              displayField : 'display_name',
               editable : false,
               fieldLabel : _this._strings['fb981fe689fbec75c6531eb7410971f4'] /* To group: */,
               forceSelection : true,
@@ -542,7 +558,7 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
               labelWidth : 4,
               loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
               minChars : 2,
-              name : 'to_group_id_name',
+              name : 'to_group_id_display_name',
               pageSize : 20,
               placeholder : _this._strings['e05f77bdf3f659c1fd354a88526c03da'] /* Select Group */,
               triggerAction : 'all',
@@ -565,6 +581,7 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
                      o.params = o.params || {};
                      
                      o.params._direct_return = 1;
+                     o.params.limit = 100;
                  }
                },
                xns : Roo.data,
@@ -578,7 +595,7 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
                },
                reader : {
                 xtype : 'JsonReader',
-                fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
+                fields : ['name','display_name',{"name":"id","type":"int"}],
                 id : 'name',
                 root : 'data',
                 totalProperty : 'total',
@@ -784,9 +801,22 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
                         var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
                         
                         Pman.Dialog.BAdminImageManager.show({
-                            id : 0,
+                            id: 0,
                             onid: id,
                             ontable: ontable
+                        }, function(img){
+                            _this.form.findField('bodytext').editorcore.insertAtCursor(
+                                String.format(
+                                    '<img src="{0}/Images/{1}/{2}#image-{1}" height="{3}" width="{4}" alt="{5}" align="{6}">',
+                                    baseURL,
+                                    img.id,
+                                    img.filename.replace('%', '-'),
+                                    img.height,
+                                    img.width,
+                                    img.descript,
+                                    img.align
+                                )
+                            )
                         });
                         
                     }
@@ -964,12 +994,32 @@ Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
           items  : [
            {
             xtype : 'Column',
-            md : 12,
+            md : 6,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Input',
+              allowBlank : false,
+              disabled : true,
+              fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
+              indicatorpos : 'right',
+              labelAlign : 'top',
+              name : 'name',
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           },
+           {
+            xtype : 'Column',
+            md : 6,
             xns : Roo.bootstrap,
             '|xns' : 'Roo.bootstrap',
             items  : [
              {
               xtype : 'Input',
+              disabled : true,
               fieldLabel : _this._strings['3858712080cb3d846ea206d1d1070674'] /* Test Class (for system reference only): */,
               labelAlign : 'top',
               name : 'test_class',