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)
72 var t = Roo.lib.Event.getTarget(e);
73 var ri = _this.grid.view.findRowIndex(t);
76 rid = _this.grid.getDataSource().getAt(ri).data;
79 var s = _this.grid.getSelectionModel().getSelections();
81 var isFromGroup = s.length ? s[0].data.id > 0 : false;
83 var isToGroup = rid && rid.id > 0;
85 if (isFromGroup && isToGroup) {
86 return this.dropNotAllowed;
88 if (!isFromGroup && !isToGroup) {
89 return this.dropNotAllowed;
91 if (isFromGroup && !isToGroup) {
92 return 'x-dd-drop-ok-sub';
94 //if (!isFromGroup && isToGroup) {
95 return 'x-dd-drop-ok-add';
98 dragdrop : function (_self, dd, targetId, e)
101 var t = Roo.lib.Event.getTarget(e);
102 var ri = _this.grid.view.findRowIndex(t);
105 rid = _this.grid.getDataSource().getAt(ri).data;
107 var s = _this.grid.getSelectionModel().getSelections();
110 var isFromGroup = s.length ? s[0].data.id > 0 : false;
112 var isToGroup = rid && rid.id > 0;
114 if (isFromGroup && isToGroup) {
117 if (!isFromGroup && !isToGroup) {
121 if (isFromGroup && !isToGroup) {
123 //return 'x-dd-drop-ok-sub';
125 // build a list of selections.
127 for (var i=0; i < data.selections.length; i++) {
128 sels.push(data.selections[i].data.id);
132 url: baseURL + '/Core/GroupMembers.php',
135 group_id: action =='add' ? rid.id : s[0].data.id,
137 user_ids : sels.join(',')
141 success : function(data) {
145 failure: function() {
146 //Ext.get(document.body).unmask();
156 //if (!isFromGroup && isToGroup) {
157 //return 'x-dd-drop-ok-add';
163 autoExpandColumn : 'name',
171 beforeload : function (_self, o)
173 o.params = o.params || {};
176 load : function (_self, records, options)
178 var sm = _this.grid.getSelectionModel();
179 if (!sm.getSelections().length) {
182 Pman.Tab.AdminContacts.grid.footer.onClick('first');
186 sortInfo : { field : 'name', direction: 'ASC' },
191 url : baseURL + '/Roo/Groups.php'
196 totalProperty : 'total',
221 'name': 'leader_office_id',
225 'name': 'leader_name',
229 'name': 'leader_phone',
233 'name': 'leader_fax',
237 'name': 'leader_email',
241 'name': 'leader_company_id',
245 'name': 'leader_role',
249 'name': 'leader_active',
253 'name': 'leader_remarks',
257 'name': 'leader_passwd',
261 'name': 'leader_owner_id',
265 'name': 'leader_lang',
269 'name': 'leader_no_reset_sent',
273 'name': 'leader_action_type',
277 'name': 'leader_project_id',
290 text : "Manage Groups",
301 if (!_this.dialog) return;
302 _this.dialog.show( { id : 0 } , function() {
303 _this.grid.ds.load({});
307 cls : 'x-btn-text-icon',
309 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
317 var s = _this.grid.getSelectionModel().getSelections();
318 if (!s.length || (s.length > 1)) {
319 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
322 if (!_this.dialog) return;
323 _this.dialog.show(s[0].data, function() {
324 _this.grid.ds.load({});
329 cls : 'x-btn-text-icon',
331 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
339 Pman.genericDelete(_this, 'Groups');
342 cls : 'x-btn-text-icon',
344 icon : rootURL + '/Pman/templates/images/trash.gif'
354 click : function (_self, e)
356 _this.grid.ds.load({});
368 xtype: 'ColumnModel',
373 renderer : function(v,x,r) {
374 if (r.data.id == -1) {
375 return '<b>' + "Not in a Group" + '</b>';
377 if ((r.data.id == 0) && (_this.type == 0)) {
378 return '<b>' + "All Staff (Default Permissions)" + '</b>';
380 if ((r.data.id == 0) && (_this.type == 2)) {
381 return '<b>' + "Everybody" + '</b>';
383 if (r.data.id == 0) {
384 return '<b>' + "All Staff" + '</b>';
386 if (v == 'Administrators') {
387 return '<b>' + "Adminstrators" + '</b>';
390 return v + ' (' + r.data.leader_name + ')';
398 xtype: 'RowSelectionModel',
401 afterselectionchange : function (_self)
403 Pman.Tab.AdminContacts.footer.onClick('first');
410 this.layout = this.panel.layout;