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;
539 displayField : 'name',
541 emptyText : "Select Company",
542 forceSelection : true,
543 hiddenName : 'company_id',
545 loadingText : "Searching...",
547 name : 'company_name',
549 qtip : "Select Companies",
550 queryParam : 'query[name]',
551 selectOnFocus : true,
552 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
553 triggerAction : 'all',
561 sortInfo : { direction : 'ASC', field: 'id' },
563 beforeload : function (_self, o){
564 o.params = o.params || {};
572 url : baseURL + '/Roo/Companies.php'
579 totalProperty : 'total',
580 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
588 click : function (_self, e)
590 _this.grid.footer.onClick('first');
594 icon : rootURL + '/Pman/templates/images/search.gif'
600 click : function (_self, e)
602 _this.searchBox.setValue('');
603 _this.grid.footer.onClick('first');
607 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
613 toggle : function (_self, pressed)
615 _this.grid.footer.onClick('first');
616 this.setText(pressed ? "Show Active" : "Show Removed");
620 render : function (_self)
622 _this.activeButton = _self;
626 text : "Show Removed"
639 _this.dialog.show( { id : 0 } , function() {
640 _this.grid.footer.onClick('first');
644 cls : 'x-btn-text-icon',
646 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
655 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
656 _this.grid.footer.onClick('first');
660 cls : 'x-btn-text-icon',
662 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
670 var s = _this.grid.getSelectionModel().getSelections();
671 if (!s.length || (s.length > 1)) {
672 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
676 _this.dialog.show(s[0].data, function() {
677 _this.grid.footer.onClick('first');
682 cls : 'x-btn-text-icon',
684 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
692 Pman.genericDelete(_this, 'Person');
695 cls : 'x-btn-text-icon',
697 icon : rootURL + '/Pman/templates/images/trash.gif'
703 xtype: 'ColumnModel',
705 dataIndex : 'project_id_code',
710 renderer : function(v,x,r) {
711 return String.format('<span qtip="{0}">{1}</span>',
712 r.data.project_id_name,
717 xtype: 'ColumnModel',
719 dataIndex : 'company_id_comptype',
723 renderer : function(v,x,r) {
724 if (r.data.office_id) {
725 return String.format('{0} - {1}', v, r.data.office_id_name);
727 return String.format('{0}', v);
731 xtype: 'ColumnModel',
733 dataIndex : 'company_id_name',
737 renderer : function(v,x,r) {
738 if (r.data.office_id) {
739 return String.format('{0} - {1}', v, r.data.office_id_name);
741 return String.format('{0}', v);
745 xtype: 'ColumnModel',
751 renderer : function(v) { return String.format('{0}', v); }
754 xtype: 'ColumnModel',
759 renderer : function(v) { return String.format('{0}', v); }
762 xtype: 'ColumnModel',
767 renderer : function(v) { return String.format('{0}', v); }
770 xtype: 'ColumnModel',
775 renderer : function(v) { return String.format('{0}', v); }
778 xtype: 'ColumnModel',
784 renderer : function(v) {
785 return (v.length && v.indexOf('@') > 0 ) ?
786 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
790 xtype: 'ColumnModel',
792 dataIndex : 'active',
795 renderer : function(v) {
796 var state = v> 0 ? '-checked' : '';
798 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
805 this.layout = this.panel.layout;