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 part : ["Admin","Contacts"],
12 modKey : '001-Pman.Tab.AdminContacts',
13 module : Pman.Tab.AdminContacts,
15 parent : Pman.Tab.AdminContactsManager,
16 name : "Pman.Tab.AdminContacts",
18 permname: 'Core.Person'
22 Pman.Tab.AdminContacts = new Roo.util.Observable({
28 add : function(parentLayout, region)
32 this.parentLayout = parentLayout;
34 this.panel = parentLayout.addxtype({
38 activate : function() {
41 _this.grid.footer.onClick('first');
60 _this.dialog = Pman.Dialog.PersonEdit;
63 //_this.dialog = Pman.Dialog.FILL_IN
64 if (_this.panel.active) {
65 this.footer.onClick('first');
68 rowdblclick : function (_self, rowIndex, e)
70 if (!_this.dialog) return;
71 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
72 _this.grid.footer.onClick('first');
75 cellclick : function (_self, rowIndex, columnIndex, e)
78 var di = this.colModel.getDataIndex(columnIndex);
83 var rec = _this.grid.ds.getAt(rowIndex);
85 rec.set('active', rec.data.active ? 0 : 1);
91 autoExpandColumn : 'name',
99 beforeload : function (_self, o)
102 o.params['!company_id_comptype'] = 'OWNER';
103 o.params['query[search]'] = _this.searchBox.getValue();
105 if (!_this.activeButton) {return; false;}
107 if (_this.companyCombo && _this.companyCombo.getValue()) {
108 o.params.company_id = _this.companyCombo.getValue();
112 o.params.active = _this.activeButton.pressed ? 0 : 1;
113 if (!Pman.Tab.AdminContactsGroup) {
118 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
119 var tms = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelected();
124 o.params['query[in_group]'] = tms.data.id;
125 o.params['query[type]'] = 2; // group type..
128 //o.params['query[name]'] = _this.searchBox.getValue();
131 update : function (_self, record, operation)
133 if (operation != 'commit') {
136 // only used to change active status.
139 url : baseURL + '/Roo/Person.php',
143 active: record.data.active
146 success : function() {
149 _this.grid.ds.remove(record);
154 Roo.MessageBox.alert("Error", "saving failed", function() {
155 _this.grid.footer.onClick('first');
162 sortInfo : { field : 'name', direction: 'ASC' },
167 url : baseURL + '/Roo/Person.php'
172 totalProperty : 'total',
201 'name': 'company_id',
229 'name': 'no_reset_sent',
233 'name': 'action_type',
237 'name': 'project_id',
241 'name': 'office_id_id',
245 'name': 'office_id_company_id',
249 'name': 'office_id_name',
253 'name': 'office_id_address',
257 'name': 'office_id_phone',
261 'name': 'office_id_fax',
265 'name': 'office_id_email',
269 'name': 'office_id_role',
273 'name': 'company_id_code',
277 'name': 'company_id_name',
281 'name': 'company_id_remarks',
285 'name': 'company_id_owner_id',
289 'name': 'company_id_address',
293 'name': 'company_id_tel',
297 'name': 'company_id_fax',
301 'name': 'company_id_email',
305 'name': 'company_id_id',
309 'name': 'company_id_isOwner',
313 'name': 'company_id_logo_id',
317 'name': 'company_id_background_color',
321 'name': 'company_id_comptype',
325 'name': 'company_id_url',
329 'name': 'company_id_main_office_id',
333 'name': 'company_id_created_by',
337 'name': 'company_id_created_dt',
341 'name': 'company_id_updated_by',
345 'name': 'company_id_updated_dt',
349 'name': 'company_id_passwd',
353 'name': 'project_id_id',
357 'name': 'project_id_name',
361 'name': 'project_id_remarks',
365 'name': 'project_id_owner_id',
369 'name': 'project_id_code',
373 'name': 'project_id_active',
377 'name': 'project_id_type',
381 'name': 'project_id_client_id',
385 'name': 'project_id_team_id',
389 'name': 'project_id_file_location',
393 'name': 'project_id_open_date',
397 'name': 'project_id_open_by',
401 'name': 'project_id_close_date',
405 'name': 'project_id_countries',
409 'name': 'project_id_languages',
413 'name': 'project_id_agency_id',
417 'name': 'owner_id_id',
421 'name': 'owner_id_office_id',
425 'name': 'owner_id_name',
429 'name': 'owner_id_phone',
433 'name': 'owner_id_fax',
437 'name': 'owner_id_email',
441 'name': 'owner_id_company_id',
445 'name': 'owner_id_role',
449 'name': 'owner_id_active',
453 'name': 'owner_id_remarks',
457 'name': 'owner_id_passwd',
461 'name': 'owner_id_owner_id',
465 'name': 'owner_id_lang',
469 'name': 'owner_id_no_reset_sent',
473 'name': 'owner_id_action_type',
477 'name': 'owner_id_project_id',
484 xtype: 'PagingToolbar',
488 displayMsg : "Displaying Person{0} - {1} of {2}",
489 emptyMsg : "No Person found",
494 text : "Drag person to add or remove from group"
511 render : function (_self)
513 _this.searchBox = _self;
515 show : function (_self,e)
517 if (e.getCharCode() != 13) {
520 _this.grid.footer.onClick('first');
522 specialkey : function (_self, e)
524 if (e.getKey() == 13) {
525 _this.grid.footer.onClick('first');
534 render : function (_self)
536 _this.companyCombo = _self;
538 select : function (combo, record, index)
540 _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );
543 displayField : 'name',
545 emptyText : "Select Company",
546 forceSelection : true,
547 hiddenName : 'company_id',
549 loadingText : "Searching...",
551 name : 'company_name',
553 qtip : "Select Companies",
554 queryParam : 'query[name]',
555 selectOnFocus : true,
556 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
557 triggerAction : 'all',
565 beforeload : function (_self, o){
566 o.params = o.params || {};
571 sortInfo : { direction : 'ASC', field: 'name' },
576 url : baseURL + '/Roo/Companies.php'
583 totalProperty : 'total',
584 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
592 click : function (_self, e)
594 _this.grid.footer.onClick('first');
598 icon : rootURL + '/Pman/templates/images/search.gif'
604 click : function (_self, e)
606 _this.searchBox.setValue('');
607 _this.grid.footer.onClick('first');
611 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
617 toggle : function (_self, pressed)
619 _this.grid.footer.onClick('first');
620 this.setText(pressed ? "Show Active" : "Show Removed");
624 render : function (_self)
626 _this.activeButton = _self;
630 text : "Show Removed"
643 _this.dialog.show( { id : 0 } , function() {
644 _this.grid.footer.onClick('first');
648 cls : 'x-btn-text-icon',
650 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
659 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
660 _this.grid.footer.onClick('first');
664 cls : 'x-btn-text-icon',
666 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
674 var s = _this.grid.getSelectionModel().getSelections();
675 if (!s.length || (s.length > 1)) {
676 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
680 _this.dialog.show(s[0].data, function() {
681 _this.grid.footer.onClick('first');
686 cls : 'x-btn-text-icon',
688 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
696 Pman.genericDelete(_this, 'Person');
699 cls : 'x-btn-text-icon',
701 icon : rootURL + '/Pman/templates/images/trash.gif'
707 xtype: 'ColumnModel',
709 dataIndex : 'project_id_code',
714 renderer : function(v,x,r) {
715 return String.format('<span qtip="{0}">{1}</span>',
716 r.data.project_id_name,
721 xtype: 'ColumnModel',
723 dataIndex : 'company_id_comptype',
727 renderer : function(v,x,r) {
728 if (r.data.office_id) {
729 return String.format('{0} - {1}', v, r.data.office_id_name);
731 return String.format('{0}', v);
735 xtype: 'ColumnModel',
737 dataIndex : 'company_id_name',
741 renderer : function(v,x,r) {
742 if (r.data.office_id) {
743 return String.format('{0} - {1}', v, r.data.office_id_name);
745 return String.format('{0}', v);
749 xtype: 'ColumnModel',
755 renderer : function(v) { return String.format('{0}', v); }
758 xtype: 'ColumnModel',
763 renderer : function(v) { return String.format('{0}', v); }
766 xtype: 'ColumnModel',
771 renderer : function(v) { return String.format('{0}', v); }
774 xtype: 'ColumnModel',
779 renderer : function(v) { return String.format('{0}', v); }
782 xtype: 'ColumnModel',
788 renderer : function(v) {
789 return (v.length && v.indexOf('@') > 0 ) ?
790 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
794 xtype: 'ColumnModel',
796 dataIndex : 'active',
799 renderer : function(v) {
800 var state = v> 0 ? '-checked' : '';
802 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
809 this.layout = this.panel.layout;