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.AdminContactsGroup',
12 module : Pman.Tab.AdminContactsGroup,
14 parent : Pman.Tab.AdminContactsManager,
15 name : "Pman.Tab.AdminContactsGroup",
21 Pman.Tab.AdminContactsGroup = new Roo.util.Observable({
27 add : function(parentLayout, region)
31 this.parentLayout = parentLayout;
33 this.panel = parentLayout.addxtype({
37 activate : function() {
40 _this.grid.ds.load({});
57 //_this.dialog = Pman.Dialog.FILL_IN
58 if (_this.panel.active) {
59 _this.grid.ds.load({});
62 rowdblclick : function (_self, rowIndex, e)
64 if (!_this.dialog) return;
65 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
66 _this.grid.footer.onClick('first');
69 dragover : function (_self, dd, targetId, e)
71 var t = Roo.lib.Event.getTarget(e);
72 var ri = _this.grid.view.findRowIndex(t);
75 rid = _this.grid.getDataSource().getAt(ri).data;
78 var s = _this.grid.getSelectionModel().getSelections();
80 var isFromGroup = s.length ? s[0].data.id > 0 : false;
82 var isToGroup = rid && rid.id > 0;
84 if (isFromGroup && isToGroup) {
85 return this.dropNotAllowed;
87 if (!isFromGroup && !isToGroup) {
88 return this.dropNotAllowed;
90 if (isFromGroup && !isToGroup) {
91 return 'x-dd-drop-ok-sub';
93 //if (!isFromGroup && isToGroup) {
94 return 'x-dd-drop-ok-add';
97 dragdrop : function (_self, dd, targetId, e)
100 var t = Roo.lib.Event.getTarget(e);
101 var ri = _this.grid.view.findRowIndex(t);
104 rid = _this.grid.getDataSource().getAt(ri).data;
106 var s = _this.grid.getSelectionModel().getSelections();
109 var isFromGroup = s.length ? s[0].data.id > 0 : false;
111 var isToGroup = rid && rid.id > 0;
113 if (isFromGroup && isToGroup) {
116 if (!isFromGroup && !isToGroup) {
120 if (isFromGroup && !isToGroup) {
122 //return 'x-dd-drop-ok-sub';
124 // build a list of selections.
126 for (var i=0; i < data.selections.length; i++) {
127 sels.push(data.selections[i].data.id);
131 url: baseURL + '/Core/GroupMembers.php',
134 group_id: action =='add' ? rid.id : s[0].data.id,
136 user_ids : sels.join(',')
140 success : function(data) {
144 failure: function() {
145 //Ext.get(document.body).unmask();
155 //if (!isFromGroup && isToGroup) {
156 //return 'x-dd-drop-ok-add';
162 autoExpandColumn : 'name',
170 beforeload : function (_self, o)
172 o.params = o.params || {};
175 load : function (_self, records, options)
177 var sm = _this.grid.getSelectionModel();
178 if (!sm.getSelections().length) {
181 Pman.Tab.AdminContacts.grid.footer.onClick('first');
185 sortInfo : { field : 'name', direction: 'ASC' },
190 url : baseURL + '/Roo/Groups.php'
195 totalProperty : 'total',
220 'name': 'leader_office_id',
224 'name': 'leader_name',
228 'name': 'leader_phone',
232 'name': 'leader_fax',
236 'name': 'leader_email',
240 'name': 'leader_company_id',
244 'name': 'leader_role',
248 'name': 'leader_active',
252 'name': 'leader_remarks',
256 'name': 'leader_passwd',
260 'name': 'leader_owner_id',
264 'name': 'leader_lang',
268 'name': 'leader_no_reset_sent',
272 'name': 'leader_action_type',
276 'name': 'leader_project_id',
289 text : "Manage Groups",
300 if (!_this.dialog) return;
301 _this.dialog.show( { id : 0 } , function() {
302 _this.grid.ds.load({});
306 cls : 'x-btn-text-icon',
308 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
316 var s = _this.grid.getSelectionModel().getSelections();
317 if (!s.length || (s.length > 1)) {
318 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
321 if (!_this.dialog) return;
322 _this.dialog.show(s[0].data, function() {
323 _this.grid.ds.load({});
328 cls : 'x-btn-text-icon',
330 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
338 Pman.genericDelete(_this, 'Groups');
341 cls : 'x-btn-text-icon',
343 icon : rootURL + '/Pman/templates/images/trash.gif'
353 click : function (_self, e)
355 _this.grid.ds.load({});
367 xtype: 'ColumnModel',
372 renderer : function(v,x,r) {
373 if (r.data.id == -1) {
374 return '<b>' + "Not in a Group" + '</b>';
376 if ((r.data.id == 0) && (_this.type == 0)) {
377 return '<b>' + "All Staff (Default Permissions)" + '</b>';
379 if ((r.data.id == 0) && (_this.type == 2)) {
380 return '<b>' + "Everybody" + '</b>';
382 if (r.data.id == 0) {
383 return '<b>' + "All Staff" + '</b>';
385 if (v == 'Administrators') {
386 return '<b>' + "Adminstrators" + '</b>';
389 return v + ' (' + r.data.leader_name + ')';
397 xtype: 'RowSelectionModel',
400 afterselectionchange : function (_self)
402 Pman.Tab.AdminContacts.footer.onClick('first');
409 this.layout = this.panel.layout;