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.BAdminEmail= function() {}
8 Roo.apply(Pman.Dialog.BAdminEmail.prototype, {
11 '843627586c62e389041a4d8800143974' :"Searching",
12 '2c466a2c159463f1d9ef5a7b57b52827' :"Select BCC Group",
13 '396ecabf0cd1f9503e591418851ef406' :"Edit / Create Message",
14 '3858712080cb3d846ea206d1d1070674' :"Test Class (for system reference only):",
15 '31fde7b05ac8952dacf4af8a704074ec' :"Preview",
16 '5b8ef4e762c00a15a41cfc26dc3ef99c' :"Send me a test copy",
17 '4182c8f19d40c7ca236a5f4f83faeb6b' :"Unsubscribe",
18 'b2bce8099bf8e6f51345bee5c9015c89' :"Convert HTML to Plain Text",
19 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
20 'c4ca4238a0b923820dcc509a6f75849b' :"1",
21 '1e6d57e813355689e9c77e947d73ad8f' :"From:",
22 '47a0be8d1015d526a1fbaa56c3102135' :"Subject:",
23 '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
24 '292f75d54a6892cfe18a93e64230112a' :"Mailout Name:",
25 '7038eac66e387c3b3a0834d786a88757' :"Insert Image",
26 'e71c729cd7f3c6b6ebdb447e65952dfd' :"From email address:",
27 'edddfc18b2ffb806573a1b3f341832cd' :"BCC to Group:",
28 'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version",
29 'e44b145bd8b49b06e0ad2ced1ad56466' :"Plain Text",
30 'c9cc8cce247e49bae79f15173ce97354' :"Save",
31 'b5a7adde1af5c87d7fd797b6245c2a39' :"Description",
32 '49ee3087348e8d44e1feda1917443987' :"Name",
33 '28690be026c0bb9003aa58e45e5662ca' :"Enabled - will be sent out",
34 'fb981fe689fbec75c6531eb7410971f4' :"To group:",
35 'e05f77bdf3f659c1fd354a88526c03da' :"Select Group",
36 '36a65bbd12f7586ea1f9b0be4e8848aa' :"HTML Editor"
39 'description_fieldLabel' : 'b5a7adde1af5c87d7fd797b6245c2a39' /* Description */ ,
40 'active_boxLabel' : '28690be026c0bb9003aa58e45e5662ca' /* Enabled - will be sent out */ ,
41 'to_group_id_name_loadingText' : '843627586c62e389041a4d8800143974' /* Searching */ ,
42 'to_group_id_name_fieldLabel' : 'fb981fe689fbec75c6531eb7410971f4' /* To group: */ ,
43 'save_html' : 'c9cc8cce247e49bae79f15173ce97354' /* Save */ ,
44 'bcc_group_id_name_placeholder' : '2c466a2c159463f1d9ef5a7b57b52827' /* Select BCC Group */ ,
45 'name_fieldLabel' : '292f75d54a6892cfe18a93e64230112a' /* Mailout Name: */ ,
46 'cancel_html' : 'ea4788705e6873b424c65e91c2846b19' /* Cancel */ ,
47 'from_email_fieldLabel' : 'e71c729cd7f3c6b6ebdb447e65952dfd' /* From email address: */ ,
48 'to_group_id_name_placeholder' : 'e05f77bdf3f659c1fd354a88526c03da' /* Select Group */ ,
49 'preview_html' : '31fde7b05ac8952dacf4af8a704074ec' /* Preview */ ,
50 'active_value' : 'c4ca4238a0b923820dcc509a6f75849b' /* 1 */ ,
51 'send_html' : '5b8ef4e762c00a15a41cfc26dc3ef99c' /* Send me a test copy */ ,
52 'from_name_fieldLabel' : '1e6d57e813355689e9c77e947d73ad8f' /* From: */ ,
53 'bcc_group_id_name_loadingText' : '843627586c62e389041a4d8800143974' /* Searching */ ,
54 'bcc_group_id_name_fieldLabel' : 'edddfc18b2ffb806573a1b3f341832cd' /* BCC to Group: */ ,
55 'subject_fieldLabel' : '47a0be8d1015d526a1fbaa56c3102135' /* Subject: */ ,
56 'test_class_fieldLabel' : '3858712080cb3d846ea206d1d1070674' /* Test Class (for system reference only): */
62 show : function(data, cb)
70 this.dialog.show(this.data._el);
73 this.form.setValues(data);
74 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
82 this.dialog = Roo.factory({
84 cls : 'modal-body-enable-overflow-y',
86 title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
88 hide : function (_self)
92 clearInterval(_this.autosave);
95 render : function (_self)
99 show : function (_self)
105 '|xns' : 'Roo.bootstrap',
109 html : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
113 click : function (_self, e)
115 var id = _this.form.findField('id').getValue();
118 Roo.bootstrap.MessageBox.alert('Error', 'Please save the message first!');
123 url : baseURL + '/Core/MessagePreview',
128 _table : _this.data.module
130 success : function(res) {
131 if(res.data == 'SUCCESS'){
132 Roo.bootstrap.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
139 '|xns' : 'Roo.bootstrap'
143 html : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
147 click : function (_self, e)
149 Pman.Dialog.BAdminEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
153 '|xns' : 'Roo.bootstrap'
157 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
161 click : function (_self, e)
167 '|xns' : 'Roo.bootstrap'
171 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
175 click : function (_self, e)
177 _this.form.preValidate(function(res) {
185 '|xns' : 'Roo.bootstrap'
192 '|xns' : 'Roo.bootstrap',
197 hideshow : function()
199 _this.to_group_row.hide();
201 if (this.findField('to_group_id').getValue() == -1) {
205 _this.to_group_row.show();
208 preValidate : function(done_callback) {
210 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
211 _this.form.findField('bodytext').syncValue();
213 _this.form.findField('bodytext').pushValue();
216 var html = _this.form.findField('bodytext').getValue();
218 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
220 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
225 s.select('img[src]').each(function(i) {
230 var total = nodes.length;
232 var mkimg = function() {
234 _this.form.findField('bodytext').syncValue();
236 _this.form.doAction("submit");
241 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
248 n = i.getAttribute('src').match(/^http(.*)/);
258 url : baseURL + '/Roo/Images.php',
261 onid : _this.form.findField('id').getValue(),
263 _remote_upload : i.src
265 success : function(res){
266 if(res.success == true){
267 i.setAttribute('src', res.data);
276 url : baseURL + '/Roo/crm_mailing_list_message.php',
278 actioncomplete : function(_self,action)
281 if (action.type == 'setdata') {
283 _this.data.module = _this.data.module || 'crm_mailing_list_message';
284 this.url = baseURL + '/Roo/' + _this.data.module;
286 if(_this.data.id*1 > 0){
287 _this.dialog.el.mask("Loading");
290 { method: 'GET', params: { '_id' : _this.data.id, '_with_css' : 1 }}
295 //this.findField('name').setDisabled(false);
296 //this.findField('test_class').setDisabled(false);
300 this.findField('to_group_id').setValue(-1);
301 this.findField('bodytext').setValue('');
304 'from_name' : Pman.Login.authUser.name,
305 'from_email' : Pman.Login.authUser.email
315 if (action.type == 'load') {
318 this.findField('name').setDisabled(false);
319 this.findField('test_class').setDisabled(false);
321 if(action.result.data['is_system'] == 1) {
322 this.findField('name').setDisabled(true);
323 this.findField('test_class').setDisabled(true);
327 _this.dialog.el.unmask();
329 this.findField('bodytext').originalValue = this.findField('bodytext').getValue();
331 _this.form_data = action.result.data;
333 if(_this.form_data._css && _this.form_data._css.length){
334 _this.htmleditor.editorcore.setStyle(_this.form_data._css);
337 this.findField('_ignore_group_count').setValue('0');
339 if(!_this.form_data.description.length){
340 _this.form_data.findField('description').setValue(_this.form_data.name);
348 if (action.type =='submit') {
350 _this.dialog.el.unmask();
353 if (_this.callback) {
354 _this.callback.call(_this, action.result.data);
362 actionfailed : function (_self, action)
365 var displayErr = function() {
366 if(action.result.errorMsg.length >= 200) {
367 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg.substring(0,199) + '...');
369 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
372 switch(action.failureType) {
373 case Roo.form.Action.SERVER_INVALID:
374 if(action.result.errors.errcode) {
375 switch (action.result.errors.errcode) {
378 Roo.bootstrap.MessageBox.show({
379 title: 'Confirm Save',
380 msg: 'No member found in To Group: '+ _this.combo_to_group.getRawValue(),
381 buttons: {yes:'OK Save anyway', no:'Change to another group'},
388 _this.form.findField('_ignore_group_count').setValue('1');
389 _this.form.doAction("submit");
405 case Roo.form.Action.CLIENT_INVALID: //for validation
407 case Roo.form.Action.CONNECT_FAILURE:
408 Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
411 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
416 render : function (_self)
422 '|xns' : 'Roo.bootstrap',
427 '|xns' : 'Roo.bootstrap',
434 '|xns' : 'Roo.bootstrap',
439 fieldLabel : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
440 indicatorpos : 'right',
442 name : 'description',
444 '|xns' : 'Roo.bootstrap'
452 '|xns' : 'Roo.bootstrap',
456 boxLabel : _this._strings['28690be026c0bb9003aa58e45e5662ca'] /* Enabled - will be sent out */,
458 indicatorpos : 'right',
463 check : function (_self, checked)
465 var boxLabel = 'Enabled - will be sent out';
468 boxLabel = 'Disabled - will NOT be sent out';
471 //this.setBoxLabel(boxLabel);
475 '|xns' : 'Roo.bootstrap'
484 '|xns' : 'Roo.bootstrap',
492 '|xns' : 'Roo.bootstrap',
497 fieldLabel : _this._strings['1e6d57e813355689e9c77e947d73ad8f'] /* From: */,
498 indicatorpos : 'right',
502 '|xns' : 'Roo.bootstrap'
511 '|xns' : 'Roo.bootstrap',
516 fieldLabel : _this._strings['e71c729cd7f3c6b6ebdb447e65952dfd'] /* From email address: */,
517 indicatorpos : 'right',
522 '|xns' : 'Roo.bootstrap'
531 '|xns' : 'Roo.bootstrap',
538 render : function (_self)
540 _this.to_group_row = this;
544 '|xns' : 'Roo.bootstrap',
550 displayField : 'name',
552 fieldLabel : _this._strings['fb981fe689fbec75c6531eb7410971f4'] /* To group: */,
553 forceSelection : true,
554 hiddenName : 'to_group_id',
555 indicatorpos : 'right',
558 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
560 name : 'to_group_id_name',
562 placeholder : _this._strings['e05f77bdf3f659c1fd354a88526c03da'] /* Select Group */,
563 triggerAction : 'all',
567 render : function (_self)
569 _this.combo_to_group = _self;
573 '|xns' : 'Roo.bootstrap',
577 sortInfo : { direction : 'ASC', field: 'name' },
579 beforeload : function (_self, o){
580 o.params = o.params || {};
582 o.params._direct_return = 1;
590 url : baseURL + '/Roo/Core_group',
595 xtype : 'JsonReader',
596 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
599 totalProperty : 'total',
612 '|xns' : 'Roo.bootstrap',
618 displayField : 'name',
620 fieldLabel : _this._strings['edddfc18b2ffb806573a1b3f341832cd'] /* BCC to Group: */,
621 forceSelection : true,
622 hiddenName : 'bcc_group_id',
623 indicatorpos : 'right',
626 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
628 name : 'bcc_group_id_name',
630 placeholder : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
631 triggerAction : 'all',
635 '|xns' : 'Roo.bootstrap',
639 sortInfo : { direction : 'ASC', field: 'name' },
641 beforeload : function (_self, o){
642 o.params = o.params || {};
644 o.params._direct_return = 1;
652 url : baseURL + '/Roo/Core_group',
657 xtype : 'JsonReader',
658 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
661 totalProperty : 'total',
674 '|xns' : 'Roo.bootstrap',
681 '|xns' : 'Roo.bootstrap',
686 fieldLabel : _this._strings['47a0be8d1015d526a1fbaa56c3102135'] /* Subject: */,
687 indicatorpos : 'right',
691 '|xns' : 'Roo.bootstrap'
700 '|xns' : 'Roo.bootstrap',
706 '|xns' : 'Roo.bootstrap',
710 header : _this._strings['36a65bbd12f7586ea1f9b0be4e8848aa'] /* HTML Editor */,
713 '|xns' : 'Roo.bootstrap',
716 xtype : 'HtmlEditor',
717 bodyCls : 'roo-email',
721 autosave : function (_self)
725 var id = _this.form.findField('id').getValue() * 1;
728 url : baseURL + '/Roo/Events.php',
733 on_id : (id > 0) ? id : 0,
734 on_table : 'crm_mailing_list_message',
736 source: _self.getValue()
738 success : function() {
739 _self.originalValue = _self.getValue();
744 Roo.log('body autosave failed?!');
749 render : function (_self)
751 _this.htmleditor = this;
753 savedpreview : function (_self)
755 var id = _this.form.findField('id').getValue() * 1;
757 var successFn = function(res){
758 return res.data.POST.source;
764 on_id : (id < 1) ? 0 : id,
765 on_table : 'core_email',
766 successFn : successFn
770 Pman.Dialog.BAdminAutoSavePreview.show(params, function(res){
772 _self.originalValue = res;
777 '|xns' : 'Roo.bootstrap',
781 glyphicon : 'camera',
782 html : _this._strings['7038eac66e387c3b3a0834d786a88757'] /* Insert Image */,
785 click : function (_self, e)
787 if (!_this.form.findField('bodytext').editorcore.activated) {
788 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select a place in the belowing text area where the image will insert at');
792 var id = _this.form.findField('id').getValue();
795 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please save the email template first');
799 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
801 Pman.Dialog.BAdminImageManager.show({
806 _this.form.findField('bodytext').editorcore.insertAtCursor(
808 '<img src="{0}/Images/{1}/{2}#image-{1}" height="{3}" width="{4}" alt="{5}" align="{6}">',
811 img.filename.replace('%', '-'),
823 '|xns' : 'Roo.bootstrap'
828 html : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
831 '|xns' : 'Roo.bootstrap',
835 '|xns' : 'Roo.bootstrap',
839 html : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
841 click : function (_self, e)
843 if (!_this.form.findField('bodytext').editorcore.activated) {
844 Roo.bootstrap.MessageBox.alert('Cannot add the name tag', 'Please select a place in the belowing text area where the tag will insert at');
848 _this.form.findField('bodytext').editorcore.insertAtCursor(
856 '|xns' : 'Roo.bootstrap'
860 html : _this._strings['4182c8f19d40c7ca236a5f4f83faeb6b'] /* Unsubscribe */,
862 click : function (_self, e)
864 if (!_this.form.findField('bodytext').editorcore.activated) {
865 Roo.bootstrap.MessageBox.alert('Cannot add the unsubscribe tag', 'Please select a place in the belowing text area where the tag will insert at');
869 _this.form.findField('bodytext').editorcore.insertAtCursor(
870 String.format('<a href="{0}">{1}</a>',
871 '#unsubscribe', "Unsubscribe"
877 '|xns' : 'Roo.bootstrap'
884 glyphicon : 'refresh',
885 html : _this._strings['b2bce8099bf8e6f51345bee5c9015c89'] /* Convert HTML to Plain Text */,
888 click : function (_self, e)
890 var h = _this.form.findField('bodytext').getValue();
891 var p = _this.form.findField('plaintext');
894 url : baseURL + '/Core/ImportMailMessage.php',
\r
898 _convertToPlain : true,
899 _check_unsubscribe : true
\r
901 success : function(res) {
\r
902 if(res.success == true){
903 p.setValue(res.data);
911 '|xns' : 'Roo.bootstrap'
915 glyphicon : 'floppy-disk',
916 html : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
919 click : function (_self, e)
921 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
925 '|xns' : 'Roo.bootstrap'
938 click : function (_self, e)
940 var h = _this.form.findField('bodytext').getValue();
941 var p = _this.form.findField('plaintext');
944 url : baseURL + '/Core/ImportMailMessage.php',
\r
948 _convertToPlain : true,
949 _check_unsubscribe : true
\r
951 success : function(res) {
\r
952 if(res.success == true){
953 p.setValue(res.data);
961 '|xns' : 'Roo.bootstrap',
967 '|xns' : 'Roo.bootstrap',
971 header : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
974 '|xns' : 'Roo.bootstrap',
980 '|xns' : 'Roo.bootstrap'
991 '|xns' : 'Roo.bootstrap',
997 '|xns' : 'Roo.bootstrap',
1003 fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
1004 indicatorpos : 'right',
1007 xns : Roo.bootstrap,
1008 '|xns' : 'Roo.bootstrap'
1015 xns : Roo.bootstrap,
1016 '|xns' : 'Roo.bootstrap',
1021 fieldLabel : _this._strings['3858712080cb3d846ea206d1d1070674'] /* Test Class (for system reference only): */,
1023 name : 'test_class',
1024 xns : Roo.bootstrap,
1025 '|xns' : 'Roo.bootstrap'
1033 inputType : 'hidden',
1036 xns : Roo.bootstrap,
1037 '|xns' : 'Roo.bootstrap'
1041 inputType : 'hidden',
1043 name : '_ignore_group_count',
1044 xns : Roo.bootstrap,
1045 '|xns' : 'Roo.bootstrap'
1055 Roo.apply(Pman.Dialog.BAdminEmail, Pman.Dialog.BAdminEmail.prototype);