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 'ea30b40c3caf28acb29198d20d243e54' :"Images / Attachments >>",
17 '31fde7b05ac8952dacf4af8a704074ec' :"Preview",
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 '68b00d723d37122f64da8d9939f836f0' :"BCC Group",
32 'c4ca4238a0b923820dcc509a6f75849b' :"1",
33 'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version",
34 'b20a8b77b05d53b4e695738731400c85' :"Mailout Name",
35 '1bd18d39370b7f26c1c5e18067b74c6f' :"Html File",
36 '2c466a2c159463f1d9ef5a7b57b52827' :"Select BCC Group",
37 '5da618e8e4b89c66fe86e32cdafde142' :"From",
38 '31bb2f6e9b8fb11cbb7fb63c6025223f' :"Select Template",
39 'b78a3223503896721cca1303f776159b' :"Title",
40 '278c491bdd8a53618c149c4ac790da34' :"Template",
41 '1351017ac6423911223bc19a8cb7c653' :"Filename",
42 '308f2757bfc9ce92fb00ff93fdffd279' :"Images / Attachments",
43 'c9cc8cce247e49bae79f15173ce97354' :"Save",
44 '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
45 '4c2a8fe7eaf24721cc7a9f0175115bd4' :"Message",
46 'fff0d600f8a0b5e19e88bfb821dd1157' :"Images"
52 show : function(data, cb)
60 this.dialog.show(this.data._el);
63 this.form.setValues(data);
64 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
72 this.dialog = Roo.factory({
78 title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
82 xtype : 'LayoutDialog',
84 show : function (_self)
87 _self.layout.getRegion('center').showPanel(0);
88 var w = Roo.lib.Dom.getViewWidth();
\r
89 var h = Roo.lib.Dom.getViewHeight();
\r this.resizeTo(w-50, h-50);
\r
91 var ew = Math.max(250, w-320);
\r
92 var eh = Math.max(250, h-350) ;
\r
93 var e = _this.dialog.layout.getRegion('east');
98 var el = _self.getEl();
99 var elw = el.dom.clientWidth;
101 var bdtext = _this.form.findField('bodytext');
102 var ptext = _this.form.findField('plaintext');
104 bdtext.width = elw-100;
105 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
106 ptext.setSize(bdtext.width , bdtext.height);
115 xtype : 'LayoutRegion'
120 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
125 xtype : 'LayoutRegion'
129 text : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
134 click : function (_self, e)
136 //_this.dialog.hide();
137 Roo.log(_this.data.module);
138 Pman.Dialog.CoreEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
140 render : function (_self)
142 _this.preview_btn = _self;
147 text : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
152 click : function (_self, e)
154 //_this.dialog.hide();
156 var id = _this.form.findField('id').getValue();
159 Roo.MessageBox.alert('Error', 'Please save the message frist!');
164 url : baseURL + '/Core/MessagePreview',
169 _table : _this.data.module
171 success : function(res) {
172 if(res.data == 'SUCCESS'){
173 Roo.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
178 render : function (_self)
180 _this.html_preview = _self;
185 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
190 click : function (_self, e)
197 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
202 click : function (_self, e)
206 _this.form.preValidate(function(res) {
210 _this.form.doAction("submit");
225 xtype : 'NestedLayoutPanel',
232 text : _this._strings['72d6d7a1885885bb55a565fd1070581a'] /* Import */,
234 '|xns' : 'Roo.Toolbar',
242 text : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
247 click : function (_self, e)
249 Pman.Dialog.CoreImportUrl.show({
250 target : '/Core/ImportMailMessage.php'
254 _this.form.findField('bodytext').setValue(data);
261 text : _this._strings['1bd18d39370b7f26c1c5e18067b74c6f'] /* Html File */,
266 click : function (_self, e)
268 Pman.Dialog.Image.show({
269 _url : baseURL + '/Core/ImportMailMessage.php'
272 _this.form.findField('bodytext').setValue(data);
282 text : _this._strings['884df8e413319ff51a3f5f528606238a'] /* Use template */,
284 '|xns' : 'Roo.Toolbar',
292 text : _this._strings['dc0de523c25be298ba751c63c694109e'] /* Responsive Email (1) */,
297 click : function (_self, e)
300 var l = document.location;
303 url : baseURL + '/Core/ImportMailMessage.php',
308 importUrl : l.protocol +'//' + l.host + rootURL + '/Pman/Crm/mail_templates/responsive1.html'
310 success : function (res) {
312 _this.form.findField('bodytext').setValue(res.data);
325 displayField : 'file',
327 emptyText : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
328 fieldLabel : _this._strings['278c491bdd8a53618c149c4ac790da34'] /* Template */,
329 forceSelection : true,
330 hiddenName : 'template',
332 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
336 qtip : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
337 selectOnFocus : true,
338 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{file}</b> </div>',
339 triggerAction : 'all',
347 select : function (combo, record, index)
358 _this.form.findField('bodytext').setValue(record.data.content);
364 sortInfo : { direction : 'DESC', field: 'file' },
369 beforeload : function (_self, o){
370 o.params = o.params || {};
377 url : baseURL + '/Core/MailTemplateList.php',
383 fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}],
386 totalProperty : 'total',
395 '|xns' : 'Roo.Toolbar',
399 text : _this._strings['ea30b40c3caf28acb29198d20d243e54'] /* Images / Attachments >> */,
401 '|xns' : 'Roo.Toolbar',
404 click : function (_self, e)
406 var el = _this.dialog.layout.getRegion('east');
422 xtype : 'BorderLayout',
427 xtype : 'LayoutRegion'
436 title : _this._strings['4c2a8fe7eaf24721cc7a9f0175115bd4'] /* Message */,
439 xtype : 'ContentPanel',
441 render : function (_self, width, height)
444 Roo.log("RESIZE, " + width + ',' + height);
446 var ew = Math.max(250, width-50);
447 var eh = Math.max(250,height-50) ;
452 resize : function (_self, width, height)
\r
454 var ew = Math.max(250, width-50);
\r
455 var eh = Math.max(250,height-50) ;
460 var bdtext = _this.form.findField('bodytext');
\r
461 var ptext = _this.form.findField('plaintext');
\r
462 if(bdtext.resizeEl){
\r
463 bdtext.width = ew-50;
\r
464 bdtext.resizeEl.resizeTo.defer(110, bdtext.resizeEl,[ bdtext.width, bdtext.height ] );
\r
465 ptext.setSize(bdtext.width , bdtext.height);
\r
472 labelAlign : 'right',
475 preValidate : function(done_callback) {
477 Roo.MessageBox.progress("Uploading Images", "Uploading");
479 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
480 _this.form.findField('bodytext').syncValue();
482 _this.form.findField('bodytext').pushValue();
485 var html = _this.form.findField('bodytext').getValue();
487 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
489 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
492 s.select('img[src]').each(function(i) {
495 var total = nodes.length;
496 var mkimg = function() {
499 Roo.MessageBox.hide();
500 _this.form.findField('bodytext').syncValue();
502 // _this.form.doAction("submit");
507 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
514 n = i.getAttribute('src').match(/^http(.*)/);
522 url : baseURL + '/Roo/Images.php',
525 onid : _this.form.findField('id').getValue(),
527 _remote_upload : i.src
529 success : function(res){
530 if(res.success == true){
531 i.setAttribute('src', res.data);
532 Roo.MessageBox.updateProgress( (total - nodes.length) / total , "Done " + (total - nodes.length) + '/' + total);
541 style : 'margin:10px',
542 url : baseURL + '/Roo/crm_mailing_list_message.php',
547 actioncomplete : function(_self,action)
550 if (action.type == 'setdata') {
552 setInterval(_this.form.findField('bodytext').autosave, 5000);
554 _this.data.module = _this.data.module || 'crm_mailing_list_message';
556 _this.form.url = baseURL + '/Roo/' + _this.data.module;
558 _this.html_preview.hide();
559 _this.preview_btn.hide();
561 if(_this.data.id*1 > 0){
562 _this.dialog.el.mask("Loading");
563 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
564 _this.html_preview.show();
565 _this.preview_btn.show();
568 _this.form.setValues({
569 'from_name' : Pman.Login.authUser.name,
570 'from_email' : Pman.Login.authUser.email
575 if (action.type == 'load') {
576 _this.dialog.el.unmask();
578 _this.form.findField('bodytext').originalValue = _this.form.findField('bodytext').getValue();
582 if (action.type =='submit') {
584 _this.dialog.el.unmask();
587 if (_this.callback) {
588 _this.callback.call(_this, action.result.data);
594 rendered : function (form)
607 fieldLabel : _this._strings['b20a8b77b05d53b4e695738731400c85'] /* Mailout Name */,
621 boxLabel : 'Enabled - will be sent out',
630 check : function (_self, checked)
632 var boxLabel = 'Enabled - will be sent out';
635 boxLabel = 'Disabled - will NOT be sent out';
638 this.setBoxLabel(boxLabel);
653 fieldLabel : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
662 fieldLabel : _this._strings['b357b524e740bc85b9790a0712d84a30'] /* Email address */,
672 displayField : 'name',
674 emptyText : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
675 fieldLabel : _this._strings['68b00d723d37122f64da8d9939f836f0'] /* BCC Group */,
676 forceSelection : true,
677 hiddenName : 'template',
678 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
682 qtip : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
683 selectOnFocus : true,
684 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
685 triggerAction : 'all',
694 sortInfo : { direction : 'ASC', field: 'name' },
699 beforeload : function (_self, o){
700 o.params = o.params || {};
707 url : baseURL + '/Roo/Groups',
713 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
716 totalProperty : 'total',
727 fieldLabel : _this._strings['c7892ebbb139886662c6f2fc8c450710'] /* Subject */,
742 legend : _this._strings['962b90039a542a29cedd51d87a9f28a1'] /* Html Editor */,
743 style : 'text-align:center;',
749 autosave : function() {
751 var body = _this.form.findField('bodytext');
753 if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
754 Roo.log('body not dirty');
758 Roo.log('body dirty, auto save!');
760 body.fireEvent('autosave', body);
807 xtype : 'HtmlEditor',
809 autosave : function (_self)
813 var id = _this.form.findField('id').getValue() * 1;
816 if(!_self.editorcore.sourceEditMode){
824 url : baseURL + '/Roo/Events.php',
829 on_id : (id > 0) ? id : 0,
830 on_table : 'crm_mailing_list_message',
832 source: _self.getValue()
834 success : function() {
835 _self.originalValue = _self.getValue();
840 Roo.log('body autosave failed?!');
845 savedpreview : function (_self)
847 var id = _this.form.findField('id').getValue() * 1;
849 var successFn = function(res){
850 return res.data.POST.source;
856 on_id : (id < 1) ? 0 : id,
857 on_table : 'crm_mailing_list_message',
858 successFn : successFn
862 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
864 _self.originalValue = res;
870 xns : Roo.form.HtmlEditor,
871 '|xns' : 'Roo.form.HtmlEditor',
872 xtype : 'ToolbarContext'
875 xns : Roo.form.HtmlEditor,
876 '|xns' : 'Roo.form.HtmlEditor',
877 xtype : 'ToolbarStandard',
881 displayField : 'name',
883 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
884 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
885 forceSelection : true,
887 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
890 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
891 selectOnFocus : true,
892 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>',
893 triggerAction : 'all',
901 beforequery : function (combo, query, forceAll, cancel, e)
903 var id = _this.form.findField('id').getValue() * 1;
905 Roo.MessageBox.alert("Error", "Save message first");
909 render : function (_self)
911 _this.extendimgselect = _self;
913 select : function (combo, record, index)
919 var editor = _this.form.findField('bodytext').editorcore;
921 var curnode = editor.getSelectedNode();
922 if (curnode && curnode.tagName == 'IMG') {
923 curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',
924 baseURL, record.data.id, record.data.filename
926 // note -forces an update... hopefully...
927 editor.owner.fireEvent('editorevent', editor, false);
930 editor.insertAtCursor(
931 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
932 baseURL, record.data.id, record.data.filename
942 sortInfo : { direction : 'ASC', field: 'id' },
947 beforeload : function (_self, o){
948 o.params = o.params || {};
950 var id = _this.form.findField('id').getValue() * 1;
952 Roo.MessageBox.alert("Error", "Save email template first");
956 o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
958 // o.params.imgtype = 'PressRelease';
959 //o.params['query[imagesize]'] = '150x150';
965 url : baseURL + '/Roo/Images.php',
971 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
974 totalProperty : 'total',
983 displayField : 'name',
985 emptyText : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
986 fieldLabel : _this._strings['6f16a5f8ff5d75ab84c018adacdfcbb7'] /* Field */,
987 forceSelection : true,
989 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
992 qtip : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
993 selectOnFocus : true,
994 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
995 triggerAction : 'all',
1000 '|xns' : 'Roo.form',
1003 render : function (_self)
1005 _this.unsubscribeselect = _self;
1007 select : function (combo, record, index)
1013 var editor = _this.form.findField('bodytext').editorcore;
1015 if(record.data.name == 'Unsubscribe'){
1016 editor.insertAtCursor(
1017 String.format('<a href="{0}">{1}</a>',
1018 record.data.type, record.data.name
1024 editor.insertAtCursor(
1025 String.format('{0}',
1034 [ '{person.firstname}', "First Name"],
1035 [ '{person.lastname}' , "Last Name"],
1036 [ '{person.name}', "Full Name"],
1037 [ '#unsubscribe', "Unsubscribe"]
1039 fields : [ 'type', 'name'],
1041 '|xns' : 'Roo.data',
1042 xtype : 'SimpleStore'
1047 '|xns' : 'Roo.Toolbar',
1051 cls : 'x-init-enable',
1052 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
1054 '|xns' : 'Roo.Toolbar',
1057 click : function (_self, e)
1059 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
1075 '|xns' : 'Roo.form',
1079 text : _this._strings['e9968623956c15023d54335ea3699855'] /* Convert Html to Text */,
1084 click : function (_self, e)
1086 var h = _this.form.findField('bodytext').getValue();
1087 var p = _this.form.findField('plaintext');
1089 new Pman.Request({
\r
1090 url : baseURL + '/Core/ImportMailMessage.php',
\r
1094 _convertToPlain : true,
1095 _check_unsubscribe : true
\r
1097 success : function(res) {
\r
1098 if(res.success == true){
1099 p.setValue(res.data);
1112 '|xns' : 'Roo.form',
1117 legend : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
1118 style : 'text-align:center;',
1120 '|xns' : 'Roo.form',
1127 '|xns' : 'Roo.form',
1137 '|xns' : 'Roo.form',
1150 fitContainer : true,
1153 tableName : 'Images',
1154 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
1157 xtype : 'GridPanel',
1159 activate : function() {
1160 _this.ipanel = this;
1162 _this.igrid.ds.load({});
1167 autoExpandColumn : 'filename',
1170 '|xns' : 'Roo.grid',
1176 //_this.dialog = Pman.Dialog.FILL_IN
1177 if (_this.ipanel.active) {
1178 // _this.igrid.ds.load({});
1188 cls : 'x-btn-text-icon',
1189 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1190 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
1192 '|xns' : 'Roo.Toolbar',
1197 var id = _this.form.findField('id').getValue();
1200 Roo.MessageBox.alert('Error', 'Please save the email template first');
1204 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1206 Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
1207 _this.igrid.getDataSource().load({});
1213 cls : 'x-btn-text-icon',
1214 icon : rootURL + '/Pman/templates/images/trash.gif',
1215 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
1217 '|xns' : 'Roo.Toolbar',
1222 var s = _this.igrid.getSelectionModel().getSelected();
1223 if (!s || isNaN(s.id *1)) {
1224 Roo.MessageBox.alert("Error", "Select a image");
1227 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
1233 url : baseURL + '/Roo/Images.php',
1238 success : function()
1240 Roo.log('Got Success!!');
1241 _this.igrid.ds.load({});
1252 sortInfo : { field : 'filename', direction: 'ASC' },
1254 '|xns' : 'Roo.data',
1257 beforeload : function (_self, options)
1259 options.params = options.params || {};
1260 if (typeof(_this.data) == 'undefined') {
1263 if(_this.data.id * 1 >= 0)
1265 options.params.onid = _this.data.id;
1267 options.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
1273 url : baseURL + '/Roo/Images.php',
1275 '|xns' : 'Roo.data',
1313 'name': 'displayorder',
1321 'name': 'parent_image_id',
1327 'dateFormat': 'Y-m-d'
1346 'name': 'parent_image_id_id',
1350 'name': 'parent_image_id_filename',
1354 'name': 'parent_image_id_ontable',
1358 'name': 'parent_image_id_onid',
1362 'name': 'parent_image_id_mimetype',
1366 'name': 'parent_image_id_width',
1370 'name': 'parent_image_id_height',
1374 'name': 'parent_image_id_filesize',
1378 'name': 'parent_image_id_displayorder',
1382 'name': 'parent_image_id_language',
1386 'name': 'parent_image_id_parent_image_id',
1390 'name': 'parent_image_id_created',
1394 'name': 'parent_image_id_imgtype',
1398 'name': 'parent_image_id_linkurl',
1402 'name': 'parent_image_id_descript',
1406 'name': 'parent_image_id_title',
1412 totalProperty : 'total',
1414 '|xns' : 'Roo.data',
1415 xtype : 'JsonReader'
1420 dataIndex : 'filename',
1421 header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
1422 renderer : function(v,x,r)
1424 var width = r.data.width;
1425 var height = r.data.height;
1428 height = Math.round(height * 50 / width);
1432 return '<img src="' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '" width="' + width + '" height="' + height + '" />';
1436 '|xns' : 'Roo.grid',
1437 xtype : 'ColumnModel'
1440 dataIndex : 'displayorder',
1441 header : _this._strings['2393ad754ba179442d85e415d1d5167c'] /* Displayorder */,
1442 renderer : function(v) { return String.format('{0}', v); },
1445 '|xns' : 'Roo.grid',
1446 xtype : 'ColumnModel'
1449 dataIndex : 'title',
1450 header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1451 renderer : function(v) { return String.format('{0}', v); },
1454 '|xns' : 'Roo.grid',
1455 xtype : 'ColumnModel'