1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Dialog');
7 Pman.Dialog.CoreEmail = {
10 'e44b145bd8b49b06e0ad2ced1ad56466' :"Plain Text",
11 '2f26e35d61be90501e099089dc533638' :"Select Images",
12 'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
13 'b357b524e740bc85b9790a0712d84a30' :"Email address",
14 '962b90039a542a29cedd51d87a9f28a1' :"Html Editor",
15 '72d6d7a1885885bb55a565fd1070581a' :"Import",
16 '31fde7b05ac8952dacf4af8a704074ec' :"Preview",
17 'ea30b40c3caf28acb29198d20d243e54' :"Images / Attachments >>",
18 '884df8e413319ff51a3f5f528606238a' :"Use template",
19 'e6b391a8d2c4d45902a23a8b6585703d' :"URL",
20 '2393ad754ba179442d85e415d1d5167c' :"Displayorder",
21 '6f16a5f8ff5d75ab84c018adacdfcbb7' :"Field",
22 'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
23 'e9968623956c15023d54335ea3699855' :"Convert Html to Text",
24 '5b8ef4e762c00a15a41cfc26dc3ef99c' :"Send me a test copy",
25 '1243daf593fa297e07ab03bf06d925af' :"Searching...",
26 'c7892ebbb139886662c6f2fc8c450710' :"Subject",
27 'dc0de523c25be298ba751c63c694109e' :"Responsive Email (1)",
28 '396ecabf0cd1f9503e591418851ef406' :"Edit / Create Message",
29 'b9c49611cfda3259a2b837b39489e650' :"Add Image",
30 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
31 'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version",
32 'b20a8b77b05d53b4e695738731400c85' :"Mailout Name",
33 '1bd18d39370b7f26c1c5e18067b74c6f' :"Html File",
34 '5da618e8e4b89c66fe86e32cdafde142' :"From",
35 '31bb2f6e9b8fb11cbb7fb63c6025223f' :"Select Template",
36 'b78a3223503896721cca1303f776159b' :"Title",
37 '278c491bdd8a53618c149c4ac790da34' :"Template",
38 '1351017ac6423911223bc19a8cb7c653' :"Filename",
39 '308f2757bfc9ce92fb00ff93fdffd279' :"Images / Attachments",
40 'c9cc8cce247e49bae79f15173ce97354' :"Save",
41 '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
42 '4c2a8fe7eaf24721cc7a9f0175115bd4' :"Message",
43 'fff0d600f8a0b5e19e88bfb821dd1157' :"Images"
49 show : function(data, cb)
57 this.dialog.show(this.data._el);
60 this.form.setValues(data);
61 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
69 this.dialog = Roo.factory({
75 title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
79 xtype : 'LayoutDialog',
81 show : function (_self)
84 _self.layout.getRegion('center').showPanel(0);
85 var w = Roo.lib.Dom.getViewWidth();
\r
86 var h = Roo.lib.Dom.getViewHeight();
\r this.resizeTo(w-50, h-50);
\r
88 var ew = Math.max(250, w-320);
\r
89 var eh = Math.max(250, h-350) ;
\r
90 var e = _this.dialog.layout.getRegion('east');
95 var el = _self.getEl();
96 var elw = el.dom.clientWidth;
98 var bdtext = _this.form.findField('bodytext');
99 var ptext = _this.form.findField('plaintext');
101 bdtext.width = elw-100;
102 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
103 ptext.setSize(bdtext.width , bdtext.height);
112 xtype : 'LayoutRegion'
117 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
122 xtype : 'LayoutRegion'
126 text : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
131 click : function (_self, e)
133 //_this.dialog.hide();
134 Roo.log(_this.data.module);
135 Pman.Dialog.CoreEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
137 render : function (_self)
139 _this.preview_btn = _self;
144 text : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
149 click : function (_self, e)
151 //_this.dialog.hide();
153 var id = _this.form.findField('id').getValue();
156 Roo.MessageBox.alert('Error', 'Please save the message frist!');
161 url : baseURL + '/Core/MessagePreview',
166 _table : _this.data.module
168 success : function(res) {
169 if(res.data == 'SUCCESS'){
170 Roo.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
175 render : function (_self)
177 _this.html_preview = _self;
182 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
187 click : function (_self, e)
194 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
199 click : function (_self, e)
203 _this.form.preValidate(function(res) {
207 _this.form.doAction("submit");
222 xtype : 'NestedLayoutPanel',
229 text : _this._strings['72d6d7a1885885bb55a565fd1070581a'] /* Import */,
231 '|xns' : 'Roo.Toolbar',
239 text : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
244 click : function (_self, e)
246 Pman.Dialog.CoreImportUrl.show({
247 target : '/Core/ImportMailMessage.php'
251 _this.form.findField('bodytext').setValue(data);
258 text : _this._strings['1bd18d39370b7f26c1c5e18067b74c6f'] /* Html File */,
263 click : function (_self, e)
265 Pman.Dialog.Image.show({
266 _url : baseURL + '/Core/ImportMailMessage.php'
269 _this.form.findField('bodytext').setValue(data);
279 text : _this._strings['884df8e413319ff51a3f5f528606238a'] /* Use template */,
281 '|xns' : 'Roo.Toolbar',
289 text : _this._strings['dc0de523c25be298ba751c63c694109e'] /* Responsive Email (1) */,
294 click : function (_self, e)
297 var l = document.location;
300 url : baseURL + '/Core/ImportMailMessage.php',
305 importUrl : l.protocol +'//' + l.host + rootURL + '/Pman/Crm/mail_templates/responsive1.html'
307 success : function (res) {
309 _this.form.findField('bodytext').setValue(res.data);
322 displayField : 'file',
324 emptyText : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
325 fieldLabel : _this._strings['278c491bdd8a53618c149c4ac790da34'] /* Template */,
326 forceSelection : true,
327 hiddenName : 'template',
329 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
333 qtip : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
334 selectOnFocus : true,
335 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{file}</b> </div>',
336 triggerAction : 'all',
344 select : function (combo, record, index)
355 _this.form.findField('bodytext').setValue(record.data.content);
361 sortInfo : { direction : 'DESC', field: 'file' },
366 beforeload : function (_self, o){
367 o.params = o.params || {};
374 url : baseURL + '/Core/MailTemplateList.php',
380 fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}],
383 totalProperty : 'total',
392 '|xns' : 'Roo.Toolbar',
396 text : _this._strings['ea30b40c3caf28acb29198d20d243e54'] /* Images / Attachments >> */,
398 '|xns' : 'Roo.Toolbar',
401 click : function (_self, e)
403 var el = _this.dialog.layout.getRegion('east');
419 xtype : 'BorderLayout',
424 xtype : 'LayoutRegion'
433 title : _this._strings['4c2a8fe7eaf24721cc7a9f0175115bd4'] /* Message */,
436 xtype : 'ContentPanel',
438 render : function (_self, width, height)
441 Roo.log("RESIZE, " + width + ',' + height);
443 var ew = Math.max(250, width-50);
444 var eh = Math.max(250,height-50) ;
449 resize : function (_self, width, height)
\r
451 var ew = Math.max(250, width-50);
\r
452 var eh = Math.max(250,height-50) ;
457 var bdtext = _this.form.findField('bodytext');
\r
458 var ptext = _this.form.findField('plaintext');
\r
459 if(bdtext.resizeEl){
\r
460 bdtext.width = ew-50;
\r
461 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
\r
462 ptext.setSize(bdtext.width , bdtext.height);
\r
469 labelAlign : 'right',
472 preValidate : function(done_callback) {
474 Roo.MessageBox.progress("Uploading Images", "Uploading");
476 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
477 _this.form.findField('bodytext').syncValue();
479 _this.form.findField('bodytext').pushValue();
482 var html = _this.form.findField('bodytext').getValue();
484 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
486 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
489 s.select('img[src]').each(function(i) {
492 var total = nodes.length;
493 var mkimg = function() {
496 Roo.MessageBox.hide();
497 _this.form.findField('bodytext').syncValue();
499 // _this.form.doAction("submit");
504 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
511 n = i.getAttribute('src').match(/^http(.*)/);
519 url : baseURL + '/Roo/Images.php',
522 onid : _this.form.findField('id').getValue(),
524 _remote_upload : i.src
526 success : function(res){
527 if(res.success == true){
528 i.setAttribute('src', res.data);
529 Roo.MessageBox.updateProgress( (total - nodes.length) / total , "Done " + (total - nodes.length) + '/' + total);
538 style : 'margin:10px',
539 url : baseURL + '/Roo/crm_mailing_list_message.php',
544 actioncomplete : function(_self,action)
547 if (action.type == 'setdata') {
549 setInterval(_this.form.findField('bodytext').autosave, 60000);
551 _this.data.module = _this.data.module || 'crm_mailing_list_message';
553 _this.form.url = baseURL + '/Roo/' + _this.data.module;
555 _this.html_preview.hide();
556 _this.preview_btn.hide();
558 if(_this.data.id*1 > 0){
559 _this.dialog.el.mask("Loading");
560 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
561 _this.html_preview.show();
562 _this.preview_btn.show();
565 _this.form.setValues({
566 'from_name' : Pman.Login.authUser.name,
567 'from_email' : Pman.Login.authUser.email
572 if (action.type == 'load') {
573 _this.dialog.el.unmask();
576 if (action.type =='submit') {
578 _this.dialog.el.unmask();
581 if (_this.callback) {
582 _this.callback.call(_this, action.result.data);
588 rendered : function (form)
601 fieldLabel : _this._strings['b20a8b77b05d53b4e695738731400c85'] /* Mailout Name */,
617 fieldLabel : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
626 fieldLabel : _this._strings['b357b524e740bc85b9790a0712d84a30'] /* Email address */,
637 fieldLabel : _this._strings['c7892ebbb139886662c6f2fc8c450710'] /* Subject */,
652 legend : _this._strings['962b90039a542a29cedd51d87a9f28a1'] /* Html Editor */,
653 style : 'text-align:center;',
659 autosave : function() {
661 var body = _this.form.findField('bodytext');
663 if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
664 Roo.log('body not dirty');
668 Roo.log('body dirty, auto save!');
670 body.fireEvent('autosave', body);
718 xtype : 'HtmlEditor',
720 savedpreview : function (_self)
722 Roo.log('saved preview');
724 var id = _this.form.findField('id').getValue() * 1;
726 var successFn = function(res){
727 return res.data.POST.source;
733 on_id : (id < 1) ? 0 : id,
734 on_table : 'crm_mailing_list_message',
735 successFn : successFn
739 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
741 _self.originalValue = res;
747 xns : Roo.form.HtmlEditor,
748 '|xns' : 'Roo.form.HtmlEditor',
749 xtype : 'ToolbarContext'
752 xns : Roo.form.HtmlEditor,
753 '|xns' : 'Roo.form.HtmlEditor',
754 xtype : 'ToolbarStandard',
758 displayField : 'name',
760 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
761 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
762 forceSelection : true,
764 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
767 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
768 selectOnFocus : true,
769 tpl : '<div class=\"x-grid-cell-text x-btn button\"><img src=\"{public_baseURL}/Core/Images/Thumb/150x150/{id}.jpg\" height=\"150\" width=\"150\"><b>{filename}</b> </div>',
770 triggerAction : 'all',
778 beforequery : function (combo, query, forceAll, cancel, e)
780 var id = _this.form.findField('id').getValue() * 1;
782 Roo.MessageBox.alert("Error", "Save message first");
786 render : function (_self)
788 _this.extendimgselect = _self;
790 select : function (combo, record, index)
796 var editor = _this.form.findField('bodytext').editorcore;
798 var curnode = editor.getSelectedNode();
799 if (curnode && curnode.tagName == 'IMG') {
800 curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',
801 baseURL, record.data.id, record.data.filename
803 // note -forces an update... hopefully...
804 editor.owner.fireEvent('editorevent', editor, false);
807 editor.insertAtCursor(
808 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
809 baseURL, record.data.id, record.data.filename
819 sortInfo : { direction : 'ASC', field: 'id' },
824 beforeload : function (_self, o){
825 o.params = o.params || {};
827 var id = _this.form.findField('id').getValue() * 1;
829 Roo.MessageBox.alert("Error", "Save email template first");
833 o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
835 // o.params.imgtype = 'PressRelease';
836 //o.params['query[imagesize]'] = '150x150';
842 url : baseURL + '/Roo/Images.php',
848 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
851 totalProperty : 'total',
860 displayField : 'name',
862 emptyText : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
863 fieldLabel : _this._strings['6f16a5f8ff5d75ab84c018adacdfcbb7'] /* Field */,
864 forceSelection : true,
866 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
869 qtip : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
870 selectOnFocus : true,
871 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
872 triggerAction : 'all',
880 render : function (_self)
882 _this.unsubscribeselect = _self;
884 select : function (combo, record, index)
890 var editor = _this.form.findField('bodytext').editorcore;
892 if(record.data.name == 'Unsubscribe'){
893 editor.insertAtCursor(
894 String.format('<a href="{0}">{1}</a>',
895 record.data.type, record.data.name
901 editor.insertAtCursor(
911 [ '{person.firstname}', "First Name"],
912 [ '{person.lastname}' , "Last Name"],
913 [ '{person.name}', "Full Name"],
914 [ '#unsubscribe', "Unsubscribe"]
916 fields : [ 'type', 'name'],
919 xtype : 'SimpleStore'
924 '|xns' : 'Roo.Toolbar',
928 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
930 '|xns' : 'Roo.Toolbar',
933 click : function (_self, e)
935 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
954 text : _this._strings['e9968623956c15023d54335ea3699855'] /* Convert Html to Text */,
959 click : function (_self, e)
961 var h = _this.form.findField('bodytext').getValue();
962 var p = _this.form.findField('plaintext');
965 url : baseURL + '/Core/ImportMailMessage.php',
\r
969 _convertToPlain : true,
970 _check_unsubscribe : true
\r
972 success : function(res) {
\r
973 if(res.success == true){
974 p.setValue(res.data);
992 legend : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
993 style : 'text-align:center;',
1002 '|xns' : 'Roo.form',
1012 '|xns' : 'Roo.form',
1025 fitContainer : true,
1028 tableName : 'Images',
1029 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
1032 xtype : 'GridPanel',
1034 activate : function() {
1035 _this.ipanel = this;
1037 _this.igrid.ds.load({});
1042 autoExpandColumn : 'filename',
1045 '|xns' : 'Roo.grid',
1051 //_this.dialog = Pman.Dialog.FILL_IN
1052 if (_this.ipanel.active) {
1053 // _this.igrid.ds.load({});
1063 cls : 'x-btn-text-icon',
1064 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1065 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
1067 '|xns' : 'Roo.Toolbar',
1072 var id = _this.form.findField('id').getValue();
1075 Roo.MessageBox.alert('Error', 'Please save the email template first');
1079 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1081 Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
1082 _this.igrid.getDataSource().load({});
1088 cls : 'x-btn-text-icon',
1089 icon : rootURL + '/Pman/templates/images/trash.gif',
1090 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
1092 '|xns' : 'Roo.Toolbar',
1097 var s = _this.igrid.getSelectionModel().getSelected();
1098 if (!s || isNaN(s.id *1)) {
1099 Roo.MessageBox.alert("Error", "Select a image");
1102 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
1108 url : baseURL + '/Roo/Images.php',
1113 success : function()
1115 Roo.log('Got Success!!');
1116 _this.igrid.ds.load({});
1127 sortInfo : { field : 'filename', direction: 'ASC' },
1129 '|xns' : 'Roo.data',
1132 beforeload : function (_self, options)
1134 options.params = options.params || {};
1135 if (typeof(_this.data) == 'undefined') {
1138 if(_this.data.id * 1 >= 0)
1140 options.params.onid = _this.data.id;
1142 options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1148 url : baseURL + '/Roo/Images.php',
1150 '|xns' : 'Roo.data',
1188 'name': 'displayorder',
1196 'name': 'parent_image_id',
1202 'dateFormat': 'Y-m-d'
1221 'name': 'parent_image_id_id',
1225 'name': 'parent_image_id_filename',
1229 'name': 'parent_image_id_ontable',
1233 'name': 'parent_image_id_onid',
1237 'name': 'parent_image_id_mimetype',
1241 'name': 'parent_image_id_width',
1245 'name': 'parent_image_id_height',
1249 'name': 'parent_image_id_filesize',
1253 'name': 'parent_image_id_displayorder',
1257 'name': 'parent_image_id_language',
1261 'name': 'parent_image_id_parent_image_id',
1265 'name': 'parent_image_id_created',
1269 'name': 'parent_image_id_imgtype',
1273 'name': 'parent_image_id_linkurl',
1277 'name': 'parent_image_id_descript',
1281 'name': 'parent_image_id_title',
1287 totalProperty : 'total',
1289 '|xns' : 'Roo.data',
1290 xtype : 'JsonReader'
1295 dataIndex : 'filename',
1296 header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
1297 renderer : function(v,x,r)
1299 var width = r.data.width;
1300 var height = r.data.height;
1303 height = Math.round(height * 50 / width);
1307 return '<img src="' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '" width="' + width + '" height="' + height + '" />';
1311 '|xns' : 'Roo.grid',
1312 xtype : 'ColumnModel'
1315 dataIndex : 'displayorder',
1316 header : _this._strings['2393ad754ba179442d85e415d1d5167c'] /* Displayorder */,
1317 renderer : function(v) { return String.format('{0}', v); },
1320 '|xns' : 'Roo.grid',
1321 xtype : 'ColumnModel'
1324 dataIndex : 'title',
1325 header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1326 renderer : function(v) { return String.format('{0}', v); },
1329 '|xns' : 'Roo.grid',
1330 xtype : 'ColumnModel'