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 '308f2757bfc9ce92fb00ff93fdffd279' :"Images / Attachments",
11 'dc0de523c25be298ba751c63c694109e' :"Responsive Email (1)",
12 'ea30b40c3caf28acb29198d20d243e54' :"Images / Attachments >>",
13 '4c2a8fe7eaf24721cc7a9f0175115bd4' :"Message",
14 '2f26e35d61be90501e099089dc533638' :"Select Images",
15 'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
16 '72d6d7a1885885bb55a565fd1070581a' :"Import",
17 '884df8e413319ff51a3f5f528606238a' :"Use template",
18 '396ecabf0cd1f9503e591418851ef406' :"Edit / Create Message",
19 '31bb2f6e9b8fb11cbb7fb63c6025223f' :"Select Template",
20 '1bd18d39370b7f26c1c5e18067b74c6f' :"Html File",
21 '1243daf593fa297e07ab03bf06d925af' :"Searching...",
22 'b78a3223503896721cca1303f776159b' :"Title",
23 '31fde7b05ac8952dacf4af8a704074ec' :"Preview",
24 '5b8ef4e762c00a15a41cfc26dc3ef99c' :"Send me a test copy",
25 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
26 '962b90039a542a29cedd51d87a9f28a1' :"Html Editor",
27 '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
28 '2393ad754ba179442d85e415d1d5167c' :"Displayorder",
29 'b9c49611cfda3259a2b837b39489e650' :"Add Image",
30 'e44b145bd8b49b06e0ad2ced1ad56466' :"Plain Text",
31 'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
32 '1351017ac6423911223bc19a8cb7c653' :"Filename",
33 'c9cc8cce247e49bae79f15173ce97354' :"Save",
34 'e6b391a8d2c4d45902a23a8b6585703d' :"URL",
35 'e9968623956c15023d54335ea3699855' :"Convert Html to Text"
41 show : function(data, cb)
49 this.dialog.show(this.data._el);
52 this.form.setValues(data);
53 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
61 this.dialog = Roo.factory({
66 xtype : 'LayoutRegion'
72 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'],
76 xtype : 'LayoutRegion'
84 title : _this._strings['396ecabf0cd1f9503e591418851ef406'],
87 xtype : 'LayoutDialog',
91 text : _this._strings['31fde7b05ac8952dacf4af8a704074ec'],
95 click : function (_self, e)
97 //_this.dialog.hide();
98 Roo.log(_this.data.module);
99 Pman.Dialog.CoreEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
101 render : function (_self)
103 _this.preview_btn = _self;
109 text : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'],
113 click : function (_self, e)
115 //_this.dialog.hide();
117 var id = _this.form.findField('id').getValue();
120 Roo.MessageBox.alert('Error', 'Please save the message frist!');
125 url : baseURL + '/Core/MessagePreview',
130 _table : _this.data.module
132 success : function(res) {
133 if(res.data == 'SUCCESS'){
134 Roo.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
139 render : function (_self)
141 _this.html_preview = _self;
147 text : _this._strings['ea4788705e6873b424c65e91c2846b19'],
151 click : function (_self, e)
159 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'],
163 click : function (_self, e)
167 _this.form.preValidate(function(res) {
171 _this.form.doAction("submit");
179 show : function (_self)
182 _self.layout.getRegion('center').showPanel(0);
183 var w = Roo.lib.Dom.getViewWidth();
\r
184 var h = Roo.lib.Dom.getViewHeight();
\r this.resizeTo(w-50, h-50);
\r
186 var ew = Math.max(250, w-320);
\r
187 var eh = Math.max(250, h-350) ;
\r
188 var e = _this.dialog.layout.getRegion('east');
193 var el = _self.getEl();
194 var elw = el.dom.clientWidth;
196 var bdtext = _this.form.findField('bodytext');
197 var ptext = _this.form.findField('plaintext');
199 bdtext.width = elw-100;
200 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
201 ptext.setSize(bdtext.width , bdtext.height);
221 text : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'],
225 click : function (_self, e)
227 Pman.Dialog.CoreImportUrl.show({
228 target : '/Core/ImportMailMessage.php'
232 _this.form.findField('bodytext').setValue(data);
240 text : _this._strings['1bd18d39370b7f26c1c5e18067b74c6f'],
244 click : function (_self, e)
246 Pman.Dialog.Image.show({
247 _url : baseURL + '/Core/ImportMailMessage.php'
250 _this.form.findField('bodytext').setValue(data);
259 '|xns' : 'Roo.Toolbar',
260 text : _this._strings['72d6d7a1885885bb55a565fd1070581a'],
276 text : _this._strings['dc0de523c25be298ba751c63c694109e'],
280 click : function (_self, e)
283 var l = document.location;
286 url : baseURL + '/Core/ImportMailMessage.php',
291 importUrl : l.protocol +'//' + l.host + rootURL + '/Pman/Crm/mail_templates/responsive1.html',
293 success : function (res) {
295 _this.form.findField('bodytext').setValue(res.data);
305 '|xns' : 'Roo.Toolbar',
306 text : _this._strings['884df8e413319ff51a3f5f528606238a'],
319 url : baseURL + '/Core/MailTemplateList.php',
325 fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}],
328 totalProperty : 'total',
334 sortInfo : { direction : 'DESC', field: 'file' },
338 beforeload : function (_self, o){
339 o.params = o.params || {};
352 displayField : 'file',
354 emptyText : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'],
355 fieldLabel : 'Template',
356 forceSelection : true,
357 hiddenName : 'template',
359 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
363 qtip : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'],
364 selectOnFocus : true,
365 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{file}</b> </div>',
366 triggerAction : 'all',
373 select : function (combo, record, index)
384 _this.form.findField('bodytext').setValue(record.data.content);
394 '|xns' : 'Roo.Toolbar',
399 '|xns' : 'Roo.Toolbar',
400 text : _this._strings['ea30b40c3caf28acb29198d20d243e54'],
404 click : function (_self, e)
406 var el = _this.dialog.layout.getRegion('east');
425 xtype : 'LayoutRegion'
429 xtype : 'BorderLayout',
438 title : _this._strings['4c2a8fe7eaf24721cc7a9f0175115bd4'],
440 xtype : 'ContentPanel',
442 render : function (_self, width, height)
445 Roo.log("RESIZE, " + width + ',' + height);
447 var ew = Math.max(250, width-50);
448 var eh = Math.max(250,height-50) ;
453 resize : function (_self, width, height)
\r
455 var ew = Math.max(250, width-50);
\r
456 var eh = Math.max(250,height-50) ;
461 var bdtext = _this.form.findField('bodytext');
\r
462 var ptext = _this.form.findField('plaintext');
\r
463 if(bdtext.resizeEl){
\r
464 bdtext.width = ew-50;
\r
465 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
\r
466 ptext.setSize(bdtext.width , bdtext.height);
\r
474 labelAlign : 'right',
477 preValidate : function(done_callback) {
479 Roo.MessageBox.progress("Uploading Images", "Uploading");
480 var html = _this.form.findField('bodytext').getValue();
482 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
484 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
487 s.select('img[src]').each(function(i) {
490 var total = nodes.length;
491 var mkimg = function() {
494 Roo.MessageBox.hide();
495 _this.form.findField('bodytext').syncValue();
497 // _this.form.doAction("submit");
502 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
509 n = i.getAttribute('src').match(/^http(.*)/)
517 url : baseURL + '/Roo/Images.php',
520 onid : _this.form.findField('id').getValue(),
522 _remote_upload : i.src
524 success : function(res){
525 if(res.success == true){
526 i.setAttribute('src', res.data);
527 Roo.MessageBox.updateProgress( (total - nodes.length) / total , "Done " + (total - nodes.length) + '/' + total);
536 style : 'margin:10px',
537 url : baseURL + '/Roo/crm_mailing_list_message.php',
541 actioncomplete : function(_self,action)
544 if (action.type == 'setdata') {
546 _this.data.module = _this.data.module || 'crm_mailing_list_message';
548 _this.form.url = baseURL + '/Roo/' + _this.data.module;
550 _this.html_preview.hide();
551 _this.preview_btn.hide();
553 if(_this.data.id*1 > 0){
554 _this.dialog.el.mask("Loading");
555 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
556 _this.html_preview.show();
557 _this.preview_btn.show();
560 _this.form.setValues({
561 'from_name' : Pman.Login.authUser.name,
562 'from_email' : Pman.Login.authUser.email
567 if (action.type == 'load') {
568 _this.dialog.el.unmask();
571 if (action.type =='submit') {
573 _this.dialog.el.unmask();
576 if (_this.callback) {
577 _this.callback.call(_this, action.result.data);
583 rendered : function (form)
597 fieldLabel : 'Mailout Name',
623 fieldLabel : 'Email address',
635 fieldLabel : 'Subject',
650 legend : _this._strings['962b90039a542a29cedd51d87a9f28a1'],
651 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',
717 url : baseURL + '/Roo/Images.php',
723 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
726 totalProperty : 'total',
732 sortInfo : { direction : 'ASC', field: 'id' },
736 beforeload : function (_self, o){
737 o.params = o.params || {};
739 var id = _this.form.findField('id').getValue() * 1;
741 Roo.MessageBox.alert("Error", "Save email template first");
745 o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
747 // o.params.imgtype = 'PressRelease';
748 //o.params['query[imagesize]'] = '150x150';
759 displayField : 'name',
761 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'],
762 fieldLabel : 'Images',
763 forceSelection : true,
765 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
768 qtip : _this._strings['2f26e35d61be90501e099089dc533638'],
769 selectOnFocus : true,
770 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>',
771 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;
797 editor.insertAtCursor(
798 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
799 baseURL, record.data.id, record.data.filename
815 [ '{person.firstname}', "First Name"],
816 [ '{person.lastname}' , "Last Name"],
817 [ '{person.name}', "Full Name"],
818 [ '#unsubscribe', "Unsubscribe"]
820 fields : [ 'type', 'name'],
822 xtype : 'SimpleStore'
826 displayField : 'name',
828 emptyText : _this._strings['5feb9bf3c03b32635135006cbacb9542'],
829 fieldLabel : 'Field',
830 forceSelection : true,
832 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
835 qtip : _this._strings['5feb9bf3c03b32635135006cbacb9542'],
836 selectOnFocus : true,
837 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
838 triggerAction : 'all',
845 render : function (_self)
847 _this.unsubscribeselect = _self;
849 select : function (combo, record, index)
855 var editor = _this.form.findField('bodytext').editorcore;
857 if(record.data.name == 'Unsubscribe'){
858 editor.insertAtCursor(
859 String.format('<a href="{0}">{1}</a>',
860 record.data.type, record.data.name
866 editor.insertAtCursor(
905 text : _this._strings['e9968623956c15023d54335ea3699855'],
909 click : function (_self, e)
911 var h = _this.form.findField('bodytext').getValue();
912 var p = _this.form.findField('plaintext');
915 url : baseURL + '/Core/ImportMailMessage.php',
\r
919 _convertToPlain : true,
920 _check_unsubscribe : true
\r
922 success : function(res) {
\r
923 if(res.success == true){
924 p.setValue(res.data);
944 legend : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'],
945 style : 'text-align:center;',
983 xtype : 'NestedLayoutPanel',
995 url : baseURL + '/Roo/Images.php',
1000 '|xns' : 'Roo.data',
1035 'name': 'displayorder',
1043 'name': 'parent_image_id',
1049 'dateFormat': 'Y-m-d'
1068 'name': 'parent_image_id_id',
1072 'name': 'parent_image_id_filename',
1076 'name': 'parent_image_id_ontable',
1080 'name': 'parent_image_id_onid',
1084 'name': 'parent_image_id_mimetype',
1088 'name': 'parent_image_id_width',
1092 'name': 'parent_image_id_height',
1096 'name': 'parent_image_id_filesize',
1100 'name': 'parent_image_id_displayorder',
1104 'name': 'parent_image_id_language',
1108 'name': 'parent_image_id_parent_image_id',
1112 'name': 'parent_image_id_created',
1116 'name': 'parent_image_id_imgtype',
1120 'name': 'parent_image_id_linkurl',
1124 'name': 'parent_image_id_descript',
1128 'name': 'parent_image_id_title',
1134 totalProperty : 'total',
1136 xtype : 'JsonReader'
1138 '|xns' : 'Roo.data',
1140 sortInfo : { field : 'filename', direction: 'ASC' },
1144 beforeload : function (_self, options)
1146 options.params = options.params || {};
1147 if (typeof(_this.data) == 'undefined') {
1150 if(_this.data.id * 1 >= 0)
1152 options.params.onid = _this.data.id;
1154 options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1169 '|xns' : 'Roo.Toolbar',
1170 cls : 'x-btn-text-icon',
1171 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1172 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'],
1178 var id = _this.form.findField('id').getValue();
1181 Roo.MessageBox.alert('Error', 'Please save the email template first');
1185 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1187 Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
1188 _this.igrid.getDataSource().load({});
1194 '|xns' : 'Roo.Toolbar',
1195 cls : 'x-btn-text-icon',
1196 icon : rootURL + '/Pman/templates/images/trash.gif',
1197 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'],
1203 var s = _this.igrid.getSelectionModel().getSelected();
1204 if (!s || isNaN(s.id *1)) {
1205 Roo.MessageBox.alert("Error", "Select a image");
1208 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
1214 url : baseURL + '/Roo/Images.php',
1219 success : function()
1221 Roo.log('Got Success!!');
1222 _this.igrid.ds.load({});
1232 '|xns' : 'Roo.grid',
1233 autoExpandColumn : 'filename',
1239 '|xns' : 'Roo.grid',
1240 dataIndex : 'filename',
1241 header : _this._strings['1351017ac6423911223bc19a8cb7c653'],
1242 renderer : function(v,x,r)
1244 return '<img src="' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '" width="' + r.data.width + '" height="' + r.data.height + '" />';
1248 xtype : 'ColumnModel'
1251 '|xns' : 'Roo.grid',
1252 dataIndex : 'displayorder',
1253 header : _this._strings['2393ad754ba179442d85e415d1d5167c'],
1254 renderer : function(v) { return String.format('{0}', v); },
1257 xtype : 'ColumnModel'
1260 '|xns' : 'Roo.grid',
1261 dataIndex : 'title',
1262 header : _this._strings['b78a3223503896721cca1303f776159b'],
1263 renderer : function(v) { return String.format('{0}', v); },
1266 xtype : 'ColumnModel'
1273 //_this.dialog = Pman.Dialog.FILL_IN
1274 if (_this.ipanel.active) {
1275 // _this.igrid.ds.load({});
1287 fitContainer : true,
1290 tableName : 'Images',
1291 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'],
1293 xtype : 'GridPanel',
1295 activate : function() {
1296 _this.ipanel = this;
1298 _this.igrid.ds.load({});