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 'c4ca4238a0b923820dcc509a6f75849b' :"1",
32 'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version",
33 'b20a8b77b05d53b4e695738731400c85' :"Mailout Name",
34 '1bd18d39370b7f26c1c5e18067b74c6f' :"Html File",
35 '5da618e8e4b89c66fe86e32cdafde142' :"From",
36 '31bb2f6e9b8fb11cbb7fb63c6025223f' :"Select Template",
37 'b78a3223503896721cca1303f776159b' :"Title",
38 '278c491bdd8a53618c149c4ac790da34' :"Template",
39 '1351017ac6423911223bc19a8cb7c653' :"Filename",
40 '308f2757bfc9ce92fb00ff93fdffd279' :"Images / Attachments",
41 'c9cc8cce247e49bae79f15173ce97354' :"Save",
42 '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
43 '4c2a8fe7eaf24721cc7a9f0175115bd4' :"Message",
44 'fff0d600f8a0b5e19e88bfb821dd1157' :"Images"
50 show : function(data, cb)
58 this.dialog.show(this.data._el);
61 this.form.setValues(data);
62 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
70 this.dialog = Roo.factory({
76 title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
80 xtype : 'LayoutDialog',
82 show : function (_self)
85 _self.layout.getRegion('center').showPanel(0);
86 var w = Roo.lib.Dom.getViewWidth();
\r
87 var h = Roo.lib.Dom.getViewHeight();
\r this.resizeTo(w-50, h-50);
\r
89 var ew = Math.max(250, w-320);
\r
90 var eh = Math.max(250, h-350) ;
\r
91 var e = _this.dialog.layout.getRegion('east');
96 var el = _self.getEl();
97 var elw = el.dom.clientWidth;
99 var bdtext = _this.form.findField('bodytext');
100 var ptext = _this.form.findField('plaintext');
102 bdtext.width = elw-100;
103 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
104 ptext.setSize(bdtext.width , bdtext.height);
113 xtype : 'LayoutRegion'
118 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
123 xtype : 'LayoutRegion'
127 text : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
132 click : function (_self, e)
134 //_this.dialog.hide();
135 Roo.log(_this.data.module);
136 Pman.Dialog.CoreEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
138 render : function (_self)
140 _this.preview_btn = _self;
145 text : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
150 click : function (_self, e)
152 //_this.dialog.hide();
154 var id = _this.form.findField('id').getValue();
157 Roo.MessageBox.alert('Error', 'Please save the message frist!');
162 url : baseURL + '/Core/MessagePreview',
167 _table : _this.data.module
169 success : function(res) {
170 if(res.data == 'SUCCESS'){
171 Roo.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
176 render : function (_self)
178 _this.html_preview = _self;
183 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
188 click : function (_self, e)
195 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
200 click : function (_self, e)
204 _this.form.preValidate(function(res) {
208 _this.form.doAction("submit");
223 xtype : 'NestedLayoutPanel',
230 text : _this._strings['72d6d7a1885885bb55a565fd1070581a'] /* Import */,
232 '|xns' : 'Roo.Toolbar',
240 text : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
245 click : function (_self, e)
247 Pman.Dialog.CoreImportUrl.show({
248 target : '/Core/ImportMailMessage.php'
252 _this.form.findField('bodytext').setValue(data);
259 text : _this._strings['1bd18d39370b7f26c1c5e18067b74c6f'] /* Html File */,
264 click : function (_self, e)
266 Pman.Dialog.Image.show({
267 _url : baseURL + '/Core/ImportMailMessage.php'
270 _this.form.findField('bodytext').setValue(data);
280 text : _this._strings['884df8e413319ff51a3f5f528606238a'] /* Use template */,
282 '|xns' : 'Roo.Toolbar',
290 text : _this._strings['dc0de523c25be298ba751c63c694109e'] /* Responsive Email (1) */,
295 click : function (_self, e)
298 var l = document.location;
301 url : baseURL + '/Core/ImportMailMessage.php',
306 importUrl : l.protocol +'//' + l.host + rootURL + '/Pman/Crm/mail_templates/responsive1.html'
308 success : function (res) {
310 _this.form.findField('bodytext').setValue(res.data);
323 displayField : 'file',
325 emptyText : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
326 fieldLabel : _this._strings['278c491bdd8a53618c149c4ac790da34'] /* Template */,
327 forceSelection : true,
328 hiddenName : 'template',
330 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
334 qtip : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
335 selectOnFocus : true,
336 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{file}</b> </div>',
337 triggerAction : 'all',
345 select : function (combo, record, index)
356 _this.form.findField('bodytext').setValue(record.data.content);
362 sortInfo : { direction : 'DESC', field: 'file' },
367 beforeload : function (_self, o){
368 o.params = o.params || {};
375 url : baseURL + '/Core/MailTemplateList.php',
381 fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}],
384 totalProperty : 'total',
393 '|xns' : 'Roo.Toolbar',
397 text : _this._strings['ea30b40c3caf28acb29198d20d243e54'] /* Images / Attachments >> */,
399 '|xns' : 'Roo.Toolbar',
402 click : function (_self, e)
404 var el = _this.dialog.layout.getRegion('east');
420 xtype : 'BorderLayout',
425 xtype : 'LayoutRegion'
434 title : _this._strings['4c2a8fe7eaf24721cc7a9f0175115bd4'] /* Message */,
437 xtype : 'ContentPanel',
439 render : function (_self, width, height)
442 Roo.log("RESIZE, " + width + ',' + height);
444 var ew = Math.max(250, width-50);
445 var eh = Math.max(250,height-50) ;
450 resize : function (_self, width, height)
\r
452 var ew = Math.max(250, width-50);
\r
453 var eh = Math.max(250,height-50) ;
458 var bdtext = _this.form.findField('bodytext');
\r
459 var ptext = _this.form.findField('plaintext');
\r
460 if(bdtext.resizeEl){
\r
461 bdtext.width = ew-50;
\r
462 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
\r
463 ptext.setSize(bdtext.width , bdtext.height);
\r
470 labelAlign : 'right',
473 preValidate : function(done_callback) {
475 Roo.MessageBox.progress("Uploading Images", "Uploading");
477 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
478 _this.form.findField('bodytext').syncValue();
480 _this.form.findField('bodytext').pushValue();
483 var html = _this.form.findField('bodytext').getValue();
485 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
487 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
490 s.select('img[src]').each(function(i) {
493 var total = nodes.length;
494 var mkimg = function() {
497 Roo.MessageBox.hide();
498 _this.form.findField('bodytext').syncValue();
500 // _this.form.doAction("submit");
505 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
512 n = i.getAttribute('src').match(/^http(.*)/);
520 url : baseURL + '/Roo/Images.php',
523 onid : _this.form.findField('id').getValue(),
525 _remote_upload : i.src
527 success : function(res){
528 if(res.success == true){
529 i.setAttribute('src', res.data);
530 Roo.MessageBox.updateProgress( (total - nodes.length) / total , "Done " + (total - nodes.length) + '/' + total);
539 style : 'margin:10px',
540 url : baseURL + '/Roo/crm_mailing_list_message.php',
545 actioncomplete : function(_self,action)
548 if (action.type == 'setdata') {
550 setInterval(_this.form.findField('bodytext').autosave, 5000);
552 _this.data.module = _this.data.module || 'crm_mailing_list_message';
554 _this.form.url = baseURL + '/Roo/' + _this.data.module;
556 _this.html_preview.hide();
557 _this.preview_btn.hide();
559 if(_this.data.id*1 > 0){
560 _this.dialog.el.mask("Loading");
561 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
562 _this.html_preview.show();
563 _this.preview_btn.show();
566 _this.form.setValues({
567 'from_name' : Pman.Login.authUser.name,
568 'from_email' : Pman.Login.authUser.email
573 if (action.type == 'load') {
574 _this.dialog.el.unmask();
576 _this.form.findField('bodytext').originalValue = _this.form.findField('bodytext').getValue();
580 if (action.type =='submit') {
582 _this.dialog.el.unmask();
585 if (_this.callback) {
586 _this.callback.call(_this, action.result.data);
592 rendered : function (form)
605 fieldLabel : _this._strings['b20a8b77b05d53b4e695738731400c85'] /* Mailout Name */,
619 boxLabel : 'Enabled - will be sent out',
625 check : function (_self, checked)
642 fieldLabel : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
651 fieldLabel : _this._strings['b357b524e740bc85b9790a0712d84a30'] /* Email address */,
662 fieldLabel : _this._strings['c7892ebbb139886662c6f2fc8c450710'] /* Subject */,
677 legend : _this._strings['962b90039a542a29cedd51d87a9f28a1'] /* Html Editor */,
678 style : 'text-align:center;',
684 autosave : function() {
686 var body = _this.form.findField('bodytext');
688 if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
689 Roo.log('body not dirty');
693 Roo.log('body dirty, auto save!');
695 body.fireEvent('autosave', body);
742 xtype : 'HtmlEditor',
744 autosave : function (_self)
748 var id = _this.form.findField('id').getValue() * 1;
751 if(!_self.editorcore.sourceEditMode){
759 url : baseURL + '/Roo/Events.php',
764 on_id : (id > 0) ? id : 0,
765 on_table : 'crm_mailing_list_message',
767 source: _self.getValue()
769 success : function() {
770 _self.originalValue = _self.getValue();
775 Roo.log('body autosave failed?!');
780 savedpreview : function (_self)
782 var id = _this.form.findField('id').getValue() * 1;
784 var successFn = function(res){
785 return res.data.POST.source;
791 on_id : (id < 1) ? 0 : id,
792 on_table : 'crm_mailing_list_message',
793 successFn : successFn
797 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
799 _self.originalValue = res;
805 xns : Roo.form.HtmlEditor,
806 '|xns' : 'Roo.form.HtmlEditor',
807 xtype : 'ToolbarContext'
810 xns : Roo.form.HtmlEditor,
811 '|xns' : 'Roo.form.HtmlEditor',
812 xtype : 'ToolbarStandard',
816 displayField : 'name',
818 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
819 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
820 forceSelection : true,
822 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
825 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
826 selectOnFocus : true,
827 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>',
828 triggerAction : 'all',
836 beforequery : function (combo, query, forceAll, cancel, e)
838 var id = _this.form.findField('id').getValue() * 1;
840 Roo.MessageBox.alert("Error", "Save message first");
844 render : function (_self)
846 _this.extendimgselect = _self;
848 select : function (combo, record, index)
854 var editor = _this.form.findField('bodytext').editorcore;
856 var curnode = editor.getSelectedNode();
857 if (curnode && curnode.tagName == 'IMG') {
858 curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',
859 baseURL, record.data.id, record.data.filename
861 // note -forces an update... hopefully...
862 editor.owner.fireEvent('editorevent', editor, false);
865 editor.insertAtCursor(
866 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
867 baseURL, record.data.id, record.data.filename
877 sortInfo : { direction : 'ASC', field: 'id' },
882 beforeload : function (_self, o){
883 o.params = o.params || {};
885 var id = _this.form.findField('id').getValue() * 1;
887 Roo.MessageBox.alert("Error", "Save email template first");
891 o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
893 // o.params.imgtype = 'PressRelease';
894 //o.params['query[imagesize]'] = '150x150';
900 url : baseURL + '/Roo/Images.php',
906 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
909 totalProperty : 'total',
918 displayField : 'name',
920 emptyText : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
921 fieldLabel : _this._strings['6f16a5f8ff5d75ab84c018adacdfcbb7'] /* Field */,
922 forceSelection : true,
924 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
927 qtip : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
928 selectOnFocus : true,
929 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
930 triggerAction : 'all',
938 render : function (_self)
940 _this.unsubscribeselect = _self;
942 select : function (combo, record, index)
948 var editor = _this.form.findField('bodytext').editorcore;
950 if(record.data.name == 'Unsubscribe'){
951 editor.insertAtCursor(
952 String.format('<a href="{0}">{1}</a>',
953 record.data.type, record.data.name
959 editor.insertAtCursor(
969 [ '{person.firstname}', "First Name"],
970 [ '{person.lastname}' , "Last Name"],
971 [ '{person.name}', "Full Name"],
972 [ '#unsubscribe', "Unsubscribe"]
974 fields : [ 'type', 'name'],
977 xtype : 'SimpleStore'
982 '|xns' : 'Roo.Toolbar',
986 cls : 'x-init-enable',
987 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
989 '|xns' : 'Roo.Toolbar',
992 click : function (_self, e)
994 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
1010 '|xns' : 'Roo.form',
1014 text : _this._strings['e9968623956c15023d54335ea3699855'] /* Convert Html to Text */,
1019 click : function (_self, e)
1021 var h = _this.form.findField('bodytext').getValue();
1022 var p = _this.form.findField('plaintext');
1024 new Pman.Request({
\r
1025 url : baseURL + '/Core/ImportMailMessage.php',
\r
1029 _convertToPlain : true,
1030 _check_unsubscribe : true
\r
1032 success : function(res) {
\r
1033 if(res.success == true){
1034 p.setValue(res.data);
1047 '|xns' : 'Roo.form',
1052 legend : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
1053 style : 'text-align:center;',
1055 '|xns' : 'Roo.form',
1062 '|xns' : 'Roo.form',
1072 '|xns' : 'Roo.form',
1085 fitContainer : true,
1088 tableName : 'Images',
1089 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
1092 xtype : 'GridPanel',
1094 activate : function() {
1095 _this.ipanel = this;
1097 _this.igrid.ds.load({});
1102 autoExpandColumn : 'filename',
1105 '|xns' : 'Roo.grid',
1111 //_this.dialog = Pman.Dialog.FILL_IN
1112 if (_this.ipanel.active) {
1113 // _this.igrid.ds.load({});
1123 cls : 'x-btn-text-icon',
1124 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1125 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
1127 '|xns' : 'Roo.Toolbar',
1132 var id = _this.form.findField('id').getValue();
1135 Roo.MessageBox.alert('Error', 'Please save the email template first');
1139 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1141 Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
1142 _this.igrid.getDataSource().load({});
1148 cls : 'x-btn-text-icon',
1149 icon : rootURL + '/Pman/templates/images/trash.gif',
1150 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
1152 '|xns' : 'Roo.Toolbar',
1157 var s = _this.igrid.getSelectionModel().getSelected();
1158 if (!s || isNaN(s.id *1)) {
1159 Roo.MessageBox.alert("Error", "Select a image");
1162 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
1168 url : baseURL + '/Roo/Images.php',
1173 success : function()
1175 Roo.log('Got Success!!');
1176 _this.igrid.ds.load({});
1187 sortInfo : { field : 'filename', direction: 'ASC' },
1189 '|xns' : 'Roo.data',
1192 beforeload : function (_self, options)
1194 options.params = options.params || {};
1195 if (typeof(_this.data) == 'undefined') {
1198 if(_this.data.id * 1 >= 0)
1200 options.params.onid = _this.data.id;
1202 options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1208 url : baseURL + '/Roo/Images.php',
1210 '|xns' : 'Roo.data',
1248 'name': 'displayorder',
1256 'name': 'parent_image_id',
1262 'dateFormat': 'Y-m-d'
1281 'name': 'parent_image_id_id',
1285 'name': 'parent_image_id_filename',
1289 'name': 'parent_image_id_ontable',
1293 'name': 'parent_image_id_onid',
1297 'name': 'parent_image_id_mimetype',
1301 'name': 'parent_image_id_width',
1305 'name': 'parent_image_id_height',
1309 'name': 'parent_image_id_filesize',
1313 'name': 'parent_image_id_displayorder',
1317 'name': 'parent_image_id_language',
1321 'name': 'parent_image_id_parent_image_id',
1325 'name': 'parent_image_id_created',
1329 'name': 'parent_image_id_imgtype',
1333 'name': 'parent_image_id_linkurl',
1337 'name': 'parent_image_id_descript',
1341 'name': 'parent_image_id_title',
1347 totalProperty : 'total',
1349 '|xns' : 'Roo.data',
1350 xtype : 'JsonReader'
1355 dataIndex : 'filename',
1356 header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
1357 renderer : function(v,x,r)
1359 var width = r.data.width;
1360 var height = r.data.height;
1363 height = Math.round(height * 50 / width);
1367 return '<img src="' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '" width="' + width + '" height="' + height + '" />';
1371 '|xns' : 'Roo.grid',
1372 xtype : 'ColumnModel'
1375 dataIndex : 'displayorder',
1376 header : _this._strings['2393ad754ba179442d85e415d1d5167c'] /* Displayorder */,
1377 renderer : function(v) { return String.format('{0}', v); },
1380 '|xns' : 'Roo.grid',
1381 xtype : 'ColumnModel'
1384 dataIndex : 'title',
1385 header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1386 renderer : function(v) { return String.format('{0}', v); },
1389 '|xns' : 'Roo.grid',
1390 xtype : 'ColumnModel'