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 //_this.dialog.hide();
115 var id = _this.form.findField('id').getValue();
118 Roo.bootstrap.MessageBox.alert('Error', 'Please save the message first!');
123 url : baseURL + '/Core/MessagePreview',
128 _table : _this.data.module
130 success : function(res) {
131 if(res.data == 'SUCCESS'){
132 Roo.bootstrap.MessageBox.alert("Email Sent", 'The report was sent to your email (HTML format).');
139 '|xns' : 'Roo.bootstrap'
143 html : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
147 click : function (_self, e)
149 Pman.Dialog.BAdminEmailPreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
153 '|xns' : 'Roo.bootstrap'
157 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
161 click : function (_self, e)
167 '|xns' : 'Roo.bootstrap'
171 html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
175 click : function (_self, e)
177 _this.form.preValidate(function(res) {
185 '|xns' : 'Roo.bootstrap'
192 '|xns' : 'Roo.bootstrap',
197 hideshow : function()
199 _this.to_group_row.hide();
201 if (this.findField('to_group_id').getValue() == -1) {
205 _this.to_group_row.show();
208 preValidate : function(done_callback) {
210 if(!_this.form.findField('bodytext').editorcore.sourceEditMode){
211 _this.form.findField('bodytext').syncValue();
213 _this.form.findField('bodytext').pushValue();
216 var html = _this.form.findField('bodytext').getValue();
218 var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);
220 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
225 s.select('img[src]').each(function(i) {
230 var total = nodes.length;
232 var mkimg = function() {
234 _this.form.findField('bodytext').syncValue();
236 _this.form.doAction("submit");
241 var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);
248 n = i.getAttribute('src').match(/^http(.*)/);
258 url : baseURL + '/Roo/Images.php',
261 onid : _this.form.findField('id').getValue(),
263 _remote_upload : i.src
265 success : function(res){
266 if(res.success == true){
267 i.setAttribute('src', res.data);
276 url : baseURL + '/Roo/crm_mailing_list_message.php',
278 actioncomplete : function(_self,action)
281 if (action.type == 'setdata') {
283 _this.data.module = _this.data.module || 'crm_mailing_list_message';
284 this.url = baseURL + '/Roo/' + _this.data.module;
286 if(_this.data.id*1 > 0){
287 _this.dialog.el.mask("Loading");
290 { method: 'GET', params: { '_id' : _this.data.id, '_with_css' : 1 }}
295 this.findField('name').setDisabled(false);
296 this.findField('test_class').setDisabled(false);
300 this.findField('to_group_id').setValue(-1);
301 this.findField('bodytext').setValue('');
304 'from_name' : Pman.Login.authUser.name,
305 'from_email' : Pman.Login.authUser.email
315 if (action.type == 'load') {
317 this.findField('name').setDisabled(false);
318 this.findField('test_class').setDisabled(false);
320 if(action.result.data['is_system'] == 1) {
321 this.findField('name').setDisabled(true);
322 this.findField('test_class').setDisabled(true);
325 _this.dialog.el.unmask();
327 this.findField('bodytext').originalValue = this.findField('bodytext').getValue();
329 _this.form_data = action.result.data;
331 if(_this.form_data._css && _this.form_data._css.length){
332 _this.htmleditor.editorcore.setStyle(_this.form_data._css);
335 this.findField('_ignore_group_count').setValue('0');
342 if (action.type =='submit') {
344 _this.dialog.el.unmask();
347 if (_this.callback) {
348 _this.callback.call(_this, action.result.data);
356 actionfailed : function (_self, action)
359 var displayErr = function() {
360 if(action.result.errorMsg.length >= 200) {
361 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg.substring(0,199) + '...');
363 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
366 switch(action.failureType) {
367 case Roo.form.Action.SERVER_INVALID:
368 if(action.result.errors.errcode) {
369 switch (action.result.errors.errcode) {
371 Roo.bootstrap.MessageBox.confirm('Confirm Save', 'No member found in To Group: ' + _this.combo_to_group.getRawValue() ,function(ret) {
375 _this.form.findField('_ignore_group_count').setValue('1');
376 _this.form.doAction("submit");
389 case Roo.form.Action.CLIENT_INVALID: //for validation
391 case Roo.form.Action.CONNECT_FAILURE:
392 Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
395 Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
400 render : function (_self)
406 '|xns' : 'Roo.bootstrap',
411 '|xns' : 'Roo.bootstrap',
418 '|xns' : 'Roo.bootstrap',
423 fieldLabel : _this._strings['292f75d54a6892cfe18a93e64230112a'] /* Mailout Name: */,
424 indicatorpos : 'right',
428 '|xns' : 'Roo.bootstrap'
436 '|xns' : 'Roo.bootstrap',
440 boxLabel : _this._strings['28690be026c0bb9003aa58e45e5662ca'] /* Enabled - will be sent out */,
442 indicatorpos : 'right',
447 check : function (_self, checked)
449 var boxLabel = 'Enabled - will be sent out';
452 boxLabel = 'Disabled - will NOT be sent out';
455 //this.setBoxLabel(boxLabel);
459 '|xns' : 'Roo.bootstrap'
468 '|xns' : 'Roo.bootstrap',
476 '|xns' : 'Roo.bootstrap',
481 fieldLabel : _this._strings['1e6d57e813355689e9c77e947d73ad8f'] /* From: */,
482 indicatorpos : 'right',
486 '|xns' : 'Roo.bootstrap'
495 '|xns' : 'Roo.bootstrap',
500 fieldLabel : _this._strings['e71c729cd7f3c6b6ebdb447e65952dfd'] /* From email address: */,
501 indicatorpos : 'right',
506 '|xns' : 'Roo.bootstrap'
515 '|xns' : 'Roo.bootstrap',
522 render : function (_self)
524 _this.to_group_row = this;
528 '|xns' : 'Roo.bootstrap',
534 displayField : 'name',
536 fieldLabel : _this._strings['fb981fe689fbec75c6531eb7410971f4'] /* To group: */,
537 forceSelection : true,
538 hiddenName : 'to_group_id',
539 indicatorpos : 'right',
542 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
544 name : 'to_group_id_name',
546 placeholder : _this._strings['e05f77bdf3f659c1fd354a88526c03da'] /* Select Group */,
547 triggerAction : 'all',
551 render : function (_self)
553 _this.combo_to_group = _self;
557 '|xns' : 'Roo.bootstrap',
561 sortInfo : { direction : 'ASC', field: 'name' },
563 beforeload : function (_self, o){
564 o.params = o.params || {};
566 o.params._direct_return = 1;
574 url : baseURL + '/Roo/Core_group',
579 xtype : 'JsonReader',
580 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
583 totalProperty : 'total',
596 '|xns' : 'Roo.bootstrap',
602 displayField : 'name',
604 fieldLabel : _this._strings['edddfc18b2ffb806573a1b3f341832cd'] /* BCC to Group: */,
605 forceSelection : true,
606 hiddenName : 'bcc_group_id',
609 loadingText : _this._strings['843627586c62e389041a4d8800143974'] /* Searching */,
611 name : 'bcc_group_id_name',
613 placeholder : _this._strings['2c466a2c159463f1d9ef5a7b57b52827'] /* Select BCC Group */,
614 triggerAction : 'all',
618 '|xns' : 'Roo.bootstrap',
622 sortInfo : { direction : 'ASC', field: 'name' },
624 beforeload : function (_self, o){
625 o.params = o.params || {};
627 o.params._direct_return = 1;
635 url : baseURL + '/Roo/Core_group',
640 xtype : 'JsonReader',
641 fields : [{"name":"name","type":"string"},{"name":"id","type":"int"}],
644 totalProperty : 'total',
657 '|xns' : 'Roo.bootstrap',
664 '|xns' : 'Roo.bootstrap',
669 fieldLabel : _this._strings['47a0be8d1015d526a1fbaa56c3102135'] /* Subject: */,
670 indicatorpos : 'right',
674 '|xns' : 'Roo.bootstrap'
683 '|xns' : 'Roo.bootstrap',
689 '|xns' : 'Roo.bootstrap',
693 header : _this._strings['36a65bbd12f7586ea1f9b0be4e8848aa'] /* HTML Editor */,
696 '|xns' : 'Roo.bootstrap',
699 xtype : 'HtmlEditor',
700 bodyCls : 'roo-email',
704 autosave : function (_self)
708 var id = _this.form.findField('id').getValue() * 1;
711 url : baseURL + '/Roo/Events.php',
716 on_id : (id > 0) ? id : 0,
717 on_table : 'crm_mailing_list_message',
719 source: _self.getValue()
721 success : function() {
722 _self.originalValue = _self.getValue();
727 Roo.log('body autosave failed?!');
732 render : function (_self)
734 _this.htmleditor = this;
736 savedpreview : function (_self)
738 var id = _this.form.findField('id').getValue() * 1;
740 var successFn = function(res){
741 return res.data.POST.source;
747 on_id : (id < 1) ? 0 : id,
748 on_table : 'core_email',
749 successFn : successFn
753 Pman.Dialog.BAdminAutoSavePreview.show(params, function(res){
755 _self.originalValue = res;
760 '|xns' : 'Roo.bootstrap',
764 glyphicon : 'camera',
765 html : _this._strings['7038eac66e387c3b3a0834d786a88757'] /* Insert Image */,
768 click : function (_self, e)
770 if (!_this.form.findField('bodytext').editorcore.activated) {
771 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select a place in the belowing text area where the image will insert at');
775 var id = _this.form.findField('id').getValue();
778 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please save the email template first');
782 var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';
784 Pman.Dialog.BAdminImageManager.show({
793 '|xns' : 'Roo.bootstrap'
798 html : _this._strings['5feb9bf3c03b32635135006cbacb9542'] /* Insert Field */,
801 '|xns' : 'Roo.bootstrap',
805 '|xns' : 'Roo.bootstrap',
809 html : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
811 click : function (_self, e)
813 if (!_this.form.findField('bodytext').editorcore.activated) {
814 Roo.bootstrap.MessageBox.alert('Cannot add the name tag', 'Please select a place in the belowing text area where the tag will insert at');
818 _this.form.findField('bodytext').editorcore.insertAtCursor(
826 '|xns' : 'Roo.bootstrap'
830 html : _this._strings['4182c8f19d40c7ca236a5f4f83faeb6b'] /* Unsubscribe */,
832 click : function (_self, e)
834 if (!_this.form.findField('bodytext').editorcore.activated) {
835 Roo.bootstrap.MessageBox.alert('Cannot add the unsubscribe tag', 'Please select a place in the belowing text area where the tag will insert at');
839 _this.form.findField('bodytext').editorcore.insertAtCursor(
840 String.format('<a href="{0}">{1}</a>',
841 '#unsubscribe', "Unsubscribe"
847 '|xns' : 'Roo.bootstrap'
854 glyphicon : 'refresh',
855 html : _this._strings['b2bce8099bf8e6f51345bee5c9015c89'] /* Convert HTML to Plain Text */,
858 click : function (_self, e)
860 var h = _this.form.findField('bodytext').getValue();
861 var p = _this.form.findField('plaintext');
864 url : baseURL + '/Core/ImportMailMessage.php',
\r
868 _convertToPlain : true,
869 _check_unsubscribe : true
\r
871 success : function(res) {
\r
872 if(res.success == true){
873 p.setValue(res.data);
881 '|xns' : 'Roo.bootstrap'
885 glyphicon : 'floppy-disk',
886 html : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
889 click : function (_self, e)
891 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
895 '|xns' : 'Roo.bootstrap'
908 click : function (_self, e)
910 var h = _this.form.findField('bodytext').getValue();
911 var p = _this.form.findField('plaintext');
914 url : baseURL + '/Core/ImportMailMessage.php',
\r
918 _convertToPlain : true,
919 _check_unsubscribe : true
\r
921 success : function(res) {
\r
922 if(res.success == true){
923 p.setValue(res.data);
931 '|xns' : 'Roo.bootstrap',
937 '|xns' : 'Roo.bootstrap',
941 header : _this._strings['e44b145bd8b49b06e0ad2ced1ad56466'] /* Plain Text */,
944 '|xns' : 'Roo.bootstrap',
950 '|xns' : 'Roo.bootstrap'
961 '|xns' : 'Roo.bootstrap',
967 '|xns' : 'Roo.bootstrap',
971 fieldLabel : _this._strings['3858712080cb3d846ea206d1d1070674'] /* Test Class (for system reference only): */,
975 '|xns' : 'Roo.bootstrap'
983 inputType : 'hidden',
987 '|xns' : 'Roo.bootstrap'
991 inputType : 'hidden',
993 name : '_ignore_group_count',
995 '|xns' : 'Roo.bootstrap'
1005 Roo.apply(Pman.Dialog.BAdminEmail, Pman.Dialog.BAdminEmail.prototype);