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[type]'] = 2; // group type..
129 //o.params['query[name]'] = _this.searchBox.getValue();
132 update : function (_self, record, operation)
134 if (operation != 'commit') {
137 // only used to change active status.
140 url : baseURL + '/Roo/Person.php',
144 active: record.data.active
147 success : function() {
150 _this.grid.ds.remove(record);
155 Roo.MessageBox.alert("Error", "saving failed", function() {
156 _this.grid.footer.onClick('first');
163 sortInfo : { field : 'name', direction: 'ASC' },
168 url : baseURL + '/Roo/Person.php'
173 totalProperty : 'total',
202 'name': 'company_id',
230 'name': 'no_reset_sent',
234 'name': 'action_type',
238 'name': 'project_id',
242 'name': 'office_id_id',
246 'name': 'office_id_company_id',
250 'name': 'office_id_name',
254 'name': 'office_id_address',
258 'name': 'office_id_phone',
262 'name': 'office_id_fax',
266 'name': 'office_id_email',
270 'name': 'office_id_role',
274 'name': 'company_id_code',
278 'name': 'company_id_name',
282 'name': 'company_id_remarks',
286 'name': 'company_id_owner_id',
290 'name': 'company_id_address',
294 'name': 'company_id_tel',
298 'name': 'company_id_fax',
302 'name': 'company_id_email',
306 'name': 'company_id_id',
310 'name': 'company_id_isOwner',
314 'name': 'company_id_logo_id',
318 'name': 'company_id_background_color',
322 'name': 'company_id_comptype',
326 'name': 'company_id_url',
330 'name': 'company_id_main_office_id',
334 'name': 'company_id_created_by',
338 'name': 'company_id_created_dt',
342 'name': 'company_id_updated_by',
346 'name': 'company_id_updated_dt',
350 'name': 'company_id_passwd',
354 'name': 'project_id_id',
358 'name': 'project_id_name',
362 'name': 'project_id_remarks',
366 'name': 'project_id_owner_id',
370 'name': 'project_id_code',
374 'name': 'project_id_active',
378 'name': 'project_id_type',
382 'name': 'project_id_client_id',
386 'name': 'project_id_team_id',
390 'name': 'project_id_file_location',
394 'name': 'project_id_open_date',
398 'name': 'project_id_open_by',
402 'name': 'project_id_close_date',
406 'name': 'project_id_countries',
410 'name': 'project_id_languages',
414 'name': 'project_id_agency_id',
418 'name': 'owner_id_id',
422 'name': 'owner_id_office_id',
426 'name': 'owner_id_name',
430 'name': 'owner_id_phone',
434 'name': 'owner_id_fax',
438 'name': 'owner_id_email',
442 'name': 'owner_id_company_id',
446 'name': 'owner_id_role',
450 'name': 'owner_id_active',
454 'name': 'owner_id_remarks',
458 'name': 'owner_id_passwd',
462 'name': 'owner_id_owner_id',
466 'name': 'owner_id_lang',
470 'name': 'owner_id_no_reset_sent',
474 'name': 'owner_id_action_type',
478 'name': 'owner_id_project_id',
485 xtype: 'PagingToolbar',
489 displayMsg : "Displaying Person{0} - {1} of {2}",
490 emptyMsg : "No Person found",
495 text : "Drag person to add or remove from group"
512 render : function (_self)
514 _this.searchBox = _self;
516 show : function (_self,e)
518 if (e.getCharCode() != 13) {
521 _this.grid.footer.onClick('first');
523 specialkey : function (_self, e)
525 if (e.getKey() == 13) {
526 _this.grid.footer.onClick('first');
535 render : function (_self)
537 _this.companyCombo = _self;
539 select : function (combo, record, index)
541 _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );
544 displayField : 'name',
546 emptyText : "Select Company",
547 forceSelection : true,
548 hiddenName : 'company_id',
550 loadingText : "Searching...",
552 name : 'company_name',
554 qtip : "Select Companies",
555 queryParam : 'query[name]',
556 selectOnFocus : true,
557 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
558 triggerAction : 'all',
566 beforeload : function (_self, o){
567 o.params = o.params || {};
572 sortInfo : { direction : 'ASC', field: 'name' },
577 url : baseURL + '/Roo/Companies.php'
584 totalProperty : 'total',
585 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
593 click : function (_self, e)
595 _this.grid.footer.onClick('first');
599 icon : rootURL + '/Pman/templates/images/search.gif'
605 click : function (_self, e)
607 _this.searchBox.setValue('');
608 _this.grid.footer.onClick('first');
612 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
618 toggle : function (_self, pressed)
620 _this.grid.footer.onClick('first');
621 this.setText(pressed ? "Show Active" : "Show Removed");
625 render : function (_self)
627 _this.activeButton = _self;
631 text : "Show Removed"
637 toggle : function (_self, pressed)
639 _this.grid.footer.onClick('first');
640 this.setText(pressed ? "Show Company" : "Show No Company");
644 render : function (_self)
646 _this.active_company_button = _self;
650 text : "Show No Company"
656 click : function (_self, e)
658 var s = _this.grid.getSelectionModel().getSelections();
660 Roo.MessageBox.alert("Error", "Select a Person");
665 url : baseURL + '/Login.php',
668 'switch' : s[0].data.id
670 success : function (){
671 document.location = baseURL + '?ts=' + Math.random();
673 failure : function (d){
675 Roo.MessageBox.alert("Error", d);
680 text : "Switch to Selected User"
693 _this.dialog.show( { id : 0 } , function() {
694 _this.grid.footer.onClick('first');
698 cls : 'x-btn-text-icon',
700 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
709 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
710 _this.grid.footer.onClick('first');
714 cls : 'x-btn-text-icon',
716 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
724 var s = _this.grid.getSelectionModel().getSelections();
725 if (!s.length || (s.length > 1)) {
726 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
730 _this.dialog.show(s[0].data, function() {
731 _this.grid.footer.onClick('first');
736 cls : 'x-btn-text-icon',
738 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
746 Pman.genericDelete(_this, 'Person');
749 cls : 'x-btn-text-icon',
751 icon : rootURL + '/Pman/templates/images/trash.gif'
757 xtype: 'ColumnModel',
759 dataIndex : 'project_id_code',
764 renderer : function(v,x,r) {
765 return String.format('<span qtip="{0}">{1}</span>',
766 r.data.project_id_name,
771 xtype: 'ColumnModel',
773 dataIndex : 'company_id_comptype',
777 renderer : function(v,x,r) {
778 if (r.data.office_id) {
779 return String.format('{0} - {1}', v, r.data.office_id_name);
781 return String.format('{0}', v);
785 xtype: 'ColumnModel',
787 dataIndex : 'company_id_name',
791 renderer : function(v,x,r) {
792 if (r.data.office_id) {
793 return String.format('{0} - {1}', v, r.data.office_id_name);
795 return String.format('{0}', v);
799 xtype: 'ColumnModel',
805 renderer : function(v) { return String.format('{0}', v); }
808 xtype: 'ColumnModel',
813 renderer : function(v) { return String.format('{0}', v); }
816 xtype: 'ColumnModel',
821 renderer : function(v) { return String.format('{0}', v); }
824 xtype: 'ColumnModel',
829 renderer : function(v) { return String.format('{0}', v); }
832 xtype: 'ColumnModel',
838 renderer : function(v) {
839 return (v.length && v.indexOf('@') > 0 ) ?
840 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
844 xtype: 'ColumnModel',
846 dataIndex : 'active',
849 renderer : function(v) {
850 var state = v> 0 ? '-checked' : '';
852 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';