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;
103 var c = Pman.Tab.AdminContactsManager.layout.getRegion('west').getActivePanel();
109 var tms = c.grid.getSelectionModel().getSelected();
115 if(c.tableName == 'Groups'){
116 o.params['query[in_group]'] = tms.data.id;
117 o.params['query[type]'] = 2; // group type..
119 o.params['query[in_country]'] = tms.data.country;
120 o.params['query[in_group]'] = 0;
121 o.params['query[type]'] = 2;
124 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
130 if(Pman.Tab.AdminCountries && Pman.Tab.AdminCountries.grid){
131 var tms = Pman.Tab.AdminCountries.grid.getSelectionModel().getSelected();
139 //o.params['query[name]'] = _this.searchBox.getValue();
142 update : function (_self, record, operation)
144 if (operation != 'commit') {
147 // only used to change active status.
150 url : baseURL + '/Roo/Person.php',
154 active: record.data.active
157 success : function() {
160 _this.grid.ds.remove(record);
165 Roo.MessageBox.alert("Error", "saving failed", function() {
166 _this.grid.footer.onClick('first');
173 sortInfo : { field : 'name', direction: 'ASC' },
178 url : baseURL + '/Roo/Person.php'
183 totalProperty : 'total',
212 'name': 'company_id',
240 'name': 'no_reset_sent',
244 'name': 'action_type',
248 'name': 'project_id',
252 'name': 'office_id_id',
256 'name': 'office_id_company_id',
260 'name': 'office_id_name',
264 'name': 'office_id_address',
268 'name': 'office_id_phone',
272 'name': 'office_id_fax',
276 'name': 'office_id_email',
280 'name': 'office_id_role',
284 'name': 'company_id_code',
288 'name': 'company_id_name',
292 'name': 'company_id_remarks',
296 'name': 'company_id_owner_id',
300 'name': 'company_id_address',
304 'name': 'company_id_tel',
308 'name': 'company_id_fax',
312 'name': 'company_id_email',
316 'name': 'company_id_id',
320 'name': 'company_id_isOwner',
324 'name': 'company_id_logo_id',
328 'name': 'company_id_background_color',
332 'name': 'company_id_comptype',
336 'name': 'company_id_url',
340 'name': 'company_id_main_office_id',
344 'name': 'company_id_created_by',
348 'name': 'company_id_created_dt',
352 'name': 'company_id_updated_by',
356 'name': 'company_id_updated_dt',
360 'name': 'company_id_passwd',
364 'name': 'project_id_id',
368 'name': 'project_id_name',
372 'name': 'project_id_remarks',
376 'name': 'project_id_owner_id',
380 'name': 'project_id_code',
384 'name': 'project_id_active',
388 'name': 'project_id_type',
392 'name': 'project_id_client_id',
396 'name': 'project_id_team_id',
400 'name': 'project_id_file_location',
404 'name': 'project_id_open_date',
408 'name': 'project_id_open_by',
412 'name': 'project_id_close_date',
416 'name': 'project_id_countries',
420 'name': 'project_id_languages',
424 'name': 'project_id_agency_id',
428 'name': 'owner_id_id',
432 'name': 'owner_id_office_id',
436 'name': 'owner_id_name',
440 'name': 'owner_id_phone',
444 'name': 'owner_id_fax',
448 'name': 'owner_id_email',
452 'name': 'owner_id_company_id',
456 'name': 'owner_id_role',
460 'name': 'owner_id_active',
464 'name': 'owner_id_remarks',
468 'name': 'owner_id_passwd',
472 'name': 'owner_id_owner_id',
476 'name': 'owner_id_lang',
480 'name': 'owner_id_no_reset_sent',
484 'name': 'owner_id_action_type',
488 'name': 'owner_id_project_id',
495 xtype: 'PagingToolbar',
499 displayMsg : "Displaying Person{0} - {1} of {2}",
500 emptyMsg : "No Person found",
505 text : "Drag person to add or remove from group"
522 render : function (_self)
524 _this.searchBox = _self;
526 show : function (_self,e)
528 if (e.getCharCode() != 13) {
531 _this.grid.footer.onClick('first');
533 specialkey : function (_self, e)
535 if (e.getKey() == 13) {
536 _this.grid.footer.onClick('first');
545 render : function (_self)
547 _this.companyCombo = _self;
549 select : function (combo, record, index)
551 _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );
554 displayField : 'name',
556 emptyText : "Select Company",
557 forceSelection : true,
558 hiddenName : 'company_id',
560 loadingText : "Searching...",
562 name : 'company_name',
564 qtip : "Select Companies",
565 queryParam : 'query[name]',
566 selectOnFocus : true,
567 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
568 triggerAction : 'all',
576 beforeload : function (_self, o){
577 o.params = o.params || {};
582 sortInfo : { direction : 'ASC', field: 'name' },
587 url : baseURL + '/Roo/Companies.php'
594 totalProperty : 'total',
595 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
603 click : function (_self, e)
605 _this.grid.footer.onClick('first');
609 icon : rootURL + '/Pman/templates/images/search.gif'
615 click : function (_self, e)
617 _this.searchBox.setValue('');
618 _this.grid.footer.onClick('first');
622 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
628 toggle : function (_self, pressed)
630 _this.grid.footer.onClick('first');
631 this.setText(pressed ? "Show Active" : "Show Removed");
635 render : function (_self)
637 _this.activeButton = _self;
641 text : "Show Removed"
647 toggle : function (_self, pressed)
649 _this.grid.footer.onClick('first');
650 this.setText(pressed ? "Show Company" : "Show No Company");
654 render : function (_self)
656 _this.active_company_button = _self;
660 text : "Show No Company"
666 click : function (_self, e)
668 var s = _this.grid.getSelectionModel().getSelections();
670 Roo.MessageBox.alert("Error", "Select a Person");
675 url : baseURL + '/Login.php',
678 'switch' : s[0].data.id
680 success : function (){
681 document.location = baseURL + '?ts=' + Math.random();
683 failure : function (d){
685 Roo.MessageBox.alert("Error", d);
690 text : "Switch to Selected User"
703 _this.dialog.show( { id : 0 } , function() {
704 _this.grid.footer.onClick('first');
708 cls : 'x-btn-text-icon',
710 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
719 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
720 _this.grid.footer.onClick('first');
724 cls : 'x-btn-text-icon',
726 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
734 var s = _this.grid.getSelectionModel().getSelections();
735 if (!s.length || (s.length > 1)) {
736 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
740 _this.dialog.show(s[0].data, function() {
741 _this.grid.footer.onClick('first');
746 cls : 'x-btn-text-icon',
748 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
756 Pman.genericDelete(_this, 'Person');
759 cls : 'x-btn-text-icon',
761 icon : rootURL + '/Pman/templates/images/trash.gif'
767 xtype: 'ColumnModel',
769 dataIndex : 'project_id_code',
774 renderer : function(v,x,r) {
775 return String.format('<span qtip="{0}">{1}</span>',
776 r.data.project_id_name,
781 xtype: 'ColumnModel',
783 dataIndex : 'company_id_comptype',
787 renderer : function(v,x,r) {
788 if (r.data.office_id) {
789 return String.format('{0} - {1}', v, r.data.office_id_name);
791 return String.format('{0}', v);
795 xtype: 'ColumnModel',
797 dataIndex : 'company_id_name',
801 renderer : function(v,x,r) {
802 if (r.data.office_id) {
803 return String.format('{0} - {1}', v, r.data.office_id_name);
805 return String.format('{0}', v);
809 xtype: 'ColumnModel',
815 renderer : function(v) { return String.format('{0}', v); }
818 xtype: 'ColumnModel',
823 renderer : function(v) { return String.format('{0}', v); }
826 xtype: 'ColumnModel',
831 renderer : function(v) { return String.format('{0}', v); }
834 xtype: 'ColumnModel',
839 renderer : function(v) { return String.format('{0}', v); }
842 xtype: 'ColumnModel',
848 renderer : function(v) {
849 return (v.length && v.indexOf('@') > 0 ) ?
850 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
854 xtype: 'ColumnModel',
856 dataIndex : 'active',
859 renderer : function(v) {
860 var state = v> 0 ? '-checked' : '';
862 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';