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 '0a5fecb1d88a50f47cc2ed2fd985c304' :"BCC Group:",
18 '4182c8f19d40c7ca236a5f4f83faeb6b' :"Unsubscribe",
19 'b2bce8099bf8e6f51345bee5c9015c89' :"Convert HTML to Plain Text",
20 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
21 'c4ca4238a0b923820dcc509a6f75849b' :"1",
22 '1e6d57e813355689e9c77e947d73ad8f' :"From:",
23 '292f75d54a6892cfe18a93e64230112a' :"Mailout Name:",
24 '47a0be8d1015d526a1fbaa56c3102135' :"Subject:",
25 '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
26 '7038eac66e387c3b3a0834d786a88757' :"Insert Image",
27 'e71c729cd7f3c6b6ebdb447e65952dfd' :"From email address:",
28 'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version",
29 'e44b145bd8b49b06e0ad2ced1ad56466' :"Plain Text",
30 'c9cc8cce247e49bae79f15173ce97354' :"Save",
31 '49ee3087348e8d44e1feda1917443987' :"Name",
32 'fb981fe689fbec75c6531eb7410971f4' :"To group:",
33 'e05f77bdf3f659c1fd354a88526c03da' :"Select Group",
34 '36a65bbd12f7586ea1f9b0be4e8848aa' :"HTML Editor"
40 show : function(data, cb)
48 this.dialog.show(this.data._el);
51 this.form.setValues(data);
52 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
60 this.dialog = Roo.factory({
62 cls : 'modal-body-enable-overflow-y',
64 title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
66 hide : function (_self)
70 clearInterval(_this.autosave);
73 render : function (_self)
77 show : function (_self)
83 '|xns' : 'Roo.bootstrap',
87 html : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
91 click : function (_self, e)
93 //_this.dialog.hide();
95 var id = _this.form.findField('id').getValue();
98 Roo.bootstrap.MessageBox.alert('Error', 'Please save the message first!');
103 url : baseURL + '/Core/MessagePreview',
108 _table : _this.data.module
110 success : function(res) {
111 if(res.data == 'SUCCESS'){
112 Roo.bootstrap.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
119 '|xns' : 'Roo.bootstrap'
123 html : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
127 click : function (_self, e)
129 Pman.Dialog.BAdminEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
133 '|xns' : 'Roo.bootstrap'
137 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
141 click : function (_self, e)
147 '|xns' : 'Roo.bootstrap'
151 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
155 click : function (_self, e)
157 _this.form.preValidate(function(res) {
165 '|xns' : 'Roo.bootstrap'
172 '|xns' : 'Roo.bootstrap',
177 hideshow : function()
179 if (this.findField('to_group').getValue() == -1) {
180 _this.to_group_row.hide();
182 _this.to_group_row.show();
186 preValidate : function(done_callback) {
188 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
189 _this.form.findField('bodytext').syncValue();
191 _this.form.findField('bodytext').pushValue();
194 var html = _this.form.findField('bodytext').getValue();
196 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
198 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
203 s.select('img[src]').each(function(i) {
208 var total = nodes.length;
210 var mkimg = function() {
212 _this.form.findField('bodytext').syncValue();
214 _this.form.doAction("submit");
219 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
226 n = i.getAttribute('src').match(/^http(.*)/);
236 url : baseURL + '/Roo/Images.php',
239 onid : _this.form.findField('id').getValue(),
241 _remote_upload : i.src
243 success : function(res){
244 if(res.success == true){
245 i.setAttribute('src', res.data);
254 url : baseURL + '/Roo/crm_mailing_list_message.php',
256 actioncomplete : function(_self,action)
259 if (action.type == 'setdata') {
261 _this.data.module = _this.data.module || 'crm_mailing_list_message';
262 this.url = baseURL + '/Roo/' + _this.data.module;
264 if(_this.data.id*1 > 0){
265 _this.dialog.el.mask("Loading");
268 { method: 'GET', params: { '_id' : _this.data.id, '_with_css' : 1 }}
273 this.findField('name').setDisabled(false);
274 this.findField('test_class').setDisabled(false);
278 this.findField('to_group').setValue(-1);
279 this.findField('bodytext').setValue('');
282 'from_name' : Pman.Login.authUser.name,
283 'from_email' : Pman.Login.authUser.email
293 if (action.type == 'load') {
295 this.findField('name').setDisabled(false);
296 this.findField('test_class').setDisabled(false);
298 if(action.result.data['is_system'] == 1) {
299 this.findField('name').setDisabled(true);
300 this.findField('test_class').setDisabled(true);
303 _this.dialog.el.unmask();
305 this.findField('bodytext').originalValue = this.findField('bodytext').getValue();
307 _this.form_data = action.result.data;
308 this.findField('_ignore_group_count').setValue('0');
314 if (action.type =='submit') {
316 _this.dialog.el.unmask();
319 if (_this.callback) {
320 _this.callback.call(_this, action.result.data);
328 actionfailed : function (_self, action)
331 var displayErr = function() {
332 if(action.result.errorMsg.length >= 200) {
333 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg.substring(0,199) + '...');
335 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
338 switch(action.failureType) {
339 case Roo.form.Action.SERVER_INVALID:
340 if(action.result.errors.errcode) {
341 switch (action.result.errors.errcode) {
343 Roo.bootstrap.MessageBox.confirm('Confirm Save', 'No member found in To Group: ' + _this.combo_to_group.getRawValue() ,function(ret) {
347 _this.form.findField('_ignore_group_count').setValue('1');
348 _this.form.doAction("submit");
361 case Roo.form.Action.CLIENT_INVALID: //for validation
363 case Roo.form.Action.CONNECT_FAILURE:
364 Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
367 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
372 render : function (_self)
378 '|xns' : 'Roo.bootstrap',
383 '|xns' : 'Roo.bootstrap',
390 '|xns' : 'Roo.bootstrap',
395 fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
396 indicatorpos : 'right',
400 '|xns' : 'Roo.bootstrap'
408 '|xns' : 'Roo.bootstrap',
412 boxLabel : 'Enabled - will be sent out',
414 indicatorpos : 'right',
419 check : function (_self, checked)
421 var boxLabel = 'Enabled - will be sent out';
424 boxLabel = 'Disabled - will NOT be sent out';
427 //this.setBoxLabel(boxLabel);
431 '|xns' : 'Roo.bootstrap'
440 '|xns' : 'Roo.bootstrap',
448 '|xns' : 'Roo.bootstrap',
453 fieldLabel : _this._strings['1e6d57e813355689e9c77e947d73ad8f'] /* From: */,
454 indicatorpos : 'right',
458 '|xns' : 'Roo.bootstrap'
467 '|xns' : 'Roo.bootstrap',
472 fieldLabel : _this._strings['e71c729cd7f3c6b6ebdb447e65952dfd'] /* From email address: */,
473 indicatorpos : 'right',
478 '|xns' : 'Roo.bootstrap'
487 render : function (_self)
489 _this.to_group_row = this;
493 '|xns' : 'Roo.bootstrap',
500 '|xns' : 'Roo.bootstrap',
506 displayField : 'name',
508 fieldLabel : _this._strings['fb981fe689fbec75c6531eb7410971f4'] /* To group: */,
509 forceSelection : true,
510 hiddenName : 'to_group',
513 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
515 name : 'to_group_name',
517 placeholder : _this._strings['e05f77bdf3f659c1fd354a88526c03da'] /* Select Group */,
518 triggerAction : 'all',
522 render : function (_self)
524 _this.combo_to_group = _self;
528 '|xns' : 'Roo.bootstrap',
532 sortInfo : { direction : 'ASC', field: 'name' },
534 beforeload : function (_self, o){
535 o.params = o.params || {};
537 o.params._direct_return = 1;
545 url : baseURL + '/Roo/Core_group',
550 xtype : 'JsonReader',
551 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
554 totalProperty : 'total',
567 '|xns' : 'Roo.bootstrap',
573 displayField : 'name',
575 fieldLabel : _this._strings['0a5fecb1d88a50f47cc2ed2fd985c304'] /* BCC Group: */,
576 forceSelection : true,
577 hiddenName : 'bcc_group',
580 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
582 name : 'bcc_group_name',
584 placeholder : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
585 triggerAction : 'all',
589 '|xns' : 'Roo.bootstrap',
593 sortInfo : { direction : 'ASC', field: 'name' },
595 beforeload : function (_self, o){
596 o.params = o.params || {};
598 o.params._direct_return = 1;
606 url : baseURL + '/Roo/Core_group',
611 xtype : 'JsonReader',
612 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
615 totalProperty : 'total',
628 '|xns' : 'Roo.bootstrap',
635 '|xns' : 'Roo.bootstrap',
640 fieldLabel : _this._strings['47a0be8d1015d526a1fbaa56c3102135'] /* Subject: */,
641 indicatorpos : 'right',
645 '|xns' : 'Roo.bootstrap'
654 '|xns' : 'Roo.bootstrap',
660 '|xns' : 'Roo.bootstrap',
664 header : _this._strings['36a65bbd12f7586ea1f9b0be4e8848aa'] /* HTML Editor */,
667 '|xns' : 'Roo.bootstrap',
670 xtype : 'HtmlEditor',
673 autosave : function (_self)
677 var id = _this.form.findField('id').getValue() * 1;
680 url : baseURL + '/Roo/Events.php',
685 on_id : (id > 0) ? id : 0,
686 on_table : 'crm_mailing_list_message',
688 source: _self.getValue()
690 success : function() {
691 _self.originalValue = _self.getValue();
696 Roo.log('body autosave failed?!');
701 render : function (_self)
703 _this.htmleditor = this;
705 savedpreview : function (_self)
707 var id = _this.form.findField('id').getValue() * 1;
709 var successFn = function(res){
710 return res.data.POST.source;
716 on_id : (id < 1) ? 0 : id,
717 on_table : 'core_email',
718 successFn : successFn
722 Pman.Dialog.BAdminAutoSavePreview.show(params, function(res){
724 _self.originalValue = res;
729 '|xns' : 'Roo.bootstrap',
733 glyphicon : 'camera',
734 html : _this._strings['7038eac66e387c3b3a0834d786a88757'] /* Insert Image */,
737 click : function (_self, e)
739 if (!_this.form.findField('bodytext').editorcore.activated) {
740 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select a place in the belowing text area where the image will insert at');
744 var id = _this.form.findField('id').getValue();
747 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please save the email template first');
751 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
753 Pman.Dialog.BAdminImageManager.show({
762 '|xns' : 'Roo.bootstrap'
767 html : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
770 '|xns' : 'Roo.bootstrap',
774 '|xns' : 'Roo.bootstrap',
778 html : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
780 click : function (_self, e)
782 if (!_this.form.findField('bodytext').editorcore.activated) {
783 Roo.bootstrap.MessageBox.alert('Cannot add the name tag', 'Please select a place in the belowing text area where the tag will insert at');
787 _this.form.findField('bodytext').editorcore.insertAtCursor(
795 '|xns' : 'Roo.bootstrap'
799 html : _this._strings['4182c8f19d40c7ca236a5f4f83faeb6b'] /* Unsubscribe */,
801 click : function (_self, e)
803 if (!_this.form.findField('bodytext').editorcore.activated) {
804 Roo.bootstrap.MessageBox.alert('Cannot add the unsubscribe tag', 'Please select a place in the belowing text area where the tag will insert at');
808 _this.form.findField('bodytext').editorcore.insertAtCursor(
809 String.format('<a href="{0}">{1}</a>',
810 '#unsubscribe', "Unsubscribe"
816 '|xns' : 'Roo.bootstrap'
823 glyphicon : 'refresh',
824 html : _this._strings['b2bce8099bf8e6f51345bee5c9015c89'] /* Convert HTML to Plain Text */,
827 click : function (_self, e)
829 var h = _this.form.findField('bodytext').getValue();
830 var p = _this.form.findField('plaintext');
833 url : baseURL + '/Core/ImportMailMessage.php',
\r
837 _convertToPlain : true,
838 _check_unsubscribe : true
\r
840 success : function(res) {
\r
841 if(res.success == true){
842 p.setValue(res.data);
850 '|xns' : 'Roo.bootstrap'
854 glyphicon : 'floppy-disk',
855 html : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
858 click : function (_self, e)
860 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
864 '|xns' : 'Roo.bootstrap'
877 click : function (_self, e)
879 var h = _this.form.findField('bodytext').getValue();
880 var p = _this.form.findField('plaintext');
883 url : baseURL + '/Core/ImportMailMessage.php',
\r
887 _convertToPlain : true,
888 _check_unsubscribe : true
\r
890 success : function(res) {
\r
891 if(res.success == true){
892 p.setValue(res.data);
900 '|xns' : 'Roo.bootstrap',
906 '|xns' : 'Roo.bootstrap',
910 header : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
913 '|xns' : 'Roo.bootstrap',
919 '|xns' : 'Roo.bootstrap'
930 '|xns' : 'Roo.bootstrap',
936 '|xns' : 'Roo.bootstrap',
940 fieldLabel : _this._strings['3858712080cb3d846ea206d1d1070674'] /* Test Class (for system reference only): */,
944 '|xns' : 'Roo.bootstrap'
952 inputType : 'hidden',
956 '|xns' : 'Roo.bootstrap'
960 inputType : 'hidden',
962 name : '_ignore_group_count',
964 '|xns' : 'Roo.bootstrap'
974 Roo.apply(Pman.Dialog.BAdminEmail, Pman.Dialog.BAdminEmail.prototype);