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 '292f75d54a6892cfe18a93e64230112a' :"Mailout Name:",
23 '47a0be8d1015d526a1fbaa56c3102135' :"Subject:",
24 '5feb9bf3c03b32635135006cbacb9542' :"Insert Field",
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 '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 _this.to_group_row.hide();
181 if (this.findField('to_group').getValue() == -1) {
185 _this.to_group_row.show();
188 preValidate : function(done_callback) {
190 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
191 _this.form.findField('bodytext').syncValue();
193 _this.form.findField('bodytext').pushValue();
196 var html = _this.form.findField('bodytext').getValue();
198 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
200 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
205 s.select('img[src]').each(function(i) {
210 var total = nodes.length;
212 var mkimg = function() {
214 _this.form.findField('bodytext').syncValue();
216 _this.form.doAction("submit");
221 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
228 n = i.getAttribute('src').match(/^http(.*)/);
238 url : baseURL + '/Roo/Images.php',
241 onid : _this.form.findField('id').getValue(),
243 _remote_upload : i.src
245 success : function(res){
246 if(res.success == true){
247 i.setAttribute('src', res.data);
256 url : baseURL + '/Roo/crm_mailing_list_message.php',
258 actioncomplete : function(_self,action)
261 if (action.type == 'setdata') {
263 _this.data.module = _this.data.module || 'crm_mailing_list_message';
264 this.url = baseURL + '/Roo/' + _this.data.module;
266 if(_this.data.id*1 > 0){
267 _this.dialog.el.mask("Loading");
270 { method: 'GET', params: { '_id' : _this.data.id, '_with_css' : 1 }}
275 this.findField('name').setDisabled(false);
276 this.findField('test_class').setDisabled(false);
280 this.findField('to_group').setValue(-1);
281 this.findField('bodytext').setValue('');
284 'from_name' : Pman.Login.authUser.name,
285 'from_email' : Pman.Login.authUser.email
295 if (action.type == 'load') {
297 this.findField('name').setDisabled(false);
298 this.findField('test_class').setDisabled(false);
300 if(action.result.data['is_system'] == 1) {
301 this.findField('name').setDisabled(true);
302 this.findField('test_class').setDisabled(true);
305 _this.dialog.el.unmask();
307 this.findField('bodytext').originalValue = this.findField('bodytext').getValue();
309 _this.form_data = action.result.data;
311 if(_this.form_data._css && _this.form_data._css.length){
312 _this.htmleditor.editorcore.setStyle(_this.form_data._css);
315 this.findField('_ignore_group_count').setValue('0');
322 if (action.type =='submit') {
324 _this.dialog.el.unmask();
327 if (_this.callback) {
328 _this.callback.call(_this, action.result.data);
336 actionfailed : function (_self, action)
339 var displayErr = function() {
340 if(action.result.errorMsg.length >= 200) {
341 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg.substring(0,199) + '...');
343 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
346 switch(action.failureType) {
347 case Roo.form.Action.SERVER_INVALID:
348 if(action.result.errors.errcode) {
349 switch (action.result.errors.errcode) {
351 Roo.bootstrap.MessageBox.confirm('Confirm Save', 'No member found in To Group: ' + _this.combo_to_group.getRawValue() ,function(ret) {
355 _this.form.findField('_ignore_group_count').setValue('1');
356 _this.form.doAction("submit");
369 case Roo.form.Action.CLIENT_INVALID: //for validation
371 case Roo.form.Action.CONNECT_FAILURE:
372 Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
375 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
380 render : function (_self)
386 '|xns' : 'Roo.bootstrap',
391 '|xns' : 'Roo.bootstrap',
398 '|xns' : 'Roo.bootstrap',
403 fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
404 indicatorpos : 'right',
408 '|xns' : 'Roo.bootstrap'
416 '|xns' : 'Roo.bootstrap',
420 boxLabel : 'Enabled - will be sent out',
422 indicatorpos : 'right',
427 check : function (_self, checked)
429 var boxLabel = 'Enabled - will be sent out';
432 boxLabel = 'Disabled - will NOT be sent out';
435 //this.setBoxLabel(boxLabel);
439 '|xns' : 'Roo.bootstrap'
448 '|xns' : 'Roo.bootstrap',
456 '|xns' : 'Roo.bootstrap',
461 fieldLabel : _this._strings['1e6d57e813355689e9c77e947d73ad8f'] /* From: */,
462 indicatorpos : 'right',
466 '|xns' : 'Roo.bootstrap'
475 '|xns' : 'Roo.bootstrap',
480 fieldLabel : _this._strings['e71c729cd7f3c6b6ebdb447e65952dfd'] /* From email address: */,
481 indicatorpos : 'right',
486 '|xns' : 'Roo.bootstrap'
495 '|xns' : 'Roo.bootstrap',
502 render : function (_self)
504 _this.to_group_row = this;
508 '|xns' : 'Roo.bootstrap',
514 displayField : 'name',
516 fieldLabel : _this._strings['fb981fe689fbec75c6531eb7410971f4'] /* To group: */,
517 forceSelection : true,
518 hiddenName : 'to_group_id',
521 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
523 name : 'to_group_id_name',
525 placeholder : _this._strings['e05f77bdf3f659c1fd354a88526c03da'] /* Select Group */,
526 triggerAction : 'all',
530 render : function (_self)
532 _this.combo_to_group = _self;
536 '|xns' : 'Roo.bootstrap',
540 sortInfo : { direction : 'ASC', field: 'name' },
542 beforeload : function (_self, o){
543 o.params = o.params || {};
545 o.params._direct_return = 1;
553 url : baseURL + '/Roo/Core_group',
558 xtype : 'JsonReader',
559 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
562 totalProperty : 'total',
575 '|xns' : 'Roo.bootstrap',
581 displayField : 'name',
583 fieldLabel : _this._strings['edddfc18b2ffb806573a1b3f341832cd'] /* BCC to Group: */,
584 forceSelection : true,
585 hiddenName : 'bcc_group_id',
588 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
590 name : 'bcc_group_id_name',
592 placeholder : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
593 triggerAction : 'all',
597 '|xns' : 'Roo.bootstrap',
601 sortInfo : { direction : 'ASC', field: 'name' },
603 beforeload : function (_self, o){
604 o.params = o.params || {};
606 o.params._direct_return = 1;
614 url : baseURL + '/Roo/Core_group',
619 xtype : 'JsonReader',
620 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
623 totalProperty : 'total',
636 '|xns' : 'Roo.bootstrap',
643 '|xns' : 'Roo.bootstrap',
648 fieldLabel : _this._strings['47a0be8d1015d526a1fbaa56c3102135'] /* Subject: */,
649 indicatorpos : 'right',
653 '|xns' : 'Roo.bootstrap'
662 '|xns' : 'Roo.bootstrap',
668 '|xns' : 'Roo.bootstrap',
672 header : _this._strings['36a65bbd12f7586ea1f9b0be4e8848aa'] /* HTML Editor */,
675 '|xns' : 'Roo.bootstrap',
678 xtype : 'HtmlEditor',
679 bodyCls : 'roo-email',
683 autosave : function (_self)
687 var id = _this.form.findField('id').getValue() * 1;
690 url : baseURL + '/Roo/Events.php',
695 on_id : (id > 0) ? id : 0,
696 on_table : 'crm_mailing_list_message',
698 source: _self.getValue()
700 success : function() {
701 _self.originalValue = _self.getValue();
706 Roo.log('body autosave failed?!');
711 render : function (_self)
713 _this.htmleditor = this;
715 savedpreview : function (_self)
717 var id = _this.form.findField('id').getValue() * 1;
719 var successFn = function(res){
720 return res.data.POST.source;
726 on_id : (id < 1) ? 0 : id,
727 on_table : 'core_email',
728 successFn : successFn
732 Pman.Dialog.BAdminAutoSavePreview.show(params, function(res){
734 _self.originalValue = res;
739 '|xns' : 'Roo.bootstrap',
743 glyphicon : 'camera',
744 html : _this._strings['7038eac66e387c3b3a0834d786a88757'] /* Insert Image */,
747 click : function (_self, e)
749 if (!_this.form.findField('bodytext').editorcore.activated) {
750 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select a place in the belowing text area where the image will insert at');
754 var id = _this.form.findField('id').getValue();
757 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please save the email template first');
761 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
763 Pman.Dialog.BAdminImageManager.show({
772 '|xns' : 'Roo.bootstrap'
777 html : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
780 '|xns' : 'Roo.bootstrap',
784 '|xns' : 'Roo.bootstrap',
788 html : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
790 click : function (_self, e)
792 if (!_this.form.findField('bodytext').editorcore.activated) {
793 Roo.bootstrap.MessageBox.alert('Cannot add the name tag', 'Please select a place in the belowing text area where the tag will insert at');
797 _this.form.findField('bodytext').editorcore.insertAtCursor(
805 '|xns' : 'Roo.bootstrap'
809 html : _this._strings['4182c8f19d40c7ca236a5f4f83faeb6b'] /* Unsubscribe */,
811 click : function (_self, e)
813 if (!_this.form.findField('bodytext').editorcore.activated) {
814 Roo.bootstrap.MessageBox.alert('Cannot add the unsubscribe tag', 'Please select a place in the belowing text area where the tag will insert at');
818 _this.form.findField('bodytext').editorcore.insertAtCursor(
819 String.format('<a href="{0}">{1}</a>',
820 '#unsubscribe', "Unsubscribe"
826 '|xns' : 'Roo.bootstrap'
833 glyphicon : 'refresh',
834 html : _this._strings['b2bce8099bf8e6f51345bee5c9015c89'] /* Convert HTML to Plain Text */,
837 click : function (_self, e)
839 var h = _this.form.findField('bodytext').getValue();
840 var p = _this.form.findField('plaintext');
843 url : baseURL + '/Core/ImportMailMessage.php',
\r
847 _convertToPlain : true,
848 _check_unsubscribe : true
\r
850 success : function(res) {
\r
851 if(res.success == true){
852 p.setValue(res.data);
860 '|xns' : 'Roo.bootstrap'
864 glyphicon : 'floppy-disk',
865 html : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
868 click : function (_self, e)
870 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
874 '|xns' : 'Roo.bootstrap'
887 click : function (_self, e)
889 var h = _this.form.findField('bodytext').getValue();
890 var p = _this.form.findField('plaintext');
893 url : baseURL + '/Core/ImportMailMessage.php',
\r
897 _convertToPlain : true,
898 _check_unsubscribe : true
\r
900 success : function(res) {
\r
901 if(res.success == true){
902 p.setValue(res.data);
910 '|xns' : 'Roo.bootstrap',
916 '|xns' : 'Roo.bootstrap',
920 header : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
923 '|xns' : 'Roo.bootstrap',
929 '|xns' : 'Roo.bootstrap'
940 '|xns' : 'Roo.bootstrap',
946 '|xns' : 'Roo.bootstrap',
950 fieldLabel : _this._strings['3858712080cb3d846ea206d1d1070674'] /* Test Class (for system reference only): */,
954 '|xns' : 'Roo.bootstrap'
962 inputType : 'hidden',
966 '|xns' : 'Roo.bootstrap'
970 inputType : 'hidden',
972 name : '_ignore_group_count',
974 '|xns' : 'Roo.bootstrap'
984 Roo.apply(Pman.Dialog.BAdminEmail, Pman.Dialog.BAdminEmail.prototype);