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 Roo.log('iniinininin');
44 _this.dialog = Pman.Dialog.PersonEdit;
47 //_this.dialog = Pman.Dialog.FILL_IN
48 if (_this.panel.active) {
49 this.footer.onClick('first');
52 rowdblclick : function (_self, rowIndex, e)
54 if (!_this.dialog) return;
55 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
56 _this.grid.footer.onClick('first');
59 cellclick : function (_self, rowIndex, columnIndex, e)
62 var di = this.colModel.getDataIndex(columnIndex);
67 var rec = _this.grid.ds.getAt(rowIndex);
69 rec.set('active', rec.data.active ? 0 : 1);
75 autoExpandColumn : 'name',
83 beforeload : function (_self, o)
85 if(!_this.active_company_button.pressed){
86 o.params['!company_id_comptype'] = 'OWNER';
89 o.params['query[search]'] = _this.searchBox.getValue();
91 if (!_this.activeButton) {return; false;}
93 if (_this.companyCombo && _this.companyCombo.getValue()) {
94 o.params.company_id = _this.companyCombo.getValue();
98 o.params.active = _this.activeButton.pressed ? 0 : 1;
100 if(_this.active_company_button.pressed){
101 o.params.company_id = 0;
103 if (!Pman.Tab.AdminContactsGroup) {
108 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
109 var tms = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelected();
114 o.params['query[in_group]'] = tms.data.id;
115 o.params['query[type]'] = 2; // group type..
118 //o.params['query[name]'] = _this.searchBox.getValue();
121 update : function (_self, record, operation)
123 if (operation != 'commit') {
126 // only used to change active status.
129 url : baseURL + '/Roo/Person.php',
133 active: record.data.active
136 success : function() {
139 _this.grid.ds.remove(record);
144 Roo.MessageBox.alert("Error", "saving failed", function() {
145 _this.grid.footer.onClick('first');
152 sortInfo : { field : 'name', direction: 'ASC' },
157 url : baseURL + '/Roo/Person.php'
162 totalProperty : 'total',
191 'name': 'company_id',
219 'name': 'no_reset_sent',
223 'name': 'action_type',
227 'name': 'project_id',
231 'name': 'office_id_id',
235 'name': 'office_id_company_id',
239 'name': 'office_id_name',
243 'name': 'office_id_address',
247 'name': 'office_id_phone',
251 'name': 'office_id_fax',
255 'name': 'office_id_email',
259 'name': 'office_id_role',
263 'name': 'company_id_code',
267 'name': 'company_id_name',
271 'name': 'company_id_remarks',
275 'name': 'company_id_owner_id',
279 'name': 'company_id_address',
283 'name': 'company_id_tel',
287 'name': 'company_id_fax',
291 'name': 'company_id_email',
295 'name': 'company_id_id',
299 'name': 'company_id_isOwner',
303 'name': 'company_id_logo_id',
307 'name': 'company_id_background_color',
311 'name': 'company_id_comptype',
315 'name': 'company_id_url',
319 'name': 'company_id_main_office_id',
323 'name': 'company_id_created_by',
327 'name': 'company_id_created_dt',
331 'name': 'company_id_updated_by',
335 'name': 'company_id_updated_dt',
339 'name': 'company_id_passwd',
343 'name': 'project_id_id',
347 'name': 'project_id_name',
351 'name': 'project_id_remarks',
355 'name': 'project_id_owner_id',
359 'name': 'project_id_code',
363 'name': 'project_id_active',
367 'name': 'project_id_type',
371 'name': 'project_id_client_id',
375 'name': 'project_id_team_id',
379 'name': 'project_id_file_location',
383 'name': 'project_id_open_date',
387 'name': 'project_id_open_by',
391 'name': 'project_id_close_date',
395 'name': 'project_id_countries',
399 'name': 'project_id_languages',
403 'name': 'project_id_agency_id',
407 'name': 'owner_id_id',
411 'name': 'owner_id_office_id',
415 'name': 'owner_id_name',
419 'name': 'owner_id_phone',
423 'name': 'owner_id_fax',
427 'name': 'owner_id_email',
431 'name': 'owner_id_company_id',
435 'name': 'owner_id_role',
439 'name': 'owner_id_active',
443 'name': 'owner_id_remarks',
447 'name': 'owner_id_passwd',
451 'name': 'owner_id_owner_id',
455 'name': 'owner_id_lang',
459 'name': 'owner_id_no_reset_sent',
463 'name': 'owner_id_action_type',
467 'name': 'owner_id_project_id',
474 xtype: 'PagingToolbar',
478 displayMsg : "Displaying Person{0} - {1} of {2}",
479 emptyMsg : "No Person found",
484 text : "Drag person to add or remove from group"
501 render : function (_self)
503 _this.searchBox = _self;
505 show : function (_self,e)
507 if (e.getCharCode() != 13) {
510 _this.grid.footer.onClick('first');
512 specialkey : function (_self, e)
514 if (e.getKey() == 13) {
515 _this.grid.footer.onClick('first');
524 render : function (_self)
526 _this.companyCombo = _self;
528 select : function (combo, record, index)
530 _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );
533 displayField : 'name',
535 emptyText : "Select Company",
536 forceSelection : true,
537 hiddenName : 'company_id',
539 loadingText : "Searching...",
541 name : 'company_name',
543 qtip : "Select Companies",
544 queryParam : 'query[name]',
545 selectOnFocus : true,
546 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
547 triggerAction : 'all',
555 beforeload : function (_self, o){
556 o.params = o.params || {};
561 sortInfo : { direction : 'ASC', field: 'name' },
566 url : baseURL + '/Roo/Companies.php'
573 totalProperty : 'total',
574 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
582 click : function (_self, e)
584 _this.grid.footer.onClick('first');
588 icon : rootURL + '/Pman/templates/images/search.gif'
594 click : function (_self, e)
596 _this.searchBox.setValue('');
597 _this.grid.footer.onClick('first');
601 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
607 toggle : function (_self, pressed)
609 _this.grid.footer.onClick('first');
610 this.setText(pressed ? "Show Active" : "Show Removed");
614 render : function (_self)
616 _this.activeButton = _self;
620 text : "Show Removed"
626 toggle : function (_self, pressed)
628 _this.grid.footer.onClick('first');
629 this.setText(pressed ? "Show Company" : "Show No Company");
633 render : function (_self)
635 _this.active_company_button = _self;
639 text : "Show No Company"
645 click : function (_self, e)
647 var s = _this.grid.getSelectionModel().getSelections();
649 Roo.MessageBox.alert("Error", "Select a Person");
654 url : baseURL + '/Login.php',
657 'switch' : s[0].data.id
659 success : function (){
660 document.location = baseURL + '?ts=' + Math.random();
662 failure : function (d){
664 Roo.MessageBox.alert("Error", d);
669 text : "Switch to Selected User"
682 _this.dialog.show( { id : 0 } , function() {
683 _this.grid.footer.onClick('first');
687 cls : 'x-btn-text-icon',
689 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
698 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
699 _this.grid.footer.onClick('first');
703 cls : 'x-btn-text-icon',
705 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
713 var s = _this.grid.getSelectionModel().getSelections();
714 if (!s.length || (s.length > 1)) {
715 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
719 _this.dialog.show(s[0].data, function() {
720 _this.grid.footer.onClick('first');
725 cls : 'x-btn-text-icon',
727 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
735 Pman.genericDelete(_this, 'Person');
738 cls : 'x-btn-text-icon',
740 icon : rootURL + '/Pman/templates/images/trash.gif'
746 xtype: 'ColumnModel',
748 dataIndex : 'project_id_code',
753 renderer : function(v,x,r) {
754 return String.format('<span qtip="{0}">{1}</span>',
755 r.data.project_id_name,
760 xtype: 'ColumnModel',
762 dataIndex : 'company_id_comptype',
766 renderer : function(v,x,r) {
767 if (r.data.office_id) {
768 return String.format('{0} - {1}', v, r.data.office_id_name);
770 return String.format('{0}', v);
774 xtype: 'ColumnModel',
776 dataIndex : 'company_id_name',
780 renderer : function(v,x,r) {
781 if (r.data.office_id) {
782 return String.format('{0} - {1}', v, r.data.office_id_name);
784 return String.format('{0}', v);
788 xtype: 'ColumnModel',
794 renderer : function(v) { return String.format('{0}', v); }
797 xtype: 'ColumnModel',
802 renderer : function(v) { return String.format('{0}', v); }
805 xtype: 'ColumnModel',
810 renderer : function(v) { return String.format('{0}', v); }
813 xtype: 'ColumnModel',
818 renderer : function(v) { return String.format('{0}', v); }
821 xtype: 'ColumnModel',
827 renderer : function(v) {
828 return (v.length && v.indexOf('@') > 0 ) ?
829 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
833 xtype: 'ColumnModel',
835 dataIndex : 'active',
838 renderer : function(v) {
839 var state = v> 0 ? '-checked' : '';
841 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';