1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Tab');
7 Pman.Tab.BAdminEmailTemplates = new Roo.XComponent({
10 'cdb6b6bab1fd18b9dbfe3fb84a5d34ae' :"<i class=\"fa fa-search\"></i>",
11 'cae905999a2ad1dfb8f4eae0e8cda73b' :"From Name<br/>Email",
12 '98d2ee61ddce0c7666297d81639914f1' :"To / BCC Group",
13 '73ea6b4441cdced246d236b22c8f991c' :"HTML File",
14 '694e249c3a9503141fa5ce3fb71d5477' :"<i class=\"fa fa-edit\"></i> Edit",
15 'cffbd822c38679e2fbf11cc182c945e5' :"search for email template",
16 '9e11143e29a031212f2cdefcf61f39e9' :"View Message",
17 'f49559cda3fb906fbd7736f8b8a0e37d' :"Email Template",
18 '27a7146e1e1890e289bc7fad72876831' :"<i class=\"fa fa-plus\"></i> Create a template",
19 'cd6df251f262cc64514b25f04aecf3c8' :"<i class=\"fa fa-clipboard\"></i> Copy",
20 'ed807858fcb68abdd180481f1fcba5c5' :"<i class=\"fa fa-trash\"></i> Delete",
21 '03c2e7e41ffc181a4e84080b4710e81e' :"New",
22 '4d3d769b812b6faa6b76e1a8abaece2d' :"Active",
23 'b5a7adde1af5c87d7fd797b6245c2a39' :"Description",
24 'e6b391a8d2c4d45902a23a8b6585703d' :"URL"
27 part : ["BAdmin", "EmailTemplates" ],
28 order : '004-Pman.Tab.BAdminEmailTemplates',
30 parent : 'Pman.Tab.BAdmin',
31 name : "Pman.Tab.BAdminEmailTemplates",
34 _tree : function(_data)
41 title : _this._strings['f49559cda3fb906fbd7736f8b8a0e37d'] /* Email Template */,
43 activate : function (_self)
45 if(!document.getElementsByClassName('email-south-pane')) {
49 document.getElementsByClassName('email-south-pane')[0].classList.remove('disable-pane');
52 appDisabled.indexOf('Core.SuperAdmin') * 1 != -1
54 document.getElementsByClassName('email-south-pane')[0].classList.add('disable-pane');
58 xns : Roo.bootstrap.panel,
59 '|xns' : 'Roo.bootstrap.panel',
62 xns : Roo.bootstrap.layout,
63 '|xns' : 'Roo.bootstrap.layout',
68 xns : Roo.bootstrap.layout,
69 '|xns' : 'Roo.bootstrap.layout'
74 cls : 'email-south-pane',
80 xns : Roo.bootstrap.layout,
81 '|xns' : 'Roo.bootstrap.layout'
92 activate : function (_self)
94 _this.edit_btn.hide();
95 _this.copy_btn.hide();
96 _this.delete_btn.hide();
99 _this.table.footer.onClick('first');
103 render : function (_self)
108 xns : Roo.bootstrap.panel,
109 '|xns' : 'Roo.bootstrap.panel',
111 xtype : 'NavSimplebar',
113 '|xns' : 'Roo.bootstrap',
118 '|xns' : 'Roo.bootstrap',
123 '|xns' : 'Roo.bootstrap',
128 '|xns' : 'Roo.bootstrap',
134 '|xns' : 'Roo.bootstrap',
140 '|xns' : 'Roo.bootstrap',
144 placeholder : _this._strings['cffbd822c38679e2fbf11cc182c945e5'] /* search for email template */,
146 render : function (_self)
148 _this.searchBox = this;
150 specialkey : function (_self, e)
152 if(e.keyCode == e.ENTER) {
154 _this.table.footer.onClick('first');
162 '|xns' : 'Roo.bootstrap',
165 html : _this._strings['cdb6b6bab1fd18b9dbfe3fb84a5d34ae'] /* <i class="fa fa-search"></i> */,
167 click : function (_self, e)
169 _this.table.footer.onClick('first');
173 '|xns' : 'Roo.bootstrap'
181 style : 'text-align: right;',
183 '|xns' : 'Roo.bootstrap',
187 cls : 'roo-toolbar-button',
188 html : _this._strings['27a7146e1e1890e289bc7fad72876831'] /* <i class="fa fa-plus"></i> Create a template */,
190 render : function (_self)
196 '|xns' : 'Roo.bootstrap',
200 '|xns' : 'Roo.bootstrap',
205 html : _this._strings['03c2e7e41ffc181a4e84080b4710e81e'] /* New */,
207 click : function (_self, e)
213 _this.dialog.show( { id : 0, module : 'core_email' } , function() {
214 _this.table.footer.onClick('first');
219 '|xns' : 'Roo.bootstrap'
224 html : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
226 click : function (_self, e)
228 Pman.Dialog.BAdminImportUrl.show(
230 target : '/Core/ImportMailMessage.php'
235 Pman.Dialog.BAdminEmail.dialog.show();
236 Pman.Dialog.BAdminEmail.form.findField('bodytext').setValue(data);
243 '|xns' : 'Roo.bootstrap'
248 html : _this._strings['73ea6b4441cdced246d236b22c8f991c'] /* HTML File */,
250 click : function (_self, e)
252 Pman.Dialog.BAdminImage.show(
254 _url : '/Core/ImportMailMessage.php'
259 Pman.Dialog.BAdminEmail.dialog.show();
260 Pman.Dialog.BAdminEmail.form.findField('bodytext').setValue(data);
267 '|xns' : 'Roo.bootstrap'
274 cls : 'roo-toolbar-button',
275 html : _this._strings['694e249c3a9503141fa5ce3fb71d5477'] /* <i class="fa fa-edit"></i> Edit */,
277 click : function (_self, e)
279 var sel = _this.grid.grid.selModel.getSelected();
281 if (!sel || sel.data.id * 1 < 1) {
282 Roo.MessageBox.alert("Error", "Select a message to edit");
286 Pman.Dialog.BAdminEmail.show( {id : sel.data.id, module : 'core_email'} , function() {
287 _this.table.footer.onClick('first');
290 render : function (_self)
292 _this.edit_btn = this;
298 '|xns' : 'Roo.bootstrap'
302 cls : 'roo-toolbar-button',
303 html : _this._strings['cd6df251f262cc64514b25f04aecf3c8'] /* <i class="fa fa-clipboard"></i> Copy */,
305 click : function (_self, e)
307 var sel = _this.grid.grid.selModel.getSelected();
309 Roo.MessageBox.alert("Error", "Select a message to copy");
313 url : baseURL + '/Roo/Core_email',
319 success : function() {
320 _this.table.footer.onClick('refresh');
324 render : function (_self)
326 _this.copy_btn = this;
332 '|xns' : 'Roo.bootstrap'
336 cls : 'roo-toolbar-button',
337 html : _this._strings['ed807858fcb68abdd180481f1fcba5c5'] /* <i class="fa fa-trash"></i> Delete */,
340 click : function (_self, e)
342 Pman.genericDelete(_this.grid, 'core_email');
344 render : function (_self)
346 _this.delete_btn = this;
352 '|xns' : 'Roo.bootstrap'
368 cellSelection : true,
373 cellclick : function (_self, el, rowIndex, columnIndex, e)
375 var di = this.colModel.getDataIndex(columnIndex);
381 var r = this.store.getAt(rowIndex);
383 if(r.data.active * 1 < 1){
385 Pman.Dialog.BAdminEmail.show( {id : r.data.id, module : 'core_email'} , function() {
386 _this.table.footer.onClick('refresh');
397 render : function (_self)
402 _this.dialog = Pman.Dialog.BAdminEmail;
404 rowdblclick : function (_self, el, rowIndex, e)
410 //var data = this.getDataSource().getAt(rowIndex).data;
411 var data = _this.table.store.getAt(rowIndex).data;
413 _this.dialog.show( {id : data.id, module : 'core_email'} , function() {
415 _this.table.footer.onClick('refresh');
420 '|xns' : 'Roo.bootstrap',
422 xtype : 'PagingToolbar',
426 '|xns' : 'Roo.bootstrap'
431 sortInfo : {field:'description',direction:'ASC'},
433 beforeload : function (_self, options)
435 if (!Pman.buildCompleted) {
439 options.params = options.params || {};
441 var s = _this.searchBox.getValue();
444 options.params['search[nameortitle]'] = s;
446 // hide our system emails.
447 if (appDisabled.indexOf('Core.SuperAdmin') > -1) {
448 options.params._hide_system_emails = 1;
452 load : function (_self, records, options)
454 _this.edit_btn.hide();
455 _this.copy_btn.hide();
456 _this.delete_btn.hide();
458 update : function (_self, record, operation)
460 if (operation != 'commit') {
465 url : baseURL + '/Roo/Core_email',
469 active : record.data.active
471 success : function() {
472 _this.table.footer.onClick('refresh');
482 url : baseURL+'/Roo/Core_email.php',
487 xtype : 'JsonReader',
498 "name":"description",
504 totalProperty : 'total',
510 xtype : 'RowSelectionModel',
513 afterselectionchange : function (_self)
515 _this.edit_btn.hide();
516 _this.copy_btn.hide();
517 _this.delete_btn.hide();
519 if (!this.getSelected()) {
520 _this.viewPanel.setContent("Nothing Selected");
524 if(this.getSelected().data) {
525 _this.viewPanel.setContent(this.getSelected().data.bodytext);
528 _this.edit_btn.show();
529 _this.copy_btn.show();
530 _this.delete_btn.show();
534 xns : Roo.bootstrap.Table,
535 '|xns' : 'Roo.bootstrap.Table'
539 xtype : 'ColumnModel',
542 dataIndex : 'active',
543 header : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
544 renderer : function(v) {
546 var state = v > 0 ? 'check-' : '';
547 var cls = v > 0 ? 'text-primary' : '';
549 return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
558 xtype : 'ColumnModel',
560 dataIndex : 'description',
561 header : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
562 renderer : function(v,x,r)
564 vv = (v.length) ? v : r.data.name;
566 if(r.data.active * 1 < 1){
567 return '<small style="color: #999;">' + vv + '</small>';
570 return '<b>' + vv + '</b>';
578 xtype : 'ColumnModel',
580 dataIndex : 'from_email',
581 header : _this._strings['cae905999a2ad1dfb8f4eae0e8cda73b'] /* From Name<br/>Email */,
582 renderer : function(v,x,r)
584 if(r.data.active * 1 < 1){
588 return String.format('<small>{0}</small>', r.data.from_name );
596 xtype : 'ColumnModel',
598 dataIndex : 'to_group_name',
599 header : _this._strings['98d2ee61ddce0c7666297d81639914f1'] /* To / BCC Group */,
600 renderer : function(v,x,r)
602 if(r.data.active * 1 < 1){
606 var nid = r.data.to_group_id * 1 ;
607 var n = nid > 0 ? r.data.group_member_count * 1 : 0;
608 var grp_str = String.format('<small>To: {0} ' +
609 '<span class="badge' + (n > 0 ? '' : ' badge-danger') + '">{1}</span></small><br>',
610 r.data.to_group_id_name,
611 nid < 1 ? 'Not set' : n
614 if (nid < 0) { // no To needed..
617 nid = r.data.bcc_group_id * 1;
618 n = nid > 0 ? r.data.bcc_group_member_count * 1 : 0;
620 var bcc_str = String.format('<small>BCC: {0} <span class="badge' + (n > 0 ? '' : ' badge-danger') + '">{1}</span></small>',
621 r.data.bcc_group_id_name,
622 nid < 1 ? 'Not set' : n
625 if (nid < 0) { // no To needed..
629 return grp_str + bcc_str;
642 title : _this._strings['9e11143e29a031212f2cdefcf61f39e9'] /* View Message */,
644 render : function (_self)
646 _this.viewPanel = this;
649 xns : Roo.bootstrap.panel,
650 '|xns' : 'Roo.bootstrap.panel'