diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php index bd2957b64..84742a456 100644 --- a/gulliver/system/class.rbac.php +++ b/gulliver/system/class.rbac.php @@ -562,8 +562,8 @@ class RBAC * @param string $filter * @return $this->rolesObj->getAllRolesFilter */ - function getAllRolesFilter ($filter) { - return $this->rolesObj->getAllRolesFilter($filter); + function getAllRolesFilter ($start,$limit,$filter) { + return $this->rolesObj->getAllRolesFilter($start,$limit,$filter); } /** @@ -657,6 +657,19 @@ class RBAC return $this->rolesObj->getRoleUsers($ROL_UID,$filter); } +/** + * this function gets the number of users by roles + * + * + * @access public + * @author: Enrique Ponce de Leon + * + * @return $this->rolesObj->getAllUsersByRole + */ + function getAllUsersByRole(){ + return $this->rolesObj->getAllUsersByRole(); + } + /** * this function gets roles code * diff --git a/rbac/engine/classes/model/Roles.php b/rbac/engine/classes/model/Roles.php index 3709b44f3..504f10ea6 100644 --- a/rbac/engine/classes/model/Roles.php +++ b/rbac/engine/classes/model/Roles.php @@ -124,28 +124,57 @@ class Roles extends BaseRoles { } //Added by QENNIX - function getAllRolesFilter($filter='') { + function getAllRolesFilter($start, $limit, $filter='') { + //echo $start.'<<<<'.$limit; $systemCode = 'PROCESSMAKER'; - $c = $this->listAllRoles($systemCode,$filter); - $rs = RolesPeer::DoSelectRs($c); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - $aRows = Array(); - while($rs->next()){ - $row = $rs->getRow(); - $o = new Roles(); - $o->load($row['ROL_UID']); - $row['ROL_NAME'] = $o->getRolName(); - $aRows[] = $row; - } - return $aRows; + $oCriteria2 = new Criteria('rbac'); + $result = Array(); + + $oCriteria2->addSelectColumn('COUNT(*) AS CNT'); + $oCriteria2->add(RolesPeer::ROL_UID, '', Criteria::NOT_EQUAL); + $oCriteria2->add(SystemsPeer::SYS_CODE, $systemCode); + $oCriteria2->add(RolesPeer::ROL_CREATE_DATE, '', Criteria::NOT_EQUAL); + $oCriteria2->add(RolesPeer::ROL_UPDATE_DATE, '', Criteria::NOT_EQUAL); + $oCriteria2->addJoin(RolesPeer::ROL_SYSTEM, SystemsPeer::SYS_UID); + if ($filter != ''){ + $oCriteria2->add(RolesPeer::ROL_CODE, '%'.$filter.'%', Criteria::LIKE); } + $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') { $c = $this->listAllRoles($systemCode); - $rs = RolesPeer::DoSelectRs($c); + $rs = RolesPeer::DoSelectRs($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $aRows = Array(); @@ -313,6 +342,23 @@ class Roles extends BaseRoles { 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='') { try { $criteria = new Criteria(); diff --git a/workflow/engine/classes/model/Content.php b/workflow/engine/classes/model/Content.php index 5acdf18ff..fa60b00b6 100644 --- a/workflow/engine/classes/model/Content.php +++ b/workflow/engine/classes/model/Content.php @@ -305,4 +305,24 @@ class Content extends BaseContent { 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 diff --git a/workflow/engine/methods/roles/rolesUsersPermission.php b/workflow/engine/methods/roles/rolesUsersPermission.php index 2a76608a3..168d8e626 100755 --- a/workflow/engine/methods/roles/rolesUsersPermission.php +++ b/workflow/engine/methods/roles/rolesUsersPermission.php @@ -55,20 +55,13 @@ $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript('roles/rolesUsersPermission', false); //adding a javascript file .js $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['ROL_UID'] = $_GET['rUID']; $roles['ROL_CODE'] = $RBAC->getRoleCode($_GET['rUID']); $roles['CURRENT_TAB'] = ($_GET['tab']=='permissions') ? 1 : 0; -$oHeadPublisher->assign('TRANSLATIONS', $labels); + $oHeadPublisher->assign('ROLES', $roles); G::RenderPage('publish', 'extJs'); diff --git a/workflow/engine/methods/roles/roles_Ajax.php b/workflow/engine/methods/roles/roles_Ajax.php index 8d888b67f..a3413c96f 100644 --- a/workflow/engine/methods/roles/roles_Ajax.php +++ b/workflow/engine/methods/roles/roles_Ajax.php @@ -260,6 +260,58 @@ switch ($REQUEST) { $RBAC->deleteUserRole($ROL_UID, $aUID); } 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'; } diff --git a/workflow/engine/methods/roles/roles_List.php b/workflow/engine/methods/roles/roles_List.php index 352ef5aae..798af10ed 100644 --- a/workflow/engine/methods/roles/roles_List.php +++ b/workflow/engine/methods/roles/roles_List.php @@ -46,46 +46,20 @@ $G_ID_MENU_SELECTED = 'USERS'; $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::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->usingExtJs('ux/Ext.ux.fileUploadField'); $oHeadPublisher->addExtJsScript('roles/rolesList', false); //adding a javascript file .js $oHeadPublisher->addContent('roles/rolesList'); //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_SEARCH','ID_ENTER_SEARCH_TERM','ID_SELECT_STATUS','ID_CREATE_ROLE_TITLE','ID_EDIT_ROLE_TITLE')); - -$oHeadPublisher->assign('TRANSLATIONS', $labels); +$oHeadPublisher->assign('FORMATS',$c->getFormats()); +$oHeadPublisher->assign('CONFIG', $Config); G::RenderPage('publish', 'extJs'); ?> diff --git a/workflow/engine/methods/users/users_Ajax.php b/workflow/engine/methods/users/users_Ajax.php index c18347304..35db6b254 100644 --- a/workflow/engine/methods/users/users_Ajax.php +++ b/workflow/engine/methods/users/users_Ajax.php @@ -235,28 +235,39 @@ try { break; case 'authSources': $criteria = $RBAC->getAllAuthSources(); - $objects = AuthenticationSourcePeer::doSelectRS($criteria); + $objects = AuthenticationSourcePeer::doSelectRS($criteria); $objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); $started = Array(); $started['AUTH_SOURCE_UID'] = '00000000000000000000000000000000'; - $started['AUTH_SOURCE_NAME'] = 'ProcessMaker'; - $started['AUTH_SOURCE_TYPE'] = 'MYSQL'; + //$started['AUTH_SOURCE_NAME'] = 'ProcessMaker'; + //$started['AUTH_SOURCE_TYPE'] = 'MYSQL'; + $started['AUTH_SOURCE_SHOW'] = 'ProcessMaker (MYSQL)'; $arr = Array(); $arr[] = $started; 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).'}'; break; case 'loadAuthSourceByUID': - require_once 'classes/model/Users.php'; + require_once 'classes/model/Users.php'; $oCriteria=$RBAC->load($_POST['uUID']); $UID_AUTH = $oCriteria['UID_AUTH_SOURCE']; 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{ $arr = Array(); - $arr['AUTH_SOURCE_NAME'] = 'ProcessMaker'; + $arr['AUTH_SOURCE_NAME'] = 'ProcessMaker (MYSQL)'; $arr['AUTH_SOURCE_PROVIDER'] = 'MYSQL'; $aFields = $arr; } @@ -291,28 +302,27 @@ try { echo '{success: true}'; break; case 'usersList': - require_once 'classes/model/Users.php'; - require_once 'classes/model/LoginLog.php'; - require_once 'classes/model/Department.php'; - require_once 'classes/model/AppCacheView.php'; - G::LoadClass('configuration'); - $co = new Configurations(); - $config = $co->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']); - $env = $co->getConfiguration('ENVIRONMENT_SETTINGS', ''); - $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20; - $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; + require_once 'classes/model/Users.php'; + require_once 'classes/model/LoginLog.php'; + require_once 'classes/model/Department.php'; + require_once 'classes/model/AppCacheView.php'; + G::LoadClass('configuration'); + $co = new Configurations(); + $config = $co->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']); + $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20; + $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size; $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : ''; $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn('COUNT(*) AS CNT'); - if ($filter != ''){ + if ($filter != ''){ $cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( $oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( $oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE))); $oCriteria->add($cc); - } + } $oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN); - $oDataset = UsersPeer::DoSelectRs ($oCriteria); + $oDataset = UsersPeer::DoSelectRs ($oCriteria); $oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $row = $oDataset->getRow(); @@ -351,18 +361,14 @@ try { $Department = new Department(); $aDepart = $Department->getAllDepartmentsByUser(); - $dateFormat = $env['dateFormat']; - $rows = Array(); while($oDataset->next()){ $rows[] = $oDataset->getRow(); $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]['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]['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.'}'; break; diff --git a/workflow/engine/methods/users/users_List.php b/workflow/engine/methods/users/users_List.php index 24bb66d17..78bee4755 100644 --- a/workflow/engine/methods/users/users_List.php +++ b/workflow/engine/methods/users/users_List.php @@ -67,4 +67,8 @@ $oHeadPublisher->addExtJsScript('users/usersList', false); //adding a javascr $oHeadPublisher->addContent('users/usersList'); //adding a html file .html. $oHeadPublisher->assign('CONFIG', $Config); +G::LoadClass('configuration'); +$c = new Configurations(); +$oHeadPublisher->assign('FORMATS',$c->getFormats()); + G::RenderPage('publish', 'extJs'); \ No newline at end of file diff --git a/workflow/engine/templates/roles/rolesList.js b/workflow/engine/templates/roles/rolesList.js index 13b0adb70..2d1e22eef 100755 --- a/workflow/engine/templates/roles/rolesList.js +++ b/workflow/engine/templates/roles/rolesList.js @@ -48,63 +48,59 @@ var cmodel; var infoGrid; var viewport; var smodel; - var newButton; var editButton; var deleteButton; var usersButton; var permissionsButton; var searchButton; - var serachText; - var newForm; var comboStatusStore; var editForm; - var contextMenu; - var w; - Ext.onReady(function(){ Ext.QuickTips.init(); + pageSize = parseInt(CONFIG.pageSize); + newButton = new Ext.Action({ - text: TRANSLATIONS.ID_NEW, + text: _('ID_NEW'), iconCls: 'button_menu_ext ss_sprite ss_add', handler: NewRoleWindow }); editButton = new Ext.Action({ - text: TRANSLATIONS.ID_EDIT, + text: _('ID_EDIT'), iconCls: 'button_menu_ext ss_sprite ss_pencil', handler: EditRole, disabled: true }); deleteButton = new Ext.Action({ - text: TRANSLATIONS.ID_DELETE, + text: _('ID_DELETE'), iconCls: 'button_menu_ext ss_sprite ss_delete', handler: CanDeleteRole, disabled: true }); usersButton = new Ext.Action({ - text: TRANSLATIONS.ID_USERS, + text: _('ID_USERS'), iconCls: 'button_menu_ext ss_sprite ss_user_add', handler: RolesUserPage, disabled: true }); permissionsButton = new Ext.Action({ - text: TRANSLATIONS.ID_PERMISSIONS, + text: _('ID_PERMISSIONS'), iconCls: 'button_menu_ext ss_sprite ss_key_add', handler: RolesPermissionPage, disabled: true }); searchButton = new Ext.Action({ - text: TRANSLATIONS.ID_SEARCH, + text: _('ID_SEARCH'), handler: DoSearch }); @@ -117,7 +113,7 @@ Ext.onReady(function(){ ctCls:'pm_search_text_field', allowBlank: true, width: 150, - emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,//'enter search term', + emptyText: _('ID_ENTER_SEARCH_TERM'),//'enter search term', listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { @@ -139,18 +135,18 @@ Ext.onReady(function(){ comboStatusStore = new Ext.data.SimpleStore({ fields: ['id','value'], - data: [['1',TRANSLATIONS.ID_ACTIVE],['0',TRANSLATIONS.ID_INACTIVE]] + data: [['1',_('ID_ACTIVE')],['0',_('ID_INACTIVE')]] }); newForm = new Ext.FormPanel({ url: 'roles_Ajax?request=saveNewRole', frame: true, items:[ - {xtype: 'textfield', fieldLabel: TRANSLATIONS.ID_CODE, name: 'code', width: 250, allowBlank: false}, - {xtype: 'textfield', fieldLabel: TRANSLATIONS.ID_NAME, name: 'name', width: 200, allowBlank: false}, + {xtype: 'textfield', fieldLabel: _('ID_CODE'), name: 'code', width: 250, allowBlank: false}, + {xtype: 'textfield', fieldLabel: _('ID_NAME'), name: 'name', width: 200, allowBlank: false}, { xtype: 'combo', - fieldLabel: TRANSLATIONS.ID_STATUS, + fieldLabel: _('ID_STATUS'), hiddenName: 'status', typeAhead: true, mode: 'local', @@ -159,13 +155,14 @@ Ext.onReady(function(){ valueField:'id', allowBlank: false, triggerAction: 'all', - emptyText: TRANSLATIONS.ID_SELECT_STATUS, + emptyText: _('ID_SELECT_STATUS'), selectOnFocus:true } ], buttons: [ - {text: TRANSLATIONS.ID_CLOSE, handler: CloseWindow}, - {text: TRANSLATIONS.ID_SAVE, handler: SaveNewRole} + {text: _('ID_SAVE'), handler: SaveNewRole}, + {text: _('ID_CANCEL'), handler: CloseWindow} + ] }); @@ -174,11 +171,11 @@ Ext.onReady(function(){ frame: true, items:[ {xtype: 'textfield', name: 'rol_uid', hidden: true }, - {xtype: 'textfield', fieldLabel: TRANSLATIONS.ID_CODE, name: 'code', width: 250, allowBlank: false}, - {xtype: 'textfield', fieldLabel: TRANSLATIONS.ID_NAME, name: 'name', width: 200, allowBlank: false}, + {xtype: 'textfield', fieldLabel: _('ID_CODE'), name: 'code', width: 250, allowBlank: false}, + {xtype: 'textfield', fieldLabel: _('ID_NAME'), name: 'name', width: 200, allowBlank: false}, { xtype: 'combo', - fieldLabel: TRANSLATIONS.ID_STATUS, + fieldLabel: _('ID_STATUS'), hiddenName: 'status', typeAhead: true, mode: 'local', @@ -187,13 +184,13 @@ Ext.onReady(function(){ valueField:'id', allowBlank: false, triggerAction: 'all', - emptyText: TRANSLATIONS.ID_SELECT_STATUS, + emptyText: _('ID_SELECT_STATUS'), selectOnFocus:true } ], buttons: [ - {text: TRANSLATIONS.ID_CLOSE, handler: CloseWindow}, - {text: TRANSLATIONS.ID_SAVE, handler: UpdateRole} + {text: _('ID_SAVE'), handler: UpdateRole}, + {text: _('ID_CANCEL'), handler: CloseWindow} ] }); @@ -217,17 +214,19 @@ Ext.onReady(function(){ store = new Ext.data.GroupingStore( { proxy : new Ext.data.HttpProxy({ - url: 'data_rolesList' + url: 'roles_Ajax?request=rolesList' }), reader : new Ext.data.JsonReader( { root: 'roles', + totalProperty: 'total_roles', fields : [ {name : 'ROL_UID'}, {name : 'ROL_CODE'}, {name : 'ROL_NAME'}, {name : 'ROL_CREATE_DATE'}, {name : 'ROL_UPDATE_DATE'}, - {name : 'ROL_STATUS'} + {name : 'ROL_STATUS'}, + {name : 'TOTAL_USERS'} ] }) }); @@ -239,14 +238,50 @@ Ext.onReady(function(){ }, columns: [ {id:'ROL_UID', dataIndex: 'ROL_UID', hidden:true, hideable:false}, - {header: TRANSLATIONS.ID_CODE, dataIndex: 'ROL_CODE', width: 60, align:'left'}, - {header: TRANSLATIONS.ID_NAME, dataIndex: 'ROL_NAME', width: 60, hidden:false, align:'left'}, - {header: TRANSLATIONS.ID_STATUS, dataIndex: 'ROL_STATUS', width: 20, hidden: false, align: 'center', renderer: status_role}, - {header: TRANSLATIONS.ID_PRO_CREATE_DATE, dataIndex: 'ROL_CREATE_DATE', width: 40, hidden:false, align:'center'}, - {header: TRANSLATIONS.ID_LAN_UPDATE_DATE, dataIndex: 'ROL_UPDATE_DATE', width: 40, hidden:false, align:'center'} + {header: _('ID_CODE'), dataIndex: 'ROL_CODE', width: 220, align:'left'}, + {header: _('ID_NAME'), dataIndex: 'ROL_NAME', width: 180, hidden:false, align:'left'}, + {header: _('ID_STATUS'), dataIndex: 'ROL_STATUS', width: 80, hidden: false, align: 'center', renderer: status_role}, + {header: _('ID_USERS'), dataIndex: 'TOTAL_USERS', width: 50, 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') + '    ', + emptyMsg: _('ID_GRID_PAGE_NO_ROLES_MESSAGE'), + items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize] + }); + infoGrid = new Ext.grid.GridPanel({ region: 'center', layout: 'fit', @@ -263,11 +298,12 @@ Ext.onReady(function(){ viewConfig: { forceFit:true }, - title : TRANSLATIONS.ID_ROLES, + title : _('ID_ROLES'), store: store, cm: cmodel, sm: smodel, tbar: [newButton, '-', editButton, deleteButton,'-',usersButton, permissionsButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton], + bbar: bbarpaging, listeners: { rowdblclick: EditRole }, @@ -310,26 +346,26 @@ onMessageContextMenu = function (grid, rowIndex, e) { e.stopEvent(); var coords = e.getXY(); contextMenu.showAt([coords[0], coords[1]]); -} +}; //Do Nothing Function -DoNothing = function(){} +DoNothing = function(){}; //Open New Role Form NewRoleWindow = function(){ w = new Ext.Window({ - title: TRANSLATIONS.ID_CREATE_ROLE_TITLE, + title: _('ID_CREATE_ROLE_TITLE'), autoHeight: true, width: 420, items: [newForm] }); w.show(); -} +}; //Close Popup Window CloseWindow = function(){ w.hide(); -} +}; //Save New Role SaveNewRole = function(){ @@ -339,7 +375,7 @@ SaveNewRole = function(){ newForm.getForm().reset(); //Set empty form to next use searchText.reset(); 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){ switch(a.failureType){ @@ -349,7 +385,7 @@ SaveNewRole = function(){ } } }); -} +}; //Update Selected Role UpdateRole = function(){ @@ -359,7 +395,7 @@ UpdateRole = function(){ DoSearch(); //Reload store grid editButton.disable(); //Disable Edit 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){ switch(a.failureType){ @@ -370,14 +406,14 @@ UpdateRole = function(){ } }); -} +}; //Edit Selected Role EditRole = function(){ rowSelected = infoGrid.getSelectionModel().getSelected(); if (rowSelected){ if (rowSelected.data.ROL_UID == '00000000000000000000000000000002'){ - Ext.Msg.alert(TRANSLATIONS.ID_ROLES,TRANSLATIONS.ID_ROLES_MSG); + PMExt.warning(_('ID_ROLES'),_('ID_ROLES_MSG')); }else{ editForm.getForm().findField('rol_uid').setValue(rowSelected.data.ROL_UID); editForm.getForm().findField('code').setValue(rowSelected.data.ROL_CODE); @@ -386,52 +422,56 @@ EditRole = function(){ w = new Ext.Window({ autoHeight: true, width: 420, - title: TRANSLATIONS.ID_EDIT_ROLE_TITLE, + title: _('ID_EDIT_ROLE_TITLE'), items: [editForm] }); w.show(); } } -} +}; //Check Can Delete Role CanDeleteRole = function(){ rowSelected = infoGrid.getSelectionModel().getSelected(); if (rowSelected){ var swDelete = false; + viewport.getEl().mask(_('ID_PROCESSING')); Ext.Ajax.request({ url: 'roles_Ajax', success: function(response, opts){ + viewport.getEl().unmask(); swDelete = (response.responseText=='true') ? true : false; if (swDelete){ - Ext.Msg.confirm(TRANSLATIONS.ID_CONFIRM, TRANSLATIONS.ID_REMOVE_ROLE, + Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_REMOVE_ROLE'), function(btn, text){ if (btn=="yes"){ + viewport.getEl().mask(_('ID_PROCESSING')); Ext.Ajax.request({ url: 'roles_Ajax', params: {request: 'deleteRole', ROL_UID: rowSelected.data.ROL_UID}, success: function(r,o){ + viewport.getEl().unmask(); infoGrid.store.load(); //Reload store grid editButton.disable(); //Disable Edit Button deleteButton.disable(); //Disable Delete Button usersButton.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{ - 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} }); } -} +}; //Open User-Roles Manager @@ -442,7 +482,7 @@ RolesUserPage = function(value){ value = rowSelected.data.ROL_UID; location.href = 'rolesUsersPermission?rUID=' + value + '&tab=users'; } -} +}; //Open Permission-Roles Manager @@ -453,20 +493,38 @@ RolesPermissionPage = function(value){ value = rowSelected.data.ROL_UID; location.href = 'rolesUsersPermission?rUID=' + value + '&tab=permissions'; } -} +}; //Renderer Active/Inactive Role status_role = function(value){ - return (value==1) ? TRANSLATIONS.ID_ACTIVE : TRANSLATIONS.ID_INACTIVE; -} + var aux; + switch(value){ + case '1': aux = '' + _('ID_ACTIVE') + ''; break; + case '0': aux = ''+ _('ID_INACTIVE') + ''; break; + } + return aux; +}; //Load Grid By Default GridByDefault = function(){ searchText.reset(); infoGrid.store.load(); -} +}; //Do Search Function DoSearch = function(){ infoGrid.store.load({params: {textFilter: searchText.getValue()}}); -} \ No newline at end of file +}; + +//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} + }); +}; \ No newline at end of file diff --git a/workflow/engine/templates/roles/rolesUsersPermission.js b/workflow/engine/templates/roles/rolesUsersPermission.js index 77bef51ea..aae782d42 100755 --- a/workflow/engine/templates/roles/rolesUsersPermission.js +++ b/workflow/engine/templates/roles/rolesUsersPermission.js @@ -63,61 +63,61 @@ 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 -// }); + editPermissionsButton = new Ext.Action({ + text: _('ID_EDIT_PERMISSIONS'), + iconCls: 'button_menu_ext ss_sprite ss_key_add', + handler: EditPermissionsAction + }); + + 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({ -// text: TRANSLATIONS.ID_ASSIGN, +// text: _('ID_ASSIGN, // iconCls: 'button_menu_ext ss_sprite ss_add', // handler: AssignUserAction, // disabled: true // }); - assignUAllButton = new Ext.Action({ - text: TRANSLATIONS.ID_ASSIGN_ALL_USERS, - iconCls: 'button_menu_ext ss_sprite ss_add', - handler: AssignAllUsersAction - }); +// assignUAllButton = new Ext.Action({ +// text: _('ID_ASSIGN_ALL_USERS'), +// iconCls: 'button_menu_ext ss_sprite ss_add', +// handler: AssignAllUsersAction +// }); // removeUButton = new Ext.Action({ -// text: TRANSLATIONS.ID_REMOVE, +// text: _('ID_REMOVE, // iconCls: 'button_menu_ext ss_sprite ss_delete', // handler: RemoveUserAction, // disabled: true // }); - removeUAllButton = new Ext.Action({ - text: TRANSLATIONS.ID_REMOVE_ALL_USERS, - iconCls: 'button_menu_ext ss_sprite ss_delete', - handler: RemoveAllUsersAction - }); +// removeUAllButton = new Ext.Action({ +// text: _('ID_REMOVE_ALL_USERS'), +// iconCls: 'button_menu_ext ss_sprite ss_delete', +// handler: RemoveAllUsersAction +// }); backButton = new Ext.Action({ - text: TRANSLATIONS.ID_BACK, + text: _('ID_BACK'), iconCls: 'button_menu_ext ss_sprite ss_arrow_redo', handler: BackToRoles }); @@ -159,7 +159,7 @@ Ext.onReady(function(){ }, columns: [ {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', allowBlank: true, width: 110, - emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM, + emptyText: _('ID_ENTER_SEARCH_TERM'), listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { @@ -213,7 +213,7 @@ Ext.onReady(function(){ ctCls:'pm_search_text_field', allowBlank: true, width: 110, - emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM, + emptyText: _('ID_ENTER_SEARCH_TERM'), listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { @@ -250,9 +250,10 @@ Ext.onReady(function(){ frame : false, columnLines : false, viewConfig : {forceFit:true}, - tbar: [TRANSLATIONS.ID_AVAILABLE_PERMISSIONS,{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA], - bbar: [{xtype: 'tbfill'}, assignAllButton], - listeners: {rowdblclick: AssignPermissionAction} + tbar: [_('ID_AVAILABLE_PERMISSIONS'),{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA], + //bbar: [{xtype: 'tbfill'}, assignAllButton], + listeners: {rowdblclick: AssignPermissionAction}, + hidden: true }); assignedGrid = new Ext.grid.GridPanel({ @@ -275,9 +276,10 @@ Ext.onReady(function(){ frame : false, columnLines : false, viewConfig : {forceFit:true}, - tbar: [TRANSLATIONS.ID_ASSIGNED_PERMISSIONS,{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP], - bbar: [{xtype: 'tbfill'},removeAllButton], - listeners: {rowdblclick: RemovePermissionAction} + tbar: [_('ID_ASSIGNED_PERMISSIONS'),{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP], + //bbar: [{xtype: 'tbfill'},removeAllButton], + listeners: {rowdblclick: function(){ + (availableGrid.hidden)? DoNothing() :RemovePermissionAction();}} }); buttonsPanel = new Ext.Panel({ @@ -290,22 +292,26 @@ Ext.onReady(function(){ }, 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} - ] + {xtype:'button',text: '>', handler: AssignPermissionAction, id: 'assignButton', 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(); //PERMISSIONS DRAG AND DROP PANEL PermissionsPanel = new Ext.Panel({ - title : TRANSLATIONS.ID_PERMISSIONS, + title : _('ID_PERMISSIONS'), autoWidth : true, layout : 'hbox', defaults : { flex : 1 }, //auto stretch layoutConfig : { align : 'stretch' }, items : [availableGrid,buttonsPanel,assignedGrid], - viewConfig : {forceFit:true} + viewConfig : {forceFit:true}, + bbar: [{xtype: 'tbfill'},editPermissionsButton, cancelEditPermissionsButton] }); @@ -346,9 +352,9 @@ Ext.onReady(function(){ }, columns: [ {id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false}, - {header: TRANSLATIONS.ID_FIRST_NAME, dataIndex: 'USR_FIRSTNAME', width: 60, align:'left'}, - {header: TRANSLATIONS.ID_LAST_NAME, dataIndex: 'USR_LASTNAME', width: 60, align:'left'}, - {header: TRANSLATIONS.ID_USER_NAME, dataIndex: 'USR_USERNAME', width: 60, align:'left'} + {header: _('ID_FIRST_NAME'), dataIndex: 'USR_FIRSTNAME', width: 60, align:'left'}, + {header: _('ID_LAST_NAME'), dataIndex: 'USR_LASTNAME', 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', allowBlank: true, width: 110, - emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM, + emptyText: _('ID_ENTER_SEARCH_TERM'), listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { @@ -402,7 +408,7 @@ Ext.onReady(function(){ ctCls:'pm_search_text_field', allowBlank: true, width: 110, - emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM, + emptyText: _('ID_ENTER_SEARCH_TERM'), listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { @@ -439,9 +445,10 @@ Ext.onReady(function(){ frame : false, columnLines : false, viewConfig : {forceFit:true}, - tbar: [TRANSLATIONS.ID_AVAILABLE_USERS,{xtype: 'tbfill'},'-',searchTextU, clearTextButtonU], - bbar: [{xtype: 'tbfill'}, assignUAllButton], - listeners: {rowdblclick: AssignUserAction} + tbar: [_('ID_AVAILABLE_USERS'),{xtype: 'tbfill'},'-',searchTextU, clearTextButtonU], + //bbar: [{xtype: 'tbfill'}, assignUAllButton], + listeners: {rowdblclick: AssignUserAction}, + hidden : true }); assignedUGrid = new Ext.grid.GridPanel({ @@ -464,9 +471,10 @@ Ext.onReady(function(){ frame : false, columnLines : false, viewConfig : {forceFit:true}, - tbar: [TRANSLATIONS.ID_ASSIGNED_USERS,{xtype: 'tbfill'},'-',searchTextX, clearTextButtonX], - bbar: [{xtype: 'tbfill'},removeUAllButton], - listeners: {rowdblclick: RemoveUserAction} + tbar: [_('ID_ASSIGNED_USERS'),{xtype: 'tbfill'},'-',searchTextX, clearTextButtonX], + //bbar: [{xtype: 'tbfill'},removeUAllButton], + listeners: {rowdblclick: function(){ + (availableUGrid.hidden)? DoNothing() : RemoveUserAction();}} }); buttonsUPanel = new Ext.Panel({ @@ -479,29 +487,33 @@ Ext.onReady(function(){ }, 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} - ] + {xtype:'button',text: '>', handler: AssignUserAction, id: 'assignUButton', 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(); //PERMISSIONS DRAG AND DROP PANEL UsersPanel = new Ext.Panel({ - title : TRANSLATIONS.ID_USERS, + title : _('ID_USERS'), autoWidth : true, layout : 'hbox', defaults : { flex : 1 }, //auto stretch layoutConfig : { align : 'stretch' }, items : [availableUGrid,buttonsUPanel,assignedUGrid], - viewConfig : {forceFit:true} + viewConfig : {forceFit:true}, + bbar: [{xtype: 'tbfill'},editPermissionsUButton, cancelEditPermissionsUButton] }); //NORTH PANEL WITH TITLE AND ROLE DETAILS northPanel = new Ext.Panel({ region: 'north', xtype: 'panel', - tbar: [TRANSLATIONS.ID_ROLES + ' : ' + ROLES.ROL_CODE,{xtype: 'tbfill'},backButton] + tbar: [''+_('ID_ROLE') + ' : ' + ROLES.ROL_CODE+'',{xtype: 'tbfill'},backButton] }); //TABS PANEL @@ -512,10 +524,10 @@ Ext.onReady(function(){ listeners:{ tabchange: function(p,t){ switch(t.title){ - case TRANSLATIONS.ID_PERMISSIONS: + case _('ID_PERMISSIONS'): sw_func_permissions ? DoNothing() : DDLoadPermissions(); break; - case TRANSLATIONS.ID_USERS: + case _('ID_USERS'): sw_func_users ? DoNothing() : DDLoadUsers(); break; } @@ -532,12 +544,12 @@ Ext.onReady(function(){ }); //Do Nothing Function -DoNothing = function(){} +DoNothing = function(){}; //Return to Roles Main Page BackToRoles = function(){ location.href = 'roles_List'; -} +}; //Loads Drag N Drop Functionality for Permissions DDLoadPermissions = function(){ @@ -572,7 +584,7 @@ DDLoadPermissions = function(){ } }); sw_func_permissions = true; -} +}; DDLoadUsers = function(){ //USERS DRAG N DROP AVAILABLE @@ -605,29 +617,29 @@ DDLoadUsers = function(){ } }); sw_func_users = true; -} +}; //REFRESH PERMISSION GRIDS RefreshPermissions = function(){ DoSearchA(); DoSearchP(); -} +}; //REFRESH USERS GRIDS RefreshUsers = function(){ DoSearchX(); DoSearchU(); -} +}; //FAILURE AJAX 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 SavePermissionsRole = function(arr_per, function_success, function_failure){ var sw_response; - viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING); + viewport.getEl().mask(_('ID_PROCESSING')); Ext.Ajax.request({ url: 'roles_Ajax', 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(); } }); -} +}; //REMOVE PERMISSION FROM A ROLE DeletePermissionsRole = function(arr_per, function_success, function_failure){ var sw_response; - viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING); + viewport.getEl().mask(_('ID_PROCESSING')); Ext.Ajax.request({ url: 'roles_Ajax', 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(); } }); -} +}; //AssignButton Functionality AssignPermissionAction = function(){ @@ -668,7 +680,7 @@ AssignPermissionAction = function(){ arrAux[a] = rowsSelected[a].get('PER_UID'); } SavePermissionsRole(arrAux,RefreshPermissions,FailureProcess); -} +}; //RemoveButton Functionality RemovePermissionAction = function(){ @@ -680,7 +692,7 @@ RemovePermissionAction = function(){ } DeletePermissionsRole(arrAux,RefreshPermissions,FailureProcess); } -} +}; //AssignALLButton Functionality AssignAllPermissionsAction = function(){ @@ -693,7 +705,7 @@ AssignAllPermissionsAction = function(){ } SavePermissionsRole(arrAux,RefreshPermissions,FailureProcess); } -} +}; //RevomeALLButton Functionality RemoveAllPermissionsAction = function(){ @@ -706,12 +718,12 @@ RemoveAllPermissionsAction = function(){ } DeletePermissionsRole(arrAux,RefreshPermissions,FailureProcess); } -} +}; //ASSIGN USERS TO A ROLE SaveUsersRole = function(arr_usr, function_success, function_failure){ var sw_response; - viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING); + viewport.getEl().mask(_('ID_PROCESSING')); Ext.Ajax.request({ url: 'roles_Ajax', 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(); } }); -} +}; //REMOVE USERS FROM A ROLE DeleteUsersRole = function(arr_usr, function_success, function_failure){ var sw_response; - viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING); + viewport.getEl().mask(_('ID_PROCESSING')); Ext.Ajax.request({ url: 'roles_Ajax', 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(); } }); -} +}; //AssignUButton Functionality AssignUserAction = function(){ @@ -752,7 +764,7 @@ AssignUserAction = function(){ arrAux[a] = rowsSelected[a].get('USR_UID'); } SaveUsersRole(arrAux,RefreshUsers,FailureProcess); -} +}; //RemoveUButton Functionality RemoveUserAction = function(){ @@ -762,13 +774,13 @@ RemoveUserAction = function(){ arrAux[a] = rowsSelected[a].get('USR_UID'); } DeleteUsersRole(arrAux,RefreshUsers,FailureProcess); -} +}; //AssignUALLButton Functionality AssignAllUsersAction = function(){ var allRows = availableUGrid.getStore(); 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){ if (btn=="yes"){ var arrAux = new Array(); @@ -781,7 +793,7 @@ AssignAllUsersAction = function(){ } ); } -} +}; //RevomeALLButton Functionality RemoveAllUsersAction = function(){ @@ -794,48 +806,84 @@ RemoveAllUsersAction = function(){ } DeleteUsersRole(arrAux,RefreshUsers,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(); -} +}; //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(); -} +}; + +//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(); +}; \ No newline at end of file diff --git a/workflow/engine/templates/users/usersGroups.js b/workflow/engine/templates/users/usersGroups.js index 41a73d910..2f29ff44d 100644 --- a/workflow/engine/templates/users/usersGroups.js +++ b/workflow/engine/templates/users/usersGroups.js @@ -284,7 +284,8 @@ Ext.onReady(function(){ {id: 'AUTH_SOURCE_UID'}, {name : 'AUTH_SOURCE_UID'}, {name : 'AUTH_SOURCE_NAME'}, - {name : 'AUTH_SOURCE_PROVIDER'} + {name : 'AUTH_SOURCE_PROVIDER'}, + {name : 'AUTH_SOURCE_SHOW'} ] }), autoLoad: true @@ -306,7 +307,7 @@ Ext.onReady(function(){ typeAhead: true, mode: 'local', store: comboAuthSourcesStore, - displayField: 'AUTH_SOURCE_NAME', + displayField: 'AUTH_SOURCE_SHOW', valueField:'AUTH_SOURCE_UID', allowBlank: false, submitValue: true, diff --git a/workflow/engine/templates/users/usersList.js b/workflow/engine/templates/users/usersList.js index eb4565e6b..8d6052989 100755 --- a/workflow/engine/templates/users/usersList.js +++ b/workflow/engine/templates/users/usersList.js @@ -24,11 +24,11 @@ new Ext.KeyMap(document, [ { key: Ext.EventObject.DELETE, fn: function(k,e){ - iGrid = Ext.getCmp('infoGrid'); - rowSelected = iGrid.getSelectionModel().getSelected(); - if (rowSelected){ - DeleteUserAction(); - } + iGrid = Ext.getCmp('infoGrid'); + rowSelected = iGrid.getSelectionModel().getSelected(); + if (rowSelected){ + 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_ROLE'), dataIndex: 'USR_ROLE', width: 180, hidden:false, 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_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 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 @@ -414,9 +414,13 @@ render_status = function(v){ //Render Due Date render_duedate = function(v,x,s){ if (s.data.DUE_DATE_OK) - return v; + return _DF(v); else - return '' + v + ''; + return '' + _DF(v) + ''; +}; + +render_lastlogin = function(v){ + return _DF(v); }; //Load Grid By Default @@ -449,13 +453,4 @@ UpdatePageConfig = function(pageSize){ url: 'users_Ajax', 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; }; \ No newline at end of file