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 '28690be026c0bb9003aa58e45e5662ca' :"Enabled - will be sent out",
33 'fb981fe689fbec75c6531eb7410971f4' :"To group:",
34 'e05f77bdf3f659c1fd354a88526c03da' :"Select Group",
35 '36a65bbd12f7586ea1f9b0be4e8848aa' :"HTML Editor"
38 'active_boxLabel' : '28690be026c0bb9003aa58e45e5662ca' /* Enabled - will be sent out */ ,
39 'to_group_id_name_loadingText' : '843627586c62e389041a4d8800143974' /* Searching */ ,
40 'to_group_id_name_fieldLabel' : 'fb981fe689fbec75c6531eb7410971f4' /* To group: */ ,
41 'save_html' : 'c9cc8cce247e49bae79f15173ce97354' /* Save */ ,
42 'name_fieldLabel' : '292f75d54a6892cfe18a93e64230112a' /* Mailout Name: */ ,
43 'bcc_group_id_name_placeholder' : '2c466a2c159463f1d9ef5a7b57b52827' /* Select BCC Group */ ,
44 'cancel_html' : 'ea4788705e6873b424c65e91c2846b19' /* Cancel */ ,
45 'from_email_fieldLabel' : 'e71c729cd7f3c6b6ebdb447e65952dfd' /* From email address: */ ,
46 'to_group_id_name_placeholder' : 'e05f77bdf3f659c1fd354a88526c03da' /* Select Group */ ,
47 'preview_html' : '31fde7b05ac8952dacf4af8a704074ec' /* Preview */ ,
48 'active_value' : 'c4ca4238a0b923820dcc509a6f75849b' /* 1 */ ,
49 'send_html' : '5b8ef4e762c00a15a41cfc26dc3ef99c' /* Send me a test copy */ ,
50 'from_name_fieldLabel' : '1e6d57e813355689e9c77e947d73ad8f' /* From: */ ,
51 'bcc_group_id_name_loadingText' : '843627586c62e389041a4d8800143974' /* Searching */ ,
52 'bcc_group_id_name_fieldLabel' : 'edddfc18b2ffb806573a1b3f341832cd' /* BCC to Group: */ ,
53 'subject_fieldLabel' : '47a0be8d1015d526a1fbaa56c3102135' /* Subject: */ ,
54 'test_class_fieldLabel' : '3858712080cb3d846ea206d1d1070674' /* Test Class (for system reference only): */
60 show : function(data, cb)
68 this.dialog.show(this.data._el);
71 this.form.setValues(data);
72 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
80 this.dialog = Roo.factory({
82 cls : 'modal-body-enable-overflow-y',
84 title : _this._strings['396ecabf0cd1f9503e591418851ef406'] /* Edit / Create Message */,
86 hide : function (_self)
90 clearInterval(_this.autosave);
93 render : function (_self)
97 show : function (_self)
103 '|xns' : 'Roo.bootstrap',
107 html : _this._strings['5b8ef4e762c00a15a41cfc26dc3ef99c'] /* Send me a test copy */,
111 click : function (_self, e)
113 var id = _this.form.findField('id').getValue();
116 Roo.bootstrap.MessageBox.alert('Error', 'Please save the message first!');
121 url : baseURL + '/Core/MessagePreview',
126 _table : _this.data.module
128 success : function(res) {
129 if(res.data == 'SUCCESS'){
130 Roo.bootstrap.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
137 '|xns' : 'Roo.bootstrap'
141 html : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
145 click : function (_self, e)
147 Pman.Dialog.BAdminEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
151 '|xns' : 'Roo.bootstrap'
155 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
159 click : function (_self, e)
165 '|xns' : 'Roo.bootstrap'
169 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
173 click : function (_self, e)
175 _this.form.preValidate(function(res) {
183 '|xns' : 'Roo.bootstrap'
190 '|xns' : 'Roo.bootstrap',
195 hideshow : function()
197 _this.to_group_row.hide();
199 if (this.findField('to_group_id').getValue() == -1) {
203 _this.to_group_row.show();
206 preValidate : function(done_callback) {
208 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
209 _this.form.findField('bodytext').syncValue();
211 _this.form.findField('bodytext').pushValue();
214 var html = _this.form.findField('bodytext').getValue();
216 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
218 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
223 s.select('img[src]').each(function(i) {
228 var total = nodes.length;
230 var mkimg = function() {
232 _this.form.findField('bodytext').syncValue();
234 _this.form.doAction("submit");
239 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
246 n = i.getAttribute('src').match(/^http(.*)/);
256 url : baseURL + '/Roo/Images.php',
259 onid : _this.form.findField('id').getValue(),
261 _remote_upload : i.src
263 success : function(res){
264 if(res.success == true){
265 i.setAttribute('src', res.data);
274 url : baseURL + '/Roo/crm_mailing_list_message.php',
276 actioncomplete : function(_self,action)
279 if (action.type == 'setdata') {
281 _this.data.module = _this.data.module || 'crm_mailing_list_message';
282 this.url = baseURL + '/Roo/' + _this.data.module;
284 if(_this.data.id*1 > 0){
285 _this.dialog.el.mask("Loading");
288 { method: 'GET', params: { '_id' : _this.data.id, '_with_css' : 1 }}
293 this.findField('name').setDisabled(false);
294 this.findField('test_class').setDisabled(false);
298 this.findField('to_group_id').setValue(-1);
299 this.findField('bodytext').setValue('');
302 'from_name' : Pman.Login.authUser.name,
303 'from_email' : Pman.Login.authUser.email
313 if (action.type == 'load') {
315 this.findField('name').setDisabled(false);
316 this.findField('test_class').setDisabled(false);
318 if(action.result.data['is_system'] == 1) {
319 this.findField('name').setDisabled(true);
320 this.findField('test_class').setDisabled(true);
323 _this.dialog.el.unmask();
325 this.findField('bodytext').originalValue = this.findField('bodytext').getValue();
327 _this.form_data = action.result.data;
329 if(_this.form_data._css && _this.form_data._css.length){
330 _this.htmleditor.editorcore.setStyle(_this.form_data._css);
333 this.findField('_ignore_group_count').setValue('0');
340 if (action.type =='submit') {
342 _this.dialog.el.unmask();
345 if (_this.callback) {
346 _this.callback.call(_this, action.result.data);
354 actionfailed : function (_self, action)
357 var displayErr = function() {
358 if(action.result.errorMsg.length >= 200) {
359 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg.substring(0,199) + '...');
361 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
364 switch(action.failureType) {
365 case Roo.form.Action.SERVER_INVALID:
366 if(action.result.errors.errcode) {
367 switch (action.result.errors.errcode) {
370 Roo.bootstrap.MessageBox.show({
371 title: 'Confirm Save',
372 msg: 'No member found in To Group: '+ _this.combo_to_group.getRawValue(),
373 buttons: {yes:'OK Save anyway', no:'Change to another group'},
380 _this.form.findField('_ignore_group_count').setValue('1');
381 _this.form.doAction("submit");
397 case Roo.form.Action.CLIENT_INVALID: //for validation
399 case Roo.form.Action.CONNECT_FAILURE:
400 Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
403 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
408 render : function (_self)
414 '|xns' : 'Roo.bootstrap',
419 '|xns' : 'Roo.bootstrap',
426 '|xns' : 'Roo.bootstrap',
431 fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
432 indicatorpos : 'right',
436 '|xns' : 'Roo.bootstrap'
444 '|xns' : 'Roo.bootstrap',
448 boxLabel : _this._strings['28690be026c0bb9003aa58e45e5662ca'] /* Enabled - will be sent out */,
450 indicatorpos : 'right',
455 check : function (_self, checked)
457 var boxLabel = 'Enabled - will be sent out';
460 boxLabel = 'Disabled - will NOT be sent out';
463 //this.setBoxLabel(boxLabel);
467 '|xns' : 'Roo.bootstrap'
476 '|xns' : 'Roo.bootstrap',
484 '|xns' : 'Roo.bootstrap',
489 fieldLabel : _this._strings['1e6d57e813355689e9c77e947d73ad8f'] /* From: */,
490 indicatorpos : 'right',
494 '|xns' : 'Roo.bootstrap'
503 '|xns' : 'Roo.bootstrap',
508 fieldLabel : _this._strings['e71c729cd7f3c6b6ebdb447e65952dfd'] /* From email address: */,
509 indicatorpos : 'right',
514 '|xns' : 'Roo.bootstrap'
523 '|xns' : 'Roo.bootstrap',
530 render : function (_self)
532 _this.to_group_row = this;
536 '|xns' : 'Roo.bootstrap',
542 displayField : 'name',
544 fieldLabel : _this._strings['fb981fe689fbec75c6531eb7410971f4'] /* To group: */,
545 forceSelection : true,
546 hiddenName : 'to_group_id',
547 indicatorpos : 'right',
550 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
552 name : 'to_group_id_name',
554 placeholder : _this._strings['e05f77bdf3f659c1fd354a88526c03da'] /* Select Group */,
555 triggerAction : 'all',
559 render : function (_self)
561 _this.combo_to_group = _self;
565 '|xns' : 'Roo.bootstrap',
569 sortInfo : { direction : 'ASC', field: 'name' },
571 beforeload : function (_self, o){
572 o.params = o.params || {};
574 o.params._direct_return = 1;
582 url : baseURL + '/Roo/Core_group',
587 xtype : 'JsonReader',
588 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
591 totalProperty : 'total',
604 '|xns' : 'Roo.bootstrap',
610 displayField : 'name',
612 fieldLabel : _this._strings['edddfc18b2ffb806573a1b3f341832cd'] /* BCC to Group: */,
613 forceSelection : true,
614 hiddenName : 'bcc_group_id',
615 indicatorpos : 'right',
618 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
620 name : 'bcc_group_id_name',
622 placeholder : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
623 triggerAction : 'all',
627 '|xns' : 'Roo.bootstrap',
631 sortInfo : { direction : 'ASC', field: 'name' },
633 beforeload : function (_self, o){
634 o.params = o.params || {};
636 o.params._direct_return = 1;
644 url : baseURL + '/Roo/Core_group',
649 xtype : 'JsonReader',
650 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
653 totalProperty : 'total',
666 '|xns' : 'Roo.bootstrap',
673 '|xns' : 'Roo.bootstrap',
678 fieldLabel : _this._strings['47a0be8d1015d526a1fbaa56c3102135'] /* Subject: */,
679 indicatorpos : 'right',
683 '|xns' : 'Roo.bootstrap'
692 '|xns' : 'Roo.bootstrap',
698 '|xns' : 'Roo.bootstrap',
702 header : _this._strings['36a65bbd12f7586ea1f9b0be4e8848aa'] /* HTML Editor */,
705 '|xns' : 'Roo.bootstrap',
708 xtype : 'HtmlEditor',
709 bodyCls : 'roo-email',
710 insertEmailImageDetail : function() { },
714 autosave : function (_self)
718 var id = _this.form.findField('id').getValue() * 1;
721 url : baseURL + '/Roo/Events.php',
726 on_id : (id > 0) ? id : 0,
727 on_table : 'crm_mailing_list_message',
729 source: _self.getValue()
731 success : function() {
732 _self.originalValue = _self.getValue();
737 Roo.log('body autosave failed?!');
742 render : function (_self)
744 _this.htmleditor = this;
746 savedpreview : function (_self)
748 var id = _this.form.findField('id').getValue() * 1;
750 var successFn = function(res){
751 return res.data.POST.source;
757 on_id : (id < 1) ? 0 : id,
758 on_table : 'core_email',
759 successFn : successFn
763 Pman.Dialog.BAdminAutoSavePreview.show(params, function(res){
765 _self.originalValue = res;
770 '|xns' : 'Roo.bootstrap',
774 glyphicon : 'camera',
775 html : _this._strings['7038eac66e387c3b3a0834d786a88757'] /* Insert Image */,
778 click : function (_self, e)
780 if (!_this.form.findField('bodytext').editorcore.activated) {
781 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select a place in the belowing text area where the image will insert at');
785 var id = _this.form.findField('id').getValue();
788 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please save the email template first');
792 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
794 Pman.Dialog.BAdminImageManager.show({
803 '|xns' : 'Roo.bootstrap'
808 html : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
811 '|xns' : 'Roo.bootstrap',
815 '|xns' : 'Roo.bootstrap',
819 html : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
821 click : function (_self, e)
823 if (!_this.form.findField('bodytext').editorcore.activated) {
824 Roo.bootstrap.MessageBox.alert('Cannot add the name tag', 'Please select a place in the belowing text area where the tag will insert at');
828 _this.form.findField('bodytext').editorcore.insertAtCursor(
836 '|xns' : 'Roo.bootstrap'
840 html : _this._strings['4182c8f19d40c7ca236a5f4f83faeb6b'] /* Unsubscribe */,
842 click : function (_self, e)
844 if (!_this.form.findField('bodytext').editorcore.activated) {
845 Roo.bootstrap.MessageBox.alert('Cannot add the unsubscribe tag', 'Please select a place in the belowing text area where the tag will insert at');
849 _this.form.findField('bodytext').editorcore.insertAtCursor(
850 String.format('<a href="{0}">{1}</a>',
851 '#unsubscribe', "Unsubscribe"
857 '|xns' : 'Roo.bootstrap'
864 glyphicon : 'refresh',
865 html : _this._strings['b2bce8099bf8e6f51345bee5c9015c89'] /* Convert HTML to Plain Text */,
868 click : function (_self, e)
870 var h = _this.form.findField('bodytext').getValue();
871 var p = _this.form.findField('plaintext');
874 url : baseURL + '/Core/ImportMailMessage.php',
\r
878 _convertToPlain : true,
879 _check_unsubscribe : true
\r
881 success : function(res) {
\r
882 if(res.success == true){
883 p.setValue(res.data);
891 '|xns' : 'Roo.bootstrap'
895 glyphicon : 'floppy-disk',
896 html : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
899 click : function (_self, e)
901 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
905 '|xns' : 'Roo.bootstrap'
918 click : function (_self, e)
920 var h = _this.form.findField('bodytext').getValue();
921 var p = _this.form.findField('plaintext');
924 url : baseURL + '/Core/ImportMailMessage.php',
\r
928 _convertToPlain : true,
929 _check_unsubscribe : true
\r
931 success : function(res) {
\r
932 if(res.success == true){
933 p.setValue(res.data);
941 '|xns' : 'Roo.bootstrap',
947 '|xns' : 'Roo.bootstrap',
951 header : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
954 '|xns' : 'Roo.bootstrap',
960 '|xns' : 'Roo.bootstrap'
971 '|xns' : 'Roo.bootstrap',
977 '|xns' : 'Roo.bootstrap',
981 fieldLabel : _this._strings['3858712080cb3d846ea206d1d1070674'] /* Test Class (for system reference only): */,
985 '|xns' : 'Roo.bootstrap'
993 inputType : 'hidden',
997 '|xns' : 'Roo.bootstrap'
1001 inputType : 'hidden',
1003 name : '_ignore_group_count',
1004 xns : Roo.bootstrap,
1005 '|xns' : 'Roo.bootstrap'
1015 Roo.apply(Pman.Dialog.BAdminEmail, Pman.Dialog.BAdminEmail.prototype);