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 '1243daf593fa297e07ab03bf06d925af' :"Searching...",
25 '5b8ef4e762c00a15a41cfc26dc3ef99c' :"Send me a test copy",
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 '2c466a2c159463f1d9ef5a7b57b52827' :"Select BCC Group",
36 '5da618e8e4b89c66fe86e32cdafde142' :"From",
37 '31bb2f6e9b8fb11cbb7fb63c6025223f' :"Select Template",
38 'b78a3223503896721cca1303f776159b' :"Title",
39 '278c491bdd8a53618c149c4ac790da34' :"Template",
40 '1351017ac6423911223bc19a8cb7c653' :"Filename",
41 '308f2757bfc9ce92fb00ff93fdffd279' :"Images / Attachments",
42 'c9cc8cce247e49bae79f15173ce97354' :"Save",
43 '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
44 '4c2a8fe7eaf24721cc7a9f0175115bd4' :"Message",
45 'fff0d600f8a0b5e19e88bfb821dd1157' :"Images"
51 show : function(data, cb)
59 this.dialog.show(this.data._el);
62 this.form.setValues(data);
63 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
71 this.dialog = Roo.factory({
77 title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
81 xtype : 'LayoutDialog',
83 show : function (_self)
86 _self.layout.getRegion('center').showPanel(0);
87 var w = Roo.lib.Dom.getViewWidth();
\r
88 var h = Roo.lib.Dom.getViewHeight();
\r this.resizeTo(w-50, h-50);
\r
90 var ew = Math.max(250, w-320);
\r
91 var eh = Math.max(250, h-350) ;
\r
92 var e = _this.dialog.layout.getRegion('east');
97 var el = _self.getEl();
98 var elw = el.dom.clientWidth;
100 var bdtext = _this.form.findField('bodytext');
101 var ptext = _this.form.findField('plaintext');
103 bdtext.width = elw-100;
104 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
105 ptext.setSize(bdtext.width , bdtext.height);
114 xtype : 'LayoutRegion'
119 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
124 xtype : 'LayoutRegion'
128 text : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
133 click : function (_self, e)
135 //_this.dialog.hide();
136 Roo.log(_this.data.module);
137 Pman.Dialog.CoreEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
139 render : function (_self)
141 _this.preview_btn = _self;
146 text : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
151 click : function (_self, e)
153 //_this.dialog.hide();
155 var id = _this.form.findField('id').getValue();
158 Roo.MessageBox.alert('Error', 'Please save the message frist!');
163 url : baseURL + '/Core/MessagePreview',
168 _table : _this.data.module
170 success : function(res) {
171 if(res.data == 'SUCCESS'){
172 Roo.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
177 render : function (_self)
179 _this.html_preview = _self;
184 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
189 click : function (_self, e)
196 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
201 click : function (_self, e)
205 _this.form.preValidate(function(res) {
209 _this.form.doAction("submit");
224 xtype : 'NestedLayoutPanel',
231 text : _this._strings['72d6d7a1885885bb55a565fd1070581a'] /* Import */,
233 '|xns' : 'Roo.Toolbar',
241 text : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
246 click : function (_self, e)
248 Pman.Dialog.CoreImportUrl.show({
249 target : '/Core/ImportMailMessage.php'
253 _this.form.findField('bodytext').setValue(data);
260 text : _this._strings['1bd18d39370b7f26c1c5e18067b74c6f'] /* Html File */,
265 click : function (_self, e)
267 Pman.Dialog.Image.show({
268 _url : baseURL + '/Core/ImportMailMessage.php'
271 _this.form.findField('bodytext').setValue(data);
281 text : _this._strings['884df8e413319ff51a3f5f528606238a'] /* Use template */,
283 '|xns' : 'Roo.Toolbar',
291 text : _this._strings['dc0de523c25be298ba751c63c694109e'] /* Responsive Email (1) */,
296 click : function (_self, e)
299 var l = document.location;
302 url : baseURL + '/Core/ImportMailMessage.php',
307 importUrl : l.protocol +'//' + l.host + rootURL + '/Pman/Crm/mail_templates/responsive1.html'
309 success : function (res) {
311 _this.form.findField('bodytext').setValue(res.data);
324 displayField : 'file',
326 emptyText : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
327 fieldLabel : _this._strings['278c491bdd8a53618c149c4ac790da34'] /* Template */,
328 forceSelection : true,
329 hiddenName : 'template',
331 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
335 qtip : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
336 selectOnFocus : true,
337 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{file}</b> </div>',
338 triggerAction : 'all',
346 select : function (combo, record, index)
357 _this.form.findField('bodytext').setValue(record.data.content);
363 sortInfo : { direction : 'DESC', field: 'file' },
368 beforeload : function (_self, o){
369 o.params = o.params || {};
376 url : baseURL + '/Core/MailTemplateList.php',
382 fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}],
385 totalProperty : 'total',
394 '|xns' : 'Roo.Toolbar',
398 text : _this._strings['ea30b40c3caf28acb29198d20d243e54'] /* Images / Attachments >> */,
400 '|xns' : 'Roo.Toolbar',
403 click : function (_self, e)
405 var el = _this.dialog.layout.getRegion('east');
421 xtype : 'BorderLayout',
426 xtype : 'LayoutRegion'
435 title : _this._strings['4c2a8fe7eaf24721cc7a9f0175115bd4'] /* Message */,
438 xtype : 'ContentPanel',
440 render : function (_self, width, height)
443 Roo.log("RESIZE, " + width + ',' + height);
445 var ew = Math.max(250, width-50);
446 var eh = Math.max(250,height-50) ;
451 resize : function (_self, width, height)
\r
453 var ew = Math.max(250, width-50);
\r
454 var eh = Math.max(250,height-50) ;
459 var bdtext = _this.form.findField('bodytext');
\r
460 var ptext = _this.form.findField('plaintext');
\r
461 if(bdtext.resizeEl){
\r
462 bdtext.width = ew-50;
\r
463 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
\r
464 ptext.setSize(bdtext.width , bdtext.height);
\r
471 labelAlign : 'right',
474 preValidate : function(done_callback) {
476 Roo.MessageBox.progress("Uploading Images", "Uploading");
478 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
479 _this.form.findField('bodytext').syncValue();
481 _this.form.findField('bodytext').pushValue();
484 var html = _this.form.findField('bodytext').getValue();
486 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
488 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
491 s.select('img[src]').each(function(i) {
494 var total = nodes.length;
495 var mkimg = function() {
498 Roo.MessageBox.hide();
499 _this.form.findField('bodytext').syncValue();
501 // _this.form.doAction("submit");
506 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
513 n = i.getAttribute('src').match(/^http(.*)/);
521 url : baseURL + '/Roo/Images.php',
524 onid : _this.form.findField('id').getValue(),
526 _remote_upload : i.src
528 success : function(res){
529 if(res.success == true){
530 i.setAttribute('src', res.data);
531 Roo.MessageBox.updateProgress( (total - nodes.length) / total , "Done " + (total - nodes.length) + '/' + total);
540 style : 'margin:10px',
541 url : baseURL + '/Roo/crm_mailing_list_message.php',
546 actioncomplete : function(_self,action)
549 if (action.type == 'setdata') {
551 setInterval(_this.form.findField('bodytext').autosave, 5000);
553 _this.data.module = _this.data.module || 'crm_mailing_list_message';
555 _this.form.url = baseURL + '/Roo/' + _this.data.module;
557 _this.html_preview.hide();
558 _this.preview_btn.hide();
560 if(_this.data.id*1 > 0){
561 _this.dialog.el.mask("Loading");
562 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
563 _this.html_preview.show();
564 _this.preview_btn.show();
567 _this.form.setValues({
568 'from_name' : Pman.Login.authUser.name,
569 'from_email' : Pman.Login.authUser.email
574 if (action.type == 'load') {
575 _this.dialog.el.unmask();
577 _this.form.findField('bodytext').originalValue = _this.form.findField('bodytext').getValue();
581 if (action.type =='submit') {
583 _this.dialog.el.unmask();
586 if (_this.callback) {
587 _this.callback.call(_this, action.result.data);
593 rendered : function (form)
606 fieldLabel : _this._strings['b20a8b77b05d53b4e695738731400c85'] /* Mailout Name */,
620 boxLabel : 'Enabled - will be sent out',
629 check : function (_self, checked)
631 var boxLabel = 'Enabled - will be sent out';
634 boxLabel = 'Disabled - will NOT be sent out';
637 this.setBoxLabel(boxLabel);
652 fieldLabel : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
661 fieldLabel : _this._strings['b357b524e740bc85b9790a0712d84a30'] /* Email address */,
671 displayField : 'name',
673 emptyText : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
674 fieldLabel : _this._strings['278c491bdd8a53618c149c4ac790da34'] /* Template */,
675 forceSelection : true,
676 hiddenName : 'template',
677 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
681 qtip : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
682 selectOnFocus : true,
683 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
684 triggerAction : 'all',
693 sortInfo : { direction : 'DESC', field: 'file' },
698 beforeload : function (_self, o){
699 o.params = o.params || {};
706 url : baseURL + '/Core/MailTemplateList.php',
712 fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}],
715 totalProperty : 'total',
726 fieldLabel : _this._strings['c7892ebbb139886662c6f2fc8c450710'] /* Subject */,
741 legend : _this._strings['962b90039a542a29cedd51d87a9f28a1'] /* Html Editor */,
742 style : 'text-align:center;',
748 autosave : function() {
750 var body = _this.form.findField('bodytext');
752 if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
753 Roo.log('body not dirty');
757 Roo.log('body dirty, auto save!');
759 body.fireEvent('autosave', body);
806 xtype : 'HtmlEditor',
808 autosave : function (_self)
812 var id = _this.form.findField('id').getValue() * 1;
815 if(!_self.editorcore.sourceEditMode){
823 url : baseURL + '/Roo/Events.php',
828 on_id : (id > 0) ? id : 0,
829 on_table : 'crm_mailing_list_message',
831 source: _self.getValue()
833 success : function() {
834 _self.originalValue = _self.getValue();
839 Roo.log('body autosave failed?!');
844 savedpreview : function (_self)
846 var id = _this.form.findField('id').getValue() * 1;
848 var successFn = function(res){
849 return res.data.POST.source;
855 on_id : (id < 1) ? 0 : id,
856 on_table : 'crm_mailing_list_message',
857 successFn : successFn
861 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
863 _self.originalValue = res;
869 xns : Roo.form.HtmlEditor,
870 '|xns' : 'Roo.form.HtmlEditor',
871 xtype : 'ToolbarContext'
874 xns : Roo.form.HtmlEditor,
875 '|xns' : 'Roo.form.HtmlEditor',
876 xtype : 'ToolbarStandard',
880 displayField : 'name',
882 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
883 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
884 forceSelection : true,
886 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
889 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
890 selectOnFocus : true,
891 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>',
892 triggerAction : 'all',
900 beforequery : function (combo, query, forceAll, cancel, e)
902 var id = _this.form.findField('id').getValue() * 1;
904 Roo.MessageBox.alert("Error", "Save message first");
908 render : function (_self)
910 _this.extendimgselect = _self;
912 select : function (combo, record, index)
918 var editor = _this.form.findField('bodytext').editorcore;
920 var curnode = editor.getSelectedNode();
921 if (curnode && curnode.tagName == 'IMG') {
922 curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',
923 baseURL, record.data.id, record.data.filename
925 // note -forces an update... hopefully...
926 editor.owner.fireEvent('editorevent', editor, false);
929 editor.insertAtCursor(
930 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
931 baseURL, record.data.id, record.data.filename
941 sortInfo : { direction : 'ASC', field: 'id' },
946 beforeload : function (_self, o){
947 o.params = o.params || {};
949 var id = _this.form.findField('id').getValue() * 1;
951 Roo.MessageBox.alert("Error", "Save email template first");
955 o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
957 // o.params.imgtype = 'PressRelease';
958 //o.params['query[imagesize]'] = '150x150';
964 url : baseURL + '/Roo/Images.php',
970 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
973 totalProperty : 'total',
982 displayField : 'name',
984 emptyText : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
985 fieldLabel : _this._strings['6f16a5f8ff5d75ab84c018adacdfcbb7'] /* Field */,
986 forceSelection : true,
988 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
991 qtip : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
992 selectOnFocus : true,
993 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
994 triggerAction : 'all',
1002 render : function (_self)
1004 _this.unsubscribeselect = _self;
1006 select : function (combo, record, index)
1012 var editor = _this.form.findField('bodytext').editorcore;
1014 if(record.data.name == 'Unsubscribe'){
1015 editor.insertAtCursor(
1016 String.format('<a href="{0}">{1}</a>',
1017 record.data.type, record.data.name
1023 editor.insertAtCursor(
1024 String.format('{0}',
1033 [ '{person.firstname}', "First Name"],
1034 [ '{person.lastname}' , "Last Name"],
1035 [ '{person.name}', "Full Name"],
1036 [ '#unsubscribe', "Unsubscribe"]
1038 fields : [ 'type', 'name'],
1040 '|xns' : 'Roo.data',
1041 xtype : 'SimpleStore'
1046 '|xns' : 'Roo.Toolbar',
1050 cls : 'x-init-enable',
1051 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
1053 '|xns' : 'Roo.Toolbar',
1056 click : function (_self, e)
1058 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
1074 '|xns' : 'Roo.form',
1078 text : _this._strings['e9968623956c15023d54335ea3699855'] /* Convert Html to Text */,
1083 click : function (_self, e)
1085 var h = _this.form.findField('bodytext').getValue();
1086 var p = _this.form.findField('plaintext');
1088 new Pman.Request({
\r
1089 url : baseURL + '/Core/ImportMailMessage.php',
\r
1093 _convertToPlain : true,
1094 _check_unsubscribe : true
\r
1096 success : function(res) {
\r
1097 if(res.success == true){
1098 p.setValue(res.data);
1111 '|xns' : 'Roo.form',
1116 legend : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
1117 style : 'text-align:center;',
1119 '|xns' : 'Roo.form',
1126 '|xns' : 'Roo.form',
1136 '|xns' : 'Roo.form',
1149 fitContainer : true,
1152 tableName : 'Images',
1153 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
1156 xtype : 'GridPanel',
1158 activate : function() {
1159 _this.ipanel = this;
1161 _this.igrid.ds.load({});
1166 autoExpandColumn : 'filename',
1169 '|xns' : 'Roo.grid',
1175 //_this.dialog = Pman.Dialog.FILL_IN
1176 if (_this.ipanel.active) {
1177 // _this.igrid.ds.load({});
1187 cls : 'x-btn-text-icon',
1188 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1189 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
1191 '|xns' : 'Roo.Toolbar',
1196 var id = _this.form.findField('id').getValue();
1199 Roo.MessageBox.alert('Error', 'Please save the email template first');
1203 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1205 Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
1206 _this.igrid.getDataSource().load({});
1212 cls : 'x-btn-text-icon',
1213 icon : rootURL + '/Pman/templates/images/trash.gif',
1214 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
1216 '|xns' : 'Roo.Toolbar',
1221 var s = _this.igrid.getSelectionModel().getSelected();
1222 if (!s || isNaN(s.id *1)) {
1223 Roo.MessageBox.alert("Error", "Select a image");
1226 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
1232 url : baseURL + '/Roo/Images.php',
1237 success : function()
1239 Roo.log('Got Success!!');
1240 _this.igrid.ds.load({});
1251 sortInfo : { field : 'filename', direction: 'ASC' },
1253 '|xns' : 'Roo.data',
1256 beforeload : function (_self, options)
1258 options.params = options.params || {};
1259 if (typeof(_this.data) == 'undefined') {
1262 if(_this.data.id * 1 >= 0)
1264 options.params.onid = _this.data.id;
1266 options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1272 url : baseURL + '/Roo/Images.php',
1274 '|xns' : 'Roo.data',
1312 'name': 'displayorder',
1320 'name': 'parent_image_id',
1326 'dateFormat': 'Y-m-d'
1345 'name': 'parent_image_id_id',
1349 'name': 'parent_image_id_filename',
1353 'name': 'parent_image_id_ontable',
1357 'name': 'parent_image_id_onid',
1361 'name': 'parent_image_id_mimetype',
1365 'name': 'parent_image_id_width',
1369 'name': 'parent_image_id_height',
1373 'name': 'parent_image_id_filesize',
1377 'name': 'parent_image_id_displayorder',
1381 'name': 'parent_image_id_language',
1385 'name': 'parent_image_id_parent_image_id',
1389 'name': 'parent_image_id_created',
1393 'name': 'parent_image_id_imgtype',
1397 'name': 'parent_image_id_linkurl',
1401 'name': 'parent_image_id_descript',
1405 'name': 'parent_image_id_title',
1411 totalProperty : 'total',
1413 '|xns' : 'Roo.data',
1414 xtype : 'JsonReader'
1419 dataIndex : 'filename',
1420 header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
1421 renderer : function(v,x,r)
1423 var width = r.data.width;
1424 var height = r.data.height;
1427 height = Math.round(height * 50 / width);
1431 return '<img src="' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '" width="' + width + '" height="' + height + '" />';
1435 '|xns' : 'Roo.grid',
1436 xtype : 'ColumnModel'
1439 dataIndex : 'displayorder',
1440 header : _this._strings['2393ad754ba179442d85e415d1d5167c'] /* Displayorder */,
1441 renderer : function(v) { return String.format('{0}', v); },
1444 '|xns' : 'Roo.grid',
1445 xtype : 'ColumnModel'
1448 dataIndex : 'title',
1449 header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1450 renderer : function(v) { return String.format('{0}', v); },
1453 '|xns' : 'Roo.grid',
1454 xtype : 'ColumnModel'