1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
7 // register the module first
8 Pman.on('beforeload', function()
11 modKey : '001-Pman.Tab.AdminContacts',
12 module : Pman.Tab.AdminContacts,
14 parent : Pman.Tab.AdminContactsManager,
15 name : "Pman.Tab.AdminContacts",
17 permname: 'Core.Person'
21 Pman.Tab.AdminContacts = new Roo.util.Observable({
27 add : function(parentLayout, region)
31 this.parentLayout = parentLayout;
33 this.panel = parentLayout.addxtype({
37 activate : function() {
40 _this.grid.footer.onClick('first');
59 _this.dialog = Pman.Dialog.PersonEdit;
62 //_this.dialog = Pman.Dialog.FILL_IN
63 if (_this.panel.active) {
64 this.footer.onClick('first');
67 rowdblclick : function (_self, rowIndex, e)
69 if (!_this.dialog) return;
70 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
71 _this.grid.footer.onClick('first');
74 cellclick : function (_self, rowIndex, columnIndex, e)
77 var di = this.colModel.getDataIndex(columnIndex);
82 var rec = _this.grid.ds.getAt(rowIndex);
84 rec.set('active', rec.data.active ? 0 : 1);
90 autoExpandColumn : 'name',
98 beforeload : function (_self, o)
101 o.params['!company_id_comptype'] = 'OWNER';
102 o.params['query[search]'] = _this.searchBox.getValue();
104 if (!_this.activeButton) {return; false;}
107 o.params.active = _this.activeButton.pressed ? 0 : 1;
109 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
110 var tms = Pman.Tab.ContactsGroup.grid.getLeftSelections();
113 o.params['query[in_group]'] = tms[0].data.id;
114 o.params['query[type]'] = 2; // group type..
117 //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"
499 _this.dialog.show( { id : 0 } , function() {
500 _this.grid.footer.onClick('first');
504 cls : 'x-btn-text-icon',
506 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
515 Pman.Dialog.PersonBulkAdd.dialog.show( { id : 0 } , function() {
516 _this.grid.footer.onClick('first');
520 cls : 'x-btn-text-icon',
522 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
530 var s = _this.grid.getSelectionModel().getSelections();
531 if (!s.length || (s.length > 1)) {
532 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
536 Pman.Dialog.PersonEdit.dialog.show(s[0].data, function() {
537 _this.grid.footer.onClick('first');
542 cls : 'x-btn-text-icon',
544 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
559 render : function (_self)
561 _this.searchBox = _self;
563 show : function (_self,e)
565 if (e.getCharCode() != 13) {
568 _this.grid.footer.onClick('first');
576 click : function (_self, e)
578 _this.grid.footer.onClick('first');
582 icon : rootURL + '/Pman/templates/images/search.gif'
588 click : function (_self, e)
590 _this.searchBox.setValue('');
591 _this.grid.footer.onClick('first');
595 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
605 toggle : function (_self, pressed)
607 _this.grid.footer.onClick('first');
608 this.setText(pressed ? "Show Active" : "Show Removed");
612 render : function (_self)
614 _this.activeButton = _self;
618 text : "Show Removed"
624 xtype: 'ColumnModel',
626 dataIndex : 'project_id_code',
631 renderer : function(v,x,r) {
632 return String.format('<span qtip="{0}">{1}</span>',
633 r.data.project_id_name,
638 xtype: 'ColumnModel',
640 dataIndex : 'company_id_comptype',
644 renderer : function(v,x,r) {
645 if (r.data.office_id) {
646 return String.format('{0} - {1}', v, r.data.office_id_name);
648 return String.format('{0}', v);
652 xtype: 'ColumnModel',
654 dataIndex : 'company_id_name',
658 renderer : function(v,x,r) {
659 if (r.data.office_id) {
660 return String.format('{0} - {1}', v, r.data.office_id_name);
662 return String.format('{0}', v);
666 xtype: 'ColumnModel',
672 renderer : function(v) { return String.format('{0}', v); }
675 xtype: 'ColumnModel',
680 renderer : function(v) { return String.format('{0}', v); }
683 xtype: 'ColumnModel',
688 renderer : function(v) { return String.format('{0}', v); }
691 xtype: 'ColumnModel',
696 renderer : function(v) { return String.format('{0}', v); }
699 xtype: 'ColumnModel',
705 renderer : function(v) {
706 return (v.length && v.indexOf('@') > 0 ) ?
707 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
711 xtype: 'ColumnModel',
713 dataIndex : 'active',
716 renderer : function(v) {
717 var state = v> 0 ? '-checked' : '';
719 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
726 this.layout = this.panel.layout;