1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
7 // register the module first
8 Pman.on('beforeload', function()
11 modKey : '001-Pman.Tab.AdminContacts',
12 module : Pman.Tab.AdminContacts,
14 parent : Pman.Tab.AdminContactsManager,
15 name : "Pman.Tab.AdminContacts",
17 permname: 'Core.Person'
21 Pman.Tab.AdminContacts = new Roo.util.Observable({
27 add : function(parentLayout, region)
31 this.parentLayout = parentLayout;
33 this.panel = parentLayout.addxtype({
37 activate : function() {
40 _this.grid.footer.onClick('first');
59 _this.dialog = Pman.Dialog.PersonEdit;
62 //_this.dialog = Pman.Dialog.FILL_IN
63 if (_this.panel.active) {
64 this.footer.onClick('first');
67 rowdblclick : function (_self, rowIndex, e)
69 if (!_this.dialog) return;
70 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
71 _this.grid.footer.onClick('first');
74 cellclick : function (_self, rowIndex, columnIndex, e)
77 var di = this.colModel.getDataIndex(columnIndex);
82 var rec = _this.grid.ds.getAt(rowIndex);
84 rec.set('active', rec.data.active ? 0 : 1);
90 autoExpandColumn : 'name',
98 beforeload : function (_self, o)
101 o.params['!company_id_comptype'] = 'OWNER';
102 o.params['query[search]'] = _this.searchBox.getValue();
104 if (!_this.activeButton) {return; false;}
107 o.params.active = _this.activeButton.pressed ? 0 : 1;
108 if (!Pman.Tab.AdminContactsGroup) {
113 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
114 var tms = Pman.Tab.ContactsGroup.grid.getLeftSelections();
117 o.params['query[in_group]'] = tms[0].data.id;
118 o.params['query[type]'] = 2; // group type..
121 //o.params['query[name]'] = _this.searchBox.getValue();
125 update : function (_self, record, operation)
127 if (operation != 'commit') {
130 // only used to change active status.
133 url : baseURL + '/Roo/Person.php',
137 active: record.data.active
140 success : function() {
143 _this.grid.ds.remove(record);
148 Roo.MessageBox.alert("Error", "saving failed", function() {
149 _this.grid.footer.onClick('first');
156 sortInfo : { field : 'name', direction: 'ASC' },
161 url : baseURL + '/Roo/Person.php'
166 totalProperty : 'total',
195 'name': 'company_id',
223 'name': 'no_reset_sent',
227 'name': 'action_type',
231 'name': 'project_id',
235 'name': 'office_id_id',
239 'name': 'office_id_company_id',
243 'name': 'office_id_name',
247 'name': 'office_id_address',
251 'name': 'office_id_phone',
255 'name': 'office_id_fax',
259 'name': 'office_id_email',
263 'name': 'office_id_role',
267 'name': 'company_id_code',
271 'name': 'company_id_name',
275 'name': 'company_id_remarks',
279 'name': 'company_id_owner_id',
283 'name': 'company_id_address',
287 'name': 'company_id_tel',
291 'name': 'company_id_fax',
295 'name': 'company_id_email',
299 'name': 'company_id_id',
303 'name': 'company_id_isOwner',
307 'name': 'company_id_logo_id',
311 'name': 'company_id_background_color',
315 'name': 'company_id_comptype',
319 'name': 'company_id_url',
323 'name': 'company_id_main_office_id',
327 'name': 'company_id_created_by',
331 'name': 'company_id_created_dt',
335 'name': 'company_id_updated_by',
339 'name': 'company_id_updated_dt',
343 'name': 'company_id_passwd',
347 'name': 'project_id_id',
351 'name': 'project_id_name',
355 'name': 'project_id_remarks',
359 'name': 'project_id_owner_id',
363 'name': 'project_id_code',
367 'name': 'project_id_active',
371 'name': 'project_id_type',
375 'name': 'project_id_client_id',
379 'name': 'project_id_team_id',
383 'name': 'project_id_file_location',
387 'name': 'project_id_open_date',
391 'name': 'project_id_open_by',
395 'name': 'project_id_close_date',
399 'name': 'project_id_countries',
403 'name': 'project_id_languages',
407 'name': 'project_id_agency_id',
411 'name': 'owner_id_id',
415 'name': 'owner_id_office_id',
419 'name': 'owner_id_name',
423 'name': 'owner_id_phone',
427 'name': 'owner_id_fax',
431 'name': 'owner_id_email',
435 'name': 'owner_id_company_id',
439 'name': 'owner_id_role',
443 'name': 'owner_id_active',
447 'name': 'owner_id_remarks',
451 'name': 'owner_id_passwd',
455 'name': 'owner_id_owner_id',
459 'name': 'owner_id_lang',
463 'name': 'owner_id_no_reset_sent',
467 'name': 'owner_id_action_type',
471 'name': 'owner_id_project_id',
478 xtype: 'PagingToolbar',
482 displayMsg : 'Displaying Person{0} - {1} of {2}',
483 emptyMsg : 'No Person found',
488 text : "Drag person to add or remove from group"
503 _this.dialog.show( { id : 0 } , function() {
504 _this.grid.footer.onClick('first');
508 cls : 'x-btn-text-icon',
510 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
519 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
520 _this.grid.footer.onClick('first');
524 cls : 'x-btn-text-icon',
526 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
534 var s = _this.grid.getSelectionModel().getSelections();
535 if (!s.length || (s.length > 1)) {
536 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
540 _this.dialog.show(s[0].data, function() {
541 _this.grid.footer.onClick('first');
546 cls : 'x-btn-text-icon',
548 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
563 render : function (_self)
565 _this.searchBox = _self;
567 show : function (_self,e)
569 if (e.getCharCode() != 13) {
572 _this.grid.footer.onClick('first');
580 click : function (_self, e)
582 _this.grid.footer.onClick('first');
586 icon : rootURL + '/Pman/templates/images/search.gif'
592 click : function (_self, e)
594 _this.searchBox.setValue('');
595 _this.grid.footer.onClick('first');
599 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
609 toggle : function (_self, pressed)
611 _this.grid.footer.onClick('first');
612 this.setText(pressed ? "Show Active" : "Show Removed");
616 render : function (_self)
618 _this.activeButton = _self;
622 text : "Show Removed"
628 xtype: 'ColumnModel',
630 dataIndex : 'project_id_code',
635 renderer : function(v,x,r) {
636 return String.format('<span qtip="{0}">{1}</span>',
637 r.data.project_id_name,
642 xtype: 'ColumnModel',
644 dataIndex : 'company_id_comptype',
648 renderer : function(v,x,r) {
649 if (r.data.office_id) {
650 return String.format('{0} - {1}', v, r.data.office_id_name);
652 return String.format('{0}', v);
656 xtype: 'ColumnModel',
658 dataIndex : 'company_id_name',
662 renderer : function(v,x,r) {
663 if (r.data.office_id) {
664 return String.format('{0} - {1}', v, r.data.office_id_name);
666 return String.format('{0}', v);
670 xtype: 'ColumnModel',
676 renderer : function(v) { return String.format('{0}', v); }
679 xtype: 'ColumnModel',
684 renderer : function(v) { return String.format('{0}', v); }
687 xtype: 'ColumnModel',
692 renderer : function(v) { return String.format('{0}', v); }
695 xtype: 'ColumnModel',
700 renderer : function(v) { return String.format('{0}', v); }
703 xtype: 'ColumnModel',
709 renderer : function(v) {
710 return (v.length && v.indexOf('@') > 0 ) ?
711 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
715 xtype: 'ColumnModel',
717 dataIndex : 'active',
720 renderer : function(v) {
721 var state = v> 0 ? '-checked' : '';
723 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
730 this.layout = this.panel.layout;