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 'save_html' : 'c9cc8cce247e49bae79f15173ce97354' /* Save */ ,
42 'to_group_id_display_name_loadingText' : '843627586c62e389041a4d8800143974' /* Searching */ ,
43 'bcc_group_id_name_placeholder' : '2c466a2c159463f1d9ef5a7b57b52827' /* Select BCC Group */ ,
44 'name_fieldLabel' : '292f75d54a6892cfe18a93e64230112a' /* Mailout Name: */ ,
45 'cancel_html' : 'ea4788705e6873b424c65e91c2846b19' /* Cancel */ ,
46 'from_email_fieldLabel' : 'e71c729cd7f3c6b6ebdb447e65952dfd' /* From email address: */ ,
47 'to_group_id_display_name_fieldLabel' : 'fb981fe689fbec75c6531eb7410971f4' /* To group: */ ,
48 'preview_html' : '31fde7b05ac8952dacf4af8a704074ec' /* Preview */ ,
49 'active_value' : 'c4ca4238a0b923820dcc509a6f75849b' /* 1 */ ,
50 'to_group_id_display_name_placeholder' : 'e05f77bdf3f659c1fd354a88526c03da' /* Select Group */ ,
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.apply(this.dialog, Array.prototype.slice.call(arguments).slice(2));
73 this.form.setValues(data);
74 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
82 this.dialog = Roo.factory({
85 cls : 'modal-body-enable-overflow-y',
87 title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
89 hide : function (_self)
93 clearInterval(_this.autosave);
96 render : function (_self)
100 show : function (_self)
106 '|xns' : 'Roo.bootstrap',
110 html : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
114 click : function (_self, e)
116 var id = _this.form.findField('id').getValue();
119 Roo.bootstrap.MessageBox.alert('Error', 'Please save the message first!');
124 url : baseURL + '/Core/MessagePreview',
129 _table : _this.data.module
131 success : function(res) {
132 if(res.data == 'SUCCESS'){
133 Roo.bootstrap.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
140 '|xns' : 'Roo.bootstrap'
144 html : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
148 click : function (_self, e)
150 Pman.Dialog.BAdminEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
154 '|xns' : 'Roo.bootstrap'
158 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
162 click : function (_self, e)
168 '|xns' : 'Roo.bootstrap'
172 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
176 click : function (_self, e)
178 _this.form.preValidate(function(res) {
186 '|xns' : 'Roo.bootstrap'
193 '|xns' : 'Roo.bootstrap',
198 hideshow : function()
200 _this.to_group_row.hide();
202 if (this.findField('to_group_id').getValue() == -1) {
206 _this.to_group_row.show();
209 preValidate : function(done_callback) {
211 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
212 _this.form.findField('bodytext').syncValue();
214 _this.form.findField('bodytext').pushValue();
217 var html = _this.form.findField('bodytext').getValue();
219 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
221 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
226 s.select('img[src]').each(function(i) {
231 var total = nodes.length;
233 var mkimg = function() {
235 _this.form.findField('bodytext').syncValue();
237 _this.form.doAction("submit");
242 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
249 n = i.getAttribute('src').match(/^http(.*)/);
259 url : baseURL + '/Roo/Images.php',
262 onid : _this.form.findField('id').getValue(),
264 _remote_upload : i.src
266 success : function(res){
267 if(res.success == true){
268 i.setAttribute('src', res.data);
277 url : baseURL + '/Roo/crm_mailing_list_message.php',
279 actioncomplete : function(_self,action)
282 if (action.type == 'setdata') {
284 _this.data.module = _this.data.module || 'crm_mailing_list_message';
285 this.url = baseURL + '/Roo/' + _this.data.module;
287 if(_this.data.id*1 > 0){
288 _this.dialog.el.mask("Loading");
291 { method: 'GET', params: { '_id' : _this.data.id, '_with_css' : 1 }}
296 //this.findField('name').setDisabled(false);
297 //this.findField('test_class').setDisabled(false);
301 this.findField('to_group_id').setValue(-1);
302 this.findField('bodytext').setValue('');
305 'from_name' : Pman.Login.authUser.name,
306 'from_email' : Pman.Login.authUser.email
316 if (action.type == 'load') {
319 this.findField('name').setDisabled(false);
320 this.findField('test_class').setDisabled(false);
322 if(action.result.data['is_system'] == 1) {
323 this.findField('name').setDisabled(true);
324 this.findField('test_class').setDisabled(true);
328 _this.dialog.el.unmask();
330 this.findField('bodytext').originalValue = this.findField('bodytext').getValue();
332 _this.form_data = action.result.data;
334 if(_this.form_data._css && _this.form_data._css.length){
335 _this.htmleditor.editorcore.setStyle(_this.form_data._css);
338 this.findField('_ignore_group_count').setValue('0');
340 if(!_this.form_data.description.length){
341 _this.form_data.findField('description').setValue(_this.form_data.name);
349 if (action.type =='submit') {
351 _this.dialog.el.unmask();
354 if (_this.callback) {
355 _this.callback.call(_this, action.result.data);
363 actionfailed : function (_self, action)
366 var displayErr = function() {
367 if(action.result.errorMsg.length >= 200) {
368 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg.substring(0,199) + '...');
370 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
373 switch(action.failureType) {
374 case Roo.form.Action.SERVER_INVALID:
375 if(action.result.errors.errcode) {
376 switch (action.result.errors.errcode) {
379 Roo.bootstrap.MessageBox.show({
380 title: 'Confirm Save',
381 msg: 'No member found in To Group: '+ _this.combo_to_group.getRawValue(),
382 buttons: {yes:'OK Save anyway', no:'Change to another group'},
389 _this.form.findField('_ignore_group_count').setValue('1');
390 _this.form.doAction("submit");
406 case Roo.form.Action.CLIENT_INVALID: //for validation
408 case Roo.form.Action.CONNECT_FAILURE:
409 Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
412 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
417 render : function (_self)
423 '|xns' : 'Roo.bootstrap',
428 '|xns' : 'Roo.bootstrap',
435 '|xns' : 'Roo.bootstrap',
440 fieldLabel : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
441 indicatorpos : 'right',
443 name : 'description',
445 '|xns' : 'Roo.bootstrap'
453 '|xns' : 'Roo.bootstrap',
457 boxLabel : _this._strings['28690be026c0bb9003aa58e45e5662ca'] /* Enabled - will be sent out */,
459 indicatorpos : 'right',
464 check : function (_self, checked)
466 var boxLabel = 'Enabled - will be sent out';
469 boxLabel = 'Disabled - will NOT be sent out';
472 //this.setBoxLabel(boxLabel);
476 '|xns' : 'Roo.bootstrap'
485 '|xns' : 'Roo.bootstrap',
493 '|xns' : 'Roo.bootstrap',
498 fieldLabel : _this._strings['1e6d57e813355689e9c77e947d73ad8f'] /* From: */,
499 indicatorpos : 'right',
503 '|xns' : 'Roo.bootstrap'
512 '|xns' : 'Roo.bootstrap',
517 fieldLabel : _this._strings['e71c729cd7f3c6b6ebdb447e65952dfd'] /* From email address: */,
518 indicatorpos : 'right',
523 '|xns' : 'Roo.bootstrap'
532 '|xns' : 'Roo.bootstrap',
539 render : function (_self)
541 _this.to_group_row = this;
545 '|xns' : 'Roo.bootstrap',
551 displayField : 'display_name',
553 fieldLabel : _this._strings['fb981fe689fbec75c6531eb7410971f4'] /* To group: */,
554 forceSelection : true,
555 hiddenName : 'to_group_id',
556 indicatorpos : 'right',
559 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
561 name : 'to_group_id_display_name',
563 placeholder : _this._strings['e05f77bdf3f659c1fd354a88526c03da'] /* Select Group */,
564 triggerAction : 'all',
568 render : function (_self)
570 _this.combo_to_group = _self;
574 '|xns' : 'Roo.bootstrap',
578 sortInfo : { direction : 'ASC', field: 'name' },
580 beforeload : function (_self, o){
581 o.params = o.params || {};
583 o.params._direct_return = 1;
584 o.params.limit = 100;
592 url : baseURL + '/Roo/Core_group',
597 xtype : 'JsonReader',
598 fields : ['name','display_name',{"name":"id","type":"int"}],
601 totalProperty : 'total',
614 '|xns' : 'Roo.bootstrap',
620 displayField : 'name',
622 fieldLabel : _this._strings['edddfc18b2ffb806573a1b3f341832cd'] /* BCC to Group: */,
623 forceSelection : true,
624 hiddenName : 'bcc_group_id',
625 indicatorpos : 'right',
628 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
630 name : 'bcc_group_id_name',
632 placeholder : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
633 triggerAction : 'all',
637 '|xns' : 'Roo.bootstrap',
641 sortInfo : { direction : 'ASC', field: 'name' },
643 beforeload : function (_self, o){
644 o.params = o.params || {};
646 o.params._direct_return = 1;
654 url : baseURL + '/Roo/Core_group',
659 xtype : 'JsonReader',
660 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
663 totalProperty : 'total',
676 '|xns' : 'Roo.bootstrap',
683 '|xns' : 'Roo.bootstrap',
688 fieldLabel : _this._strings['47a0be8d1015d526a1fbaa56c3102135'] /* Subject: */,
689 indicatorpos : 'right',
693 '|xns' : 'Roo.bootstrap'
702 '|xns' : 'Roo.bootstrap',
708 '|xns' : 'Roo.bootstrap',
712 header : _this._strings['36a65bbd12f7586ea1f9b0be4e8848aa'] /* HTML Editor */,
715 '|xns' : 'Roo.bootstrap',
718 xtype : 'HtmlEditor',
719 bodyCls : 'roo-email',
723 autosave : function (_self)
727 var id = _this.form.findField('id').getValue() * 1;
730 url : baseURL + '/Roo/Events.php',
735 on_id : (id > 0) ? id : 0,
736 on_table : 'crm_mailing_list_message',
738 source: _self.getValue()
740 success : function() {
741 _self.originalValue = _self.getValue();
746 Roo.log('body autosave failed?!');
751 render : function (_self)
753 _this.htmleditor = this;
755 savedpreview : function (_self)
757 var id = _this.form.findField('id').getValue() * 1;
759 var successFn = function(res){
760 return res.data.POST.source;
766 on_id : (id < 1) ? 0 : id,
767 on_table : 'core_email',
768 successFn : successFn
772 Pman.Dialog.BAdminAutoSavePreview.show(params, function(res){
774 _self.originalValue = res;
779 '|xns' : 'Roo.bootstrap',
783 glyphicon : 'camera',
784 html : _this._strings['7038eac66e387c3b3a0834d786a88757'] /* Insert Image */,
787 click : function (_self, e)
789 if (!_this.form.findField('bodytext').editorcore.activated) {
790 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select a place in the belowing text area where the image will insert at');
794 var id = _this.form.findField('id').getValue();
797 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please save the email template first');
801 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
803 Pman.Dialog.BAdminImageManager.show({
808 _this.form.findField('bodytext').editorcore.insertAtCursor(
810 '<img src="{0}/Images/{1}/{2}#image-{1}" height="{3}" width="{4}" alt="{5}" align="{6}">',
813 img.filename.replace('%', '-'),
825 '|xns' : 'Roo.bootstrap'
830 html : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
833 '|xns' : 'Roo.bootstrap',
837 '|xns' : 'Roo.bootstrap',
841 html : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
843 click : function (_self, e)
845 if (!_this.form.findField('bodytext').editorcore.activated) {
846 Roo.bootstrap.MessageBox.alert('Cannot add the name tag', 'Please select a place in the belowing text area where the tag will insert at');
850 _this.form.findField('bodytext').editorcore.insertAtCursor(
858 '|xns' : 'Roo.bootstrap'
862 html : _this._strings['4182c8f19d40c7ca236a5f4f83faeb6b'] /* Unsubscribe */,
864 click : function (_self, e)
866 if (!_this.form.findField('bodytext').editorcore.activated) {
867 Roo.bootstrap.MessageBox.alert('Cannot add the unsubscribe tag', 'Please select a place in the belowing text area where the tag will insert at');
871 _this.form.findField('bodytext').editorcore.insertAtCursor(
872 String.format('<a href="{0}">{1}</a>',
873 '#unsubscribe', "Unsubscribe"
879 '|xns' : 'Roo.bootstrap'
886 glyphicon : 'refresh',
887 html : _this._strings['b2bce8099bf8e6f51345bee5c9015c89'] /* Convert HTML to Plain Text */,
890 click : function (_self, e)
892 var h = _this.form.findField('bodytext').getValue();
893 var p = _this.form.findField('plaintext');
896 url : baseURL + '/Core/ImportMailMessage.php',
\r
900 _convertToPlain : true,
901 _check_unsubscribe : true
\r
903 success : function(res) {
\r
904 if(res.success == true){
905 p.setValue(res.data);
913 '|xns' : 'Roo.bootstrap'
917 glyphicon : 'floppy-disk',
918 html : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
921 click : function (_self, e)
923 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
927 '|xns' : 'Roo.bootstrap'
940 click : function (_self, e)
942 var h = _this.form.findField('bodytext').getValue();
943 var p = _this.form.findField('plaintext');
946 url : baseURL + '/Core/ImportMailMessage.php',
\r
950 _convertToPlain : true,
951 _check_unsubscribe : true
\r
953 success : function(res) {
\r
954 if(res.success == true){
955 p.setValue(res.data);
963 '|xns' : 'Roo.bootstrap',
969 '|xns' : 'Roo.bootstrap',
973 header : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
976 '|xns' : 'Roo.bootstrap',
982 '|xns' : 'Roo.bootstrap'
993 '|xns' : 'Roo.bootstrap',
999 '|xns' : 'Roo.bootstrap',
1005 fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
1006 indicatorpos : 'right',
1009 xns : Roo.bootstrap,
1010 '|xns' : 'Roo.bootstrap'
1017 xns : Roo.bootstrap,
1018 '|xns' : 'Roo.bootstrap',
1023 fieldLabel : _this._strings['3858712080cb3d846ea206d1d1070674'] /* Test Class (for system reference only): */,
1025 name : 'test_class',
1026 xns : Roo.bootstrap,
1027 '|xns' : 'Roo.bootstrap'
1035 inputType : 'hidden',
1038 xns : Roo.bootstrap,
1039 '|xns' : 'Roo.bootstrap'
1043 inputType : 'hidden',
1045 name : '_ignore_group_count',
1046 xns : Roo.bootstrap,
1047 '|xns' : 'Roo.bootstrap'
1057 Roo.apply(Pman.Dialog.BAdminEmail, Pman.Dialog.BAdminEmail.prototype);