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;
309 if(_this.form_data._css && _this.form_data._css.length){
313 this.findField('_ignore_group_count').setValue('0');
319 if (action.type =='submit') {
321 _this.dialog.el.unmask();
324 if (_this.callback) {
325 _this.callback.call(_this, action.result.data);
333 actionfailed : function (_self, action)
336 var displayErr = function() {
337 if(action.result.errorMsg.length >= 200) {
338 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg.substring(0,199) + '...');
340 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
343 switch(action.failureType) {
344 case Roo.form.Action.SERVER_INVALID:
345 if(action.result.errors.errcode) {
346 switch (action.result.errors.errcode) {
348 Roo.bootstrap.MessageBox.confirm('Confirm Save', 'No member found in To Group: ' + _this.combo_to_group.getRawValue() ,function(ret) {
352 _this.form.findField('_ignore_group_count').setValue('1');
353 _this.form.doAction("submit");
366 case Roo.form.Action.CLIENT_INVALID: //for validation
368 case Roo.form.Action.CONNECT_FAILURE:
369 Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
372 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
377 render : function (_self)
383 '|xns' : 'Roo.bootstrap',
388 '|xns' : 'Roo.bootstrap',
395 '|xns' : 'Roo.bootstrap',
400 fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
401 indicatorpos : 'right',
405 '|xns' : 'Roo.bootstrap'
413 '|xns' : 'Roo.bootstrap',
417 boxLabel : 'Enabled - will be sent out',
419 indicatorpos : 'right',
424 check : function (_self, checked)
426 var boxLabel = 'Enabled - will be sent out';
429 boxLabel = 'Disabled - will NOT be sent out';
432 //this.setBoxLabel(boxLabel);
436 '|xns' : 'Roo.bootstrap'
445 '|xns' : 'Roo.bootstrap',
453 '|xns' : 'Roo.bootstrap',
458 fieldLabel : _this._strings['1e6d57e813355689e9c77e947d73ad8f'] /* From: */,
459 indicatorpos : 'right',
463 '|xns' : 'Roo.bootstrap'
472 '|xns' : 'Roo.bootstrap',
477 fieldLabel : _this._strings['e71c729cd7f3c6b6ebdb447e65952dfd'] /* From email address: */,
478 indicatorpos : 'right',
483 '|xns' : 'Roo.bootstrap'
492 render : function (_self)
494 _this.to_group_row = this;
498 '|xns' : 'Roo.bootstrap',
505 '|xns' : 'Roo.bootstrap',
511 displayField : 'name',
513 fieldLabel : _this._strings['fb981fe689fbec75c6531eb7410971f4'] /* To group: */,
514 forceSelection : true,
515 hiddenName : 'to_group',
518 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
520 name : 'to_group_name',
522 placeholder : _this._strings['e05f77bdf3f659c1fd354a88526c03da'] /* Select Group */,
523 triggerAction : 'all',
527 render : function (_self)
529 _this.combo_to_group = _self;
533 '|xns' : 'Roo.bootstrap',
537 sortInfo : { direction : 'ASC', field: 'name' },
539 beforeload : function (_self, o){
540 o.params = o.params || {};
542 o.params._direct_return = 1;
550 url : baseURL + '/Roo/Core_group',
555 xtype : 'JsonReader',
556 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
559 totalProperty : 'total',
572 '|xns' : 'Roo.bootstrap',
578 displayField : 'name',
580 fieldLabel : _this._strings['0a5fecb1d88a50f47cc2ed2fd985c304'] /* BCC Group: */,
581 forceSelection : true,
582 hiddenName : 'bcc_group',
585 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
587 name : 'bcc_group_name',
589 placeholder : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
590 triggerAction : 'all',
594 '|xns' : 'Roo.bootstrap',
598 sortInfo : { direction : 'ASC', field: 'name' },
600 beforeload : function (_self, o){
601 o.params = o.params || {};
603 o.params._direct_return = 1;
611 url : baseURL + '/Roo/Core_group',
616 xtype : 'JsonReader',
617 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
620 totalProperty : 'total',
633 '|xns' : 'Roo.bootstrap',
640 '|xns' : 'Roo.bootstrap',
645 fieldLabel : _this._strings['47a0be8d1015d526a1fbaa56c3102135'] /* Subject: */,
646 indicatorpos : 'right',
650 '|xns' : 'Roo.bootstrap'
659 '|xns' : 'Roo.bootstrap',
665 '|xns' : 'Roo.bootstrap',
669 header : _this._strings['36a65bbd12f7586ea1f9b0be4e8848aa'] /* HTML Editor */,
672 '|xns' : 'Roo.bootstrap',
675 xtype : 'HtmlEditor',
679 autosave : function (_self)
683 var id = _this.form.findField('id').getValue() * 1;
686 url : baseURL + '/Roo/Events.php',
691 on_id : (id > 0) ? id : 0,
692 on_table : 'crm_mailing_list_message',
694 source: _self.getValue()
696 success : function() {
697 _self.originalValue = _self.getValue();
702 Roo.log('body autosave failed?!');
707 render : function (_self)
709 _this.htmleditor = this;
711 savedpreview : function (_self)
713 var id = _this.form.findField('id').getValue() * 1;
715 var successFn = function(res){
716 return res.data.POST.source;
722 on_id : (id < 1) ? 0 : id,
723 on_table : 'core_email',
724 successFn : successFn
728 Pman.Dialog.BAdminAutoSavePreview.show(params, function(res){
730 _self.originalValue = res;
735 '|xns' : 'Roo.bootstrap',
739 glyphicon : 'camera',
740 html : _this._strings['7038eac66e387c3b3a0834d786a88757'] /* Insert Image */,
743 click : function (_self, e)
745 if (!_this.form.findField('bodytext').editorcore.activated) {
746 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select a place in the belowing text area where the image will insert at');
750 var id = _this.form.findField('id').getValue();
753 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please save the email template first');
757 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
759 Pman.Dialog.BAdminImageManager.show({
768 '|xns' : 'Roo.bootstrap'
773 html : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
776 '|xns' : 'Roo.bootstrap',
780 '|xns' : 'Roo.bootstrap',
784 html : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
786 click : function (_self, e)
788 if (!_this.form.findField('bodytext').editorcore.activated) {
789 Roo.bootstrap.MessageBox.alert('Cannot add the name tag', 'Please select a place in the belowing text area where the tag will insert at');
793 _this.form.findField('bodytext').editorcore.insertAtCursor(
801 '|xns' : 'Roo.bootstrap'
805 html : _this._strings['4182c8f19d40c7ca236a5f4f83faeb6b'] /* Unsubscribe */,
807 click : function (_self, e)
809 if (!_this.form.findField('bodytext').editorcore.activated) {
810 Roo.bootstrap.MessageBox.alert('Cannot add the unsubscribe tag', 'Please select a place in the belowing text area where the tag will insert at');
814 _this.form.findField('bodytext').editorcore.insertAtCursor(
815 String.format('<a href="{0}">{1}</a>',
816 '#unsubscribe', "Unsubscribe"
822 '|xns' : 'Roo.bootstrap'
829 glyphicon : 'refresh',
830 html : _this._strings['b2bce8099bf8e6f51345bee5c9015c89'] /* Convert HTML to Plain Text */,
833 click : function (_self, e)
835 var h = _this.form.findField('bodytext').getValue();
836 var p = _this.form.findField('plaintext');
839 url : baseURL + '/Core/ImportMailMessage.php',
\r
843 _convertToPlain : true,
844 _check_unsubscribe : true
\r
846 success : function(res) {
\r
847 if(res.success == true){
848 p.setValue(res.data);
856 '|xns' : 'Roo.bootstrap'
860 glyphicon : 'floppy-disk',
861 html : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
864 click : function (_self, e)
866 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
870 '|xns' : 'Roo.bootstrap'
883 click : function (_self, e)
885 var h = _this.form.findField('bodytext').getValue();
886 var p = _this.form.findField('plaintext');
889 url : baseURL + '/Core/ImportMailMessage.php',
\r
893 _convertToPlain : true,
894 _check_unsubscribe : true
\r
896 success : function(res) {
\r
897 if(res.success == true){
898 p.setValue(res.data);
906 '|xns' : 'Roo.bootstrap',
912 '|xns' : 'Roo.bootstrap',
916 header : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
919 '|xns' : 'Roo.bootstrap',
925 '|xns' : 'Roo.bootstrap'
936 '|xns' : 'Roo.bootstrap',
942 '|xns' : 'Roo.bootstrap',
946 fieldLabel : _this._strings['3858712080cb3d846ea206d1d1070674'] /* Test Class (for system reference only): */,
950 '|xns' : 'Roo.bootstrap'
958 inputType : 'hidden',
962 '|xns' : 'Roo.bootstrap'
966 inputType : 'hidden',
968 name : '_ignore_group_count',
970 '|xns' : 'Roo.bootstrap'
980 Roo.apply(Pman.Dialog.BAdminEmail, Pman.Dialog.BAdminEmail.prototype);