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 'b20a8b77b05d53b4e695738731400c85' :"Mailout Name",
32 '1bd18d39370b7f26c1c5e18067b74c6f' :"Html File",
33 '5da618e8e4b89c66fe86e32cdafde142' :"From",
34 '31bb2f6e9b8fb11cbb7fb63c6025223f' :"Select Template",
35 'b78a3223503896721cca1303f776159b' :"Title",
36 '278c491bdd8a53618c149c4ac790da34' :"Template",
37 'c9cc8cce247e49bae79f15173ce97354' :"Save",
38 '1351017ac6423911223bc19a8cb7c653' :"Filename",
39 '308f2757bfc9ce92fb00ff93fdffd279' :"Images / Attachments",
40 '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
41 '4c2a8fe7eaf24721cc7a9f0175115bd4' :"Message",
42 'fff0d600f8a0b5e19e88bfb821dd1157' :"Images"
48 show : function(data, cb)
56 this.dialog.show(this.data._el);
59 this.form.setValues(data);
60 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
68 this.dialog = Roo.factory({
74 title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
78 xtype : 'LayoutDialog',
80 show : function (_self)
83 _self.layout.getRegion('center').showPanel(0);
84 var w = Roo.lib.Dom.getViewWidth();
\r
85 var h = Roo.lib.Dom.getViewHeight();
\r this.resizeTo(w-50, h-50);
\r
87 var ew = Math.max(250, w-320);
\r
88 var eh = Math.max(250, h-350) ;
\r
89 var e = _this.dialog.layout.getRegion('east');
94 var el = _self.getEl();
95 var elw = el.dom.clientWidth;
97 var bdtext = _this.form.findField('bodytext');
98 var ptext = _this.form.findField('plaintext');
100 bdtext.width = elw-100;
101 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
102 ptext.setSize(bdtext.width , bdtext.height);
111 xtype : 'LayoutRegion'
116 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
121 xtype : 'LayoutRegion'
125 text : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
130 click : function (_self, e)
132 //_this.dialog.hide();
133 Roo.log(_this.data.module);
134 Pman.Dialog.CoreEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
136 render : function (_self)
138 _this.preview_btn = _self;
143 text : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
148 click : function (_self, e)
150 //_this.dialog.hide();
152 var id = _this.form.findField('id').getValue();
155 Roo.MessageBox.alert('Error', 'Please save the message frist!');
160 url : baseURL + '/Core/MessagePreview',
165 _table : _this.data.module
167 success : function(res) {
168 if(res.data == 'SUCCESS'){
169 Roo.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
174 render : function (_self)
176 _this.html_preview = _self;
181 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
186 click : function (_self, e)
193 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
198 click : function (_self, e)
202 _this.form.preValidate(function(res) {
206 _this.form.doAction("submit");
221 xtype : 'NestedLayoutPanel',
228 text : _this._strings['72d6d7a1885885bb55a565fd1070581a'] /* Import */,
230 '|xns' : 'Roo.Toolbar',
238 text : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
243 click : function (_self, e)
245 Pman.Dialog.CoreImportUrl.show({
246 target : '/Core/ImportMailMessage.php'
250 _this.form.findField('bodytext').setValue(data);
257 text : _this._strings['1bd18d39370b7f26c1c5e18067b74c6f'] /* Html File */,
262 click : function (_self, e)
264 Pman.Dialog.Image.show({
265 _url : baseURL + '/Core/ImportMailMessage.php'
268 _this.form.findField('bodytext').setValue(data);
278 text : _this._strings['884df8e413319ff51a3f5f528606238a'] /* Use template */,
280 '|xns' : 'Roo.Toolbar',
288 text : _this._strings['dc0de523c25be298ba751c63c694109e'] /* Responsive Email (1) */,
293 click : function (_self, e)
296 var l = document.location;
299 url : baseURL + '/Core/ImportMailMessage.php',
304 importUrl : l.protocol +'//' + l.host + rootURL + '/Pman/Crm/mail_templates/responsive1.html'
306 success : function (res) {
308 _this.form.findField('bodytext').setValue(res.data);
321 displayField : 'file',
323 emptyText : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
324 fieldLabel : _this._strings['278c491bdd8a53618c149c4ac790da34'] /* Template */,
325 forceSelection : true,
326 hiddenName : 'template',
328 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
332 qtip : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
333 selectOnFocus : true,
334 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{file}</b> </div>',
335 triggerAction : 'all',
343 select : function (combo, record, index)
354 _this.form.findField('bodytext').setValue(record.data.content);
360 sortInfo : { direction : 'DESC', field: 'file' },
365 beforeload : function (_self, o){
366 o.params = o.params || {};
373 url : baseURL + '/Core/MailTemplateList.php',
379 fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}],
382 totalProperty : 'total',
391 '|xns' : 'Roo.Toolbar',
395 text : _this._strings['ea30b40c3caf28acb29198d20d243e54'] /* Images / Attachments >> */,
397 '|xns' : 'Roo.Toolbar',
400 click : function (_self, e)
402 var el = _this.dialog.layout.getRegion('east');
418 xtype : 'BorderLayout',
423 xtype : 'LayoutRegion'
432 title : _this._strings['4c2a8fe7eaf24721cc7a9f0175115bd4'] /* Message */,
435 xtype : 'ContentPanel',
437 render : function (_self, width, height)
440 Roo.log("RESIZE, " + width + ',' + height);
442 var ew = Math.max(250, width-50);
443 var eh = Math.max(250,height-50) ;
448 resize : function (_self, width, height)
\r
450 var ew = Math.max(250, width-50);
\r
451 var eh = Math.max(250,height-50) ;
456 var bdtext = _this.form.findField('bodytext');
\r
457 var ptext = _this.form.findField('plaintext');
\r
458 if(bdtext.resizeEl){
\r
459 bdtext.width = ew-50;
\r
460 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
\r
461 ptext.setSize(bdtext.width , bdtext.height);
\r
468 labelAlign : 'right',
471 preValidate : function(done_callback) {
473 Roo.MessageBox.progress("Uploading Images", "Uploading");
475 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
476 _this.form.findField('bodytext').syncValue();
478 _this.form.findField('bodytext').pushValue();
481 var html = _this.form.findField('bodytext').getValue();
483 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
485 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
488 s.select('img[src]').each(function(i) {
491 var total = nodes.length;
492 var mkimg = function() {
495 Roo.MessageBox.hide();
496 _this.form.findField('bodytext').syncValue();
498 // _this.form.doAction("submit");
503 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
510 n = i.getAttribute('src').match(/^http(.*)/);
518 url : baseURL + '/Roo/Images.php',
521 onid : _this.form.findField('id').getValue(),
523 _remote_upload : i.src
525 success : function(res){
526 if(res.success == true){
527 i.setAttribute('src', res.data);
528 Roo.MessageBox.updateProgress( (total - nodes.length) / total , "Done " + (total - nodes.length) + '/' + total);
537 style : 'margin:10px',
538 url : baseURL + '/Roo/crm_mailing_list_message.php',
543 actioncomplete : function(_self,action)
546 if (action.type == 'setdata') {
548 _this.data.module = _this.data.module || 'crm_mailing_list_message';
550 _this.form.url = baseURL + '/Roo/' + _this.data.module;
552 _this.html_preview.hide();
553 _this.preview_btn.hide();
555 if(_this.data.id*1 > 0){
556 _this.dialog.el.mask("Loading");
557 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
558 _this.html_preview.show();
559 _this.preview_btn.show();
562 _this.form.setValues({
563 'from_name' : Pman.Login.authUser.name,
564 'from_email' : Pman.Login.authUser.email
569 if (action.type == 'load') {
570 _this.dialog.el.unmask();
573 if (action.type =='submit') {
575 _this.dialog.el.unmask();
578 if (_this.callback) {
579 _this.callback.call(_this, action.result.data);
585 rendered : function (form)
598 fieldLabel : _this._strings['b20a8b77b05d53b4e695738731400c85'] /* Mailout Name */,
614 fieldLabel : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
623 fieldLabel : _this._strings['b357b524e740bc85b9790a0712d84a30'] /* Email address */,
634 fieldLabel : _this._strings['c7892ebbb139886662c6f2fc8c450710'] /* Subject */,
649 legend : _this._strings['962b90039a542a29cedd51d87a9f28a1'] /* Html Editor */,
650 style : 'text-align:center;',
700 xtype : 'HtmlEditor',
703 xns : Roo.form.HtmlEditor,
704 '|xns' : 'Roo.form.HtmlEditor',
705 xtype : 'ToolbarContext'
708 xns : Roo.form.HtmlEditor,
709 '|xns' : 'Roo.form.HtmlEditor',
710 xtype : 'ToolbarStandard',
714 displayField : 'name',
716 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
717 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
718 forceSelection : true,
720 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
723 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
724 selectOnFocus : true,
725 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>',
726 triggerAction : 'all',
734 beforequery : function (combo, query, forceAll, cancel, e)
736 var id = _this.form.findField('id').getValue() * 1;
738 Roo.MessageBox.alert("Error", "Save message first");
742 render : function (_self)
744 _this.extendimgselect = _self;
746 select : function (combo, record, index)
752 var editor = _this.form.findField('bodytext').editorcore;
754 var curnode = editor.getSelectedNode();
755 if (curnode && curnode.tagName == 'IMG') {
756 curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',
757 baseURL, record.data.id, record.data.filename
759 // note -forces an update... hopefully...
760 editor.owner.fireEvent('editorevent', editor, false);
763 editor.insertAtCursor(
764 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
765 baseURL, record.data.id, record.data.filename
775 sortInfo : { direction : 'ASC', field: 'id' },
780 beforeload : function (_self, o){
781 o.params = o.params || {};
783 var id = _this.form.findField('id').getValue() * 1;
785 Roo.MessageBox.alert("Error", "Save email template first");
789 o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
791 // o.params.imgtype = 'PressRelease';
792 //o.params['query[imagesize]'] = '150x150';
798 url : baseURL + '/Roo/Images.php',
804 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
807 totalProperty : 'total',
816 displayField : 'name',
818 emptyText : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
819 fieldLabel : _this._strings['6f16a5f8ff5d75ab84c018adacdfcbb7'] /* Field */,
820 forceSelection : true,
822 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
825 qtip : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
826 selectOnFocus : true,
827 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
828 triggerAction : 'all',
836 render : function (_self)
838 _this.unsubscribeselect = _self;
840 select : function (combo, record, index)
846 var editor = _this.form.findField('bodytext').editorcore;
848 if(record.data.name == 'Unsubscribe'){
849 editor.insertAtCursor(
850 String.format('<a href="{0}">{1}</a>',
851 record.data.type, record.data.name
857 editor.insertAtCursor(
867 [ '{person.firstname}', "First Name"],
868 [ '{person.lastname}' , "Last Name"],
869 [ '{person.name}', "Full Name"],
870 [ '#unsubscribe', "Unsubscribe"]
872 fields : [ 'type', 'name'],
875 xtype : 'SimpleStore'
893 text : _this._strings['e9968623956c15023d54335ea3699855'] /* Convert Html to Text */,
898 click : function (_self, e)
900 var h = _this.form.findField('bodytext').getValue();
901 var p = _this.form.findField('plaintext');
904 url : baseURL + '/Core/ImportMailMessage.php',
\r
908 _convertToPlain : true,
909 _check_unsubscribe : true
\r
911 success : function(res) {
\r
912 if(res.success == true){
913 p.setValue(res.data);
931 legend : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
932 style : 'text-align:center;',
967 tableName : 'Images',
968 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
973 activate : function() {
976 _this.igrid.ds.load({});
981 autoExpandColumn : 'filename',
990 //_this.dialog = Pman.Dialog.FILL_IN
991 if (_this.ipanel.active) {
992 // _this.igrid.ds.load({});
1002 cls : 'x-btn-text-icon',
1003 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1004 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
1006 '|xns' : 'Roo.Toolbar',
1011 var id = _this.form.findField('id').getValue();
1014 Roo.MessageBox.alert('Error', 'Please save the email template first');
1018 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1020 Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
1021 _this.igrid.getDataSource().load({});
1027 cls : 'x-btn-text-icon',
1028 icon : rootURL + '/Pman/templates/images/trash.gif',
1029 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
1031 '|xns' : 'Roo.Toolbar',
1036 var s = _this.igrid.getSelectionModel().getSelected();
1037 if (!s || isNaN(s.id *1)) {
1038 Roo.MessageBox.alert("Error", "Select a image");
1041 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
1047 url : baseURL + '/Roo/Images.php',
1052 success : function()
1054 Roo.log('Got Success!!');
1055 _this.igrid.ds.load({});
1066 sortInfo : { field : 'filename', direction: 'ASC' },
1068 '|xns' : 'Roo.data',
1071 beforeload : function (_self, options)
1073 options.params = options.params || {};
1074 if (typeof(_this.data) == 'undefined') {
1077 if(_this.data.id * 1 >= 0)
1079 options.params.onid = _this.data.id;
1081 options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1087 url : baseURL + '/Roo/Images.php',
1089 '|xns' : 'Roo.data',
1127 'name': 'displayorder',
1135 'name': 'parent_image_id',
1141 'dateFormat': 'Y-m-d'
1160 'name': 'parent_image_id_id',
1164 'name': 'parent_image_id_filename',
1168 'name': 'parent_image_id_ontable',
1172 'name': 'parent_image_id_onid',
1176 'name': 'parent_image_id_mimetype',
1180 'name': 'parent_image_id_width',
1184 'name': 'parent_image_id_height',
1188 'name': 'parent_image_id_filesize',
1192 'name': 'parent_image_id_displayorder',
1196 'name': 'parent_image_id_language',
1200 'name': 'parent_image_id_parent_image_id',
1204 'name': 'parent_image_id_created',
1208 'name': 'parent_image_id_imgtype',
1212 'name': 'parent_image_id_linkurl',
1216 'name': 'parent_image_id_descript',
1220 'name': 'parent_image_id_title',
1226 totalProperty : 'total',
1228 '|xns' : 'Roo.data',
1229 xtype : 'JsonReader'
1234 dataIndex : 'filename',
1235 header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
1236 renderer : function(v,x,r)
1238 var width = r.data.width;
1239 var height = r.data.height;
1242 height = Math.round(height * 50 / width);
1246 return '<img src="' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '" width="' + width + '" height="' + height + '" />';
1250 '|xns' : 'Roo.grid',
1251 xtype : 'ColumnModel'
1254 dataIndex : 'displayorder',
1255 header : _this._strings['2393ad754ba179442d85e415d1d5167c'] /* Displayorder */,
1256 renderer : function(v) { return String.format('{0}', v); },
1259 '|xns' : 'Roo.grid',
1260 xtype : 'ColumnModel'
1263 dataIndex : 'title',
1264 header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1265 renderer : function(v) { return String.format('{0}', v); },
1268 '|xns' : 'Roo.grid',
1269 xtype : 'ColumnModel'