1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.AdminContacts = new Roo.XComponent({
6 part : ["Admin","Contacts"],
7 order : '001-Pman.Tab.AdminContacts',
9 parent : 'Pman.Tab.AdminContactsManager',
10 name : "Pman.Tab.AdminContacts",
12 permname : 'Core.Person',
21 activate : function() {
24 _this.grid.footer.onClick('first');
43 _this.dialog = Pman.Dialog.PersonEdit;
46 //_this.dialog = Pman.Dialog.FILL_IN
47 if (_this.panel.active) {
48 this.footer.onClick('first');
51 rowdblclick : function (_self, rowIndex, e)
53 if (!_this.dialog) return;
54 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
55 _this.grid.footer.onClick('first');
58 cellclick : function (_self, rowIndex, columnIndex, e)
61 var di = this.colModel.getDataIndex(columnIndex);
66 var rec = _this.grid.ds.getAt(rowIndex);
68 rec.set('active', rec.data.active ? 0 : 1);
74 autoExpandColumn : 'name',
82 beforeload : function (_self, o)
84 if(!_this.active_company_button.pressed){
85 o.params['!company_id_comptype'] = 'OWNER';
88 o.params['query[search]'] = _this.searchBox.getValue();
90 if (!_this.activeButton) {return; false;}
92 if (_this.companyCombo && _this.companyCombo.getValue()) {
93 o.params.company_id = _this.companyCombo.getValue();
97 o.params.active = _this.activeButton.pressed ? 0 : 1;
99 if(_this.active_company_button.pressed){
100 o.params.company_id = 0;
102 if (!Pman.Tab.AdminContactsGroup) {
107 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
108 var tms = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelected();
113 o.params['query[in_group]'] = tms.data.id;
114 o.params['query[type]'] = 2; // group type..
118 if(Pman.Tab.AdminCountries && Pman.Tab.AdminCountries.grid){
119 var tms = Pman.Tab.AdminCountries.grid.getSelectionModel().getSelected();
124 o.params['query[in_country]'] = tms.data.country;
125 o.params['query[in_group]'] = 0;
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"
636 toggle : function (_self, pressed)
638 _this.grid.footer.onClick('first');
639 this.setText(pressed ? "Show Company" : "Show No Company");
643 render : function (_self)
645 _this.active_company_button = _self;
649 text : "Show No Company"
655 click : function (_self, e)
657 var s = _this.grid.getSelectionModel().getSelections();
659 Roo.MessageBox.alert("Error", "Select a Person");
664 url : baseURL + '/Login.php',
667 'switch' : s[0].data.id
669 success : function (){
670 document.location = baseURL + '?ts=' + Math.random();
672 failure : function (d){
674 Roo.MessageBox.alert("Error", d);
679 text : "Switch to Selected User"
692 _this.dialog.show( { id : 0 } , function() {
693 _this.grid.footer.onClick('first');
697 cls : 'x-btn-text-icon',
699 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
708 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
709 _this.grid.footer.onClick('first');
713 cls : 'x-btn-text-icon',
715 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
723 var s = _this.grid.getSelectionModel().getSelections();
724 if (!s.length || (s.length > 1)) {
725 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
729 _this.dialog.show(s[0].data, function() {
730 _this.grid.footer.onClick('first');
735 cls : 'x-btn-text-icon',
737 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
745 Pman.genericDelete(_this, 'Person');
748 cls : 'x-btn-text-icon',
750 icon : rootURL + '/Pman/templates/images/trash.gif'
756 xtype: 'ColumnModel',
758 dataIndex : 'project_id_code',
763 renderer : function(v,x,r) {
764 return String.format('<span qtip="{0}">{1}</span>',
765 r.data.project_id_name,
770 xtype: 'ColumnModel',
772 dataIndex : 'company_id_comptype',
776 renderer : function(v,x,r) {
777 if (r.data.office_id) {
778 return String.format('{0} - {1}', v, r.data.office_id_name);
780 return String.format('{0}', v);
784 xtype: 'ColumnModel',
786 dataIndex : 'company_id_name',
790 renderer : function(v,x,r) {
791 if (r.data.office_id) {
792 return String.format('{0} - {1}', v, r.data.office_id_name);
794 return String.format('{0}', v);
798 xtype: 'ColumnModel',
804 renderer : function(v) { return String.format('{0}', v); }
807 xtype: 'ColumnModel',
812 renderer : function(v) { return String.format('{0}', v); }
815 xtype: 'ColumnModel',
820 renderer : function(v) { return String.format('{0}', v); }
823 xtype: 'ColumnModel',
828 renderer : function(v) { return String.format('{0}', v); }
831 xtype: 'ColumnModel',
837 renderer : function(v) {
838 return (v.length && v.indexOf('@') > 0 ) ?
839 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
843 xtype: 'ColumnModel',
845 dataIndex : 'active',
848 renderer : function(v) {
849 var state = v> 0 ? '-checked' : '';
851 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';