DataObjects/Core_person_signup.php
[Pman.Core] / Pman.Dialog.CoreEmail.js
index 97b05f0..92b392f 100644 (file)
@@ -307,7 +307,7 @@ Pman.Dialog.CoreEmail = {
                                                 
                                                     _this.data.module = _this.data.module || 'crm_mailing_list_message';
                                                     
-                                                    _this.form.url = baseURL + '/Roo/' + _this.data.module + '_mailing_list_message.php';
+                                                    _this.form.url = baseURL + '/Roo/' + _this.data.module;
                                                     
                                                     _this.html_preview.hide();
                                                     _this.preview_btn.hide();
@@ -315,9 +315,7 @@ Pman.Dialog.CoreEmail = {
                                                     if(_this.data.id*1 > 0){
                                                         _this.dialog.el.mask("Loading");
                                                         this.load({ method: 'GET', params: { '_id' : _this.data.id }});
-                                                        if(_this.data.module == 'crm'){
-                                                            _this.html_preview.show();
-                                                        }
+                                                        _this.html_preview.show();
                                                         _this.preview_btn.show();
                                                         
                                                     } else {
@@ -358,9 +356,9 @@ Pman.Dialog.CoreEmail = {
                                             Roo.MessageBox.progress("Uploading Images", "Uploading");
                                             var html = _this.form.findField('bodytext').getValue();
                                             
-                                            var s = Roo.get(_this.form.findField('bodytext').doc.documentElement);
+                                            var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
                                             
-                                            var ontable = (_this.data.module) ? _this.data.module + '_mailing_list_message' : 'crm_mailing_list_message';
+                                            var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
                                             
                                             var nodes = [];
                                             s.select('img[src]').each(function(i) {
@@ -376,8 +374,17 @@ Pman.Dialog.CoreEmail = {
                                                    //    _this.form.doAction("submit");
                                                       return;
                                                 }
-                                                var i = nodes.pop();        
-                                                var n = i.getAttribute('src').match(/^http(.*)/);
+                                                var i = nodes.pop(); 
+                                                
+                                                var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
+                                                
+                                                if(n){
+                                                    mkimg();
+                                                    return;
+                                                }
+                                                
+                                                n = i.getAttribute('src').match(/^http(.*)/)
+                                               
                                                 if(!n ){
                                                     mkimg();
                                                     return;
@@ -403,7 +410,7 @@ Pman.Dialog.CoreEmail = {
                                             }
                                             mkimg();
                                         },
-                                        url : baseURL + '/Roo/Core_mailing_list_message.php',
+                                        url : baseURL + '/Roo/crm_mailing_list_message.php',
                                         items : [
                                             {
                                                 xtype: 'Row',
@@ -464,6 +471,7 @@ Pman.Dialog.CoreEmail = {
                                                             {
                                                                 xtype: 'HtmlEditor',
                                                                 xns: Roo.form,
+                                                                clearUp : false,
                                                                 height : 250,
                                                                 name : 'bodytext',
                                                                 resizable : 's',
@@ -576,7 +584,7 @@ Pman.Dialog.CoreEmail = {
                                                                                                 return false;
                                                                                             }
                                                                                             o.params.onid = id
-                                                                                            o.params.ontable = 'core_mailing_list_message';
+                                                                                            o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
                                                                                             
                                                                                            // o.params.imgtype = 'PressRelease';
                                                                                             //o.params['query[imagesize]'] = '150x150';
@@ -792,7 +800,7 @@ Pman.Dialog.CoreEmail = {
                                     {
                                         options.params.onid = _this.data.id;
                                 
-                                        options.params.ontable = (_this.data.module) ? _this.data.module + '_mailing_list_message' : 'crm_mailing_list_message';
+                                        options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
                                     }
                                 }
                             },
@@ -960,7 +968,7 @@ Pman.Dialog.CoreEmail = {
                                                 return;
                                             }
                                             
-                                            var ontable = (_this.data.module) ? _this.data.module + '_mailing_list_message' : 'crm_mailing_list_message';
+                                            var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
                                             
                                             Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
                                                 _this.igrid.getDataSource().load({});
@@ -1063,7 +1071,7 @@ Pman.Dialog.CoreEmail = {
                         {
                             //_this.dialog.hide();
                             Roo.log(_this.data.module);
-                            Pman.Dialog.CoreMailingListMessagePreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
+                            Pman.Dialog.CoreEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
                         },
                         render : function (_self)
                         {
@@ -1088,11 +1096,12 @@ Pman.Dialog.CoreEmail = {
                             }
                            
                             new Pman.Request({
-                                url : baseURL + '/Crm/MessagePreview',
+                                url : baseURL + '/Core/MessagePreview',
                                 method : 'POST',
                                 mask: 'Sending',
                                 params : {
-                                    _id : id
+                                    _id : id,
+                                    _table : _this.data.module
                                 }, 
                                 success : function(res) { 
                                     if(res.data == 'SUCCESS'){
@@ -1125,6 +1134,7 @@ Pman.Dialog.CoreEmail = {
                     listeners : {
                         click : function (_self, e)
                         {
+                        
                             // do some checks?
                             _this.form.preValidate(function(res) {
                                 if (!res) {