1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Tab');
7 Pman.Tab.AdminContactsGroup = new Roo.XComponent({
10 'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
11 'a37ede293936e29279ed543129451ec3' :"Groups",
12 '7dce122004969d56ae2e0245cb754d35' :"Edit",
13 '4d1c8263ba1036754f8db14a98f9f006' :"Reload",
14 'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
15 '49ee3087348e8d44e1feda1917443987' :"Name",
16 'aba9f7d7443652e858969bfc280690b1' :"Manage Groups"
19 part : ["Admin", "ContactsGroup" ],
20 order : '001-Pman.Tab.AdminContactsGroup',
22 parent : 'Pman.Tab.AdminContactsManager',
23 name : "Pman.Tab.AdminContactsGroup",
26 _tree : function(_data)
36 tableName : 'core_group',
37 title : _this._strings['a37ede293936e29279ed543129451ec3'] /* Groups */,
39 activate : function() {
42 _this.grid.ds.load({});
50 autoExpandColumn : 'name',
58 _this.dialog = Pman.Dialog.Groups;
59 if (_this.panel.active) {
60 _this.grid.ds.load({});
63 rowdblclick : function (_self, rowIndex, e)
68 var s = this.getDataSource().getAt(rowIndex);
72 _this.dialog.show( s.data, function() {
86 text : _this._strings['aba9f7d7443652e858969bfc280690b1'] /* Manage Groups */,
88 '|xns' : 'Roo.Toolbar',
96 cls : 'x-btn-text-icon',
97 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
98 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
105 _this.dialog.show( { id : 0, type: 2 } , function() {
106 _this.grid.ds.load({});
115 cls : 'x-btn-text-icon',
116 icon : Roo.rootURL + 'images/default/tree/leaf.gif',
117 text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
121 var s = _this.grid.getSelectionModel().getSelections();
122 if (!s.length || (s.length > 1)) {
123 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
126 if (s[0].data.id < 1 ) {
132 _this.dialog.show(s[0].data, function() {
133 _this.grid.ds.load({});
143 cls : 'x-btn-text-icon',
144 icon : rootURL + '/Pman/templates/images/trash.gif',
145 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
149 Pman.genericDelete(_this, 'core_group');
162 text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
164 click : function (_self, e)
166 _this.grid.ds.load({});
180 sortInfo : { field : 'name', direction: 'ASC' },
182 beforeload : function (_self, o)
184 o.params = o.params || {};
188 o.params._add_everyone = 1;
190 load : function (_self, records, options)
192 var sm = _this.grid.getSelectionModel();
193 if (!sm.getSelections().length) {
196 Pman.Tab.AdminContacts.grid.footer.onClick('first');
204 url : baseURL + '/Roo/core_group',
209 xtype : 'JsonReader',
232 'name': 'leader_office_id',
236 'name': 'leader_name',
240 'name': 'leader_phone',
244 'name': 'leader_fax',
248 'name': 'leader_email',
252 'name': 'leader_company_id',
256 'name': 'leader_role',
260 'name': 'leader_active',
264 'name': 'leader_remarks',
268 'name': 'leader_passwd',
272 'name': 'leader_owner_id',
276 'name': 'leader_lang',
280 'name': 'leader_no_reset_sent',
284 'name': 'leader_action_type',
288 'name': 'leader_project_id',
294 totalProperty : 'total',
300 xtype : 'DropTarget',
303 drop : function (source, e, data)
306 var t = Roo.lib.Event.getTarget(e);
307 var ri = _this.grid.view.findRowIndex(t);
310 rid = _this.grid.getDataSource().getAt(ri).data;
312 var s = _this.grid.getSelectionModel().getSelections();
315 var isFromGroup = s.length ? s[0].data.id > 0 : false;
317 var isToGroup = rid && rid.id > 0;
318 this.success = false;
319 if (isFromGroup && isToGroup) {
322 if (!isFromGroup && !isToGroup) {
326 if (isFromGroup && !isToGroup) {
328 //return 'x-dd-drop-ok-sub';
330 // build a list of selections.
332 for (var i=0; i < data.selections.length; i++) {
333 sels.push(data.selections[i].data.id);
337 url: baseURL + '/Core/GroupMembers.php',
340 group_id: action =='add' ? rid.id : s[0].data.id,
342 user_ids : sels.join(',')
346 success : function(res) {
351 // do we need to do anything??
353 Pman.Tab.AdminContacts.grid.footer.onClick('refresh');
357 failure: function() {
358 //Ext.get(document.body).unmask();
368 //if (!isFromGroup && isToGroup) {
369 //return 'x-dd-drop-ok-add';
373 over : function (source, e, data)
375 // Roo.log("dragover");
378 var t = Roo.lib.Event.getTarget(e);
380 var ri = _this.grid.view.findRowIndex(t);
385 rid = _this.grid.getDataSource().getAt(ri).data;
388 var s = _this.grid.getSelectionModel().getSelections();
390 var isFromGroup = s.length ? s[0].data.id > 0 : false;
392 var isToGroup = rid && rid.id > 0;
394 // Roo.log("isToGroup:" + isToGroup + ", isFromGroup" + isFromGroup);
396 if (isFromGroup && isToGroup) {
398 // Roo.log('not valid');
401 if (!isFromGroup && !isToGroup) {
403 // Roo.log('not valid');
406 if (isFromGroup && !isToGroup) {
407 this.valid = 'ok-sub';
410 //if (!isFromGroup && isToGroup) {
411 this.valid = 'ok-add';
420 xtype : 'RowSelectionModel',
423 afterselectionchange : function (_self)
425 // Pman.Tab.AdminContacts.grid.footer.onClick('first');
426 var c = Pman.Tab.AdminContactsManager.layout.getRegion('center');
427 c.getActivePanel().grid.footer.onClick('first');
436 xtype : 'ColumnModel',
438 header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
439 renderer : function(v,x,r) {
440 if (r.data.id == -1) {
441 return '<b>' + "Not in a Group" + '</b>';
443 if ((r.data.id == 0) && (_this.type == 0)) {
444 return '<b>' + "All Staff (Default Permissions)" + '</b>';
446 if ((r.data.id == 0) && (_this.type == 2)) {
447 return '<b>' + "Everybody" + '</b>';
449 if (r.data.id == 0) {
450 return '<b>' + "All Staff" + '</b>';
452 if (v == 'Administrators') {
453 return '<b>' + "Adminstrators" + '</b>';
456 return v + ' (' + r.data.leader_name + ')';