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, 5000);
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();
575 _this.form.findField('bodytext').originalValue = _this.form.findField('bodytext').getValue();
579 if (action.type =='submit') {
581 _this.dialog.el.unmask();
584 if (_this.callback) {
585 _this.callback.call(_this, action.result.data);
591 rendered : function (form)
604 fieldLabel : _this._strings['b20a8b77b05d53b4e695738731400c85'] /* Mailout Name */,
620 fieldLabel : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
629 fieldLabel : _this._strings['b357b524e740bc85b9790a0712d84a30'] /* Email address */,
640 fieldLabel : _this._strings['c7892ebbb139886662c6f2fc8c450710'] /* Subject */,
655 legend : _this._strings['962b90039a542a29cedd51d87a9f28a1'] /* Html Editor */,
656 style : 'text-align:center;',
662 autosave : function() {
664 var body = _this.form.findField('bodytext');
666 if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
667 Roo.log('body not dirty');
671 Roo.log('body dirty, auto save!');
673 body.fireEvent('autosave', body);
721 xtype : 'HtmlEditor',
723 autosave : function (_self)
727 var id = _this.form.findField('id').getValue() * 1;
729 if(!_self.editorcore.sourceEditMode){
736 url : baseURL + '/Roo/Events.php',
741 on_id : (id > 0) ? id : 0,
742 on_table : 'crm_mailing_list_message',
744 source: _self.getValue()
746 success : function() {
747 _self.originalValue = _self.getValue();
752 //Roo.MessageBox.alert("Error", "autosave failed");
753 Roo.log('body autosave failed?!');
758 savedpreview : function (_self)
760 Roo.log('saved preview');
762 var id = _this.form.findField('id').getValue() * 1;
764 var successFn = function(res){
765 return res.data.POST.source;
771 on_id : (id < 1) ? 0 : id,
772 on_table : 'crm_mailing_list_message',
773 successFn : successFn
777 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
779 _self.originalValue = res;
785 xns : Roo.form.HtmlEditor,
786 '|xns' : 'Roo.form.HtmlEditor',
787 xtype : 'ToolbarContext'
790 xns : Roo.form.HtmlEditor,
791 '|xns' : 'Roo.form.HtmlEditor',
792 xtype : 'ToolbarStandard',
796 displayField : 'name',
798 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
799 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
800 forceSelection : true,
802 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
805 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
806 selectOnFocus : true,
807 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>',
808 triggerAction : 'all',
816 beforequery : function (combo, query, forceAll, cancel, e)
818 var id = _this.form.findField('id').getValue() * 1;
820 Roo.MessageBox.alert("Error", "Save message first");
824 render : function (_self)
826 _this.extendimgselect = _self;
828 select : function (combo, record, index)
834 var editor = _this.form.findField('bodytext').editorcore;
836 var curnode = editor.getSelectedNode();
837 if (curnode && curnode.tagName == 'IMG') {
838 curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',
839 baseURL, record.data.id, record.data.filename
841 // note -forces an update... hopefully...
842 editor.owner.fireEvent('editorevent', editor, false);
845 editor.insertAtCursor(
846 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
847 baseURL, record.data.id, record.data.filename
857 sortInfo : { direction : 'ASC', field: 'id' },
862 beforeload : function (_self, o){
863 o.params = o.params || {};
865 var id = _this.form.findField('id').getValue() * 1;
867 Roo.MessageBox.alert("Error", "Save email template first");
871 o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
873 // o.params.imgtype = 'PressRelease';
874 //o.params['query[imagesize]'] = '150x150';
880 url : baseURL + '/Roo/Images.php',
886 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
889 totalProperty : 'total',
898 displayField : 'name',
900 emptyText : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
901 fieldLabel : _this._strings['6f16a5f8ff5d75ab84c018adacdfcbb7'] /* Field */,
902 forceSelection : true,
904 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
907 qtip : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
908 selectOnFocus : true,
909 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
910 triggerAction : 'all',
918 render : function (_self)
920 _this.unsubscribeselect = _self;
922 select : function (combo, record, index)
928 var editor = _this.form.findField('bodytext').editorcore;
930 if(record.data.name == 'Unsubscribe'){
931 editor.insertAtCursor(
932 String.format('<a href="{0}">{1}</a>',
933 record.data.type, record.data.name
939 editor.insertAtCursor(
949 [ '{person.firstname}', "First Name"],
950 [ '{person.lastname}' , "Last Name"],
951 [ '{person.name}', "Full Name"],
952 [ '#unsubscribe', "Unsubscribe"]
954 fields : [ 'type', 'name'],
957 xtype : 'SimpleStore'
962 '|xns' : 'Roo.Toolbar',
966 cls : 'x-init-enable',
967 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
969 '|xns' : 'Roo.Toolbar',
972 click : function (_self, e)
974 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
994 text : _this._strings['e9968623956c15023d54335ea3699855'] /* Convert Html to Text */,
999 click : function (_self, e)
1001 var h = _this.form.findField('bodytext').getValue();
1002 var p = _this.form.findField('plaintext');
1004 new Pman.Request({
\r
1005 url : baseURL + '/Core/ImportMailMessage.php',
\r
1009 _convertToPlain : true,
1010 _check_unsubscribe : true
\r
1012 success : function(res) {
\r
1013 if(res.success == true){
1014 p.setValue(res.data);
1027 '|xns' : 'Roo.form',
1032 legend : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
1033 style : 'text-align:center;',
1035 '|xns' : 'Roo.form',
1042 '|xns' : 'Roo.form',
1052 '|xns' : 'Roo.form',
1065 fitContainer : true,
1068 tableName : 'Images',
1069 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
1072 xtype : 'GridPanel',
1074 activate : function() {
1075 _this.ipanel = this;
1077 _this.igrid.ds.load({});
1082 autoExpandColumn : 'filename',
1085 '|xns' : 'Roo.grid',
1091 //_this.dialog = Pman.Dialog.FILL_IN
1092 if (_this.ipanel.active) {
1093 // _this.igrid.ds.load({});
1103 cls : 'x-btn-text-icon',
1104 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1105 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
1107 '|xns' : 'Roo.Toolbar',
1112 var id = _this.form.findField('id').getValue();
1115 Roo.MessageBox.alert('Error', 'Please save the email template first');
1119 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1121 Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
1122 _this.igrid.getDataSource().load({});
1128 cls : 'x-btn-text-icon',
1129 icon : rootURL + '/Pman/templates/images/trash.gif',
1130 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
1132 '|xns' : 'Roo.Toolbar',
1137 var s = _this.igrid.getSelectionModel().getSelected();
1138 if (!s || isNaN(s.id *1)) {
1139 Roo.MessageBox.alert("Error", "Select a image");
1142 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
1148 url : baseURL + '/Roo/Images.php',
1153 success : function()
1155 Roo.log('Got Success!!');
1156 _this.igrid.ds.load({});
1167 sortInfo : { field : 'filename', direction: 'ASC' },
1169 '|xns' : 'Roo.data',
1172 beforeload : function (_self, options)
1174 options.params = options.params || {};
1175 if (typeof(_this.data) == 'undefined') {
1178 if(_this.data.id * 1 >= 0)
1180 options.params.onid = _this.data.id;
1182 options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1188 url : baseURL + '/Roo/Images.php',
1190 '|xns' : 'Roo.data',
1228 'name': 'displayorder',
1236 'name': 'parent_image_id',
1242 'dateFormat': 'Y-m-d'
1261 'name': 'parent_image_id_id',
1265 'name': 'parent_image_id_filename',
1269 'name': 'parent_image_id_ontable',
1273 'name': 'parent_image_id_onid',
1277 'name': 'parent_image_id_mimetype',
1281 'name': 'parent_image_id_width',
1285 'name': 'parent_image_id_height',
1289 'name': 'parent_image_id_filesize',
1293 'name': 'parent_image_id_displayorder',
1297 'name': 'parent_image_id_language',
1301 'name': 'parent_image_id_parent_image_id',
1305 'name': 'parent_image_id_created',
1309 'name': 'parent_image_id_imgtype',
1313 'name': 'parent_image_id_linkurl',
1317 'name': 'parent_image_id_descript',
1321 'name': 'parent_image_id_title',
1327 totalProperty : 'total',
1329 '|xns' : 'Roo.data',
1330 xtype : 'JsonReader'
1335 dataIndex : 'filename',
1336 header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
1337 renderer : function(v,x,r)
1339 var width = r.data.width;
1340 var height = r.data.height;
1343 height = Math.round(height * 50 / width);
1347 return '<img src="' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '" width="' + width + '" height="' + height + '" />';
1351 '|xns' : 'Roo.grid',
1352 xtype : 'ColumnModel'
1355 dataIndex : 'displayorder',
1356 header : _this._strings['2393ad754ba179442d85e415d1d5167c'] /* Displayorder */,
1357 renderer : function(v) { return String.format('{0}', v); },
1360 '|xns' : 'Roo.grid',
1361 xtype : 'ColumnModel'
1364 dataIndex : 'title',
1365 header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1366 renderer : function(v) { return String.format('{0}', v); },
1369 '|xns' : 'Roo.grid',
1370 xtype : 'ColumnModel'