Update Look n Feel Users and Roles

This commit is contained in:
Enrique Ponce de Leon
2011-01-28 22:30:25 +00:00
parent b566a11610
commit 2dac6ae2c9
10 changed files with 347 additions and 89 deletions

View File

@@ -653,8 +653,8 @@ class RBAC
* @param string $ROL_UID
* @return $this->rolesObj->getRoleUsers
*/
function getRoleUsers($ROL_UID){
return $this->rolesObj->getRoleUsers($ROL_UID);
function getRoleUsers($ROL_UID,$filter=''){
return $this->rolesObj->getRoleUsers($ROL_UID,$filter);
}
/**
@@ -693,8 +693,8 @@ class RBAC
* @param string $ROL_UID
* @return $this->rolesObj->getAllUsers
*/
function getAllUsers($ROL_UID){
return $this->rolesObj->getAllUsers($ROL_UID);
function getAllUsers($ROL_UID, $filter=''){
return $this->rolesObj->getAllUsers($ROL_UID,$filter);
}
/**
@@ -719,8 +719,8 @@ class RBAC
* @param string $ROL_UID
* @return $this->rolesObj->getRolePermissions
*/
function getRolePermissions($ROL_UID){
return $this->rolesObj->getRolePermissions($ROL_UID);
function getRolePermissions($ROL_UID, $filter=''){
return $this->rolesObj->getRolePermissions($ROL_UID,$filter);
}
/**
@@ -733,8 +733,8 @@ class RBAC
* @param string $PER_SYSTEM
* @return $this->rolesObj->getAllPermissions
*/
function getAllPermissions($ROL_UID,$PER_SYSTEM=""){
return $this->rolesObj->getAllPermissions($ROL_UID,$PER_SYSTEM);
function getAllPermissions($ROL_UID,$PER_SYSTEM="",$filter=''){
return $this->rolesObj->getAllPermissions($ROL_UID,$PER_SYSTEM,$filter);
}
/**

View File

@@ -313,7 +313,7 @@ class Roles extends BaseRoles {
return $ret;
}
function getRoleUsers($ROL_UID) {
function getRoleUsers($ROL_UID, $filter='') {
try {
$criteria = new Criteria();
$criteria->addSelectColumn(RolesPeer::ROL_UID);
@@ -335,6 +335,14 @@ class Roles extends BaseRoles {
$criteria->addJoin(RolesPeer::ROL_UID, UsersRolesPeer::ROL_UID);
$criteria->addJoin(UsersRolesPeer::USR_UID, RbacUsersPeer::USR_UID);
if ($filter != ''){
$criteria->add(
$criteria->getNewCriterion(RbacUsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
$criteria->getNewCriterion(RbacUsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
$criteria->getNewCriterion(RbacUsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)))
);
}
$oDataset = RolesPeer::doSelectRS($criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
return $oDataset;
@@ -344,7 +352,7 @@ class Roles extends BaseRoles {
}
}
function getAllUsers($ROL_UID) {
function getAllUsers($ROL_UID, $filter='') {
try {
$c = new Criteria();
$c->addSelectColumn(RbacUsersPeer::USR_UID);
@@ -371,6 +379,14 @@ class Roles extends BaseRoles {
$criteria->add(RbacUsersPeer::USR_STATUS, 1, Criteria::EQUAL);
$criteria->add(RbacUsersPeer::USR_UID, $a, Criteria::NOT_IN);
if ($filter != ''){
$criteria->add(
$criteria->getNewCriterion(RbacUsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
$criteria->getNewCriterion(RbacUsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
$criteria->getNewCriterion(RbacUsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)))
);
}
$oDataset = RbacUsersPeer::doSelectRS($criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
return $oDataset;
@@ -436,7 +452,7 @@ class Roles extends BaseRoles {
UsersRolesPeer::doDelete($crit);
}
function getRolePermissions($ROL_UID) {
function getRolePermissions($ROL_UID, $filter='') {
try {
$criteria = new Criteria();
$criteria->addSelectColumn(RolesPeer::ROL_UID);
@@ -456,6 +472,10 @@ class Roles extends BaseRoles {
$criteria->addJoin(RolesPeer::ROL_UID, RolesPermissionsPeer::ROL_UID);
$criteria->addJoin(RolesPermissionsPeer::PER_UID, PermissionsPeer::PER_UID);
if ($filter != ''){
$criteria->add(PermissionsPeer::PER_CODE, '%'.$filter.'%',Criteria::LIKE);
}
$oDataset = RolesPeer::doSelectRS($criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
return $oDataset;
@@ -465,7 +485,7 @@ class Roles extends BaseRoles {
}
}
function getAllPermissions($ROL_UID, $PER_SYSTEM = "") {
function getAllPermissions($ROL_UID, $PER_SYSTEM = "", $filter='') {
try {
$c = new Criteria();
$c->addSelectColumn(PermissionsPeer::PER_UID);
@@ -497,6 +517,10 @@ class Roles extends BaseRoles {
}
$criteria->addJoin(PermissionsPeer::PER_SYSTEM, SystemsPeer::SYS_UID);
if ($filter != ''){
$criteria->add(PermissionsPeer::PER_CODE, '%'.$filter.'%',Criteria::LIKE);
}
$oDataset = PermissionsPeer::doSelectRS($criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
return $oDataset;

View File

@@ -176,7 +176,7 @@ class Groups
* @return object
*/
function getAvailableGroupsCriteria($sUserUid){
function getAvailableGroupsCriteria($sUserUid, $filter=''){
try{
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(GroupUserPeer::GRP_UID);
@@ -199,6 +199,11 @@ class Groups
$oCriteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
$oCriteria->add(ContentPeer::CON_CATEGORY,'GRP_TITLE');
$oCriteria->add(ContentPeer::CON_LANG,SYS_LANG);
if ($filter !=''){
$oCriteria->add(ContentPeer::CON_VALUE,'%'.$filter.'%',Criteria::LIKE);
}
return $oCriteria;
}
catch(exception $e){
@@ -213,7 +218,7 @@ class Groups
* @return object
*/
function getAssignedGroupsCriteria($sUserUid){
function getAssignedGroupsCriteria($sUserUid, $filter=''){
try{
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(GroupwfPeer::GRP_UID);
@@ -225,6 +230,11 @@ class Groups
$oCriteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
$oCriteria->add(ContentPeer::CON_CATEGORY,'GRP_TITLE');
$oCriteria->add(ContentPeer::CON_LANG,SYS_LANG);
if ($filter !=''){
$oCriteria->add(ContentPeer::CON_VALUE,'%'.$filter.'%',Criteria::LIKE);
}
return $oCriteria;
}
catch(exception $e){

View File

@@ -28,8 +28,10 @@ $TYPE_DATA = $_GET["type"];
global $RBAC;
if ($TYPE_DATA=='list') $oDataset = $RBAC->getRolePermissions($ROL_UID);
if ($TYPE_DATA=='show') $oDataset = $RBAC->getAllPermissions($ROL_UID,$RBAC->sSystem);
$filter = (isset($_REQUEST['textFilter']))? $_REQUEST['textFilter'] : '';
if ($TYPE_DATA=='list') $oDataset = $RBAC->getRolePermissions($ROL_UID,$filter);
if ($TYPE_DATA=='show') $oDataset = $RBAC->getAllPermissions($ROL_UID,$RBAC->sSystem,$filter);
$rows = Array();
while($oDataset->next()){

View File

@@ -28,8 +28,10 @@ $TYPE_DATA = $_GET["type"];
global $RBAC;
if ($TYPE_DATA=='list') $oDataset = $RBAC->getRoleUsers($ROL_UID);
if ($TYPE_DATA=='show') $oDataset = $RBAC->getAllUsers($ROL_UID);
$filter = (isset($_REQUEST['textFilter']))? $_REQUEST['textFilter'] : '';
if ($TYPE_DATA=='list') $oDataset = $RBAC->getRoleUsers($ROL_UID, $filter);
if ($TYPE_DATA=='show') $oDataset = $RBAC->getAllUsers($ROL_UID, $filter);
$rows = Array();
while($oDataset->next()){

View File

@@ -60,7 +60,7 @@ $labels = G::getTranslations(Array('ID_PRO_CREATE_DATE','ID_CODE','ID_NAME','ID_
'ID_ACTIVE','ID_INACTIVE','ID_ROLES_MSG','ID_ROLES_CAN_NOT_DELETE','ID_ROLES_SUCCESS_NEW','ID_ROLES_SUCCESS_UPDATE',
'ID_ROLES_SUCCESS_DELETE','ID_REMOVE_ROLE','ID_ASSIGN','ID_REMOVE','ID_BACK','ID_PROCESSING',
'ID_REMOVE_ALL_PERMISSIONS','ID_ASSIGN_ALL_PERMISSIONS','ID_ASSIGN_ALL_USERS','ID_REMOVE_ALL_USERS',
'ID_USER_NAME','ID_PERMISSION_CODE','ID_AVAILABLE_PERMISSIONS','ID_ASSIGNED_PERMISSIONS',
'ID_USER_NAME','ID_PERMISSION_CODE','ID_AVAILABLE_PERMISSIONS','ID_ASSIGNED_PERMISSIONS','ID_ENTER_SEARCH_TERM',
'ID_FIRST_NAME','ID_LAST_NAME','ID_AVAILABLE_USERS','ID_ASSIGNED_USERS','ID_MSG_CONFIRM_ASSIGN_ALL_USERS','ID_MSG_AJAX_FAILURE'));
$roles = Array();

View File

@@ -62,7 +62,8 @@ $oHeadPublisher->addContent('users/usersGroups'); //adding a html file .html.
$labels = G::getTranslations(Array('ID_USERS','ID_ASSIGN','ID_ASSIGN_ALL_GROUPS','ID_REMOVE','ID_REMOVE_ALL_GROUPS',
'ID_BACK','ID_GROUP_NAME','ID_AVAILABLE_GROUPS','ID_ASSIGNED_GROUPS','ID_GROUPS','ID_USERS',
'ID_MSG_AJAX_FAILURE','ID_PROCESSING','ID_AUTHENTICATION','ID_CLOSE','ID_SAVE','ID_AUTHENTICATION_SOURCE',
'ID_AUTHENTICATION_DN','ID_AUTHENTICATION_FORM_TITLE','ID_SELECT_AUTH_SOURCE','ID_SAVE_CHANGES','ID_DISCARD_CHANGES'));
'ID_AUTHENTICATION_DN','ID_AUTHENTICATION_FORM_TITLE','ID_SELECT_AUTH_SOURCE','ID_SAVE_CHANGES','ID_DISCARD_CHANGES',
'ID_ENTER_SEARCH_TERM'));
require_once 'classes/model/Users.php';

View File

@@ -200,9 +200,9 @@ try {
break;
case 'availableGroups':
G::LoadClass('groups');
$filter = (isset($_POST['textFilter']))? $_POST['textFilter'] : '';
$groups = new Groups();
$criteria = $groups->getAvailableGroupsCriteria($_REQUEST['uUID']);
$criteria = $groups->getAvailableGroupsCriteria($_REQUEST['uUID'],$filter);
$objects = GroupwfPeer::doSelectRS($criteria);
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
$arr = Array();
@@ -213,9 +213,9 @@ try {
break;
case 'assignedGroups':
G::LoadClass('groups');
$filter = (isset($_POST['textFilter']))? $_POST['textFilter'] : '';
$groups = new Groups();
$criteria = $groups->getAssignedGroupsCriteria($_REQUEST['uUID']);
$criteria = $groups->getAssignedGroupsCriteria($_REQUEST['uUID'],$filter);
$objects = GroupwfPeer::doSelectRS($criteria);
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
$arr = Array();

View File

@@ -63,12 +63,12 @@ Ext.onReady(function(){
sw_func_permissions = false;
sw_func_users = false;
assignButton = new Ext.Action({
text: TRANSLATIONS.ID_ASSIGN,
iconCls: 'button_menu_ext ss_sprite ss_add',
handler: AssignPermissionAction,
disabled: true
});
// assignButton = new Ext.Action({
// text: TRANSLATIONS.ID_ASSIGN,
// iconCls: 'button_menu_ext ss_sprite ss_add',
// handler: AssignPermissionAction,
// disabled: true
// });
assignAllButton = new Ext.Action({
text: TRANSLATIONS.ID_ASSIGN_ALL_PERMISSIONS,
@@ -76,12 +76,12 @@ Ext.onReady(function(){
handler: AssignAllPermissionsAction
});
removeButton = new Ext.Action({
text: TRANSLATIONS.ID_REMOVE,
iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: RemovePermissionAction,
disabled: true
});
// removeButton = new Ext.Action({
// text: TRANSLATIONS.ID_REMOVE,
// iconCls: 'button_menu_ext ss_sprite ss_delete',
// handler: RemovePermissionAction,
// disabled: true
// });
removeAllButton = new Ext.Action({
text: TRANSLATIONS.ID_REMOVE_ALL_PERMISSIONS,
@@ -90,12 +90,12 @@ Ext.onReady(function(){
disabled: (ROLES.ROL_UID==pm_admin) ? true : false
});
assignUButton = new Ext.Action({
text: TRANSLATIONS.ID_ASSIGN,
iconCls: 'button_menu_ext ss_sprite ss_add',
handler: AssignUserAction,
disabled: true
});
// assignUButton = new Ext.Action({
// text: TRANSLATIONS.ID_ASSIGN,
// iconCls: 'button_menu_ext ss_sprite ss_add',
// handler: AssignUserAction,
// disabled: true
// });
assignUAllButton = new Ext.Action({
text: TRANSLATIONS.ID_ASSIGN_ALL_USERS,
@@ -103,12 +103,12 @@ Ext.onReady(function(){
handler: AssignAllUsersAction
});
removeUButton = new Ext.Action({
text: TRANSLATIONS.ID_REMOVE,
iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: RemoveUserAction,
disabled: true
});
// removeUButton = new Ext.Action({
// text: TRANSLATIONS.ID_REMOVE,
// iconCls: 'button_menu_ext ss_sprite ss_delete',
// handler: RemoveUserAction,
// disabled: true
// });
removeUAllButton = new Ext.Action({
text: TRANSLATIONS.ID_REMOVE_ALL_USERS,
@@ -168,8 +168,8 @@ Ext.onReady(function(){
listeners:{
selectionchange: function(sm){
switch(sm.getCount()){
case 0: assignButton.disable(); break;
default: assignButton.enable(); break;
case 0: Ext.getCmp('assignButton').disable(); break;
default: Ext.getCmp('assignButton').enable(); break;
}
}
}
@@ -180,13 +180,55 @@ Ext.onReady(function(){
listeners:{
selectionchange: function(sm){
switch(sm.getCount()){
case 0: removeButton.disable(); break;
default: (ROLES.ROL_UID==pm_admin) ? removeButton.disable() : removeButton.enable(); break;
case 0: Ext.getCmp('removeButton').disable(); break;
default: (ROLES.ROL_UID==pm_admin)? Ext.getCmp('removeButton').disable() : Ext.getCmp('removeButton').enable(); break;
}
}
}
});
searchTextA = new Ext.form.TextField ({
id: 'searchTextA',
ctCls:'pm_search_text_field',
allowBlank: true,
width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,
listeners: {
specialkey: function(f,e){
if (e.getKey() == e.ENTER) {
DoSearchA();
}
}
}
});
clearTextButtonA = new Ext.Action({
text: 'X',
ctCls:'pm_search_x_button',
handler: GridByDefaultA
});
searchTextP = new Ext.form.TextField ({
id: 'searchTextP',
ctCls:'pm_search_text_field',
allowBlank: true,
width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,
listeners: {
specialkey: function(f,e){
if (e.getKey() == e.ENTER) {
DoSearchP();
}
}
}
});
clearTextButtonP = new Ext.Action({
text: 'X',
ctCls:'pm_search_x_button',
handler: GridByDefaultP
});
availableGrid = new Ext.grid.GridPanel({
layout : 'fit',
region : 'center',
@@ -208,7 +250,7 @@ Ext.onReady(function(){
frame : false,
columnLines : false,
viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_AVAILABLE_PERMISSIONS,{xtype: 'tbfill'},'-',assignButton],
tbar: [TRANSLATIONS.ID_AVAILABLE_PERMISSIONS,{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA],
bbar: [{xtype: 'tbfill'}, assignAllButton],
listeners: {rowdblclick: AssignPermissionAction}
});
@@ -233,11 +275,26 @@ Ext.onReady(function(){
frame : false,
columnLines : false,
viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_ASSIGNED_PERMISSIONS,{xtype: 'tbfill'},'-',removeButton],
tbar: [TRANSLATIONS.ID_ASSIGNED_PERMISSIONS,{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP],
bbar: [{xtype: 'tbfill'},removeAllButton],
listeners: {rowdblclick: RemovePermissionAction}
});
buttonsPanel = new Ext.Panel({
width : 40,
layout : {
type:'vbox',
padding:'0',
pack:'center',
align:'center'
},
defaults:{margins:'0 0 35 0'},
items:[
{xtype:'button',text: '>>', handler: AssignPermissionAction, id: 'assignButton', disabled: true},
{xtype:'button',text: '<<', handler: RemovePermissionAction, id: 'removeButton', disabled: true}
]
});
RefreshPermissions();
//PERMISSIONS DRAG AND DROP PANEL
@@ -247,7 +304,7 @@ Ext.onReady(function(){
layout : 'hbox',
defaults : { flex : 1 }, //auto stretch
layoutConfig : { align : 'stretch' },
items : [availableGrid,{xtype: '', width: 10},assignedGrid],
items : [availableGrid,buttonsPanel,assignedGrid],
viewConfig : {forceFit:true}
});
@@ -300,8 +357,8 @@ Ext.onReady(function(){
listeners:{
selectionchange: function(sm){
switch(sm.getCount()){
case 0: assignUButton.disable(); break;
default: assignUButton.enable(); break;
case 0: Ext.getCmp('assignUButton').disable(); break;
default: Ext.getCmp('assignUButton').enable(); break;
}
}
}
@@ -312,12 +369,54 @@ Ext.onReady(function(){
listeners:{
selectionchange: function(sm){
switch(sm.getCount()){
case 0: removeUButton.disable(); break;
default: removeUButton.enable(); break;
case 0: Ext.getCmp('removeUButton').disable(); break;
default: Ext.getCmp('removeUButton').enable(); break;
}
}
}
});
searchTextU = new Ext.form.TextField ({
id: 'searchTextU',
ctCls:'pm_search_text_field',
allowBlank: true,
width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,
listeners: {
specialkey: function(f,e){
if (e.getKey() == e.ENTER) {
DoSearchU();
}
}
}
});
clearTextButtonU = new Ext.Action({
text: 'X',
ctCls:'pm_search_x_button',
handler: GridByDefaultU
});
searchTextX = new Ext.form.TextField ({
id: 'searchTextX',
ctCls:'pm_search_text_field',
allowBlank: true,
width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,
listeners: {
specialkey: function(f,e){
if (e.getKey() == e.ENTER) {
DoSearchX();
}
}
}
});
clearTextButtonX = new Ext.Action({
text: 'X',
ctCls:'pm_search_x_button',
handler: GridByDefaultX
});
availableUGrid = new Ext.grid.GridPanel({
layout : 'fit',
@@ -340,7 +439,7 @@ Ext.onReady(function(){
frame : false,
columnLines : false,
viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_AVAILABLE_USERS,{xtype: 'tbfill'},'-',assignUButton],
tbar: [TRANSLATIONS.ID_AVAILABLE_USERS,{xtype: 'tbfill'},'-',searchTextU, clearTextButtonU],
bbar: [{xtype: 'tbfill'}, assignUAllButton],
listeners: {rowdblclick: AssignUserAction}
});
@@ -365,11 +464,26 @@ Ext.onReady(function(){
frame : false,
columnLines : false,
viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_ASSIGNED_USERS,{xtype: 'tbfill'},'-',removeUButton],
tbar: [TRANSLATIONS.ID_ASSIGNED_USERS,{xtype: 'tbfill'},'-',searchTextX, clearTextButtonX],
bbar: [{xtype: 'tbfill'},removeUAllButton],
listeners: {rowdblclick: RemoveUserAction}
});
buttonsUPanel = new Ext.Panel({
width : 40,
layout : {
type:'vbox',
padding:'0',
pack:'center',
align:'center'
},
defaults:{margins:'0 0 35 0'},
items:[
{xtype:'button',text: '>>', handler: AssignUserAction, id: 'assignUButton', disabled: true},
{xtype:'button',text: '<<', handler: RemoveUserAction, id: 'removeUButton', disabled: true}
]
});
RefreshUsers();
//PERMISSIONS DRAG AND DROP PANEL
@@ -379,7 +493,7 @@ Ext.onReady(function(){
layout : 'hbox',
defaults : { flex : 1 }, //auto stretch
layoutConfig : { align : 'stretch' },
items : [availableUGrid,{xtype: '', width: 10},assignedUGrid],
items : [availableUGrid,buttonsUPanel,assignedUGrid],
viewConfig : {forceFit:true}
});
@@ -495,14 +609,14 @@ DDLoadUsers = function(){
//REFRESH PERMISSION GRIDS
RefreshPermissions = function(){
availableGrid.store.load();
assignedGrid.store.load();
DoSearchA();
DoSearchP();
}
//REFRESH USERS GRIDS
RefreshUsers = function(){
availableUGrid.store.load();
assignedUGrid.store.load();
DoSearchX();
DoSearchU();
}
//FAILURE AJAX FUNCTION
@@ -682,6 +796,46 @@ RemoveAllUsersAction = function(){
}
}
//Function DoSearch Available
DoSearchA = function(){
availableGrid.store.load({params: {textFilter: searchTextA.getValue()}});
}
//Function DoSearch Assigned
DoSearchP = function(){
assignedGrid.store.load({params: {textFilter: searchTextP.getValue()}});
}
//Load Grid By Default Available Members
GridByDefaultA = function(){
searchTextA.reset();
availableGrid.store.load();
}
//Load Grid By Default Assigned Members
GridByDefaultP = function(){
searchTextP.reset();
assignedGrid.store.load();
}
//Function DoSearch Available
DoSearchU = function(){
availableUGrid.store.load({params: {textFilter: searchTextU.getValue()}});
}
//Function DoSearch Assigned
DoSearchX = function(){
assignedUGrid.store.load({params: {textFilter: searchTextX.getValue()}});
}
//Load Grid By Default Available Members
GridByDefaultU = function(){
searchTextU.reset();
availableUGrid.store.load();
}
//Load Grid By Default Assigned Members
GridByDefaultX = function(){
searchTextX.reset();
assignedUGrid.store.load();
}

View File

@@ -55,26 +55,12 @@ Ext.onReady(function(){
//sw_func_reassign = false;
sw_func_auth = false;
assignButton = new Ext.Action({
text: TRANSLATIONS.ID_ASSIGN,
iconCls: 'button_menu_ext ss_sprite ss_add',
handler: AssignGroupsAction,
disabled: true
});
assignAllButton = new Ext.Action({
text: TRANSLATIONS.ID_ASSIGN_ALL_GROUPS,
iconCls: 'button_menu_ext ss_sprite ss_add',
handler: AssignAllGroupsAction
});
removeButton = new Ext.Action({
text: TRANSLATIONS.ID_REMOVE,
iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: RemoveGroupsAction,
disabled: true
});
removeAllButton = new Ext.Action({
text: TRANSLATIONS.ID_REMOVE_ALL_GROUPS,
iconCls: 'button_menu_ext ss_sprite ss_delete',
@@ -145,8 +131,8 @@ Ext.onReady(function(){
listeners:{
selectionchange: function(sm){
switch(sm.getCount()){
case 0: assignButton.disable(); break;
default: assignButton.enable(); break;
case 0: Ext.getCmp('assignButton').disable(); break;
default: Ext.getCmp('assignButton').enable(); break;
}
}
}
@@ -157,13 +143,55 @@ Ext.onReady(function(){
listeners:{
selectionchange: function(sm){
switch(sm.getCount()){
case 0: removeButton.disable(); break;
default: removeButton.enable(); break;
case 0: Ext.getCmp('removeButton').disable(); break;
default: Ext.getCmp('removeButton').enable(); break;
}
}
}
});
searchTextA = new Ext.form.TextField ({
id: 'searchTextA',
ctCls:'pm_search_text_field',
allowBlank: true,
width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,
listeners: {
specialkey: function(f,e){
if (e.getKey() == e.ENTER) {
DoSearchA();
}
}
}
});
clearTextButtonA = new Ext.Action({
text: 'X',
ctCls:'pm_search_x_button',
handler: GridByDefaultA
});
searchTextP = new Ext.form.TextField ({
id: 'searchTextP',
ctCls:'pm_search_text_field',
allowBlank: true,
width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,
listeners: {
specialkey: function(f,e){
if (e.getKey() == e.ENTER) {
DoSearchP();
}
}
}
});
clearTextButtonP = new Ext.Action({
text: 'X',
ctCls:'pm_search_x_button',
handler: GridByDefaultP
});
availableGrid = new Ext.grid.GridPanel({
layout : 'fit',
region : 'center',
@@ -185,7 +213,7 @@ Ext.onReady(function(){
frame : false,
columnLines : false,
viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_AVAILABLE_GROUPS,{xtype: 'tbfill'},'-',assignButton],
tbar: [TRANSLATIONS.ID_AVAILABLE_GROUPS,{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA],
bbar: [{xtype: 'tbfill'}, assignAllButton],
listeners: {rowdblclick: AssignGroupsAction}
});
@@ -210,11 +238,26 @@ Ext.onReady(function(){
frame : false,
columnLines : false,
viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_ASSIGNED_GROUPS,{xtype: 'tbfill'},'-',removeButton],
tbar: [TRANSLATIONS.ID_ASSIGNED_GROUPS,{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP],
bbar: [{xtype: 'tbfill'},removeAllButton],
listeners: {rowdblclick: RemoveGroupsAction}
});
buttonsPanel = new Ext.Panel({
width : 40,
layout : {
type:'vbox',
padding:'0',
pack:'center',
align:'center'
},
defaults:{margins:'0 0 35 0'},
items:[
{xtype:'button',text: '>>', handler: AssignGroupsAction, id: 'assignButton', disabled: true},
{xtype:'button',text: '<<', handler: RemoveGroupsAction, id: 'removeButton', disabled: true}
]
});
RefreshGroups();
//GROUPS DRAG AND DROP PANEL
@@ -224,7 +267,7 @@ Ext.onReady(function(){
layout : 'hbox',
defaults : { flex : 1 }, //auto stretch
layoutConfig : { align : 'stretch' },
items : [availableGrid,{xtype: '', width: 10},assignedGrid],
items : [availableGrid,buttonsPanel,assignedGrid],
viewConfig : {forceFit:true}
});
@@ -435,8 +478,8 @@ ReportChanges = function(){
//REFRESH GROUPS GRIDS
RefreshGroups = function(){
availableGrid.store.load();
assignedGrid.store.load();
DoSearchA();
DoSearchP();
}
//SAVE AUTHENTICATION CHANGES
@@ -540,4 +583,26 @@ RemoveAllGroupsAction = function(){
}
DeleteGroupsUser(arrAux,RefreshGroups,FailureProcess);
}
}
//Function DoSearch Available
DoSearchA = function(){
availableGrid.store.load({params: {textFilter: searchTextA.getValue()}});
}
//Function DoSearch Assigned
DoSearchP = function(){
assignedGrid.store.load({params: {textFilter: searchTextP.getValue()}});
}
//Load Grid By Default Available Members
GridByDefaultA = function(){
searchTextA.reset();
availableGrid.store.load();
}
//Load Grid By Default Assigned Members
GridByDefaultP = function(){
searchTextP.reset();
assignedGrid.store.load();
}