Update Look n Feel and Functionality of User Manager
This commit is contained in:
@@ -52,6 +52,7 @@ class Configurations // extends Configuration
|
||||
{
|
||||
var $aConfig = array();
|
||||
private $Configuration = null;
|
||||
private $UserConfig = null;
|
||||
|
||||
/**
|
||||
* Set Configurations
|
||||
@@ -255,6 +256,33 @@ class Configurations // extends Configuration
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* usersNameFormat
|
||||
* @author Qennix
|
||||
* @param string $username
|
||||
* @param string $firstname
|
||||
* @param string $lastname
|
||||
* @return string User Name Well-Formatted
|
||||
*/
|
||||
|
||||
function usersNameFormat($username, $firstname, $lastname){
|
||||
try{
|
||||
if (!isset($this->UserConfig)) $this->UserConfig = $this->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
if (isset($this->UserConfig['format'])){
|
||||
$aux = '';
|
||||
$aux = str_replace('@userName', $username, $this->UserConfig['format']);
|
||||
$aux = str_replace('@firstName', $firstname, $aux);
|
||||
$aux = str_replace('@lastName', $lastname, $aux);
|
||||
return $aux;
|
||||
}else{
|
||||
return $username;
|
||||
}
|
||||
}catch(Exception $oError){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setConfig
|
||||
*
|
||||
|
||||
@@ -1194,4 +1194,20 @@ class AppCacheView extends BaseAppCacheView {
|
||||
return ($rowData);
|
||||
}
|
||||
|
||||
//Added By Qennix
|
||||
function getTotalCasesByAllUsers(){
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AppCacheViewPeer::USR_UID);
|
||||
$oCriteria->addAsColumn('CNT', 'COUNT(DISTINCT(APP_UID))');
|
||||
$oCriteria->addGroupByColumn(AppCacheViewPeer::USR_UID);
|
||||
$Dat = AppCacheViewPeer::doSelectRS ($oCriteria);
|
||||
$Dat->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
$aRows = Array();
|
||||
while ($Dat->next()){
|
||||
$row = $Dat->getRow();
|
||||
$aRows[$row['USR_UID']] = $row['CNT'];
|
||||
}
|
||||
return $aRows;
|
||||
}
|
||||
|
||||
} // AppCacheView
|
||||
|
||||
@@ -394,20 +394,36 @@ protected $depo_title = '';
|
||||
|
||||
// select departments
|
||||
// this function is used to draw the hierachy tree view
|
||||
function getDepartments( $DepParent ) {
|
||||
function getDepartments( $DepParent ) {
|
||||
try {
|
||||
$result = array();
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(DepartmentPeer::DEP_PARENT, $DepParent, Criteria::EQUAL);
|
||||
$con = Propel::getConnection(DepartmentPeer::DATABASE_NAME);
|
||||
$objects = DepartmentPeer::doSelect($criteria, $con);
|
||||
global $RBAC;
|
||||
|
||||
foreach( $objects as $oDepartment ) {
|
||||
$node = array();
|
||||
$node['DEP_UID'] = $oDepartment->getDepUid();
|
||||
$node['DEP_PARENT'] = $oDepartment->getDepParent();
|
||||
$node['DEP_TITLE'] = $oDepartment->getDepTitle();
|
||||
$node['DEP_STATUS'] = $oDepartment->getDepStatus();
|
||||
$node['DEP_MANAGER'] = $oDepartment->getDepManager();
|
||||
$node['DEP_LAST'] = 0;
|
||||
|
||||
$manager = $oDepartment->getDepManager();
|
||||
if ($manager != ''){
|
||||
$UserUID = $RBAC->load($manager);
|
||||
$node['DEP_MANAGER_USERNAME'] = $UserUID['USR_USERNAME'];
|
||||
$node['DEP_MANAGER_FIRSTNAME'] = $UserUID['USR_FIRSTNAME'];
|
||||
$node['DEP_MANAGER_LASTNAME'] = $UserUID['USR_LASTNAME'];
|
||||
}else{
|
||||
$node['DEP_MANAGER_USERNAME'] = '';
|
||||
$node['DEP_MANAGER_FIRSTNAME'] = '';
|
||||
$node['DEP_MANAGER_LASTNAME'] = '';
|
||||
}
|
||||
|
||||
$criteriaCount = new Criteria('workflow');
|
||||
$criteriaCount->clearSelectColumns();
|
||||
$criteriaCount->addSelectColumn( 'COUNT(*)' );
|
||||
@@ -556,4 +572,22 @@ protected $depo_title = '';
|
||||
return $c;
|
||||
}
|
||||
|
||||
//Added by Qennix
|
||||
function getAllDepartmentsByUser(){
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn(UsersPeer::USR_UID);
|
||||
$c->addAsColumn('DEP_TITLE', ContentPeer::CON_VALUE);
|
||||
$c->add(ContentPeer::CON_LANG,defined(SYS_LANG)?SYS_LANG:'en');
|
||||
$c->add(ContentPeer::CON_CATEGORY,'DEPO_TITLE');
|
||||
$c->addJoin(UsersPeer::DEP_UID, ContentPeer::CON_ID,Criteria::INNER_JOIN);
|
||||
$Dat = UsersPeer::doSelectRS ($c);
|
||||
$Dat->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
$aRows = Array();
|
||||
while ($Dat->next()){
|
||||
$row = $Dat->getRow();
|
||||
$aRows[$row['USR_UID']] = $row['DEP_TITLE'];
|
||||
}
|
||||
return $aRows;
|
||||
}
|
||||
|
||||
} // Department
|
||||
|
||||
@@ -110,4 +110,34 @@ class LoginLog extends BaseLoginLog {
|
||||
}
|
||||
}
|
||||
|
||||
//Added by Qennix
|
||||
function getLastLoginByUser($sUID){
|
||||
$c = new Criteria();
|
||||
$c->addSelectColumn(LoginLogPeer::LOG_INIT_DATE);
|
||||
$c->add(LoginLogPeer::USR_UID,$sUID);
|
||||
$c->setLimit(1);
|
||||
$c->addDescendingOrderByColumn(LoginLogPeer::LOG_INIT_DATE);
|
||||
$Dat = LoginLogPeer::doSelectRS ($c);
|
||||
$Dat->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$Dat->next();
|
||||
$aRow = $Dat->getRow();
|
||||
return isset($aRow['LOG_INIT_DATE']) ? $aRow['LOG_INIT_DATE'] : '';
|
||||
}
|
||||
|
||||
//Added by Qennix
|
||||
function getLastLoginAllUsers(){
|
||||
$c = new Criteria();
|
||||
$c->addSelectColumn(LoginLogPeer::USR_UID);
|
||||
$c->addAsColumn('LAST_LOGIN', 'MAX(LOG_INIT_DATE)');
|
||||
$c->addGroupByColumn(LoginLogPeer::USR_UID);
|
||||
$Dat = LoginLogPeer::doSelectRS ($c);
|
||||
$Dat->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
$aRows = Array();
|
||||
while ($Dat->next()){
|
||||
$row = $Dat->getRow();
|
||||
$aRows[$row['USR_UID']] = $row['LAST_LOGIN'];
|
||||
}
|
||||
return $aRows;
|
||||
}
|
||||
|
||||
} // LoginLog
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* users_List.php
|
||||
* usersGroups.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
@@ -53,20 +53,12 @@ $G_ID_SUB_MENU_SELECTED = 'USERS';
|
||||
|
||||
$G_PUBLISH = new Publisher;
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
|
||||
//$oHeadPublisher->usingExtJs('ux/Ext.ux.fileUploadField');
|
||||
$oHeadPublisher->addExtJsScript('users/usersGroups', false); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('users/usersGroups'); //adding a html file .html.
|
||||
|
||||
$labels = G::getTranslations(Array('ID_USERS','ID_ASSIGN','ID_ASSIGN_ALL_GROUPS','ID_REMOVE','ID_REMOVE_ALL_GROUPS',
|
||||
'ID_BACK','ID_GROUP_NAME','ID_AVAILABLE_GROUPS','ID_ASSIGNED_GROUPS','ID_GROUPS','ID_USERS',
|
||||
'ID_MSG_AJAX_FAILURE','ID_PROCESSING','ID_AUTHENTICATION','ID_CLOSE','ID_SAVE','ID_AUTHENTICATION_SOURCE',
|
||||
'ID_AUTHENTICATION_DN','ID_AUTHENTICATION_FORM_TITLE','ID_SELECT_AUTH_SOURCE','ID_SAVE_CHANGES','ID_DISCARD_CHANGES',
|
||||
'ID_ENTER_SEARCH_TERM'));
|
||||
G::LoadClass('configuration');
|
||||
$c = new Configurations();
|
||||
$configEnv = $c->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
$Config['fullNameFormat'] = isset($configEnv['format']) ? $configEnv['format'] : '@userName';
|
||||
|
||||
require_once 'classes/model/Users.php';
|
||||
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
@@ -77,13 +69,23 @@ $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
switch($_REQUEST['type']){
|
||||
case 'summary': $ctab = 0; break;
|
||||
case 'group': $ctab = 1; break;
|
||||
case 'auth': $ctab = 2; break;
|
||||
}
|
||||
|
||||
$users = Array();
|
||||
$users['USR_UID'] = $_GET['uUID'];
|
||||
$users['USR_COMPLETENAME'] = $aRow['USR_LASTNAME'].' '.$aRow['USR_FIRSTNAME'];
|
||||
$users['USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
|
||||
$users['USR_LASTNAME'] = $aRow['USR_LASTNAME'];
|
||||
$users['USR_USERNAME'] = $aRow['USR_USERNAME'];
|
||||
$users['CURRENT_TAB'] = ($_REQUEST['type']=='group') ? 0 : 1;
|
||||
$users['fullNameFormat'] = $Config['fullNameFormat'];
|
||||
$users['CURRENT_TAB'] = $ctab;
|
||||
|
||||
|
||||
$oHeadPublisher->assign('TRANSLATIONS', $labels);
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('users/usersGroups', false); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('users/usersGroups'); //adding a html file .html.
|
||||
$oHeadPublisher->assign('USERS', $users);
|
||||
|
||||
G::RenderPage('publish', 'extJs');
|
||||
@@ -49,28 +49,28 @@ try {
|
||||
//$value= $_POST['functions'];
|
||||
$value = get_ajax_value('functions');
|
||||
}
|
||||
switch ($value){
|
||||
case 'verifyUsername':
|
||||
//print_r($_POST); die;
|
||||
$_POST['sOriginalUsername'] = get_ajax_value('sOriginalUsername');
|
||||
$_POST['sUsername'] = get_ajax_value('sUsername');
|
||||
if ($_POST['sOriginalUsername'] == $_POST['sUsername'])
|
||||
{
|
||||
echo '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once 'classes/model/Users.php';
|
||||
G::LoadClass('Users');
|
||||
$oUser = new Users();
|
||||
$oCriteria=$oUser->loadByUsername($_POST['sUsername']);
|
||||
$oDataset = UsersPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
//print_r($aRow); die;
|
||||
//if (!$aRow)
|
||||
if (!is_array($aRow))
|
||||
switch ($value){
|
||||
case 'verifyUsername':
|
||||
//print_r($_POST); die;
|
||||
$_POST['sOriginalUsername'] = get_ajax_value('sOriginalUsername');
|
||||
$_POST['sUsername'] = get_ajax_value('sUsername');
|
||||
if ($_POST['sOriginalUsername'] == $_POST['sUsername'])
|
||||
{
|
||||
echo '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once 'classes/model/Users.php';
|
||||
G::LoadClass('Users');
|
||||
$oUser = new Users();
|
||||
$oCriteria=$oUser->loadByUsername($_POST['sUsername']);
|
||||
$oDataset = UsersPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
//print_r($aRow); die;
|
||||
//if (!$aRow)
|
||||
if (!is_array($aRow))
|
||||
{
|
||||
echo '0';
|
||||
}
|
||||
@@ -78,229 +78,343 @@ try {
|
||||
{
|
||||
echo '1';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'availableUsers':
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new ProcessMap();
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'users/users_AvailableUsers', $oProcessMap->getAvailableUsersCriteria($_GET['sTask'], $_GET['iType']));
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
case 'assign':
|
||||
G::LoadClass('tasks');
|
||||
$oTasks = new Tasks();
|
||||
switch ((int)$_POST['TU_RELATION']) {
|
||||
case 1:
|
||||
echo $oTasks->assignUser($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']);
|
||||
break;
|
||||
case 2:
|
||||
echo $oTasks->assignGroup($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'ofToAssign':
|
||||
G::LoadClass('tasks');
|
||||
$oTasks = new Tasks();
|
||||
switch ((int)$_POST['TU_RELATION']) {
|
||||
case 1:
|
||||
echo $oTasks->ofToAssignUser($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']);
|
||||
break;
|
||||
case 2:
|
||||
echo $oTasks->ofToAssignGroup($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'changeView':
|
||||
$_SESSION['iType'] = $_POST['TU_TYPE'];
|
||||
break;
|
||||
|
||||
case 'deleteGroup':
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
$oGroup->removeUserOfGroup($_POST['GRP_UID'], $_POST['USR_UID']);
|
||||
$_GET['sUserUID'] = $_POST['USR_UID'];
|
||||
$G_PUBLISH = new Publisher;
|
||||
$G_PUBLISH->AddContent('view', 'users/users_Tree' );
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
|
||||
case 'showUserGroupInterface':
|
||||
$_GET['sUserUID'] = $_POST['sUserUID'];
|
||||
$G_PUBLISH = new Publisher;
|
||||
$G_PUBLISH->AddContent('view', 'users/users_AssignGroup' );
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
|
||||
case 'showUserGroups':
|
||||
$_GET['sUserUID'] = $_POST['sUserUID'];
|
||||
$G_PUBLISH = new Publisher;
|
||||
$G_PUBLISH->AddContent('view', 'users/users_Tree' );
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
|
||||
case 'assignUserToGroup':
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
$oGroup->addUserToGroup($_POST['GRP_UID'], $_POST['USR_UID']);
|
||||
echo '<div align="center"><h2><font color="blue">'.G::LoadTranslation('ID_MSG_ASSIGN_DONE').'</font></h2></div>';
|
||||
break;
|
||||
|
||||
case 'usersGroup':
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
$aGroup = $oGroup->getUsersOfGroup($_POST['GRP_UID']);
|
||||
foreach ($aGroup as $iIndex => $aValues) {
|
||||
echo $aValues['USR_FIRSTNAME'] . ' ' . $aValues['USR_LASTNAME'] . '<br>';
|
||||
}
|
||||
break;
|
||||
case 'canDeleteUser':
|
||||
G::LoadClass('case');
|
||||
$oProcessMap = new Cases();
|
||||
$USR_UID = $_POST['uUID'];
|
||||
$total = 0;
|
||||
$history = 0;
|
||||
|
||||
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID);
|
||||
$total += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID);
|
||||
$total += ApplicationPeer::doCount($c);
|
||||
|
||||
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID);
|
||||
$history += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID);
|
||||
$history += ApplicationPeer::doCount($c);
|
||||
|
||||
$response = '{success: true, candelete: ';
|
||||
$response .= ($total > 0) ? 'false' : 'true';
|
||||
$response .= ', hashistory: ';
|
||||
$response .= ($history > 0) ? 'true' : 'false';
|
||||
$response .= '}';
|
||||
echo $response;
|
||||
break;
|
||||
case 'deleteUser':
|
||||
$UID = $_POST['USR_UID'];
|
||||
G::LoadClass('tasks');
|
||||
$oTasks = new Tasks();
|
||||
$oTasks->ofToAssignUserOfAllTasks($UID);
|
||||
G::LoadClass('groups');
|
||||
$oGroups = new Groups();
|
||||
$oGroups->removeUserOfAllGroups($UID);
|
||||
$RBAC->changeUserStatus($UID, 'CLOSED');
|
||||
$_GET['USR_USERNAME']='';
|
||||
$RBAC->updateUser(array('USR_UID' => $UID, 'USR_USERNAME' => $_GET['USR_USERNAME']),'');
|
||||
|
||||
require_once 'classes/model/Users.php';
|
||||
$oUser = new Users();
|
||||
$aFields = $oUser->load($UID);
|
||||
$aFields['USR_STATUS'] = 'CLOSED';
|
||||
$aFields['USR_USERNAME'] = '';
|
||||
$oUser->update($aFields);
|
||||
break;
|
||||
case 'availableGroups':
|
||||
G::LoadClass('groups');
|
||||
$filter = (isset($_POST['textFilter']))? $_POST['textFilter'] : '';
|
||||
$groups = new Groups();
|
||||
$criteria = $groups->getAvailableGroupsCriteria($_REQUEST['uUID'],$filter);
|
||||
$objects = GroupwfPeer::doSelectRS($criteria);
|
||||
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$arr = Array();
|
||||
while ($objects->next()){
|
||||
$arr[] = $objects->getRow();
|
||||
}
|
||||
echo '{groups: '.G::json_encode($arr).'}';
|
||||
break;
|
||||
case 'assignedGroups':
|
||||
G::LoadClass('groups');
|
||||
$filter = (isset($_POST['textFilter']))? $_POST['textFilter'] : '';
|
||||
$groups = new Groups();
|
||||
$criteria = $groups->getAssignedGroupsCriteria($_REQUEST['uUID'],$filter);
|
||||
$objects = GroupwfPeer::doSelectRS($criteria);
|
||||
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$arr = Array();
|
||||
while ($objects->next()){
|
||||
$arr[] = $objects->getRow();
|
||||
}
|
||||
echo '{groups: '.G::json_encode($arr).'}';
|
||||
break;
|
||||
case 'assignGroupsToUserMultiple':
|
||||
$USR_UID = $_POST['USR_UID'];
|
||||
$gUIDs = explode(',',$_POST['GRP_UID']);
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
foreach ($gUIDs as $GRP_UID){
|
||||
$oGroup->addUserToGroup($GRP_UID, $USR_UID);
|
||||
}
|
||||
break;
|
||||
case 'deleteGroupsToUserMultiple':
|
||||
$USR_UID = $_POST['USR_UID'];
|
||||
$gUIDs = explode(',',$_POST['GRP_UID']);
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
foreach ($gUIDs as $GRP_UID){
|
||||
$oGroup->removeUserOfGroup($GRP_UID, $USR_UID);
|
||||
}
|
||||
break;
|
||||
case 'authSources':
|
||||
$criteria = $RBAC->getAllAuthSources();
|
||||
$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';
|
||||
$arr = Array();
|
||||
$arr[] = $started;
|
||||
while ($objects->next()){
|
||||
$arr[] = $objects->getRow();
|
||||
}
|
||||
echo '{sources: '.G::json_encode($arr).'}';
|
||||
break;
|
||||
case 'loadAuthSourceByUID':
|
||||
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);
|
||||
}else{
|
||||
$arr = Array();
|
||||
$arr['AUTH_SOURCE_NAME'] = 'ProcessMaker';
|
||||
$arr['AUTH_SOURCE_PROVIDER'] = 'MYSQL';
|
||||
$aFields = $arr;
|
||||
}
|
||||
$res = Array();
|
||||
$res['data'] = $oCriteria;
|
||||
$res['auth'] = $aFields;
|
||||
echo G::json_encode($res);
|
||||
break;
|
||||
case 'updateAuthServices':
|
||||
$aData = $RBAC->load($_POST['usr_uid']);
|
||||
unset($aData['USR_ROLE']);
|
||||
$auth_uid = $_POST['auth_source'];
|
||||
$auth_uid2 = $_POST['auth_source_uid'];
|
||||
if ($auth_uid == $auth_uid2){
|
||||
$auth_uid = $aData['UID_AUTH_SOURCE'];
|
||||
}
|
||||
if (($auth_uid=='00000000000000000000000000000000')||($auth_uid=='')){
|
||||
$aData['USR_AUTH_TYPE'] = 'MYSQL';
|
||||
$aData['UID_AUTH_SOURCE'] = '';
|
||||
}else{
|
||||
$aFields = $RBAC->getAuthSource($auth_uid);
|
||||
$aData['USR_AUTH_TYPE'] = $aFields['AUTH_SOURCE_PROVIDER'];
|
||||
$aData['UID_AUTH_SOURCE'] = $auth_uid;
|
||||
}
|
||||
if (isset($_POST['auth_dn'])){
|
||||
$auth_dn = $_POST['auth_dn'];
|
||||
}else{
|
||||
$auth_dn = "";
|
||||
}
|
||||
$aData['USR_AUTH_USER_DN'] = $auth_dn;
|
||||
$RBAC->updateUser($aData);
|
||||
echo '{success: true}';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'availableUsers':
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new ProcessMap();
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'users/users_AvailableUsers', $oProcessMap->getAvailableUsersCriteria($_GET['sTask'], $_GET['iType']));
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
case 'assign':
|
||||
G::LoadClass('tasks');
|
||||
$oTasks = new Tasks();
|
||||
switch ((int)$_POST['TU_RELATION']) {
|
||||
case 1:
|
||||
echo $oTasks->assignUser($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']);
|
||||
break;
|
||||
case 2:
|
||||
echo $oTasks->assignGroup($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'ofToAssign':
|
||||
G::LoadClass('tasks');
|
||||
$oTasks = new Tasks();
|
||||
switch ((int)$_POST['TU_RELATION']) {
|
||||
case 1:
|
||||
echo $oTasks->ofToAssignUser($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']);
|
||||
break;
|
||||
case 2:
|
||||
echo $oTasks->ofToAssignGroup($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'changeView':
|
||||
$_SESSION['iType'] = $_POST['TU_TYPE'];
|
||||
break;
|
||||
case 'deleteGroup':
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
$oGroup->removeUserOfGroup($_POST['GRP_UID'], $_POST['USR_UID']);
|
||||
$_GET['sUserUID'] = $_POST['USR_UID'];
|
||||
$G_PUBLISH = new Publisher;
|
||||
$G_PUBLISH->AddContent('view', 'users/users_Tree' );
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
case 'showUserGroupInterface':
|
||||
$_GET['sUserUID'] = $_POST['sUserUID'];
|
||||
$G_PUBLISH = new Publisher;
|
||||
$G_PUBLISH->AddContent('view', 'users/users_AssignGroup' );
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
case 'showUserGroups':
|
||||
$_GET['sUserUID'] = $_POST['sUserUID'];
|
||||
$G_PUBLISH = new Publisher;
|
||||
$G_PUBLISH->AddContent('view', 'users/users_Tree' );
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
case 'assignUserToGroup':
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
$oGroup->addUserToGroup($_POST['GRP_UID'], $_POST['USR_UID']);
|
||||
echo '<div align="center"><h2><font color="blue">'.G::LoadTranslation('ID_MSG_ASSIGN_DONE').'</font></h2></div>';
|
||||
break;
|
||||
case 'usersGroup':
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
$aGroup = $oGroup->getUsersOfGroup($_POST['GRP_UID']);
|
||||
foreach ($aGroup as $iIndex => $aValues) {
|
||||
echo $aValues['USR_FIRSTNAME'] . ' ' . $aValues['USR_LASTNAME'] . '<br>';
|
||||
}
|
||||
break;
|
||||
case 'canDeleteUser':
|
||||
G::LoadClass('case');
|
||||
$oProcessMap = new Cases();
|
||||
$USR_UID = $_POST['uUID'];
|
||||
$total = 0;
|
||||
$history = 0;
|
||||
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID);
|
||||
$total += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID);
|
||||
$total += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID);
|
||||
$history += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID);
|
||||
$history += ApplicationPeer::doCount($c);
|
||||
$response = '{success: true, candelete: ';
|
||||
$response .= ($total > 0) ? 'false' : 'true';
|
||||
$response .= ', hashistory: ';
|
||||
$response .= ($history > 0) ? 'true' : 'false';
|
||||
$response .= '}';
|
||||
echo $response;
|
||||
break;
|
||||
case 'deleteUser':
|
||||
$UID = $_POST['USR_UID'];
|
||||
G::LoadClass('tasks');
|
||||
$oTasks = new Tasks();
|
||||
$oTasks->ofToAssignUserOfAllTasks($UID);
|
||||
G::LoadClass('groups');
|
||||
$oGroups = new Groups();
|
||||
$oGroups->removeUserOfAllGroups($UID);
|
||||
$RBAC->changeUserStatus($UID, 'CLOSED');
|
||||
$_GET['USR_USERNAME']='';
|
||||
$RBAC->updateUser(array('USR_UID' => $UID, 'USR_USERNAME' => $_GET['USR_USERNAME']),'');
|
||||
require_once 'classes/model/Users.php';
|
||||
$oUser = new Users();
|
||||
$aFields = $oUser->load($UID);
|
||||
$aFields['USR_STATUS'] = 'CLOSED';
|
||||
$aFields['USR_USERNAME'] = '';
|
||||
$oUser->update($aFields);
|
||||
break;
|
||||
case 'availableGroups':
|
||||
G::LoadClass('groups');
|
||||
$filter = (isset($_POST['textFilter']))? $_POST['textFilter'] : '';
|
||||
$groups = new Groups();
|
||||
$criteria = $groups->getAvailableGroupsCriteria($_REQUEST['uUID'],$filter);
|
||||
$objects = GroupwfPeer::doSelectRS($criteria);
|
||||
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$arr = Array();
|
||||
while ($objects->next()){
|
||||
$arr[] = $objects->getRow();
|
||||
}
|
||||
echo '{groups: '.G::json_encode($arr).'}';
|
||||
break;
|
||||
case 'assignedGroups':
|
||||
G::LoadClass('groups');
|
||||
$filter = (isset($_POST['textFilter']))? $_POST['textFilter'] : '';
|
||||
$groups = new Groups();
|
||||
$criteria = $groups->getAssignedGroupsCriteria($_REQUEST['uUID'],$filter);
|
||||
$objects = GroupwfPeer::doSelectRS($criteria);
|
||||
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$arr = Array();
|
||||
while ($objects->next()){
|
||||
$arr[] = $objects->getRow();
|
||||
}
|
||||
echo '{groups: '.G::json_encode($arr).'}';
|
||||
break;
|
||||
case 'assignGroupsToUserMultiple':
|
||||
$USR_UID = $_POST['USR_UID'];
|
||||
$gUIDs = explode(',',$_POST['GRP_UID']);
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
foreach ($gUIDs as $GRP_UID){
|
||||
$oGroup->addUserToGroup($GRP_UID, $USR_UID);
|
||||
}
|
||||
break;
|
||||
case 'deleteGroupsToUserMultiple':
|
||||
$USR_UID = $_POST['USR_UID'];
|
||||
$gUIDs = explode(',',$_POST['GRP_UID']);
|
||||
G::LoadClass('groups');
|
||||
$oGroup = new Groups();
|
||||
foreach ($gUIDs as $GRP_UID){
|
||||
$oGroup->removeUserOfGroup($GRP_UID, $USR_UID);
|
||||
}
|
||||
break;
|
||||
case 'authSources':
|
||||
$criteria = $RBAC->getAllAuthSources();
|
||||
$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';
|
||||
$arr = Array();
|
||||
$arr[] = $started;
|
||||
while ($objects->next()){
|
||||
$arr[] = $objects->getRow();
|
||||
}
|
||||
echo '{sources: '.G::json_encode($arr).'}';
|
||||
break;
|
||||
case 'loadAuthSourceByUID':
|
||||
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);
|
||||
}else{
|
||||
$arr = Array();
|
||||
$arr['AUTH_SOURCE_NAME'] = 'ProcessMaker';
|
||||
$arr['AUTH_SOURCE_PROVIDER'] = 'MYSQL';
|
||||
$aFields = $arr;
|
||||
}
|
||||
$res = Array();
|
||||
$res['data'] = $oCriteria;
|
||||
$res['auth'] = $aFields;
|
||||
echo G::json_encode($res);
|
||||
break;
|
||||
case 'updateAuthServices':
|
||||
$aData = $RBAC->load($_POST['usr_uid']);
|
||||
unset($aData['USR_ROLE']);
|
||||
$auth_uid = $_POST['auth_source'];
|
||||
$auth_uid2 = $_POST['auth_source_uid'];
|
||||
if ($auth_uid == $auth_uid2){
|
||||
$auth_uid = $aData['UID_AUTH_SOURCE'];
|
||||
}
|
||||
if (($auth_uid=='00000000000000000000000000000000')||($auth_uid=='')){
|
||||
$aData['USR_AUTH_TYPE'] = 'MYSQL';
|
||||
$aData['UID_AUTH_SOURCE'] = '';
|
||||
}else{
|
||||
$aFields = $RBAC->getAuthSource($auth_uid);
|
||||
$aData['USR_AUTH_TYPE'] = $aFields['AUTH_SOURCE_PROVIDER'];
|
||||
$aData['UID_AUTH_SOURCE'] = $auth_uid;
|
||||
}
|
||||
if (isset($_POST['auth_dn'])){
|
||||
$auth_dn = $_POST['auth_dn'];
|
||||
}else{
|
||||
$auth_dn = "";
|
||||
}
|
||||
$aData['USR_AUTH_USER_DN'] = $auth_dn;
|
||||
$RBAC->updateUser($aData);
|
||||
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;
|
||||
$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 != ''){
|
||||
$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->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$row = $oDataset->getRow();
|
||||
$totalRows = $row['CNT'];
|
||||
$oCriteria->clearSelectColumns();
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_EMAIL);
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_ROLE);
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_DUE_DATE);
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_STATUS);
|
||||
$oCriteria->addSelectColumn(UsersPeer::DEP_UID);
|
||||
$oCriteria->addAsColumn('LAST_LOGIN', 0);
|
||||
$oCriteria->addAsColumn('DEP_TITLE', 0);
|
||||
$oCriteria->addAsColumn('TOTAL_CASES', 0);
|
||||
$oCriteria->addAsColumn('DUE_DATE_OK', 1);
|
||||
$sep = "'";
|
||||
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
|
||||
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->setOffset($start);
|
||||
$oCriteria->setLimit($limit);
|
||||
$oDataset = UsersPeer::DoSelectRs ($oCriteria);
|
||||
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$Login = new LoginLog();
|
||||
$aLogin = $Login->getLastLoginAllUsers();
|
||||
$Cases = new AppCacheView();
|
||||
$aCases = $Cases->getTotalCasesByAllUsers();
|
||||
$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]['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;
|
||||
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('usersList', 'pageSize','',$_SESSION['USER_LOGGED']);
|
||||
echo '{success: true}';
|
||||
break;
|
||||
case 'summaryUserData':
|
||||
require_once 'classes/model/Users.php';
|
||||
require_once 'classes/model/Department.php';
|
||||
require_once 'classes/model/AppCacheView.php';
|
||||
G::LoadClass('configuration');
|
||||
$oUser = new Users();
|
||||
$data = $oUser->load($_REQUEST['USR_UID']);
|
||||
$oAppCache = new AppCacheView();
|
||||
$aTypes = Array();
|
||||
$aTypes['to_do'] = 'CASES_INBOX';
|
||||
$aTypes['draft'] = 'CASES_DRAFT';
|
||||
$aTypes['cancelled'] = 'CASES_CANCELLED';
|
||||
$aTypes['sent'] = 'CASES_SENT';
|
||||
$aTypes['paused'] = 'CASES_PAUSED';
|
||||
$aTypes['completed'] = 'CASES_COMPLETED';
|
||||
$aTypes['selfservice'] = 'CASES_SELFSERVICE';
|
||||
$aCount = $oAppCache->getAllCounters( array_keys($aTypes), $_REQUEST['USR_UID']);
|
||||
$dep = new Department();
|
||||
if ($dep->existsDepartment($data['DEP_UID'])){
|
||||
$dep->Load($data['DEP_UID']);
|
||||
$dep_name = $dep->getDepTitle();
|
||||
}else{
|
||||
$dep_name = '';
|
||||
}
|
||||
if ($data['USR_REPLACED_BY']!=''){
|
||||
$user = new Users();
|
||||
$u = $user->load($data['USR_REPLACED_BY']);
|
||||
$c = new Configurations();
|
||||
$replaced_by = $c->usersNameFormat($u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME']);
|
||||
}else{
|
||||
$replaced_by = '';
|
||||
}
|
||||
$misc = Array();
|
||||
$misc['DEP_TITLE'] = $dep_name;
|
||||
$misc['REPLACED_NAME'] = $replaced_by;
|
||||
echo '{success: true, userdata: '.G::json_encode($data).', cases: '.G::json_encode($aCount).', misc: '.G::json_encode($misc).'}';
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
die($oException->getMessage());
|
||||
|
||||
@@ -46,6 +46,7 @@ if( $access != 1 ){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'users';
|
||||
$G_ID_MENU_SELECTED = 'USERS';
|
||||
@@ -53,17 +54,17 @@ $G_ID_SUB_MENU_SELECTED = 'USERS';
|
||||
|
||||
$G_PUBLISH = new Publisher;
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
G::LoadClass('configuration');
|
||||
$c = new Configurations();
|
||||
$configPage = $c->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']);
|
||||
$configEnv = $c->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
|
||||
$Config['fullNameFormat'] = isset($configEnv['format']) ? $configEnv['format'] : '@userName';
|
||||
$Config['dateFormat'] = isset($configEnv['dateFormat']) ? $configEnv['dateFormat'] : 'Y/m/d';
|
||||
|
||||
//$oHeadPublisher->usingExtJs('ux/Ext.ux.fileUploadField');
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('users/usersList', false); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('users/usersList'); //adding a html file .html.
|
||||
$oHeadPublisher->assign('CONFIG', $Config);
|
||||
|
||||
$labels = G::getTranslations(Array('ID_USERS','ID_EDIT','ID_DELETE','ID_NEW','ID_GROUPS','ID_USERS_DELETE_WITH_HISTORY',
|
||||
'ID_USER_NAME','ID_PHOTO','ID_EMAIL','ID_FULL_NAME','ID_SEARCH','ID_ENTER_SEARCH_TERM',
|
||||
'ID_ROLE','ID_DUE_DATE','ID_CANNOT_DELETE_ADMIN_USER','ID_CONFIRM','ID_MSG_CONFIRM_DELETE_USER',
|
||||
'ID_MSG_CANNOT_DELETE_USER','ID_USERS_SUCCESS_DELETE','ID_AUTHENTICATION'));
|
||||
|
||||
$oHeadPublisher->assign('TRANSLATIONS', $labels);
|
||||
G::RenderPage('publish', 'extJs');
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,31 +5,31 @@
|
||||
|
||||
//Keyboard Events
|
||||
new Ext.KeyMap(document, [
|
||||
{
|
||||
key: Ext.EventObject.F5,
|
||||
fn: function(keycode, e) {
|
||||
if (! e.ctrlKey) {
|
||||
if (Ext.isIE) {
|
||||
// IE6 doesn't allow cancellation of the F5 key, so trick it into
|
||||
// thinking some other key was pressed (backspace in this case)
|
||||
e.browserEvent.keyCode = 8;
|
||||
}
|
||||
e.stopEvent();
|
||||
document.location = document.location;
|
||||
}else{
|
||||
Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
|
||||
}
|
||||
}
|
||||
{
|
||||
key: Ext.EventObject.F5,
|
||||
fn: function(keycode, e) {
|
||||
if (! e.ctrlKey) {
|
||||
if (Ext.isIE) {
|
||||
// IE6 doesn't allow cancellation of the F5 key, so trick it into
|
||||
// thinking some other key was pressed (backspace in this case)
|
||||
e.browserEvent.keyCode = 8;
|
||||
}
|
||||
e.stopEvent();
|
||||
document.location = document.location;
|
||||
}else{
|
||||
Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
key: Ext.EventObject.DELETE,
|
||||
fn: function(k,e){
|
||||
iGrid = Ext.getCmp('infoGrid');
|
||||
rowSelected = iGrid.getSelectionModel().getSelected();
|
||||
if (rowSelected){
|
||||
DeleteUserAction();
|
||||
}
|
||||
}
|
||||
key: Ext.EventObject.DELETE,
|
||||
fn: function(k,e){
|
||||
iGrid = Ext.getCmp('infoGrid');
|
||||
rowSelected = iGrid.getSelectionModel().getSelected();
|
||||
if (rowSelected){
|
||||
DeleteUserAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -38,314 +38,424 @@ var cmodel;
|
||||
var infoGrid;
|
||||
var viewport;
|
||||
var smodel;
|
||||
|
||||
var newButton;
|
||||
var editButton;
|
||||
var deleteButton;
|
||||
var summaryButton;
|
||||
var groupsButton;
|
||||
//var reassignButton;
|
||||
var authenticationButton;
|
||||
var searchButton;
|
||||
|
||||
var searchText;
|
||||
|
||||
var contextMenu;
|
||||
|
||||
var user_admin = '00000000000000000000000000000001';
|
||||
var pageSize;
|
||||
var fullNameFormat;
|
||||
var dateFormat;
|
||||
|
||||
Ext.onReady(function(){
|
||||
Ext.QuickTips.init();
|
||||
Ext.QuickTips.init();
|
||||
|
||||
newButton = new Ext.Action({
|
||||
text: TRANSLATIONS.ID_NEW,
|
||||
iconCls: 'button_menu_ext ss_sprite ss_add',
|
||||
handler: NewUserAction
|
||||
});
|
||||
fullNameFormat = CONFIG.fullNameFormat;
|
||||
dateFormat = CONFIG.dateFormat;
|
||||
pageSize = parseInt(CONFIG.pageSize);
|
||||
|
||||
editButton = new Ext.Action({
|
||||
text: TRANSLATIONS.ID_EDIT,
|
||||
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
||||
handler: EditUserAction,
|
||||
disabled: true
|
||||
});
|
||||
newButton = new Ext.Action({
|
||||
text: _('ID_NEW'),
|
||||
iconCls: 'button_menu_ext ss_sprite ss_add',
|
||||
handler: NewUserAction
|
||||
});
|
||||
|
||||
deleteButton = new Ext.Action({
|
||||
text: TRANSLATIONS.ID_DELETE,
|
||||
iconCls: 'button_menu_ext ss_sprite ss_delete',
|
||||
handler: DeleteUserAction,
|
||||
disabled: true
|
||||
});
|
||||
summaryButton = new Ext.Action({
|
||||
text: _('ID_SUMMARY'),
|
||||
iconCls: 'button_menu_ext ss_sprite ss_table',
|
||||
handler: SummaryTabOpen,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
groupsButton = new Ext.Action({
|
||||
text: TRANSLATIONS.ID_GROUPS,
|
||||
iconCls: 'button_menu_ext ss_sprite ss_group_add',
|
||||
handler: UsersGroupPage,
|
||||
disabled: true
|
||||
});
|
||||
editButton = new Ext.Action({
|
||||
text: _('ID_EDIT'),
|
||||
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
||||
handler: EditUserAction,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
deleteButton = new Ext.Action({
|
||||
text: _('ID_DELETE'),
|
||||
iconCls: 'button_menu_ext ss_sprite ss_delete',
|
||||
handler: DeleteUserAction,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
groupsButton = new Ext.Action({
|
||||
text: _('ID_GROUPS'),
|
||||
iconCls: 'button_menu_ext ss_sprite ss_group_add',
|
||||
handler: UsersGroupPage,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
// reassignButton = new Ext.Action({
|
||||
// text: TRANSLATIONS.ID_REASSIGN_CASES,
|
||||
// iconCls: 'button_menu_ext ss_sprite ss_arrow_rotate_clockwise',
|
||||
// handler: DoNothing,
|
||||
// disabled: true
|
||||
// text: _('ID_REASSIGN_CASES'),
|
||||
// iconCls: 'button_menu_ext ss_sprite ss_arrow_rotate_clockwise',
|
||||
// handler: DoNothing,
|
||||
// disabled: true
|
||||
// });
|
||||
|
||||
authenticationButton = new Ext.Action({
|
||||
text: TRANSLATIONS.ID_AUTHENTICATION,
|
||||
iconCls: 'button_menu_ext ss_sprite ss_key',
|
||||
handler: AuthUserPage,
|
||||
disabled: true
|
||||
});
|
||||
authenticationButton = new Ext.Action({
|
||||
text: _('ID_AUTHENTICATION'),
|
||||
iconCls: 'button_menu_ext ss_sprite ss_key',
|
||||
handler: AuthUserPage,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
|
||||
searchButton = new Ext.Action({
|
||||
text: TRANSLATIONS.ID_SEARCH,
|
||||
handler: DoSearch
|
||||
});
|
||||
searchButton = new Ext.Action({
|
||||
text: _('ID_SEARCH'),
|
||||
handler: DoSearch
|
||||
});
|
||||
|
||||
contextMenu = new Ext.menu.Menu({
|
||||
items: [editButton, deleteButton,'-',groupsButton,'-',authenticationButton]
|
||||
});
|
||||
contextMenu = new Ext.menu.Menu({
|
||||
items: [editButton, deleteButton,'-',groupsButton,'-',authenticationButton,'-',summaryButton]
|
||||
});
|
||||
|
||||
searchText = new Ext.form.TextField ({
|
||||
id: 'searchTxt',
|
||||
ctCls:'pm_search_text_field',
|
||||
allowBlank: true,
|
||||
width: 150,
|
||||
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,//'enter search term',
|
||||
listeners: {
|
||||
specialkey: function(f,e){
|
||||
if (e.getKey() == e.ENTER) {
|
||||
DoSearch();
|
||||
}
|
||||
},
|
||||
focus: function(f,e) {
|
||||
var row = infoGrid.getSelectionModel().getSelected();
|
||||
infoGrid.getSelectionModel().deselectRow(infoGrid.getStore().indexOf(row));
|
||||
}
|
||||
searchText = new Ext.form.TextField ({
|
||||
id: 'searchTxt',
|
||||
ctCls:'pm_search_text_field',
|
||||
allowBlank: true,
|
||||
width: 150,
|
||||
emptyText: _('ID_ENTER_SEARCH_TERM'),//'enter search term',
|
||||
listeners: {
|
||||
specialkey: function(f,e){
|
||||
if (e.getKey() == e.ENTER) {
|
||||
DoSearch();
|
||||
}
|
||||
});
|
||||
},
|
||||
focus: function(f,e) {
|
||||
var row = infoGrid.getSelectionModel().getSelected();
|
||||
infoGrid.getSelectionModel().deselectRow(infoGrid.getStore().indexOf(row));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
clearTextButton = new Ext.Action({
|
||||
text: 'X',
|
||||
ctCls:'pm_search_x_button',
|
||||
handler: GridByDefault
|
||||
});
|
||||
clearTextButton = new Ext.Action({
|
||||
text: 'X',
|
||||
ctCls:'pm_search_x_button',
|
||||
handler: GridByDefault
|
||||
});
|
||||
|
||||
smodel = new Ext.grid.RowSelectionModel({
|
||||
singleSelect: true,
|
||||
listeners:{
|
||||
rowselect: function(sm){
|
||||
editButton.enable();
|
||||
deleteButton.enable();
|
||||
groupsButton.enable();
|
||||
//reassignButton.enable();
|
||||
authenticationButton.enable();
|
||||
summaryButton.enable();
|
||||
},
|
||||
rowdeselect: function(sm){
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
groupsButton.disable();
|
||||
//reassignButton.disable();
|
||||
authenticationButton.disable();
|
||||
summaryButton.disable();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
smodel = new Ext.grid.RowSelectionModel({
|
||||
singleSelect: true,
|
||||
listeners:{
|
||||
rowselect: function(sm){
|
||||
editButton.enable();
|
||||
deleteButton.enable();
|
||||
groupsButton.enable();
|
||||
//reassignButton.enable();
|
||||
authenticationButton.enable();
|
||||
},
|
||||
rowdeselect: function(sm){
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
groupsButton.disable();
|
||||
//reassignButton.disable();
|
||||
authenticationButton.disable();
|
||||
}
|
||||
}
|
||||
});
|
||||
store = new Ext.data.GroupingStore( {
|
||||
proxy : new Ext.data.HttpProxy({
|
||||
url: 'users_Ajax?function=usersList'
|
||||
}),
|
||||
reader : new Ext.data.JsonReader( {
|
||||
root: 'users',
|
||||
totalProperty: 'total_users',
|
||||
fields : [
|
||||
{name : 'USR_UID'},
|
||||
{name : 'USR_USERNAME'},
|
||||
{name : 'USR_FIRSTNAME'},
|
||||
{name : 'USR_LASTNAME'},
|
||||
{name : 'USR_EMAIL'},
|
||||
{name : 'USR_ROLE'},
|
||||
{name : 'USR_DUE_DATE'},
|
||||
{name : 'DEP_TITLE'},
|
||||
{name : 'LAST_LOGIN'},
|
||||
{name : 'USR_STATUS'},
|
||||
{name : 'TOTAL_CASES'},
|
||||
{name : 'DUE_DATE_OK'}
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
store = new Ext.data.GroupingStore( {
|
||||
proxy : new Ext.data.HttpProxy({
|
||||
url: 'data_usersList'
|
||||
}),
|
||||
reader : new Ext.data.JsonReader( {
|
||||
root: 'users',
|
||||
fields : [
|
||||
{name : 'USR_UID'},
|
||||
{name : 'USR_USERNAME'},
|
||||
{name : 'USR_COMPLETENAME'},
|
||||
{name : 'USR_EMAIL'},
|
||||
{name : 'USR_ROLE'},
|
||||
{name : 'USR_DUE_DATE'}
|
||||
]
|
||||
})
|
||||
});
|
||||
storePageSize = new Ext.data.SimpleStore({
|
||||
fields: ['size'],
|
||||
data: [['20'],['30'],['40'],['50'],['100']],
|
||||
autoLoad: true
|
||||
});
|
||||
|
||||
cmodel = new Ext.grid.ColumnModel({
|
||||
defaults: {
|
||||
width: 50,
|
||||
sortable: true
|
||||
},
|
||||
columns: [
|
||||
{id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false},
|
||||
{header: TRANSLATIONS.ID_PHOTO, dataIndex: 'USR_UID', width: 14, align:'center', sortable: false, renderer: photo_user},
|
||||
{header: TRANSLATIONS.ID_FULL_NAME, dataIndex: 'USR_COMPLETENAME', width: 80, align:'left'},
|
||||
{header: TRANSLATIONS.ID_USER_NAME, dataIndex: 'USR_USERNAME', width: 60, hidden:false, align:'left'},
|
||||
{header: TRANSLATIONS.ID_EMAIL, dataIndex: 'USR_EMAIL', width: 60, hidden: false, align: 'left'},
|
||||
{header: TRANSLATIONS.ID_ROLE, dataIndex: 'USR_ROLE', width: 70, hidden:false, align:'left'},
|
||||
{header: TRANSLATIONS.ID_DUE_DATE, dataIndex: 'USR_DUE_DATE', width: 30, hidden:false, align:'center'}
|
||||
]
|
||||
});
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
infoGrid = new Ext.grid.GridPanel({
|
||||
region: 'center',
|
||||
layout: 'fit',
|
||||
id: 'infoGrid',
|
||||
height:100,
|
||||
autoWidth : true,
|
||||
stateful : true,
|
||||
stateId : 'grid',
|
||||
enableColumnResize: true,
|
||||
enableHdMenu: true,
|
||||
frame:false,
|
||||
iconCls:'icon-grid',
|
||||
columnLines: false,
|
||||
viewConfig: {
|
||||
forceFit:true
|
||||
},
|
||||
title : TRANSLATIONS.ID_USERS,
|
||||
store: store,
|
||||
cm: cmodel,
|
||||
sm: smodel,
|
||||
tbar: [newButton, '-', editButton, deleteButton,'-',groupsButton,'-',authenticationButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton],
|
||||
listeners: {
|
||||
rowdblclick: EditUserAction
|
||||
},
|
||||
view: new Ext.grid.GroupingView({
|
||||
forceFit:true,
|
||||
groupTextTpl: '{text}'
|
||||
})
|
||||
});
|
||||
comboPageSize.setValue(pageSize);
|
||||
|
||||
infoGrid.on('rowcontextmenu',
|
||||
function (grid, rowIndex, evt) {
|
||||
var sm = grid.getSelectionModel();
|
||||
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
||||
},
|
||||
this
|
||||
);
|
||||
bbarpaging = new Ext.PagingToolbar({
|
||||
pageSize: pageSize,
|
||||
store: store,
|
||||
displayInfo: true,
|
||||
displayMsg: _('ID_GRID_PAGE_DISPLAYING_USERS_MESSAGE') + ' ',
|
||||
emptyMsg: _('ID_GRID_PAGE_NO_USERS_MESSAGE'),
|
||||
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
|
||||
});
|
||||
|
||||
infoGrid.on('contextmenu',
|
||||
function (evt) {
|
||||
evt.preventDefault();
|
||||
},
|
||||
this
|
||||
);
|
||||
cmodel = new Ext.grid.ColumnModel({
|
||||
defaults: {
|
||||
width: 50,
|
||||
sortable: true
|
||||
},
|
||||
columns: [
|
||||
{id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false},
|
||||
{header: '', dataIndex: 'USR_UID', width: 30, align:'center', sortable: false, renderer: photo_user},
|
||||
{header: _('ID_USER_NAME'), dataIndex: 'USR_USERNAME', width: 90, hidden:false, align:'left'},
|
||||
{header: _('ID_FULL_NAME'), dataIndex: 'USR_USERNAME', width: 175, align:'left', renderer: full_name},
|
||||
{header: _('ID_EMAIL'), dataIndex: 'USR_EMAIL', width: 120, hidden: true, align: 'left'},
|
||||
{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_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}
|
||||
]
|
||||
});
|
||||
|
||||
infoGrid.addListener('rowcontextmenu',onMessageContextMenu,this);
|
||||
infoGrid = new Ext.grid.GridPanel({
|
||||
region: 'center',
|
||||
layout: 'fit',
|
||||
id: 'infoGrid',
|
||||
height:100,
|
||||
autoWidth : true,
|
||||
stateful : true,
|
||||
stateId : 'grid',
|
||||
enableColumnResize: true,
|
||||
enableHdMenu: true,
|
||||
frame:false,
|
||||
iconCls:'icon-grid',
|
||||
columnLines: false,
|
||||
viewConfig: {
|
||||
forceFit:true
|
||||
},
|
||||
title : _('ID_USERS'),
|
||||
store: store,
|
||||
cm: cmodel,
|
||||
sm: smodel,
|
||||
tbar: [newButton, '-',summaryButton,'-', editButton, deleteButton,'-',groupsButton,'-',authenticationButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton],
|
||||
bbar: bbarpaging,
|
||||
listeners: {
|
||||
rowdblclick: SummaryTabOpen
|
||||
},
|
||||
view: new Ext.grid.GroupingView({
|
||||
forceFit:true,
|
||||
groupTextTpl: '{text}'
|
||||
})
|
||||
});
|
||||
|
||||
infoGrid.store.load();
|
||||
infoGrid.on('rowcontextmenu',
|
||||
function (grid, rowIndex, evt) {
|
||||
var sm = grid.getSelectionModel();
|
||||
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
||||
},
|
||||
this
|
||||
);
|
||||
|
||||
viewport = new Ext.Viewport({
|
||||
layout: 'fit',
|
||||
autoScroll: false,
|
||||
items: [
|
||||
infoGrid
|
||||
]
|
||||
});
|
||||
infoGrid.on('contextmenu',
|
||||
function (evt) {
|
||||
evt.preventDefault();
|
||||
},
|
||||
this
|
||||
);
|
||||
|
||||
infoGrid.addListener('rowcontextmenu',onMessageContextMenu,this);
|
||||
|
||||
infoGrid.store.load();
|
||||
|
||||
viewport = new Ext.Viewport({
|
||||
layout: 'fit',
|
||||
autoScroll: false,
|
||||
items: [infoGrid]
|
||||
});
|
||||
});
|
||||
|
||||
//Funtion Handles Context Menu Opening
|
||||
//Function Handles Context Menu Opening
|
||||
onMessageContextMenu = function (grid, rowIndex, e) {
|
||||
e.stopEvent();
|
||||
var coords = e.getXY();
|
||||
contextMenu.showAt([coords[0], coords[1]]);
|
||||
}
|
||||
e.stopEvent();
|
||||
var coords = e.getXY();
|
||||
contextMenu.showAt([coords[0], coords[1]]);
|
||||
};
|
||||
|
||||
//Do Nothing Function
|
||||
DoNothing = function(){}
|
||||
DoNothing = function(){};
|
||||
|
||||
//Open New User Form
|
||||
NewUserAction = function(){
|
||||
location.href = 'users_New';
|
||||
}
|
||||
|
||||
//Edit User Action
|
||||
EditUserAction = function(){
|
||||
var uid = infoGrid.getSelectionModel().getSelected();
|
||||
if (uid){
|
||||
location.href = 'users_Edit?USR_UID=' + uid.data.USR_UID;
|
||||
}
|
||||
}
|
||||
location.href = 'users_New';
|
||||
};
|
||||
|
||||
//Delete User Action
|
||||
DeleteUserAction = function(){
|
||||
var uid = infoGrid.getSelectionModel().getSelected();
|
||||
if (uid){
|
||||
if (uid.data.USR_UID==user_admin){
|
||||
Ext.Msg.alert(TRANSLATIONS.ID_USERS, TRANSLATIONS.ID_CANNOT_DELETE_ADMIN_USER);
|
||||
}else{
|
||||
Ext.Ajax.request({
|
||||
url: 'users_Ajax',
|
||||
params: {'function': 'canDeleteUser', uUID: uid.data.USR_UID},
|
||||
success: function(res, opt){
|
||||
response = Ext.util.JSON.decode(res.responseText);
|
||||
if (response.candelete){
|
||||
if (response.hashistory){
|
||||
Ext.Msg.confirm(TRANSLATIONS.ID_CONFIRM, TRANSLATIONS.ID_USERS_DELETE_WITH_HISTORY,
|
||||
function(btn){
|
||||
if (btn=='yes') DeleteUser(uid.data.USR_UID);
|
||||
}
|
||||
);
|
||||
}else{
|
||||
Ext.Msg.confirm(TRANSLATIONS.ID_CONFIRM, TRANSLATIONS.ID_MSG_CONFIRM_DELETE_USER,
|
||||
function(btn){
|
||||
if (btn=='yes') DeleteUser(uid.data.USR_UID);
|
||||
}
|
||||
);
|
||||
}
|
||||
}else{
|
||||
Ext.Msg.alert(TRANSLATIONS.ID_USERS, TRANSLATIONS.ID_MSG_CANNOT_DELETE_USER);
|
||||
}
|
||||
},
|
||||
failure: DoNothing
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
var uid = infoGrid.getSelectionModel().getSelected();
|
||||
if (uid){
|
||||
if (uid.data.USR_UID==user_admin){
|
||||
Ext.Msg.alert(_('ID_USERS'), _('ID_CANNOT_DELETE_ADMIN_USER'));
|
||||
}else{
|
||||
viewport.getEl().mask(_('ID_PROCESSING'));
|
||||
Ext.Ajax.request({
|
||||
url: 'users_Ajax',
|
||||
params: {'function': 'canDeleteUser', uUID: uid.data.USR_UID},
|
||||
success: function(res, opt){
|
||||
viewport.getEl().unmask();
|
||||
response = Ext.util.JSON.decode(res.responseText);
|
||||
if (response.candelete){
|
||||
if (response.hashistory){
|
||||
Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_USERS_DELETE_WITH_HISTORY'),
|
||||
function(btn){
|
||||
if (btn=='yes') DeleteUser(uid.data.USR_UID);
|
||||
}
|
||||
);
|
||||
}else{
|
||||
Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_MSG_CONFIRM_DELETE_USER'),
|
||||
function(btn){
|
||||
if (btn=='yes') DeleteUser(uid.data.USR_UID);
|
||||
}
|
||||
);
|
||||
}
|
||||
}else{
|
||||
PMExt.error(_('ID_USERS'), _('ID_MSG_CANNOT_DELETE_USER'));
|
||||
}
|
||||
},
|
||||
failure: function(r,o){
|
||||
viewport.getEl().unmask();
|
||||
DoNothing();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//Open User-Groups Manager
|
||||
UsersGroupPage = function(value){
|
||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||
if (rowSelected){
|
||||
value = rowSelected.data.USR_UID;
|
||||
location.href = 'usersGroups?uUID=' + value + '&type=group';
|
||||
}
|
||||
}
|
||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||
if (rowSelected){
|
||||
value = rowSelected.data.USR_UID;
|
||||
location.href = 'usersGroups?uUID=' + value + '&type=group';
|
||||
}
|
||||
};
|
||||
|
||||
//Open Summary Tab
|
||||
SummaryTabOpen = function(){
|
||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||
if (rowSelected){
|
||||
value = rowSelected.data.USR_UID;
|
||||
location.href = 'usersGroups?uUID=' + value + '&type=summary';
|
||||
}
|
||||
};
|
||||
|
||||
//Edit User Action
|
||||
EditUserAction = function(){
|
||||
var uid = infoGrid.getSelectionModel().getSelected();
|
||||
if (uid){
|
||||
location.href = 'users_Edit?USR_UID=' + uid.data.USR_UID;
|
||||
}
|
||||
};
|
||||
|
||||
//Open Authentication-User Manager
|
||||
AuthUserPage = function(value){
|
||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||
if (rowSelected){
|
||||
value = rowSelected.data.USR_UID;
|
||||
location.href = 'usersGroups?uUID=' + value + '&type=auth';;
|
||||
}
|
||||
}
|
||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||
if (rowSelected){
|
||||
value = rowSelected.data.USR_UID;
|
||||
location.href = 'usersGroups?uUID=' + value + '&type=auth';;
|
||||
}
|
||||
};
|
||||
|
||||
//Renderer Active/Inactive Role
|
||||
photo_user = function(value){
|
||||
return '<img border="0" src="users_ViewPhotoGrid?pUID=' + value + '" width="20" />';
|
||||
}
|
||||
return '<img border="0" src="users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + value + '" width="20" />';
|
||||
};
|
||||
|
||||
//Render Full Name
|
||||
full_name = function(v,x,s){
|
||||
return parseFullName(v, s.data.USR_FIRSTNAME, s.data.USR_LASTNAME, fullNameFormat);
|
||||
};
|
||||
|
||||
//Render Status
|
||||
render_status = function(v){
|
||||
switch(v){
|
||||
case 'ACTIVE': return '<font color="green">' + _('ID_ACTIVE') + '</font>'; break;
|
||||
case 'INACTIVE': return '<font color="red">' + _('ID_INACTIVE') + '</font>';; break;
|
||||
case 'VACATION': return '<font color="blue">' + _('ID_VACATION') + '</font>';; break;
|
||||
}
|
||||
};
|
||||
|
||||
//Render Due Date
|
||||
render_duedate = function(v,x,s){
|
||||
if (s.data.DUE_DATE_OK)
|
||||
return v;
|
||||
else
|
||||
return '<font color="red">' + v + '</font>';
|
||||
};
|
||||
|
||||
//Load Grid By Default
|
||||
GridByDefault = function(){
|
||||
searchText.reset();
|
||||
infoGrid.store.load();
|
||||
}
|
||||
searchText.reset();
|
||||
infoGrid.store.load();
|
||||
};
|
||||
|
||||
//Do Search Function
|
||||
DoSearch = function(){
|
||||
infoGrid.store.load({params: {textFilter: searchText.getValue()}});
|
||||
}
|
||||
infoGrid.store.load({params: {textFilter: searchText.getValue()}});
|
||||
};
|
||||
|
||||
//Delete User Function
|
||||
DeleteUser = function(uid){
|
||||
Ext.Ajax.request({
|
||||
url: 'users_Ajax',
|
||||
params: {'function': 'deleteUser', USR_UID: uid},
|
||||
success: function(res, opt){
|
||||
DoSearch();
|
||||
Ext.Msg.alert(TRANSLATIONS.ID_USERS,TRANSLATIONS.ID_USERS_SUCCESS_DELETE);
|
||||
},
|
||||
failure: DoNothing
|
||||
});
|
||||
}
|
||||
Ext.Ajax.request({
|
||||
url: 'users_Ajax',
|
||||
params: {'function': 'deleteUser', USR_UID: uid},
|
||||
success: function(res, opt){
|
||||
DoSearch();
|
||||
PMExt.notify(_('ID_USERS'),_('ID_USERS_SUCCESS_DELETE'));
|
||||
},
|
||||
failure: DoNothing
|
||||
});
|
||||
};
|
||||
|
||||
//Update Page Size Configuration
|
||||
UpdatePageConfig = function(pageSize){
|
||||
Ext.Ajax.request({
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user