Update Look n Feel and Functionality of Roles Manager

Users Authentication Tab Changes too
This commit is contained in:
Enrique Ponce de Leon
2011-02-09 16:28:46 +00:00
parent afc2f0835a
commit 7e2d26bfc9
12 changed files with 475 additions and 265 deletions

View File

@@ -562,8 +562,8 @@ class RBAC
* @param string $filter * @param string $filter
* @return $this->rolesObj->getAllRolesFilter * @return $this->rolesObj->getAllRolesFilter
*/ */
function getAllRolesFilter ($filter) { function getAllRolesFilter ($start,$limit,$filter) {
return $this->rolesObj->getAllRolesFilter($filter); return $this->rolesObj->getAllRolesFilter($start,$limit,$filter);
} }
/** /**
@@ -657,6 +657,19 @@ class RBAC
return $this->rolesObj->getRoleUsers($ROL_UID,$filter); return $this->rolesObj->getRoleUsers($ROL_UID,$filter);
} }
/**
* this function gets the number of users by roles
*
*
* @access public
* @author: Enrique Ponce de Leon <enrique@colosa.com>
*
* @return $this->rolesObj->getAllUsersByRole
*/
function getAllUsersByRole(){
return $this->rolesObj->getAllUsersByRole();
}
/** /**
* this function gets roles code * this function gets roles code
* *

View File

@@ -124,28 +124,57 @@ class Roles extends BaseRoles {
} }
//Added by QENNIX //Added by QENNIX
function getAllRolesFilter($filter='') { function getAllRolesFilter($start, $limit, $filter='') {
//echo $start.'<<<<'.$limit;
$systemCode = 'PROCESSMAKER'; $systemCode = 'PROCESSMAKER';
$c = $this->listAllRoles($systemCode,$filter); $oCriteria2 = new Criteria('rbac');
$rs = RolesPeer::DoSelectRs($c); $result = Array();
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oCriteria2->addSelectColumn('COUNT(*) AS CNT');
$aRows = Array(); $oCriteria2->add(RolesPeer::ROL_UID, '', Criteria::NOT_EQUAL);
while($rs->next()){ $oCriteria2->add(SystemsPeer::SYS_CODE, $systemCode);
$row = $rs->getRow(); $oCriteria2->add(RolesPeer::ROL_CREATE_DATE, '', Criteria::NOT_EQUAL);
$o = new Roles(); $oCriteria2->add(RolesPeer::ROL_UPDATE_DATE, '', Criteria::NOT_EQUAL);
$o->load($row['ROL_UID']); $oCriteria2->addJoin(RolesPeer::ROL_SYSTEM, SystemsPeer::SYS_UID);
$row['ROL_NAME'] = $o->getRolName(); if ($filter != ''){
$aRows[] = $row; $oCriteria2->add(RolesPeer::ROL_CODE, '%'.$filter.'%', Criteria::LIKE);
}
return $aRows;
} }
$result['COUNTER'] = $oCriteria2;
$oCriteria = new Criteria('rbac');
$oCriteria->clear();
$oCriteria->addSelectColumn(RolesPeer::ROL_UID);
$oCriteria->addSelectColumn(RolesPeer::ROL_PARENT);
$oCriteria->addSelectColumn(RolesPeer::ROL_SYSTEM);
$oCriteria->addSelectColumn(SystemsPeer::SYS_CODE);
$oCriteria->addSelectColumn(RolesPeer::ROL_CODE);
$oCriteria->addSelectColumn(RolesPeer::ROL_CREATE_DATE);
$oCriteria->addSelectColumn(RolesPeer::ROL_UPDATE_DATE);
$oCriteria->addSelectColumn(RolesPeer::ROL_STATUS);
$oCriteria->add(RolesPeer::ROL_UID, '', Criteria::NOT_EQUAL);
$oCriteria->add(SystemsPeer::SYS_CODE, $systemCode);
$oCriteria->add(RolesPeer::ROL_CREATE_DATE, '', Criteria::NOT_EQUAL);
$oCriteria->add(RolesPeer::ROL_UPDATE_DATE, '', Criteria::NOT_EQUAL);
$oCriteria->addJoin(RolesPeer::ROL_SYSTEM, SystemsPeer::SYS_UID);
if ($filter != ''){
$oCriteria->add(RolesPeer::ROL_CODE, '%'.$filter.'%', Criteria::LIKE);
}
$oCriteria->setOffset($start);
$oCriteria->setLimit($limit);
$result['LIST'] = $oCriteria;
return $result;
}
function getAllRoles($systemCode = 'PROCESSMAKER') { function getAllRoles($systemCode = 'PROCESSMAKER') {
$c = $this->listAllRoles($systemCode); $c = $this->listAllRoles($systemCode);
$rs = RolesPeer::DoSelectRs($c); $rs = RolesPeer::DoSelectRs($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aRows = Array(); $aRows = Array();
@@ -313,6 +342,23 @@ class Roles extends BaseRoles {
return $ret; return $ret;
} }
//Added by Enrique at Feb 9th, 2011
//Gets number of users by role
function getAllUsersByRole(){
$oCriteria = new Criteria('rbac');
$oCriteria->addSelectColumn(UsersRolesPeer::ROL_UID);
$oCriteria->addSelectColumn('COUNT(*) AS CNT');
$oCriteria->addGroupByColumn(UsersRolesPeer::ROL_UID);
$oDataset = UsersRolesPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aRoles = array();
while ($oDataset->next()){
$row = $oDataset->getRow();
$aRoles[$row['ROL_UID']] = $row['CNT'];
}
return $aRoles;
}
function getRoleUsers($ROL_UID, $filter='') { function getRoleUsers($ROL_UID, $filter='') {
try { try {
$criteria = new Criteria(); $criteria = new Criteria();

View File

@@ -305,4 +305,24 @@ class Content extends BaseContent {
throw ($e); throw ($e);
} }
} }
//Added by Enrique at Feb 9th,2011
//Gets all Role Names by Role
function getAllContentsByRole($sys_lang=SYS_LANG){
if (!isset($sys_lang)) $sys_lang = 'en';
$oCriteria = new Criteria('workflow');
$oCriteria->clearSelectColumns();
$oCriteria->addSelectColumn(ContentPeer::CON_ID);
$oCriteria->addAsColumn('ROL_NAME', ContentPeer::CON_VALUE);
//$oCriteria->addAsColumn('ROL_UID', ContentPeer::CON_ID);
$oCriteria->add(ContentPeer::CON_CATEGORY,'ROL_NAME');
$oCriteria->add(ContentPeer::CON_LANG, $sys_lang);
$oDataset = ContentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aRoles = Array();
while ($oDataset->next()){
$xRow = $oDataset->getRow();
$aRoles[$xRow['CON_ID']] = $xRow['ROL_NAME'];
}
return $aRoles;
}
} // Content } // Content

View File

@@ -55,20 +55,13 @@ $oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('roles/rolesUsersPermission', false); //adding a javascript file .js $oHeadPublisher->addExtJsScript('roles/rolesUsersPermission', false); //adding a javascript file .js
$oHeadPublisher->addContent('roles/rolesUsersPermission'); //adding a html file .html. $oHeadPublisher->addContent('roles/rolesUsersPermission'); //adding a html file .html.
$labels = G::getTranslations(Array('ID_PRO_CREATE_DATE','ID_CODE','ID_NAME','ID_LAN_UPDATE_DATE', 'ID_ROLES',
'ID_USERS','ID_PERMISSIONS','ID_EDIT','ID_DELETE','ID_NEW','ID_STATUS','ID_SAVE','ID_CLOSE',
'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_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(); $roles = Array();
$roles['ROL_UID'] = $_GET['rUID']; $roles['ROL_UID'] = $_GET['rUID'];
$roles['ROL_CODE'] = $RBAC->getRoleCode($_GET['rUID']); $roles['ROL_CODE'] = $RBAC->getRoleCode($_GET['rUID']);
$roles['CURRENT_TAB'] = ($_GET['tab']=='permissions') ? 1 : 0; $roles['CURRENT_TAB'] = ($_GET['tab']=='permissions') ? 1 : 0;
$oHeadPublisher->assign('TRANSLATIONS', $labels);
$oHeadPublisher->assign('ROLES', $roles); $oHeadPublisher->assign('ROLES', $roles);
G::RenderPage('publish', 'extJs'); G::RenderPage('publish', 'extJs');

View File

@@ -260,6 +260,58 @@ switch ($REQUEST) {
$RBAC->deleteUserRole($ROL_UID, $aUID); $RBAC->deleteUserRole($ROL_UID, $aUID);
} }
break; break;
case 'rolesList':
require_once (PATH_RBAC . "model/RolesPeer.php");
require_once ("classes/model/Content.php");
G::LoadClass('configuration');
$co = new Configurations();
$config = $co->getConfiguration('rolesList', 'pageSize','',$_SESSION['USER_LOGGED']);
$limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
$start = isset($_POST['start']) ? $_POST['start'] : 0;
$limit = isset($_POST['limit']) ? $_POST['limit'] : $limit_size;
$filter = isset($_REQUEST['textFilter'])? $_REQUEST['textFilter'] : '';
global $RBAC;
$Criterias = $RBAC->getAllRolesFilter($start,$limit,$filter);
$rs = RolesPeer::DoSelectRs($Criterias['LIST']);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$content = new Content();
$rNames = $content->getAllContentsByRole();
$aUsers = $RBAC->getAllUsersByRole();
$aRows = Array();
while($rs->next()){
$aRows[] = $rs->getRow();
$index = sizeof($aRows)-1;
$aRows[$index]['ROL_NAME'] = isset($rNames[$aRows[$index]['ROL_UID']])? $rNames[$aRows[$index]['ROL_UID']] : '';
$aRows[$index]['TOTAL_USERS'] = isset($aUsers[$aRows[$index]['ROL_UID']])? $aUsers[$aRows[$index]['ROL_UID']] : 0;
}
$oData = RolesPeer::doSelectRS($Criterias['COUNTER']);
$oData->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oData->next();
$row = $oData->getRow();
$total_roles = $row['CNT'];
echo '{roles: '.G::json_encode($aRows).', total_roles: '.$total_roles.'}';
break;
case 'updatePageSize':
G::LoadClass('configuration');
$c = new Configurations();
$arr['pageSize'] = $_REQUEST['size'];
$arr['dateSave'] = date('Y-m-d H:i:s');
$config = Array();
$config[] = $arr;
$c->aConfig = $config;
$c->saveConfig('rolesList', 'pageSize','',$_SESSION['USER_LOGGED']);
echo '{success: true}';
break;
default: echo 'default'; default: echo 'default';
} }

View File

@@ -46,46 +46,20 @@
$G_ID_MENU_SELECTED = 'USERS'; $G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'ROLES'; $G_ID_SUB_MENU_SELECTED = 'ROLES';
// require_once (PATH_RBAC . "model/RolesPeer.php");
// G::LoadClass('ArrayPeer');
// $aRoles = $RBAC->getAllRoles();
//
// $fields = Array(
// 'ROL_UID'=>'char',
// 'ROL_PARENT'=>'char',
// 'ROL_SYSTEM'=>'char',
// 'ROL_CREATE_DATE'=>'char',
// 'ROL_UPDATE_DATE'=>'char',
// 'ROL_STATUS'=>'char'
// );
//
// $rows = array_merge(Array($fields), $aRoles);
//
// global $_DBArray;
// $_DBArray['roles'] = $rows;
// $_SESSION['_DBArray'] = $_DBArray;
// $oCriteria = new Criteria('dbarray');
// $oCriteria->setDBArrayTable('roles');
//
// $G_PUBLISH = new Publisher;
// $G_PUBLISH->AddContent('propeltable', 'paged-table', 'roles/roles_List', $oCriteria);
//
// G::RenderPage('publish','blank');
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher;
G::LoadClass('configuration');
$c = new Configurations();
$configPage = $c->getConfiguration('rolesList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton();
//$oHeadPublisher->usingExtJs('ux/Ext.ux.fileUploadField'); //$oHeadPublisher->usingExtJs('ux/Ext.ux.fileUploadField');
$oHeadPublisher->addExtJsScript('roles/rolesList', false); //adding a javascript file .js $oHeadPublisher->addExtJsScript('roles/rolesList', false); //adding a javascript file .js
$oHeadPublisher->addContent('roles/rolesList'); //adding a html file .html. $oHeadPublisher->addContent('roles/rolesList'); //adding a html file .html.
$oHeadPublisher->assign('FORMATS',$c->getFormats());
$labels = G::getTranslations(Array('ID_PRO_CREATE_DATE','ID_CODE','ID_NAME','ID_LAN_UPDATE_DATE', 'ID_ROLES', $oHeadPublisher->assign('CONFIG', $Config);
'ID_USERS','ID_PERMISSIONS','ID_EDIT','ID_DELETE','ID_NEW','ID_STATUS','ID_SAVE','ID_CLOSE',
'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_SEARCH','ID_ENTER_SEARCH_TERM','ID_SELECT_STATUS','ID_CREATE_ROLE_TITLE','ID_EDIT_ROLE_TITLE'));
$oHeadPublisher->assign('TRANSLATIONS', $labels);
G::RenderPage('publish', 'extJs'); G::RenderPage('publish', 'extJs');
?> ?>

View File

@@ -235,28 +235,39 @@ try {
break; break;
case 'authSources': case 'authSources':
$criteria = $RBAC->getAllAuthSources(); $criteria = $RBAC->getAllAuthSources();
$objects = AuthenticationSourcePeer::doSelectRS($criteria); $objects = AuthenticationSourcePeer::doSelectRS($criteria);
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); $objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
$started = Array(); $started = Array();
$started['AUTH_SOURCE_UID'] = '00000000000000000000000000000000'; $started['AUTH_SOURCE_UID'] = '00000000000000000000000000000000';
$started['AUTH_SOURCE_NAME'] = 'ProcessMaker'; //$started['AUTH_SOURCE_NAME'] = 'ProcessMaker';
$started['AUTH_SOURCE_TYPE'] = 'MYSQL'; //$started['AUTH_SOURCE_TYPE'] = 'MYSQL';
$started['AUTH_SOURCE_SHOW'] = 'ProcessMaker (MYSQL)';
$arr = Array(); $arr = Array();
$arr[] = $started; $arr[] = $started;
while ($objects->next()){ while ($objects->next()){
$arr[] = $objects->getRow(); $row = $objects->getRow();
$aux = Array();
$aux['AUTH_SOURCE_UID'] = $row['AUTH_SOURCE_UID'];
//$aux['AUTH_SOURCE_NAME'] = $row['AUTH_SOURCE_NAME'];
//$aux['AUTH_SOURCE_TYPE'] = $row['AUTH_SOURCE_TYPE'];
$aux['AUTH_SOURCE_SHOW'] = $row['AUTH_SOURCE_NAME'].' ('.$row['AUTH_SOURCE_PROVIDER'].')';
$arr[] = $aux;
} }
echo '{sources: '.G::json_encode($arr).'}'; echo '{sources: '.G::json_encode($arr).'}';
break; break;
case 'loadAuthSourceByUID': case 'loadAuthSourceByUID':
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oCriteria=$RBAC->load($_POST['uUID']); $oCriteria=$RBAC->load($_POST['uUID']);
$UID_AUTH = $oCriteria['UID_AUTH_SOURCE']; $UID_AUTH = $oCriteria['UID_AUTH_SOURCE'];
if (($UID_AUTH!='00000000000000000000000000000000')&&($UID_AUTH!='')){ if (($UID_AUTH!='00000000000000000000000000000000')&&($UID_AUTH!='')){
$aFields = $RBAC->getAuthSource($UID_AUTH); $aux = $RBAC->getAuthSource($UID_AUTH);
$arr = Array();
$arr['AUTH_SOURCE_NAME'] = $aux['AUTH_SOURCE_NAME'].' ('.$aux['AUTH_SOURCE_PROVIDER'].')';
$arr['AUTH_SOURCE_PROVIDER'] = $aux['AUTH_SOURCE_PROVIDER'];
$aFields = $arr;
}else{ }else{
$arr = Array(); $arr = Array();
$arr['AUTH_SOURCE_NAME'] = 'ProcessMaker'; $arr['AUTH_SOURCE_NAME'] = 'ProcessMaker (MYSQL)';
$arr['AUTH_SOURCE_PROVIDER'] = 'MYSQL'; $arr['AUTH_SOURCE_PROVIDER'] = 'MYSQL';
$aFields = $arr; $aFields = $arr;
} }
@@ -291,28 +302,27 @@ try {
echo '{success: true}'; echo '{success: true}';
break; break;
case 'usersList': case 'usersList':
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
require_once 'classes/model/LoginLog.php'; require_once 'classes/model/LoginLog.php';
require_once 'classes/model/Department.php'; require_once 'classes/model/Department.php';
require_once 'classes/model/AppCacheView.php'; require_once 'classes/model/AppCacheView.php';
G::LoadClass('configuration'); G::LoadClass('configuration');
$co = new Configurations(); $co = new Configurations();
$config = $co->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']); $config = $co->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']);
$env = $co->getConfiguration('ENVIRONMENT_SETTINGS', ''); $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
$limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20; $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size; $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
$filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : ''; $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn('COUNT(*) AS CNT'); $oCriteria->addSelectColumn('COUNT(*) AS CNT');
if ($filter != ''){ if ($filter != ''){
$cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( $cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( $oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE))); $oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)));
$oCriteria->add($cc); $oCriteria->add($cc);
} }
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN); $oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
$oDataset = UsersPeer::DoSelectRs ($oCriteria); $oDataset = UsersPeer::DoSelectRs ($oCriteria);
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
$oDataset->next(); $oDataset->next();
$row = $oDataset->getRow(); $row = $oDataset->getRow();
@@ -351,18 +361,14 @@ try {
$Department = new Department(); $Department = new Department();
$aDepart = $Department->getAllDepartmentsByUser(); $aDepart = $Department->getAllDepartmentsByUser();
$dateFormat = $env['dateFormat'];
$rows = Array(); $rows = Array();
while($oDataset->next()){ while($oDataset->next()){
$rows[] = $oDataset->getRow(); $rows[] = $oDataset->getRow();
$index = sizeof($rows) - 1; $index = sizeof($rows) - 1;
$rows[$index]['DUE_DATE_OK'] = (date('Y-m-d')>date('Y-m-d',strtotime($rows[$index]['USR_DUE_DATE'])))? 0 : 1; $rows[$index]['DUE_DATE_OK'] = (date('Y-m-d')>date('Y-m-d',strtotime($rows[$index]['USR_DUE_DATE'])))? 0 : 1;
$rows[$index]['LAST_LOGIN'] = isset($aLogin[$rows[$index]['USR_UID']]) ? $aLogin[$rows[$index]['USR_UID']] : ''; $rows[$index]['LAST_LOGIN'] = isset($aLogin[$rows[$index]['USR_UID']]) ? $aLogin[$rows[$index]['USR_UID']] : '';
$rows[$index]['TOTAL_CASES'] = isset($aCases[$rows[$index]['USR_UID']]) ? $aCases[$rows[$index]['USR_UID']] : 0; $rows[$index]['TOTAL_CASES'] = isset($aCases[$rows[$index]['USR_UID']]) ? $aCases[$rows[$index]['USR_UID']] : 0;
$rows[$index]['DEP_TITLE'] = isset($aDepart[$rows[$index]['USR_UID']]) ? $aDepart[$rows[$index]['USR_UID']] : ''; $rows[$index]['DEP_TITLE'] = isset($aDepart[$rows[$index]['USR_UID']]) ? $aDepart[$rows[$index]['USR_UID']] : '';
$rows[$index]['LAST_LOGIN'] = ($rows[$index]['LAST_LOGIN'] != '') ? date($dateFormat,strtotime($rows[$index]['LAST_LOGIN'])) : $rows[$index]['LAST_LOGIN'];
$rows[$index]['USR_DUE_DATE'] = ($rows[$index]['USR_DUE_DATE'] != '') ? date($dateFormat,strtotime($rows[$index]['USR_DUE_DATE'])) : $rows[$index]['USR_DUE_DATE'];
} }
echo '{users: '.G::json_encode($rows).', total_users: '.$totalRows.'}'; echo '{users: '.G::json_encode($rows).', total_users: '.$totalRows.'}';
break; break;

View File

@@ -67,4 +67,8 @@ $oHeadPublisher->addExtJsScript('users/usersList', false); //adding a javascr
$oHeadPublisher->addContent('users/usersList'); //adding a html file .html. $oHeadPublisher->addContent('users/usersList'); //adding a html file .html.
$oHeadPublisher->assign('CONFIG', $Config); $oHeadPublisher->assign('CONFIG', $Config);
G::LoadClass('configuration');
$c = new Configurations();
$oHeadPublisher->assign('FORMATS',$c->getFormats());
G::RenderPage('publish', 'extJs'); G::RenderPage('publish', 'extJs');

View File

@@ -48,63 +48,59 @@ var cmodel;
var infoGrid; var infoGrid;
var viewport; var viewport;
var smodel; var smodel;
var newButton; var newButton;
var editButton; var editButton;
var deleteButton; var deleteButton;
var usersButton; var usersButton;
var permissionsButton; var permissionsButton;
var searchButton; var searchButton;
var serachText; var serachText;
var newForm; var newForm;
var comboStatusStore; var comboStatusStore;
var editForm; var editForm;
var contextMenu; var contextMenu;
var w; var w;
Ext.onReady(function(){ Ext.onReady(function(){
Ext.QuickTips.init(); Ext.QuickTips.init();
pageSize = parseInt(CONFIG.pageSize);
newButton = new Ext.Action({ newButton = new Ext.Action({
text: TRANSLATIONS.ID_NEW, text: _('ID_NEW'),
iconCls: 'button_menu_ext ss_sprite ss_add', iconCls: 'button_menu_ext ss_sprite ss_add',
handler: NewRoleWindow handler: NewRoleWindow
}); });
editButton = new Ext.Action({ editButton = new Ext.Action({
text: TRANSLATIONS.ID_EDIT, text: _('ID_EDIT'),
iconCls: 'button_menu_ext ss_sprite ss_pencil', iconCls: 'button_menu_ext ss_sprite ss_pencil',
handler: EditRole, handler: EditRole,
disabled: true disabled: true
}); });
deleteButton = new Ext.Action({ deleteButton = new Ext.Action({
text: TRANSLATIONS.ID_DELETE, text: _('ID_DELETE'),
iconCls: 'button_menu_ext ss_sprite ss_delete', iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: CanDeleteRole, handler: CanDeleteRole,
disabled: true disabled: true
}); });
usersButton = new Ext.Action({ usersButton = new Ext.Action({
text: TRANSLATIONS.ID_USERS, text: _('ID_USERS'),
iconCls: 'button_menu_ext ss_sprite ss_user_add', iconCls: 'button_menu_ext ss_sprite ss_user_add',
handler: RolesUserPage, handler: RolesUserPage,
disabled: true disabled: true
}); });
permissionsButton = new Ext.Action({ permissionsButton = new Ext.Action({
text: TRANSLATIONS.ID_PERMISSIONS, text: _('ID_PERMISSIONS'),
iconCls: 'button_menu_ext ss_sprite ss_key_add', iconCls: 'button_menu_ext ss_sprite ss_key_add',
handler: RolesPermissionPage, handler: RolesPermissionPage,
disabled: true disabled: true
}); });
searchButton = new Ext.Action({ searchButton = new Ext.Action({
text: TRANSLATIONS.ID_SEARCH, text: _('ID_SEARCH'),
handler: DoSearch handler: DoSearch
}); });
@@ -117,7 +113,7 @@ Ext.onReady(function(){
ctCls:'pm_search_text_field', ctCls:'pm_search_text_field',
allowBlank: true, allowBlank: true,
width: 150, width: 150,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,//'enter search term', emptyText: _('ID_ENTER_SEARCH_TERM'),//'enter search term',
listeners: { listeners: {
specialkey: function(f,e){ specialkey: function(f,e){
if (e.getKey() == e.ENTER) { if (e.getKey() == e.ENTER) {
@@ -139,18 +135,18 @@ Ext.onReady(function(){
comboStatusStore = new Ext.data.SimpleStore({ comboStatusStore = new Ext.data.SimpleStore({
fields: ['id','value'], fields: ['id','value'],
data: [['1',TRANSLATIONS.ID_ACTIVE],['0',TRANSLATIONS.ID_INACTIVE]] data: [['1',_('ID_ACTIVE')],['0',_('ID_INACTIVE')]]
}); });
newForm = new Ext.FormPanel({ newForm = new Ext.FormPanel({
url: 'roles_Ajax?request=saveNewRole', url: 'roles_Ajax?request=saveNewRole',
frame: true, frame: true,
items:[ items:[
{xtype: 'textfield', fieldLabel: TRANSLATIONS.ID_CODE, name: 'code', width: 250, allowBlank: false}, {xtype: 'textfield', fieldLabel: _('ID_CODE'), name: 'code', width: 250, allowBlank: false},
{xtype: 'textfield', fieldLabel: TRANSLATIONS.ID_NAME, name: 'name', width: 200, allowBlank: false}, {xtype: 'textfield', fieldLabel: _('ID_NAME'), name: 'name', width: 200, allowBlank: false},
{ {
xtype: 'combo', xtype: 'combo',
fieldLabel: TRANSLATIONS.ID_STATUS, fieldLabel: _('ID_STATUS'),
hiddenName: 'status', hiddenName: 'status',
typeAhead: true, typeAhead: true,
mode: 'local', mode: 'local',
@@ -159,13 +155,14 @@ Ext.onReady(function(){
valueField:'id', valueField:'id',
allowBlank: false, allowBlank: false,
triggerAction: 'all', triggerAction: 'all',
emptyText: TRANSLATIONS.ID_SELECT_STATUS, emptyText: _('ID_SELECT_STATUS'),
selectOnFocus:true selectOnFocus:true
} }
], ],
buttons: [ buttons: [
{text: TRANSLATIONS.ID_CLOSE, handler: CloseWindow}, {text: _('ID_SAVE'), handler: SaveNewRole},
{text: TRANSLATIONS.ID_SAVE, handler: SaveNewRole} {text: _('ID_CANCEL'), handler: CloseWindow}
] ]
}); });
@@ -174,11 +171,11 @@ Ext.onReady(function(){
frame: true, frame: true,
items:[ items:[
{xtype: 'textfield', name: 'rol_uid', hidden: true }, {xtype: 'textfield', name: 'rol_uid', hidden: true },
{xtype: 'textfield', fieldLabel: TRANSLATIONS.ID_CODE, name: 'code', width: 250, allowBlank: false}, {xtype: 'textfield', fieldLabel: _('ID_CODE'), name: 'code', width: 250, allowBlank: false},
{xtype: 'textfield', fieldLabel: TRANSLATIONS.ID_NAME, name: 'name', width: 200, allowBlank: false}, {xtype: 'textfield', fieldLabel: _('ID_NAME'), name: 'name', width: 200, allowBlank: false},
{ {
xtype: 'combo', xtype: 'combo',
fieldLabel: TRANSLATIONS.ID_STATUS, fieldLabel: _('ID_STATUS'),
hiddenName: 'status', hiddenName: 'status',
typeAhead: true, typeAhead: true,
mode: 'local', mode: 'local',
@@ -187,13 +184,13 @@ Ext.onReady(function(){
valueField:'id', valueField:'id',
allowBlank: false, allowBlank: false,
triggerAction: 'all', triggerAction: 'all',
emptyText: TRANSLATIONS.ID_SELECT_STATUS, emptyText: _('ID_SELECT_STATUS'),
selectOnFocus:true selectOnFocus:true
} }
], ],
buttons: [ buttons: [
{text: TRANSLATIONS.ID_CLOSE, handler: CloseWindow}, {text: _('ID_SAVE'), handler: UpdateRole},
{text: TRANSLATIONS.ID_SAVE, handler: UpdateRole} {text: _('ID_CANCEL'), handler: CloseWindow}
] ]
}); });
@@ -217,17 +214,19 @@ Ext.onReady(function(){
store = new Ext.data.GroupingStore( { store = new Ext.data.GroupingStore( {
proxy : new Ext.data.HttpProxy({ proxy : new Ext.data.HttpProxy({
url: 'data_rolesList' url: 'roles_Ajax?request=rolesList'
}), }),
reader : new Ext.data.JsonReader( { reader : new Ext.data.JsonReader( {
root: 'roles', root: 'roles',
totalProperty: 'total_roles',
fields : [ fields : [
{name : 'ROL_UID'}, {name : 'ROL_UID'},
{name : 'ROL_CODE'}, {name : 'ROL_CODE'},
{name : 'ROL_NAME'}, {name : 'ROL_NAME'},
{name : 'ROL_CREATE_DATE'}, {name : 'ROL_CREATE_DATE'},
{name : 'ROL_UPDATE_DATE'}, {name : 'ROL_UPDATE_DATE'},
{name : 'ROL_STATUS'} {name : 'ROL_STATUS'},
{name : 'TOTAL_USERS'}
] ]
}) })
}); });
@@ -239,14 +238,50 @@ Ext.onReady(function(){
}, },
columns: [ columns: [
{id:'ROL_UID', dataIndex: 'ROL_UID', hidden:true, hideable:false}, {id:'ROL_UID', dataIndex: 'ROL_UID', hidden:true, hideable:false},
{header: TRANSLATIONS.ID_CODE, dataIndex: 'ROL_CODE', width: 60, align:'left'}, {header: _('ID_CODE'), dataIndex: 'ROL_CODE', width: 220, align:'left'},
{header: TRANSLATIONS.ID_NAME, dataIndex: 'ROL_NAME', width: 60, hidden:false, align:'left'}, {header: _('ID_NAME'), dataIndex: 'ROL_NAME', width: 180, hidden:false, align:'left'},
{header: TRANSLATIONS.ID_STATUS, dataIndex: 'ROL_STATUS', width: 20, hidden: false, align: 'center', renderer: status_role}, {header: _('ID_STATUS'), dataIndex: 'ROL_STATUS', width: 80, hidden: false, align: 'center', renderer: status_role},
{header: TRANSLATIONS.ID_PRO_CREATE_DATE, dataIndex: 'ROL_CREATE_DATE', width: 40, hidden:false, align:'center'}, {header: _('ID_USERS'), dataIndex: 'TOTAL_USERS', width: 50, hidden: false, align: 'center'},
{header: TRANSLATIONS.ID_LAN_UPDATE_DATE, dataIndex: 'ROL_UPDATE_DATE', width: 40, hidden:false, align:'center'} {header: _('ID_PRO_CREATE_DATE'), dataIndex: 'ROL_CREATE_DATE', width: 100, hidden:false, align:'center', renderer: render_date},
{header: _('ID_LAN_UPDATE_DATE'), dataIndex: 'ROL_UPDATE_DATE', width: 100, hidden:false, align:'center', renderer: render_date}
] ]
}); });
storePageSize = new Ext.data.SimpleStore({
fields: ['size'],
data: [['20'],['30'],['40'],['50'],['100']],
autoLoad: true
});
comboPageSize = new Ext.form.ComboBox({
typeAhead : false,
mode : 'local',
triggerAction : 'all',
store: storePageSize,
valueField: 'size',
displayField: 'size',
width: 50,
editable: false,
listeners:{
select: function(c,d,i){
UpdatePageConfig(d.data['size']);
bbarpaging.pageSize = parseInt(d.data['size']);
bbarpaging.moveFirst();
}
}
});
comboPageSize.setValue(pageSize);
bbarpaging = new Ext.PagingToolbar({
pageSize: pageSize,
store: store,
displayInfo: true,
displayMsg: _('ID_GRID_PAGE_DISPLAYING_ROLES_MESSAGE') + '&nbsp; &nbsp; ',
emptyMsg: _('ID_GRID_PAGE_NO_ROLES_MESSAGE'),
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
});
infoGrid = new Ext.grid.GridPanel({ infoGrid = new Ext.grid.GridPanel({
region: 'center', region: 'center',
layout: 'fit', layout: 'fit',
@@ -263,11 +298,12 @@ Ext.onReady(function(){
viewConfig: { viewConfig: {
forceFit:true forceFit:true
}, },
title : TRANSLATIONS.ID_ROLES, title : _('ID_ROLES'),
store: store, store: store,
cm: cmodel, cm: cmodel,
sm: smodel, sm: smodel,
tbar: [newButton, '-', editButton, deleteButton,'-',usersButton, permissionsButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton], tbar: [newButton, '-', editButton, deleteButton,'-',usersButton, permissionsButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton],
bbar: bbarpaging,
listeners: { listeners: {
rowdblclick: EditRole rowdblclick: EditRole
}, },
@@ -310,26 +346,26 @@ onMessageContextMenu = function (grid, rowIndex, e) {
e.stopEvent(); e.stopEvent();
var coords = e.getXY(); var coords = e.getXY();
contextMenu.showAt([coords[0], coords[1]]); contextMenu.showAt([coords[0], coords[1]]);
} };
//Do Nothing Function //Do Nothing Function
DoNothing = function(){} DoNothing = function(){};
//Open New Role Form //Open New Role Form
NewRoleWindow = function(){ NewRoleWindow = function(){
w = new Ext.Window({ w = new Ext.Window({
title: TRANSLATIONS.ID_CREATE_ROLE_TITLE, title: _('ID_CREATE_ROLE_TITLE'),
autoHeight: true, autoHeight: true,
width: 420, width: 420,
items: [newForm] items: [newForm]
}); });
w.show(); w.show();
} };
//Close Popup Window //Close Popup Window
CloseWindow = function(){ CloseWindow = function(){
w.hide(); w.hide();
} };
//Save New Role //Save New Role
SaveNewRole = function(){ SaveNewRole = function(){
@@ -339,7 +375,7 @@ SaveNewRole = function(){
newForm.getForm().reset(); //Set empty form to next use newForm.getForm().reset(); //Set empty form to next use
searchText.reset(); searchText.reset();
infoGrid.store.load(); //Reload store grid infoGrid.store.load(); //Reload store grid
Ext.Msg.alert(TRANSLATIONS.ID_ROLES,TRANSLATIONS.ID_ROLES_SUCCESS_NEW); PMExt.notify(_('ID_ROLES'),_('ID_ROLES_SUCCESS_NEW'));
}, },
failure: function(f,a){ failure: function(f,a){
switch(a.failureType){ switch(a.failureType){
@@ -349,7 +385,7 @@ SaveNewRole = function(){
} }
} }
}); });
} };
//Update Selected Role //Update Selected Role
UpdateRole = function(){ UpdateRole = function(){
@@ -359,7 +395,7 @@ UpdateRole = function(){
DoSearch(); //Reload store grid DoSearch(); //Reload store grid
editButton.disable(); //Disable Edit Button editButton.disable(); //Disable Edit Button
deleteButton.disable(); //Disable Delete Button deleteButton.disable(); //Disable Delete Button
Ext.Msg.alert(TRANSLATIONS.ID_ROLES,TRANSLATIONS.ID_ROLES_SUCCESS_UPDATE); PMExt.notify(_('ID_ROLES'),_('ID_ROLES_SUCCESS_UPDATE'));
}, },
failure: function(f,a){ failure: function(f,a){
switch(a.failureType){ switch(a.failureType){
@@ -370,14 +406,14 @@ UpdateRole = function(){
} }
}); });
} };
//Edit Selected Role //Edit Selected Role
EditRole = function(){ EditRole = function(){
rowSelected = infoGrid.getSelectionModel().getSelected(); rowSelected = infoGrid.getSelectionModel().getSelected();
if (rowSelected){ if (rowSelected){
if (rowSelected.data.ROL_UID == '00000000000000000000000000000002'){ if (rowSelected.data.ROL_UID == '00000000000000000000000000000002'){
Ext.Msg.alert(TRANSLATIONS.ID_ROLES,TRANSLATIONS.ID_ROLES_MSG); PMExt.warning(_('ID_ROLES'),_('ID_ROLES_MSG'));
}else{ }else{
editForm.getForm().findField('rol_uid').setValue(rowSelected.data.ROL_UID); editForm.getForm().findField('rol_uid').setValue(rowSelected.data.ROL_UID);
editForm.getForm().findField('code').setValue(rowSelected.data.ROL_CODE); editForm.getForm().findField('code').setValue(rowSelected.data.ROL_CODE);
@@ -386,52 +422,56 @@ EditRole = function(){
w = new Ext.Window({ w = new Ext.Window({
autoHeight: true, autoHeight: true,
width: 420, width: 420,
title: TRANSLATIONS.ID_EDIT_ROLE_TITLE, title: _('ID_EDIT_ROLE_TITLE'),
items: [editForm] items: [editForm]
}); });
w.show(); w.show();
} }
} }
} };
//Check Can Delete Role //Check Can Delete Role
CanDeleteRole = function(){ CanDeleteRole = function(){
rowSelected = infoGrid.getSelectionModel().getSelected(); rowSelected = infoGrid.getSelectionModel().getSelected();
if (rowSelected){ if (rowSelected){
var swDelete = false; var swDelete = false;
viewport.getEl().mask(_('ID_PROCESSING'));
Ext.Ajax.request({ Ext.Ajax.request({
url: 'roles_Ajax', url: 'roles_Ajax',
success: function(response, opts){ success: function(response, opts){
viewport.getEl().unmask();
swDelete = (response.responseText=='true') ? true : false; swDelete = (response.responseText=='true') ? true : false;
if (swDelete){ if (swDelete){
Ext.Msg.confirm(TRANSLATIONS.ID_CONFIRM, TRANSLATIONS.ID_REMOVE_ROLE, Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_REMOVE_ROLE'),
function(btn, text){ function(btn, text){
if (btn=="yes"){ if (btn=="yes"){
viewport.getEl().mask(_('ID_PROCESSING'));
Ext.Ajax.request({ Ext.Ajax.request({
url: 'roles_Ajax', url: 'roles_Ajax',
params: {request: 'deleteRole', ROL_UID: rowSelected.data.ROL_UID}, params: {request: 'deleteRole', ROL_UID: rowSelected.data.ROL_UID},
success: function(r,o){ success: function(r,o){
viewport.getEl().unmask();
infoGrid.store.load(); //Reload store grid infoGrid.store.load(); //Reload store grid
editButton.disable(); //Disable Edit Button editButton.disable(); //Disable Edit Button
deleteButton.disable(); //Disable Delete Button deleteButton.disable(); //Disable Delete Button
usersButton.disable(); //Disable Delete Button usersButton.disable(); //Disable Delete Button
permissionsButton.disable(); //Disable Delete Button permissionsButton.disable(); //Disable Delete Button
Ext.Msg.alert(TRANSLATIONS.ID_ROLES,TRANSLATIONS.ID_ROLES_SUCCESS_DELETE); PMExt.notify(_('ID_ROLES'),_('ID_ROLES_SUCCESS_DELETE'));
}, },
failure: DoNothing failure: function(){viewport.getEl().unmask(); DoNothing();}
}); });
} }
}); });
}else{ }else{
Ext.Msg.alert(TRANSLATIONS.ID_ROLES,TRANSLATIONS.ID_ROLES_CAN_NOT_DELETE); PMExt.error(_('ID_ROLES'),_('ID_ROLES_CAN_NOT_DELETE'));
} }
}, },
failure: DoNothing, failure: function(){viewport.getEl().unmask(); DoNothing();},
params: {request: 'canDeleteRole', ROL_UID: rowSelected.data.ROL_UID} params: {request: 'canDeleteRole', ROL_UID: rowSelected.data.ROL_UID}
}); });
} }
} };
//Open User-Roles Manager //Open User-Roles Manager
@@ -442,7 +482,7 @@ RolesUserPage = function(value){
value = rowSelected.data.ROL_UID; value = rowSelected.data.ROL_UID;
location.href = 'rolesUsersPermission?rUID=' + value + '&tab=users'; location.href = 'rolesUsersPermission?rUID=' + value + '&tab=users';
} }
} };
//Open Permission-Roles Manager //Open Permission-Roles Manager
@@ -453,20 +493,38 @@ RolesPermissionPage = function(value){
value = rowSelected.data.ROL_UID; value = rowSelected.data.ROL_UID;
location.href = 'rolesUsersPermission?rUID=' + value + '&tab=permissions'; location.href = 'rolesUsersPermission?rUID=' + value + '&tab=permissions';
} }
} };
//Renderer Active/Inactive Role //Renderer Active/Inactive Role
status_role = function(value){ status_role = function(value){
return (value==1) ? TRANSLATIONS.ID_ACTIVE : TRANSLATIONS.ID_INACTIVE; var aux;
} switch(value){
case '1': aux = '<font color="green">' + _('ID_ACTIVE') + '</font>'; break;
case '0': aux = '<font color="red">'+ _('ID_INACTIVE') + '</font>'; break;
}
return aux;
};
//Load Grid By Default //Load Grid By Default
GridByDefault = function(){ GridByDefault = function(){
searchText.reset(); searchText.reset();
infoGrid.store.load(); infoGrid.store.load();
} };
//Do Search Function //Do Search Function
DoSearch = function(){ DoSearch = function(){
infoGrid.store.load({params: {textFilter: searchText.getValue()}}); infoGrid.store.load({params: {textFilter: searchText.getValue()}});
} };
//Render Date Function
render_date = function(v){
return _DF(v);
};
//Update Page Size Configuration
UpdatePageConfig = function(pageSize){
Ext.Ajax.request({
url: 'roles_Ajax',
params: {request:'updatePageSize', size: pageSize}
});
};

View File

@@ -63,61 +63,61 @@ Ext.onReady(function(){
sw_func_permissions = false; sw_func_permissions = false;
sw_func_users = false; sw_func_users = false;
// assignButton = new Ext.Action({ editPermissionsButton = new Ext.Action({
// text: TRANSLATIONS.ID_ASSIGN, text: _('ID_EDIT_PERMISSIONS'),
// iconCls: 'button_menu_ext ss_sprite ss_add', iconCls: 'button_menu_ext ss_sprite ss_key_add',
// handler: AssignPermissionAction, handler: EditPermissionsAction
// disabled: true });
// });
cancelEditPermissionsButton = new Ext.Action({
text: _('ID_FINISH_EDITION'),
iconCls: 'button_menu_ext ss_sprite ss_cancel',
handler: CancelEditPermissionsAction,
hidden: true
});
editPermissionsUButton = new Ext.Action({
text: _('ID_EDIT_USERS'),
iconCls: 'button_menu_ext ss_sprite ss_user_add',
handler: EditPermissionsActionU
});
cancelEditPermissionsUButton = new Ext.Action({
text: _('ID_FINISH_EDITION'),
iconCls: 'button_menu_ext ss_sprite ss_cancel',
handler: CancelEditPermissionsActionU,
hidden: true
});
assignAllButton = new Ext.Action({
text: TRANSLATIONS.ID_ASSIGN_ALL_PERMISSIONS,
iconCls: 'button_menu_ext ss_sprite ss_add',
handler: AssignAllPermissionsAction
});
// 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,
iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: RemoveAllPermissionsAction,
disabled: (ROLES.ROL_UID==pm_admin) ? true : false
});
// assignUButton = new Ext.Action({ // assignUButton = new Ext.Action({
// text: TRANSLATIONS.ID_ASSIGN, // text: _('ID_ASSIGN,
// iconCls: 'button_menu_ext ss_sprite ss_add', // iconCls: 'button_menu_ext ss_sprite ss_add',
// handler: AssignUserAction, // handler: AssignUserAction,
// disabled: true // disabled: true
// }); // });
assignUAllButton = new Ext.Action({ // assignUAllButton = new Ext.Action({
text: TRANSLATIONS.ID_ASSIGN_ALL_USERS, // text: _('ID_ASSIGN_ALL_USERS'),
iconCls: 'button_menu_ext ss_sprite ss_add', // iconCls: 'button_menu_ext ss_sprite ss_add',
handler: AssignAllUsersAction // handler: AssignAllUsersAction
}); // });
// removeUButton = new Ext.Action({ // removeUButton = new Ext.Action({
// text: TRANSLATIONS.ID_REMOVE, // text: _('ID_REMOVE,
// iconCls: 'button_menu_ext ss_sprite ss_delete', // iconCls: 'button_menu_ext ss_sprite ss_delete',
// handler: RemoveUserAction, // handler: RemoveUserAction,
// disabled: true // disabled: true
// }); // });
removeUAllButton = new Ext.Action({ // removeUAllButton = new Ext.Action({
text: TRANSLATIONS.ID_REMOVE_ALL_USERS, // text: _('ID_REMOVE_ALL_USERS'),
iconCls: 'button_menu_ext ss_sprite ss_delete', // iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: RemoveAllUsersAction // handler: RemoveAllUsersAction
}); // });
backButton = new Ext.Action({ backButton = new Ext.Action({
text: TRANSLATIONS.ID_BACK, text: _('ID_BACK'),
iconCls: 'button_menu_ext ss_sprite ss_arrow_redo', iconCls: 'button_menu_ext ss_sprite ss_arrow_redo',
handler: BackToRoles handler: BackToRoles
}); });
@@ -159,7 +159,7 @@ Ext.onReady(function(){
}, },
columns: [ columns: [
{id:'PER_UID', dataIndex: 'PER_UID', hidden:true, hideable:false}, {id:'PER_UID', dataIndex: 'PER_UID', hidden:true, hideable:false},
{header: TRANSLATIONS.ID_PERMISSION_CODE, dataIndex: 'PER_CODE', width: 60, align:'left'} {header: _('ID_PERMISSION_CODE'), dataIndex: 'PER_CODE', width: 60, align:'left'}
] ]
}); });
@@ -192,7 +192,7 @@ Ext.onReady(function(){
ctCls:'pm_search_text_field', ctCls:'pm_search_text_field',
allowBlank: true, allowBlank: true,
width: 110, width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM, emptyText: _('ID_ENTER_SEARCH_TERM'),
listeners: { listeners: {
specialkey: function(f,e){ specialkey: function(f,e){
if (e.getKey() == e.ENTER) { if (e.getKey() == e.ENTER) {
@@ -213,7 +213,7 @@ Ext.onReady(function(){
ctCls:'pm_search_text_field', ctCls:'pm_search_text_field',
allowBlank: true, allowBlank: true,
width: 110, width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM, emptyText: _('ID_ENTER_SEARCH_TERM'),
listeners: { listeners: {
specialkey: function(f,e){ specialkey: function(f,e){
if (e.getKey() == e.ENTER) { if (e.getKey() == e.ENTER) {
@@ -250,9 +250,10 @@ Ext.onReady(function(){
frame : false, frame : false,
columnLines : false, columnLines : false,
viewConfig : {forceFit:true}, viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_AVAILABLE_PERMISSIONS,{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA], tbar: [_('ID_AVAILABLE_PERMISSIONS'),{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA],
bbar: [{xtype: 'tbfill'}, assignAllButton], //bbar: [{xtype: 'tbfill'}, assignAllButton],
listeners: {rowdblclick: AssignPermissionAction} listeners: {rowdblclick: AssignPermissionAction},
hidden: true
}); });
assignedGrid = new Ext.grid.GridPanel({ assignedGrid = new Ext.grid.GridPanel({
@@ -275,9 +276,10 @@ Ext.onReady(function(){
frame : false, frame : false,
columnLines : false, columnLines : false,
viewConfig : {forceFit:true}, viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_ASSIGNED_PERMISSIONS,{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP], tbar: [_('ID_ASSIGNED_PERMISSIONS'),{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP],
bbar: [{xtype: 'tbfill'},removeAllButton], //bbar: [{xtype: 'tbfill'},removeAllButton],
listeners: {rowdblclick: RemovePermissionAction} listeners: {rowdblclick: function(){
(availableGrid.hidden)? DoNothing() :RemovePermissionAction();}}
}); });
buttonsPanel = new Ext.Panel({ buttonsPanel = new Ext.Panel({
@@ -290,22 +292,26 @@ Ext.onReady(function(){
}, },
defaults:{margins:'0 0 35 0'}, defaults:{margins:'0 0 35 0'},
items:[ items:[
{xtype:'button',text: '>>', handler: AssignPermissionAction, id: 'assignButton', disabled: true}, {xtype:'button',text: '>', handler: AssignPermissionAction, id: 'assignButton', disabled: true},
{xtype:'button',text: '<<', handler: RemovePermissionAction, id: 'removeButton', disabled: true} {xtype:'button',text: '<', handler: RemovePermissionAction, id: 'removeButton', disabled: true},
] {xtype:'button',text: '>>', handler: AssignAllPermissionsAction, id: 'assignButtonAll', disabled: false},
{xtype:'button',text: '<<', handler: RemoveAllPermissionsAction, id: 'removeButtonAll', disabled: (ROLES.ROL_UID==pm_admin) ? true : false}
],
hidden : true
}); });
RefreshPermissions(); RefreshPermissions();
//PERMISSIONS DRAG AND DROP PANEL //PERMISSIONS DRAG AND DROP PANEL
PermissionsPanel = new Ext.Panel({ PermissionsPanel = new Ext.Panel({
title : TRANSLATIONS.ID_PERMISSIONS, title : _('ID_PERMISSIONS'),
autoWidth : true, autoWidth : true,
layout : 'hbox', layout : 'hbox',
defaults : { flex : 1 }, //auto stretch defaults : { flex : 1 }, //auto stretch
layoutConfig : { align : 'stretch' }, layoutConfig : { align : 'stretch' },
items : [availableGrid,buttonsPanel,assignedGrid], items : [availableGrid,buttonsPanel,assignedGrid],
viewConfig : {forceFit:true} viewConfig : {forceFit:true},
bbar: [{xtype: 'tbfill'},editPermissionsButton, cancelEditPermissionsButton]
}); });
@@ -346,9 +352,9 @@ Ext.onReady(function(){
}, },
columns: [ columns: [
{id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false}, {id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false},
{header: TRANSLATIONS.ID_FIRST_NAME, dataIndex: 'USR_FIRSTNAME', width: 60, align:'left'}, {header: _('ID_FIRST_NAME'), dataIndex: 'USR_FIRSTNAME', width: 60, align:'left'},
{header: TRANSLATIONS.ID_LAST_NAME, dataIndex: 'USR_LASTNAME', width: 60, align:'left'}, {header: _('ID_LAST_NAME'), dataIndex: 'USR_LASTNAME', width: 60, align:'left'},
{header: TRANSLATIONS.ID_USER_NAME, dataIndex: 'USR_USERNAME', width: 60, align:'left'} {header: _('ID_USER_NAME'), dataIndex: 'USR_USERNAME', width: 60, align:'left'}
] ]
}); });
@@ -381,7 +387,7 @@ Ext.onReady(function(){
ctCls:'pm_search_text_field', ctCls:'pm_search_text_field',
allowBlank: true, allowBlank: true,
width: 110, width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM, emptyText: _('ID_ENTER_SEARCH_TERM'),
listeners: { listeners: {
specialkey: function(f,e){ specialkey: function(f,e){
if (e.getKey() == e.ENTER) { if (e.getKey() == e.ENTER) {
@@ -402,7 +408,7 @@ Ext.onReady(function(){
ctCls:'pm_search_text_field', ctCls:'pm_search_text_field',
allowBlank: true, allowBlank: true,
width: 110, width: 110,
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM, emptyText: _('ID_ENTER_SEARCH_TERM'),
listeners: { listeners: {
specialkey: function(f,e){ specialkey: function(f,e){
if (e.getKey() == e.ENTER) { if (e.getKey() == e.ENTER) {
@@ -439,9 +445,10 @@ Ext.onReady(function(){
frame : false, frame : false,
columnLines : false, columnLines : false,
viewConfig : {forceFit:true}, viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_AVAILABLE_USERS,{xtype: 'tbfill'},'-',searchTextU, clearTextButtonU], tbar: [_('ID_AVAILABLE_USERS'),{xtype: 'tbfill'},'-',searchTextU, clearTextButtonU],
bbar: [{xtype: 'tbfill'}, assignUAllButton], //bbar: [{xtype: 'tbfill'}, assignUAllButton],
listeners: {rowdblclick: AssignUserAction} listeners: {rowdblclick: AssignUserAction},
hidden : true
}); });
assignedUGrid = new Ext.grid.GridPanel({ assignedUGrid = new Ext.grid.GridPanel({
@@ -464,9 +471,10 @@ Ext.onReady(function(){
frame : false, frame : false,
columnLines : false, columnLines : false,
viewConfig : {forceFit:true}, viewConfig : {forceFit:true},
tbar: [TRANSLATIONS.ID_ASSIGNED_USERS,{xtype: 'tbfill'},'-',searchTextX, clearTextButtonX], tbar: [_('ID_ASSIGNED_USERS'),{xtype: 'tbfill'},'-',searchTextX, clearTextButtonX],
bbar: [{xtype: 'tbfill'},removeUAllButton], //bbar: [{xtype: 'tbfill'},removeUAllButton],
listeners: {rowdblclick: RemoveUserAction} listeners: {rowdblclick: function(){
(availableUGrid.hidden)? DoNothing() : RemoveUserAction();}}
}); });
buttonsUPanel = new Ext.Panel({ buttonsUPanel = new Ext.Panel({
@@ -479,29 +487,33 @@ Ext.onReady(function(){
}, },
defaults:{margins:'0 0 35 0'}, defaults:{margins:'0 0 35 0'},
items:[ items:[
{xtype:'button',text: '>>', handler: AssignUserAction, id: 'assignUButton', disabled: true}, {xtype:'button',text: '>', handler: AssignUserAction, id: 'assignUButton', disabled: true},
{xtype:'button',text: '<<', handler: RemoveUserAction, id: 'removeUButton', disabled: true} {xtype:'button',text: '<', handler: RemoveUserAction, id: 'removeUButton', disabled: true},
] {xtype:'button',text: '>>', handler: AssignAllUsersAction, id: 'assignUButtonAll', disabled: false},
{xtype:'button',text: '<<', handler: RemoveAllUsersAction, id: 'removeUButtonAll', disabled: false}
],
hidden: true
}); });
RefreshUsers(); RefreshUsers();
//PERMISSIONS DRAG AND DROP PANEL //PERMISSIONS DRAG AND DROP PANEL
UsersPanel = new Ext.Panel({ UsersPanel = new Ext.Panel({
title : TRANSLATIONS.ID_USERS, title : _('ID_USERS'),
autoWidth : true, autoWidth : true,
layout : 'hbox', layout : 'hbox',
defaults : { flex : 1 }, //auto stretch defaults : { flex : 1 }, //auto stretch
layoutConfig : { align : 'stretch' }, layoutConfig : { align : 'stretch' },
items : [availableUGrid,buttonsUPanel,assignedUGrid], items : [availableUGrid,buttonsUPanel,assignedUGrid],
viewConfig : {forceFit:true} viewConfig : {forceFit:true},
bbar: [{xtype: 'tbfill'},editPermissionsUButton, cancelEditPermissionsUButton]
}); });
//NORTH PANEL WITH TITLE AND ROLE DETAILS //NORTH PANEL WITH TITLE AND ROLE DETAILS
northPanel = new Ext.Panel({ northPanel = new Ext.Panel({
region: 'north', region: 'north',
xtype: 'panel', xtype: 'panel',
tbar: [TRANSLATIONS.ID_ROLES + ' : ' + ROLES.ROL_CODE,{xtype: 'tbfill'},backButton] tbar: ['<b>'+_('ID_ROLE') + ' : ' + ROLES.ROL_CODE+'</b>',{xtype: 'tbfill'},backButton]
}); });
//TABS PANEL //TABS PANEL
@@ -512,10 +524,10 @@ Ext.onReady(function(){
listeners:{ listeners:{
tabchange: function(p,t){ tabchange: function(p,t){
switch(t.title){ switch(t.title){
case TRANSLATIONS.ID_PERMISSIONS: case _('ID_PERMISSIONS'):
sw_func_permissions ? DoNothing() : DDLoadPermissions(); sw_func_permissions ? DoNothing() : DDLoadPermissions();
break; break;
case TRANSLATIONS.ID_USERS: case _('ID_USERS'):
sw_func_users ? DoNothing() : DDLoadUsers(); sw_func_users ? DoNothing() : DDLoadUsers();
break; break;
} }
@@ -532,12 +544,12 @@ Ext.onReady(function(){
}); });
//Do Nothing Function //Do Nothing Function
DoNothing = function(){} DoNothing = function(){};
//Return to Roles Main Page //Return to Roles Main Page
BackToRoles = function(){ BackToRoles = function(){
location.href = 'roles_List'; location.href = 'roles_List';
} };
//Loads Drag N Drop Functionality for Permissions //Loads Drag N Drop Functionality for Permissions
DDLoadPermissions = function(){ DDLoadPermissions = function(){
@@ -572,7 +584,7 @@ DDLoadPermissions = function(){
} }
}); });
sw_func_permissions = true; sw_func_permissions = true;
} };
DDLoadUsers = function(){ DDLoadUsers = function(){
//USERS DRAG N DROP AVAILABLE //USERS DRAG N DROP AVAILABLE
@@ -605,29 +617,29 @@ DDLoadUsers = function(){
} }
}); });
sw_func_users = true; sw_func_users = true;
} };
//REFRESH PERMISSION GRIDS //REFRESH PERMISSION GRIDS
RefreshPermissions = function(){ RefreshPermissions = function(){
DoSearchA(); DoSearchA();
DoSearchP(); DoSearchP();
} };
//REFRESH USERS GRIDS //REFRESH USERS GRIDS
RefreshUsers = function(){ RefreshUsers = function(){
DoSearchX(); DoSearchX();
DoSearchU(); DoSearchU();
} };
//FAILURE AJAX FUNCTION //FAILURE AJAX FUNCTION
FailureProcess = function(){ FailureProcess = function(){
Ext.Msg.alert({title: TRANSLATIONS.ID_ROLES, msg: TRANSLATIONS.ID_MSG_AJAX_FAILURE}); Ext.Msg.alert(_('ID_ROLES'), _('ID_MSG_AJAX_FAILURE'));
} };
//ASSIGN PERMISSION TO A ROLE //ASSIGN PERMISSION TO A ROLE
SavePermissionsRole = function(arr_per, function_success, function_failure){ SavePermissionsRole = function(arr_per, function_success, function_failure){
var sw_response; var sw_response;
viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING); viewport.getEl().mask(_('ID_PROCESSING'));
Ext.Ajax.request({ Ext.Ajax.request({
url: 'roles_Ajax', url: 'roles_Ajax',
params: {request: 'assignPermissionToRoleMultiple', ROL_UID: ROLES.ROL_UID, PER_UID: arr_per.join(',')}, params: {request: 'assignPermissionToRoleMultiple', ROL_UID: ROLES.ROL_UID, PER_UID: arr_per.join(',')},
@@ -640,12 +652,12 @@ SavePermissionsRole = function(arr_per, function_success, function_failure){
viewport.getEl().unmask(); viewport.getEl().unmask();
} }
}); });
} };
//REMOVE PERMISSION FROM A ROLE //REMOVE PERMISSION FROM A ROLE
DeletePermissionsRole = function(arr_per, function_success, function_failure){ DeletePermissionsRole = function(arr_per, function_success, function_failure){
var sw_response; var sw_response;
viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING); viewport.getEl().mask(_('ID_PROCESSING'));
Ext.Ajax.request({ Ext.Ajax.request({
url: 'roles_Ajax', url: 'roles_Ajax',
params: {request: 'deletePermissionToRoleMultiple', ROL_UID: ROLES.ROL_UID, PER_UID: arr_per.join(',')}, params: {request: 'deletePermissionToRoleMultiple', ROL_UID: ROLES.ROL_UID, PER_UID: arr_per.join(',')},
@@ -658,7 +670,7 @@ DeletePermissionsRole = function(arr_per, function_success, function_failure){
viewport.getEl().unmask(); viewport.getEl().unmask();
} }
}); });
} };
//AssignButton Functionality //AssignButton Functionality
AssignPermissionAction = function(){ AssignPermissionAction = function(){
@@ -668,7 +680,7 @@ AssignPermissionAction = function(){
arrAux[a] = rowsSelected[a].get('PER_UID'); arrAux[a] = rowsSelected[a].get('PER_UID');
} }
SavePermissionsRole(arrAux,RefreshPermissions,FailureProcess); SavePermissionsRole(arrAux,RefreshPermissions,FailureProcess);
} };
//RemoveButton Functionality //RemoveButton Functionality
RemovePermissionAction = function(){ RemovePermissionAction = function(){
@@ -680,7 +692,7 @@ RemovePermissionAction = function(){
} }
DeletePermissionsRole(arrAux,RefreshPermissions,FailureProcess); DeletePermissionsRole(arrAux,RefreshPermissions,FailureProcess);
} }
} };
//AssignALLButton Functionality //AssignALLButton Functionality
AssignAllPermissionsAction = function(){ AssignAllPermissionsAction = function(){
@@ -693,7 +705,7 @@ AssignAllPermissionsAction = function(){
} }
SavePermissionsRole(arrAux,RefreshPermissions,FailureProcess); SavePermissionsRole(arrAux,RefreshPermissions,FailureProcess);
} }
} };
//RevomeALLButton Functionality //RevomeALLButton Functionality
RemoveAllPermissionsAction = function(){ RemoveAllPermissionsAction = function(){
@@ -706,12 +718,12 @@ RemoveAllPermissionsAction = function(){
} }
DeletePermissionsRole(arrAux,RefreshPermissions,FailureProcess); DeletePermissionsRole(arrAux,RefreshPermissions,FailureProcess);
} }
} };
//ASSIGN USERS TO A ROLE //ASSIGN USERS TO A ROLE
SaveUsersRole = function(arr_usr, function_success, function_failure){ SaveUsersRole = function(arr_usr, function_success, function_failure){
var sw_response; var sw_response;
viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING); viewport.getEl().mask(_('ID_PROCESSING'));
Ext.Ajax.request({ Ext.Ajax.request({
url: 'roles_Ajax', url: 'roles_Ajax',
params: {request: 'assignUserToRole', ROL_UID: ROLES.ROL_UID, aUsers: arr_usr.join(',')}, params: {request: 'assignUserToRole', ROL_UID: ROLES.ROL_UID, aUsers: arr_usr.join(',')},
@@ -724,12 +736,12 @@ SaveUsersRole = function(arr_usr, function_success, function_failure){
function_failure(); function_failure();
} }
}); });
} };
//REMOVE USERS FROM A ROLE //REMOVE USERS FROM A ROLE
DeleteUsersRole = function(arr_usr, function_success, function_failure){ DeleteUsersRole = function(arr_usr, function_success, function_failure){
var sw_response; var sw_response;
viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING); viewport.getEl().mask(_('ID_PROCESSING'));
Ext.Ajax.request({ Ext.Ajax.request({
url: 'roles_Ajax', url: 'roles_Ajax',
params: {request: 'deleteUserRoleMultiple', ROL_UID: ROLES.ROL_UID, USR_UID: arr_usr.join(',')}, params: {request: 'deleteUserRoleMultiple', ROL_UID: ROLES.ROL_UID, USR_UID: arr_usr.join(',')},
@@ -742,7 +754,7 @@ DeleteUsersRole = function(arr_usr, function_success, function_failure){
viewport.getEl().unmask(); viewport.getEl().unmask();
} }
}); });
} };
//AssignUButton Functionality //AssignUButton Functionality
AssignUserAction = function(){ AssignUserAction = function(){
@@ -752,7 +764,7 @@ AssignUserAction = function(){
arrAux[a] = rowsSelected[a].get('USR_UID'); arrAux[a] = rowsSelected[a].get('USR_UID');
} }
SaveUsersRole(arrAux,RefreshUsers,FailureProcess); SaveUsersRole(arrAux,RefreshUsers,FailureProcess);
} };
//RemoveUButton Functionality //RemoveUButton Functionality
RemoveUserAction = function(){ RemoveUserAction = function(){
@@ -762,13 +774,13 @@ RemoveUserAction = function(){
arrAux[a] = rowsSelected[a].get('USR_UID'); arrAux[a] = rowsSelected[a].get('USR_UID');
} }
DeleteUsersRole(arrAux,RefreshUsers,FailureProcess); DeleteUsersRole(arrAux,RefreshUsers,FailureProcess);
} };
//AssignUALLButton Functionality //AssignUALLButton Functionality
AssignAllUsersAction = function(){ AssignAllUsersAction = function(){
var allRows = availableUGrid.getStore(); var allRows = availableUGrid.getStore();
if (allRows.getCount()>0){ if (allRows.getCount()>0){
Ext.Msg.confirm(TRANSLATIONS.ID_CONFIRM, TRANSLATIONS.ID_MSG_CONFIRM_ASSIGN_ALL_USERS, Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_MSG_CONFIRM_ASSIGN_ALL_USERS'),
function(btn, text){ function(btn, text){
if (btn=="yes"){ if (btn=="yes"){
var arrAux = new Array(); var arrAux = new Array();
@@ -781,7 +793,7 @@ AssignAllUsersAction = function(){
} }
); );
} }
} };
//RevomeALLButton Functionality //RevomeALLButton Functionality
RemoveAllUsersAction = function(){ RemoveAllUsersAction = function(){
@@ -794,48 +806,84 @@ RemoveAllUsersAction = function(){
} }
DeleteUsersRole(arrAux,RefreshUsers,FailureProcess); DeleteUsersRole(arrAux,RefreshUsers,FailureProcess);
} }
} };
//Function DoSearch Available //Function DoSearch Available
DoSearchA = function(){ DoSearchA = function(){
availableGrid.store.load({params: {textFilter: searchTextA.getValue()}}); availableGrid.store.load({params: {textFilter: searchTextA.getValue()}});
} };
//Function DoSearch Assigned //Function DoSearch Assigned
DoSearchP = function(){ DoSearchP = function(){
assignedGrid.store.load({params: {textFilter: searchTextP.getValue()}}); assignedGrid.store.load({params: {textFilter: searchTextP.getValue()}});
} };
//Load Grid By Default Available Members //Load Grid By Default Available Members
GridByDefaultA = function(){ GridByDefaultA = function(){
searchTextA.reset(); searchTextA.reset();
availableGrid.store.load(); availableGrid.store.load();
} };
//Load Grid By Default Assigned Members //Load Grid By Default Assigned Members
GridByDefaultP = function(){ GridByDefaultP = function(){
searchTextP.reset(); searchTextP.reset();
assignedGrid.store.load(); assignedGrid.store.load();
} };
//Function DoSearch Available //Function DoSearch Available
DoSearchU = function(){ DoSearchU = function(){
availableUGrid.store.load({params: {textFilter: searchTextU.getValue()}}); availableUGrid.store.load({params: {textFilter: searchTextU.getValue()}});
} };
//Function DoSearch Assigned //Function DoSearch Assigned
DoSearchX = function(){ DoSearchX = function(){
assignedUGrid.store.load({params: {textFilter: searchTextX.getValue()}}); assignedUGrid.store.load({params: {textFilter: searchTextX.getValue()}});
} };
//Load Grid By Default Available Members //Load Grid By Default Available Members
GridByDefaultU = function(){ GridByDefaultU = function(){
searchTextU.reset(); searchTextU.reset();
availableUGrid.store.load(); availableUGrid.store.load();
} };
//Load Grid By Default Assigned Members //Load Grid By Default Assigned Members
GridByDefaultX = function(){ GridByDefaultX = function(){
searchTextX.reset(); searchTextX.reset();
assignedUGrid.store.load(); assignedUGrid.store.load();
} };
//edit permissions action
EditPermissionsAction = function(){
availableGrid.show();
buttonsPanel.show();
editPermissionsButton.hide();
cancelEditPermissionsButton.show();
PermissionsPanel.doLayout();
};
//CancelEditPermissions Function
CancelEditPermissionsAction = function(){
availableGrid.hide();
buttonsPanel.hide();
editPermissionsButton.show();
cancelEditPermissionsButton.hide();
PermissionsPanel.doLayout();
};
//edit users action
EditPermissionsActionU = function(){
availableUGrid.show();
buttonsUPanel.show();
editPermissionsUButton.hide();
cancelEditPermissionsUButton.show();
UsersPanel.doLayout();
};
//CancelEditUsers Function
CancelEditPermissionsActionU = function(){
availableUGrid.hide();
buttonsUPanel.hide();
editPermissionsUButton.show();
cancelEditPermissionsUButton.hide();
UsersPanel.doLayout();
};

View File

@@ -284,7 +284,8 @@ Ext.onReady(function(){
{id: 'AUTH_SOURCE_UID'}, {id: 'AUTH_SOURCE_UID'},
{name : 'AUTH_SOURCE_UID'}, {name : 'AUTH_SOURCE_UID'},
{name : 'AUTH_SOURCE_NAME'}, {name : 'AUTH_SOURCE_NAME'},
{name : 'AUTH_SOURCE_PROVIDER'} {name : 'AUTH_SOURCE_PROVIDER'},
{name : 'AUTH_SOURCE_SHOW'}
] ]
}), }),
autoLoad: true autoLoad: true
@@ -306,7 +307,7 @@ Ext.onReady(function(){
typeAhead: true, typeAhead: true,
mode: 'local', mode: 'local',
store: comboAuthSourcesStore, store: comboAuthSourcesStore,
displayField: 'AUTH_SOURCE_NAME', displayField: 'AUTH_SOURCE_SHOW',
valueField:'AUTH_SOURCE_UID', valueField:'AUTH_SOURCE_UID',
allowBlank: false, allowBlank: false,
submitValue: true, submitValue: true,

View File

@@ -24,11 +24,11 @@ new Ext.KeyMap(document, [
{ {
key: Ext.EventObject.DELETE, key: Ext.EventObject.DELETE,
fn: function(k,e){ fn: function(k,e){
iGrid = Ext.getCmp('infoGrid'); iGrid = Ext.getCmp('infoGrid');
rowSelected = iGrid.getSelectionModel().getSelected(); rowSelected = iGrid.getSelectionModel().getSelected();
if (rowSelected){ if (rowSelected){
DeleteUserAction(); DeleteUserAction();
} }
} }
} }
]); ]);
@@ -238,7 +238,7 @@ Ext.onReady(function(){
{header: _('ID_STATUS'), dataIndex: 'USR_STATUS', width: 50, hidden: false, align: 'center', renderer: render_status}, {header: _('ID_STATUS'), dataIndex: 'USR_STATUS', width: 50, hidden: false, align: 'center', renderer: render_status},
{header: _('ID_ROLE'), dataIndex: 'USR_ROLE', width: 180, hidden:false, align:'left'}, {header: _('ID_ROLE'), dataIndex: 'USR_ROLE', width: 180, hidden:false, align:'left'},
{header: _('ID_DEPARTMENT'), dataIndex: 'DEP_TITLE', width: 150, hidden:true, align:'left'}, {header: _('ID_DEPARTMENT'), dataIndex: 'DEP_TITLE', width: 150, hidden:true, align:'left'},
{header: _('ID_LAST_LOGIN'), dataIndex: 'LAST_LOGIN', width: 108, hidden:false, align:'center'}, {header: _('ID_LAST_LOGIN'), dataIndex: 'LAST_LOGIN', width: 108, hidden:false, align:'center', renderer: render_lastlogin},
{header: _('ID_CASES'), dataIndex: 'TOTAL_CASES', width: 45, hidden:false, align:'right'}, {header: _('ID_CASES'), dataIndex: 'TOTAL_CASES', width: 45, hidden:false, align:'right'},
{header: _('ID_DUE_DATE'), dataIndex: 'USR_DUE_DATE', width: 108, hidden:false, align:'center', renderer: render_duedate} {header: _('ID_DUE_DATE'), dataIndex: 'USR_DUE_DATE', width: 108, hidden:false, align:'center', renderer: render_duedate}
] ]
@@ -399,7 +399,7 @@ photo_user = function(value){
//Render Full Name //Render Full Name
full_name = function(v,x,s){ full_name = function(v,x,s){
return parseFullName(v, s.data.USR_FIRSTNAME, s.data.USR_LASTNAME, fullNameFormat); return _FNF(v, s.data.USR_FIRSTNAME, s.data.USR_LASTNAME);
}; };
//Render Status //Render Status
@@ -414,9 +414,13 @@ render_status = function(v){
//Render Due Date //Render Due Date
render_duedate = function(v,x,s){ render_duedate = function(v,x,s){
if (s.data.DUE_DATE_OK) if (s.data.DUE_DATE_OK)
return v; return _DF(v);
else else
return '<font color="red">' + v + '</font>'; return '<font color="red">' + _DF(v) + '</font>';
};
render_lastlogin = function(v){
return _DF(v);
}; };
//Load Grid By Default //Load Grid By Default
@@ -449,13 +453,4 @@ UpdatePageConfig = function(pageSize){
url: 'users_Ajax', url: 'users_Ajax',
params: {'function':'updatePageSize', size: pageSize} params: {'function':'updatePageSize', size: pageSize}
}); });
};
//Function Parse Full Name Format
parseFullName = function(uN, fN, lN, f){
var aux = f;
aux = aux.replace('@userName',uN);
aux = aux.replace('@firstName',fN);
aux = aux.replace('@lastName',lN);
return aux;
}; };