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");
474 var html = _this.form.findField('bodytext').getValue();
476 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
478 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
481 s.select('img[src]').each(function(i) {
484 var total = nodes.length;
485 var mkimg = function() {
488 Roo.MessageBox.hide();
489 _this.form.findField('bodytext').syncValue();
491 // _this.form.doAction("submit");
496 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
503 n = i.getAttribute('src').match(/^http(.*)/)
511 url : baseURL + '/Roo/Images.php',
514 onid : _this.form.findField('id').getValue(),
516 _remote_upload : i.src
518 success : function(res){
519 if(res.success == true){
520 i.setAttribute('src', res.data);
521 Roo.MessageBox.updateProgress( (total - nodes.length) / total , "Done " + (total - nodes.length) + '/' + total);
530 style : 'margin:10px',
531 url : baseURL + '/Roo/crm_mailing_list_message.php',
536 actioncomplete : function(_self,action)
539 if (action.type == 'setdata') {
541 _this.data.module = _this.data.module || 'crm_mailing_list_message';
543 _this.form.url = baseURL + '/Roo/' + _this.data.module;
545 _this.html_preview.hide();
546 _this.preview_btn.hide();
548 if(_this.data.id*1 > 0){
549 _this.dialog.el.mask("Loading");
550 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
551 _this.html_preview.show();
552 _this.preview_btn.show();
555 _this.form.setValues({
556 'from_name' : Pman.Login.authUser.name,
557 'from_email' : Pman.Login.authUser.email
562 if (action.type == 'load') {
563 _this.dialog.el.unmask();
566 if (action.type =='submit') {
568 _this.dialog.el.unmask();
571 if (_this.callback) {
572 _this.callback.call(_this, action.result.data);
578 rendered : function (form)
591 fieldLabel : _this._strings['b20a8b77b05d53b4e695738731400c85'] /* Mailout Name */,
607 fieldLabel : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
616 fieldLabel : _this._strings['b357b524e740bc85b9790a0712d84a30'] /* Email address */,
627 fieldLabel : _this._strings['c7892ebbb139886662c6f2fc8c450710'] /* Subject */,
642 legend : _this._strings['962b90039a542a29cedd51d87a9f28a1'] /* Html Editor */,
643 style : 'text-align:center;',
693 xtype : 'HtmlEditor',
696 xns : Roo.form.HtmlEditor,
697 '|xns' : 'Roo.form.HtmlEditor',
698 xtype : 'ToolbarContext'
701 xns : Roo.form.HtmlEditor,
702 '|xns' : 'Roo.form.HtmlEditor',
703 xtype : 'ToolbarStandard',
707 displayField : 'name',
709 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
710 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
711 forceSelection : true,
713 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
716 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
717 selectOnFocus : true,
718 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>',
719 triggerAction : 'all',
727 beforequery : function (combo, query, forceAll, cancel, e)
729 var id = _this.form.findField('id').getValue() * 1;
731 Roo.MessageBox.alert("Error", "Save message first");
735 render : function (_self)
737 _this.extendimgselect = _self;
739 select : function (combo, record, index)
745 var editor = _this.form.findField('bodytext').editorcore;
746 editor.insertAtCursor(
747 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
748 baseURL, record.data.id, record.data.filename
757 sortInfo : { direction : 'ASC', field: 'id' },
762 beforeload : function (_self, o){
763 o.params = o.params || {};
765 var id = _this.form.findField('id').getValue() * 1;
767 Roo.MessageBox.alert("Error", "Save email template first");
771 o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
773 // o.params.imgtype = 'PressRelease';
774 //o.params['query[imagesize]'] = '150x150';
780 url : baseURL + '/Roo/Images.php',
786 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
789 totalProperty : 'total',
798 displayField : 'name',
800 emptyText : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
801 fieldLabel : _this._strings['6f16a5f8ff5d75ab84c018adacdfcbb7'] /* Field */,
802 forceSelection : true,
804 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
807 qtip : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
808 selectOnFocus : true,
809 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
810 triggerAction : 'all',
818 render : function (_self)
820 _this.unsubscribeselect = _self;
822 select : function (combo, record, index)
828 var editor = _this.form.findField('bodytext').editorcore;
830 if(record.data.name == 'Unsubscribe'){
831 editor.insertAtCursor(
832 String.format('<a href="{0}">{1}</a>',
833 record.data.type, record.data.name
839 editor.insertAtCursor(
849 [ '{person.firstname}', "First Name"],
850 [ '{person.lastname}' , "Last Name"],
851 [ '{person.name}', "Full Name"],
852 [ '#unsubscribe', "Unsubscribe"]
854 fields : [ 'type', 'name'],
857 xtype : 'SimpleStore'
875 text : _this._strings['e9968623956c15023d54335ea3699855'] /* Convert Html to Text */,
880 click : function (_self, e)
882 var h = _this.form.findField('bodytext').getValue();
883 var p = _this.form.findField('plaintext');
886 url : baseURL + '/Core/ImportMailMessage.php',
\r
890 _convertToPlain : true,
891 _check_unsubscribe : true
\r
893 success : function(res) {
\r
894 if(res.success == true){
895 p.setValue(res.data);
913 legend : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
914 style : 'text-align:center;',
949 tableName : 'Images',
950 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
955 activate : function() {
958 _this.igrid.ds.load({});
963 autoExpandColumn : 'filename',
972 //_this.dialog = Pman.Dialog.FILL_IN
973 if (_this.ipanel.active) {
974 // _this.igrid.ds.load({});
984 cls : 'x-btn-text-icon',
985 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
986 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
988 '|xns' : 'Roo.Toolbar',
993 var id = _this.form.findField('id').getValue();
996 Roo.MessageBox.alert('Error', 'Please save the email template first');
1000 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1002 Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
1003 _this.igrid.getDataSource().load({});
1009 cls : 'x-btn-text-icon',
1010 icon : rootURL + '/Pman/templates/images/trash.gif',
1011 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
1013 '|xns' : 'Roo.Toolbar',
1018 var s = _this.igrid.getSelectionModel().getSelected();
1019 if (!s || isNaN(s.id *1)) {
1020 Roo.MessageBox.alert("Error", "Select a image");
1023 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
1029 url : baseURL + '/Roo/Images.php',
1034 success : function()
1036 Roo.log('Got Success!!');
1037 _this.igrid.ds.load({});
1048 sortInfo : { field : 'filename', direction: 'ASC' },
1050 '|xns' : 'Roo.data',
1053 beforeload : function (_self, options)
1055 options.params = options.params || {};
1056 if (typeof(_this.data) == 'undefined') {
1059 if(_this.data.id * 1 >= 0)
1061 options.params.onid = _this.data.id;
1063 options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1069 url : baseURL + '/Roo/Images.php',
1071 '|xns' : 'Roo.data',
1109 'name': 'displayorder',
1117 'name': 'parent_image_id',
1123 'dateFormat': 'Y-m-d'
1142 'name': 'parent_image_id_id',
1146 'name': 'parent_image_id_filename',
1150 'name': 'parent_image_id_ontable',
1154 'name': 'parent_image_id_onid',
1158 'name': 'parent_image_id_mimetype',
1162 'name': 'parent_image_id_width',
1166 'name': 'parent_image_id_height',
1170 'name': 'parent_image_id_filesize',
1174 'name': 'parent_image_id_displayorder',
1178 'name': 'parent_image_id_language',
1182 'name': 'parent_image_id_parent_image_id',
1186 'name': 'parent_image_id_created',
1190 'name': 'parent_image_id_imgtype',
1194 'name': 'parent_image_id_linkurl',
1198 'name': 'parent_image_id_descript',
1202 'name': 'parent_image_id_title',
1208 totalProperty : 'total',
1210 '|xns' : 'Roo.data',
1211 xtype : 'JsonReader'
1216 dataIndex : 'filename',
1217 header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
1218 renderer : function(v,x,r)
1220 var width = r.data.width;
1221 var height = r.data.height;
1225 height = Math.round(height *width / 50);
1228 return '<img src="' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '" width="' + width + '" height="' + height + '" />';
1232 '|xns' : 'Roo.grid',
1233 xtype : 'ColumnModel'
1236 dataIndex : 'displayorder',
1237 header : _this._strings['2393ad754ba179442d85e415d1d5167c'] /* Displayorder */,
1238 renderer : function(v) { return String.format('{0}', v); },
1241 '|xns' : 'Roo.grid',
1242 xtype : 'ColumnModel'
1245 dataIndex : 'title',
1246 header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1247 renderer : function(v) { return String.format('{0}', v); },
1250 '|xns' : 'Roo.grid',
1251 xtype : 'ColumnModel'