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..
117 //o.params['query[name]'] = _this.searchBox.getValue();
120 update : function (_self, record, operation)
122 if (operation != 'commit') {
125 // only used to change active status.
128 url : baseURL + '/Roo/Person.php',
132 active: record.data.active
135 success : function() {
138 _this.grid.ds.remove(record);
143 Roo.MessageBox.alert("Error", "saving failed", function() {
144 _this.grid.footer.onClick('first');
151 sortInfo : { field : 'name', direction: 'ASC' },
156 url : baseURL + '/Roo/Person.php'
161 totalProperty : 'total',
190 'name': 'company_id',
218 'name': 'no_reset_sent',
222 'name': 'action_type',
226 'name': 'project_id',
230 'name': 'office_id_id',
234 'name': 'office_id_company_id',
238 'name': 'office_id_name',
242 'name': 'office_id_address',
246 'name': 'office_id_phone',
250 'name': 'office_id_fax',
254 'name': 'office_id_email',
258 'name': 'office_id_role',
262 'name': 'company_id_code',
266 'name': 'company_id_name',
270 'name': 'company_id_remarks',
274 'name': 'company_id_owner_id',
278 'name': 'company_id_address',
282 'name': 'company_id_tel',
286 'name': 'company_id_fax',
290 'name': 'company_id_email',
294 'name': 'company_id_id',
298 'name': 'company_id_isOwner',
302 'name': 'company_id_logo_id',
306 'name': 'company_id_background_color',
310 'name': 'company_id_comptype',
314 'name': 'company_id_url',
318 'name': 'company_id_main_office_id',
322 'name': 'company_id_created_by',
326 'name': 'company_id_created_dt',
330 'name': 'company_id_updated_by',
334 'name': 'company_id_updated_dt',
338 'name': 'company_id_passwd',
342 'name': 'project_id_id',
346 'name': 'project_id_name',
350 'name': 'project_id_remarks',
354 'name': 'project_id_owner_id',
358 'name': 'project_id_code',
362 'name': 'project_id_active',
366 'name': 'project_id_type',
370 'name': 'project_id_client_id',
374 'name': 'project_id_team_id',
378 'name': 'project_id_file_location',
382 'name': 'project_id_open_date',
386 'name': 'project_id_open_by',
390 'name': 'project_id_close_date',
394 'name': 'project_id_countries',
398 'name': 'project_id_languages',
402 'name': 'project_id_agency_id',
406 'name': 'owner_id_id',
410 'name': 'owner_id_office_id',
414 'name': 'owner_id_name',
418 'name': 'owner_id_phone',
422 'name': 'owner_id_fax',
426 'name': 'owner_id_email',
430 'name': 'owner_id_company_id',
434 'name': 'owner_id_role',
438 'name': 'owner_id_active',
442 'name': 'owner_id_remarks',
446 'name': 'owner_id_passwd',
450 'name': 'owner_id_owner_id',
454 'name': 'owner_id_lang',
458 'name': 'owner_id_no_reset_sent',
462 'name': 'owner_id_action_type',
466 'name': 'owner_id_project_id',
473 xtype: 'PagingToolbar',
477 displayMsg : "Displaying Person{0} - {1} of {2}",
478 emptyMsg : "No Person found",
483 text : "Drag person to add or remove from group"
500 render : function (_self)
502 _this.searchBox = _self;
504 show : function (_self,e)
506 if (e.getCharCode() != 13) {
509 _this.grid.footer.onClick('first');
511 specialkey : function (_self, e)
513 if (e.getKey() == 13) {
514 _this.grid.footer.onClick('first');
523 render : function (_self)
525 _this.companyCombo = _self;
527 select : function (combo, record, index)
529 _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );
532 displayField : 'name',
534 emptyText : "Select Company",
535 forceSelection : true,
536 hiddenName : 'company_id',
538 loadingText : "Searching...",
540 name : 'company_name',
542 qtip : "Select Companies",
543 queryParam : 'query[name]',
544 selectOnFocus : true,
545 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
546 triggerAction : 'all',
554 beforeload : function (_self, o){
555 o.params = o.params || {};
560 sortInfo : { direction : 'ASC', field: 'name' },
565 url : baseURL + '/Roo/Companies.php'
572 totalProperty : 'total',
573 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
581 click : function (_self, e)
583 _this.grid.footer.onClick('first');
587 icon : rootURL + '/Pman/templates/images/search.gif'
593 click : function (_self, e)
595 _this.searchBox.setValue('');
596 _this.grid.footer.onClick('first');
600 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
606 toggle : function (_self, pressed)
608 _this.grid.footer.onClick('first');
609 this.setText(pressed ? "Show Active" : "Show Removed");
613 render : function (_self)
615 _this.activeButton = _self;
619 text : "Show Removed"
625 toggle : function (_self, pressed)
627 _this.grid.footer.onClick('first');
628 this.setText(pressed ? "Show Company" : "Show No Company");
632 render : function (_self)
634 _this.active_company_button = _self;
638 text : "Show No Company"
643 text : "Switch to Selected User"
656 _this.dialog.show( { id : 0 } , function() {
657 _this.grid.footer.onClick('first');
661 cls : 'x-btn-text-icon',
663 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
672 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
673 _this.grid.footer.onClick('first');
677 cls : 'x-btn-text-icon',
679 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
687 var s = _this.grid.getSelectionModel().getSelections();
688 if (!s.length || (s.length > 1)) {
689 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
693 _this.dialog.show(s[0].data, function() {
694 _this.grid.footer.onClick('first');
699 cls : 'x-btn-text-icon',
701 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
709 Pman.genericDelete(_this, 'Person');
712 cls : 'x-btn-text-icon',
714 icon : rootURL + '/Pman/templates/images/trash.gif'
720 xtype: 'ColumnModel',
722 dataIndex : 'project_id_code',
727 renderer : function(v,x,r) {
728 return String.format('<span qtip="{0}">{1}</span>',
729 r.data.project_id_name,
734 xtype: 'ColumnModel',
736 dataIndex : 'company_id_comptype',
740 renderer : function(v,x,r) {
741 if (r.data.office_id) {
742 return String.format('{0} - {1}', v, r.data.office_id_name);
744 return String.format('{0}', v);
748 xtype: 'ColumnModel',
750 dataIndex : 'company_id_name',
754 renderer : function(v,x,r) {
755 if (r.data.office_id) {
756 return String.format('{0} - {1}', v, r.data.office_id_name);
758 return String.format('{0}', v);
762 xtype: 'ColumnModel',
768 renderer : function(v) { return String.format('{0}', v); }
771 xtype: 'ColumnModel',
776 renderer : function(v) { return String.format('{0}', v); }
779 xtype: 'ColumnModel',
784 renderer : function(v) { return String.format('{0}', v); }
787 xtype: 'ColumnModel',
792 renderer : function(v) { return String.format('{0}', v); }
795 xtype: 'ColumnModel',
801 renderer : function(v) {
802 return (v.length && v.indexOf('@') > 0 ) ?
803 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
807 xtype: 'ColumnModel',
809 dataIndex : 'active',
812 renderer : function(v) {
813 var state = v> 0 ? '-checked' : '';
815 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';