diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/class.configuration.php
index 5c40b7912..470eb47f3 100644
--- a/workflow/engine/classes/class.configuration.php
+++ b/workflow/engine/classes/class.configuration.php
@@ -52,6 +52,7 @@ class Configurations // extends Configuration
{
var $aConfig = array();
private $Configuration = null;
+ private $UserConfig = null;
/**
* Set Configurations
@@ -254,6 +255,33 @@ class Configurations // extends Configuration
return null;
}
}
+
+ /**
+ * 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
diff --git a/workflow/engine/classes/model/AppCacheView.php b/workflow/engine/classes/model/AppCacheView.php
index 1a26e2331..879f61285 100644
--- a/workflow/engine/classes/model/AppCacheView.php
+++ b/workflow/engine/classes/model/AppCacheView.php
@@ -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
diff --git a/workflow/engine/classes/model/Department.php b/workflow/engine/classes/model/Department.php
index daca4cca4..f06cb293a 100644
--- a/workflow/engine/classes/model/Department.php
+++ b/workflow/engine/classes/model/Department.php
@@ -394,19 +394,35 @@ 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();
@@ -555,5 +571,23 @@ protected $depo_title = '';
$c->add(ContentPeer::CON_LANG, SYS_LANG );
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
diff --git a/workflow/engine/classes/model/LoginLog.php b/workflow/engine/classes/model/LoginLog.php
index 2f75bee2b..2f6a9be88 100644
--- a/workflow/engine/classes/model/LoginLog.php
+++ b/workflow/engine/classes/model/LoginLog.php
@@ -109,5 +109,35 @@ class LoginLog extends BaseLoginLog {
throw($e);
}
}
+
+ //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
diff --git a/workflow/engine/methods/users/usersGroups.php b/workflow/engine/methods/users/usersGroups.php
index 50631cb2e..617a9e0b7 100644
--- a/workflow/engine/methods/users/usersGroups.php
+++ b/workflow/engine/methods/users/usersGroups.php
@@ -1,6 +1,6 @@
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');
\ No newline at end of file
diff --git a/workflow/engine/methods/users/users_Ajax.php b/workflow/engine/methods/users/users_Ajax.php
index b37eb785a..c18347304 100644
--- a/workflow/engine/methods/users/users_Ajax.php
+++ b/workflow/engine/methods/users/users_Ajax.php
@@ -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 '
'.G::LoadTranslation('ID_MSG_ASSIGN_DONE').'
';
- 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'] . '
';
- }
- 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 ''.G::LoadTranslation('ID_MSG_ASSIGN_DONE').'
';
+ 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'] . '
';
+ }
+ 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());
diff --git a/workflow/engine/methods/users/users_List.php b/workflow/engine/methods/users/users_List.php
index edb103d5f..24bb66d17 100644
--- a/workflow/engine/methods/users/users_List.php
+++ b/workflow/engine/methods/users/users_List.php
@@ -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');
-
+G::RenderPage('publish', 'extJs');
\ No newline at end of file
diff --git a/workflow/engine/templates/users/usersGroups.js b/workflow/engine/templates/users/usersGroups.js
index 6ba24a280..4cae02d09 100644
--- a/workflow/engine/templates/users/usersGroups.js
+++ b/workflow/engine/templates/users/usersGroups.js
@@ -1,24 +1,24 @@
/*
- * @author: Qennix
- * Jan 25th, 2011
- */
+* @author: Qennix
+* Jan 25th, 2011
+*/
//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');
}
+ }
});
var storeP;
@@ -26,16 +26,13 @@ var storeA;
var cmodelP;
var smodelA;
var smodelP;
-
var availableGrid;
var assignedGrid;
-
var GroupsPanel;
var AuthenticationPanel;
var northPanel;
var tabsPanel;
var viewport;
-
var assignButton;
var assignAllButton;
var removeButton;
@@ -43,566 +40,710 @@ var removeAllButton;
var backButton;
var discardChangesButton;
var saveChangesButton;
-
var sw_func_groups;
//var sw_func_reassign;
var sw_func_auth;
var sw_form_changed;
+var sw_user_summary;
Ext.onReady(function(){
-
- sw_func_groups = false;
- //sw_func_reassign = false;
- sw_func_auth = false;
-
- assignAllButton = new Ext.Action({
- text: TRANSLATIONS.ID_ASSIGN_ALL_GROUPS,
- iconCls: 'button_menu_ext ss_sprite ss_add',
- handler: AssignAllGroupsAction
- });
-
- removeAllButton = new Ext.Action({
- text: TRANSLATIONS.ID_REMOVE_ALL_GROUPS,
- iconCls: 'button_menu_ext ss_sprite ss_delete',
- handler: RemoveAllGroupsAction
- });
-
- backButton = new Ext.Action({
- text: TRANSLATIONS.ID_BACK,
- iconCls: 'button_menu_ext ss_sprite ss_arrow_redo',
- handler: BackToUsers
- });
-
- saveChangesButton = new Ext.Action({
- text: TRANSLATIONS.ID_SAVE_CHANGES,
- //iconCls: 'button_menu_ext ss_sprite ss_arrow_redo',
- handler: SaveChangesAuthForm,
- disabled: true
- });
-
- discardChangesButton = new Ext.Action({
- text: TRANSLATIONS.ID_DISCARD_CHANGES,
- //iconCls: 'button_menu_ext ss_sprite ss_arrow_redo',
- handler: LoadAuthForm,
- disabled: true
- });
-
- storeP = new Ext.data.GroupingStore( {
- proxy : new Ext.data.HttpProxy({
- url: 'users_Ajax?function=assignedGroups&uUID=' + USERS.USR_UID
- }),
- reader : new Ext.data.JsonReader( {
- root: 'groups',
- fields : [
- {name : 'GRP_UID'},
- {name : 'GRP_STATUS'},
- {name : 'CON_VALUE'}
- ]
- })
- });
-
- storeA = new Ext.data.GroupingStore( {
- proxy : new Ext.data.HttpProxy({
- url: 'users_Ajax?function=availableGroups&uUID=' + USERS.USR_UID
- }),
- reader : new Ext.data.JsonReader( {
- root: 'groups',
- fields : [
- {name : 'GRP_UID'},
- {name : 'GRP_STATUS'},
- {name : 'CON_VALUE'}
- ]
- })
- });
-
- cmodelP = new Ext.grid.ColumnModel({
- defaults: {
- width: 50,
- sortable: true
- },
- columns: [
- {id:'GRP_UID', dataIndex: 'GRP_UID', hidden:true, hideable:false},
- {header: TRANSLATIONS.ID_GROUP_NAME, dataIndex: 'CON_VALUE', width: 60, align:'left'}
- ]
- });
-
- smodelA = new Ext.grid.RowSelectionModel({
- selectSingle: false,
- listeners:{
- selectionchange: function(sm){
- switch(sm.getCount()){
- case 0: Ext.getCmp('assignButton').disable(); break;
- default: Ext.getCmp('assignButton').enable(); break;
- }
- }
- }
- });
-
- smodelP = new Ext.grid.RowSelectionModel({
- selectSingle: false,
- listeners:{
- selectionchange: function(sm){
- switch(sm.getCount()){
- case 0: Ext.getCmp('removeButton').disable(); break;
- default: Ext.getCmp('removeButton').enable(); break;
- }
- }
- }
- });
-
- searchTextA = new Ext.form.TextField ({
- id: 'searchTextA',
- ctCls:'pm_search_text_field',
- allowBlank: true,
- width: 110,
- emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,
- listeners: {
- specialkey: function(f,e){
- if (e.getKey() == e.ENTER) {
- DoSearchA();
+ sw_func_groups = false;
+ //sw_func_reassign = false;
+ sw_func_auth = false;
+ sw_user_summary = false;
+
+ editMembersButton = new Ext.Action({
+ text: _('ID_EDIT_MEMBEROF'),
+ iconCls: 'button_menu_ext ss_sprite ss_user_add',
+ handler: EditMembersAction
+ });
+
+ cancelEditMembersButton = new Ext.Action({
+ text: _('ID_FINISH_EDITION'),
+ iconCls: 'button_menu_ext ss_sprite ss_cancel',
+ handler: CancelEditMenbersAction,
+ hidden: true
+ });
+
+ backButton = new Ext.Action({
+ text : _('ID_BACK'),
+ iconCls: 'button_menu_ext ss_sprite ss_arrow_redo',
+ handler: BackToUsers
+ });
+
+ saveChangesButton = new Ext.Action({
+ text: _('ID_SAVE_CHANGES'),
+ //iconCls: 'button_menu_ext ss_sprite ss_arrow_redo',
+ handler: SaveChangesAuthForm,
+ disabled: true
+ });
+
+ discardChangesButton = new Ext.Action({
+ text: _('ID_DISCARD_CHANGES'),
+ //iconCls: 'button_menu_ext ss_sprite ss_arrow_redo',
+ handler: LoadAuthForm,
+ disabled: true
+ });
+
+ storeP = new Ext.data.GroupingStore( {
+ proxy : new Ext.data.HttpProxy({
+ url: 'users_Ajax?function=assignedGroups&uUID=' + USERS.USR_UID
+ }),
+ reader : new Ext.data.JsonReader( {
+ root: 'groups',
+ fields : [
+ {name : 'GRP_UID'},
+ {name : 'GRP_STATUS'},
+ {name : 'CON_VALUE'}
+ ]
+ })
+ });
+
+ storeA = new Ext.data.GroupingStore( {
+ proxy : new Ext.data.HttpProxy({
+ url: 'users_Ajax?function=availableGroups&uUID=' + USERS.USR_UID
+ }),
+ reader : new Ext.data.JsonReader( {
+ root: 'groups',
+ fields : [
+ {name : 'GRP_UID'},
+ {name : 'GRP_STATUS'},
+ {name : 'CON_VALUE'}
+ ]
+ })
+ });
+
+ cmodelP = new Ext.grid.ColumnModel({
+ defaults: {
+ width: 50,
+ sortable: true
+ },
+ columns: [
+ {id:'GRP_UID', dataIndex: 'GRP_UID', hidden:true, hideable:false},
+ {header: _('ID_GROUP_NAME'), dataIndex: 'CON_VALUE', width: 60, align:'left'}
+ ]
+ });
+
+ smodelA = new Ext.grid.RowSelectionModel({
+ selectSingle: false,
+ listeners:{
+ selectionchange: function(sm){
+ switch(sm.getCount()){
+ case 0: Ext.getCmp('assignButton').disable(); break;
+ default: Ext.getCmp('assignButton').enable(); break;
+ }
+ }
+ }
+ });
+
+ smodelP = new Ext.grid.RowSelectionModel({
+ selectSingle: false,
+ listeners:{
+ selectionchange: function(sm){
+ switch(sm.getCount()){
+ case 0: Ext.getCmp('removeButton').disable(); break;
+ default: Ext.getCmp('removeButton').enable(); break;
+ }
+ }
+ }
+ });
+
+ searchTextA = new Ext.form.TextField ({
+ id: 'searchTextA',
+ ctCls:'pm_search_text_field',
+ allowBlank: true,
+ width: 110,
+ emptyText: _('ID_ENTER_SEARCH_TERM'),
+ listeners: {
+ specialkey: function(f,e){
+ if (e.getKey() == e.ENTER) {
+ DoSearchA();
+ }
+ }
+ }
+ });
+
+ clearTextButtonA = new Ext.Action({
+ text: 'X',
+ ctCls:'pm_search_x_button',
+ handler: GridByDefaultA
+ });
+
+ searchTextP = new Ext.form.TextField ({
+ id: 'searchTextP',
+ ctCls:'pm_search_text_field',
+ allowBlank: true,
+ width: 110,
+ emptyText: _('ID_ENTER_SEARCH_TERM'),
+ listeners: {
+ specialkey: function(f,e){
+ if (e.getKey() == e.ENTER) {
+ DoSearchP();
+ }
+ }
+ }
+ });
+
+ clearTextButtonP = new Ext.Action({
+ text: 'X',
+ ctCls:'pm_search_x_button',
+ handler: GridByDefaultP
+ });
+
+ availableGrid = new Ext.grid.GridPanel({
+ layout : 'fit',
+ region : 'center',
+ ddGroup : 'assignedGridDDGroup',
+ store : storeA,
+ cm : cmodelP,
+ sm : smodelA,
+ enableDragDrop : true,
+ stripeRows : true,
+ autoExpandColumn: 'CON_VALUE',
+ iconCls : 'icon-grid',
+ id : 'availableGrid',
+ height : 100,
+ autoWidth : true,
+ stateful : true,
+ stateId : 'grid',
+ enableColumnResize : true,
+ enableHdMenu : true,
+ frame : false,
+ columnLines : false,
+ viewConfig : {forceFit:true},
+ tbar: [_('ID_AVAILABLE_GROUPS'),{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA],
+ //bbar: [{xtype: 'tbfill'}, cancelEditMembersButton],
+ listeners: {rowdblclick: AssignGroupsAction},
+ hidden: true
+ });
+
+ assignedGrid = new Ext.grid.GridPanel({
+ layout : 'fit',
+ ddGroup : 'availableGridDDGroup',
+ store : storeP,
+ cm : cmodelP,
+ sm : smodelP,
+ enableDragDrop : true,
+ stripeRows : true,
+ autoExpandColumn: 'CON_VALUE',
+ iconCls : 'icon-grid',
+ id : 'assignedGrid',
+ height : 100,
+ autoWidth : true,
+ stateful : true,
+ stateId : 'grid',
+ enableColumnResize : true,
+ enableHdMenu : true,
+ frame : false,
+ columnLines : false,
+ viewConfig : {forceFit:true},
+ tbar: [_('ID_MEMBER_OF'),{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP],
+ //bbar: [{xtype: 'tbfill'},editMembersButton],
+ listeners: {rowdblclick: function(){
+ (availableGrid.hidden)? DoNothing() : RemoveGroupsAction();
+ }}
+ });
+
+ buttonsPanel = new Ext.Panel({
+ width : 40,
+ layout : {
+ type:'vbox',
+ padding:'0',
+ pack:'center',
+ align:'center'
+ },
+ defaults:{margins:'0 0 35 0'},
+ items:[
+ {xtype:'button',text: '> ', handler: AssignGroupsAction, id: 'assignButton', disabled: true},
+ {xtype:'button',text: ' <', handler: RemoveGroupsAction, id: 'removeButton', disabled: true},
+ {xtype:'button',text: '>>', handler: AssignAllGroupsAction, id: 'assignButtonAll', disabled: false},
+ {xtype:'button',text: '<<', handler: RemoveAllGroupsAction, id: 'removeButtonAll', disabled: false}
+ ],
+ hidden: true
+ });
+
+ //GROUPS DRAG AND DROP PANEL
+ GroupsPanel = new Ext.Panel({
+ title : _('ID_GROUPS'),
+ autoWidth : true,
+ layout : 'hbox',
+ defaults : { flex : 1 }, //auto stretch
+ layoutConfig : { align : 'stretch' },
+ items : [availableGrid,buttonsPanel,assignedGrid],
+ viewConfig : {forceFit:true},
+ bbar: [{xtype: 'tbfill'},editMembersButton, cancelEditMembersButton]
+ });
+
+ comboAuthSourcesStore = new Ext.data.GroupingStore({
+ proxy : new Ext.data.HttpProxy({
+ url: 'users_Ajax?function=authSources'
+ }),
+ reader : new Ext.data.JsonReader( {
+ root: 'sources',
+ fields : [
+ {id: 'AUTH_SOURCE_UID'},
+ {name : 'AUTH_SOURCE_UID'},
+ {name : 'AUTH_SOURCE_NAME'},
+ {name : 'AUTH_SOURCE_PROVIDER'}
+ ]
+ }),
+ autoLoad: true
+ });
+
+ //AUTHENTICATION FORM
+ authForm = new Ext.FormPanel({
+ url: 'users_Ajax?function=updateAuthServices',
+ frame: true,
+ title: _('ID_AUTHENTICATION_FORM_TITLE'),
+ items:[
+ {xtype: 'textfield', name: 'usr_uid', hidden: true },
+ {
+ xtype: 'combo',
+ fieldLabel: _('ID_AUTHENTICATION_SOURCE'),
+ hiddenName: 'auth_source',
+ name: 'auth_source_uid',
+ typeAhead: true,
+ mode: 'local',
+ store: comboAuthSourcesStore,
+ displayField: 'AUTH_SOURCE_NAME',
+ valueField:'AUTH_SOURCE_UID',
+ allowBlank: false,
+ submitValue: true,
+ //hiddenValue: 'AUTH_SOURCE_UID',
+ triggerAction: 'all',
+ emptyText: _('ID_SELECT_AUTH_SOURCE'),
+ selectOnFocus:true,
+ listeners:{
+ select: function(c,r,i){
+ ReportChanges();
+ if (i==0){
+ authForm.getForm().findField('auth_dn').disable();
+ }else{
+ authForm.getForm().findField('auth_dn').enable();
}
}
}
- });
-
- clearTextButtonA = new Ext.Action({
- text: 'X',
- ctCls:'pm_search_x_button',
- handler: GridByDefaultA
- });
-
- searchTextP = new Ext.form.TextField ({
- id: 'searchTextP',
- ctCls:'pm_search_text_field',
+ },
+ {
+ xtype: 'textfield',
+ fieldLabel: _('ID_AUTHENTICATION_DN'),
+ name: 'auth_dn',
+ width: 350,
allowBlank: true,
- width: 110,
- emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,
- listeners: {
- specialkey: function(f,e){
- if (e.getKey() == e.ENTER) {
- DoSearchP();
+ enableKeyEvents: true,
+ listeners: {keyup: function(f,e){ ReportChanges(); }}
+ }
+
+ ],
+ buttons: [discardChangesButton,saveChangesButton]
+ });
+
+ //AUTHENTICATION EDITING PANEL
+ AuthenticationPanel = new Ext.Panel({
+ title : _('ID_AUTHENTICATION'),
+ autoWidth : true,
+ layout : 'hbox',
+ defaults : { flex : 1 }, //auto stretch
+ layoutConfig : { align : 'stretch' },
+ items: [authForm],
+ viewConfig : {forceFit:true},
+ hidden: true,
+ hideLabel: true
+ });
+
+ //SUMMARY VIEW FORM
+
+ userFields = new Ext.form.FieldSet({
+ title: _('ID_USER_INFORMATION'),
+ items: [
+ {xtype: 'label', fieldLabel: _('ID_FIRST_NAME'), id: 'fname', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_LAST_NAME'), id: 'lname', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_USER_NAME'), id: 'uname', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_EMAIL'), id: 'email', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_ADDRESS'), id: 'address', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_ZIP_CODE'), id: 'zipcode', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_COUNTRY'), id: 'country', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_STATE_REGION'), id: 'state', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_LOCATION'), id: 'location', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_PHONE_NUMBER'), id: 'phone', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_POSITION'), id: 'position', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_DEPARTMENT'), id: 'department', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_REPLACED_BY'), id: 'replaced', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_EXPIRATION_DATE'), id: 'duedate', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_STATUS'), id: 'status', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_ROLE'), id: 'role', width: 250}
+ ]
+ });
+
+ caseFields = new Ext.form.FieldSet({
+ title: _('ID_CASES_SUMMARY'),
+ labelWidth: 200,
+ items: [
+ {xtype: 'label', fieldLabel: _('ID_INBOX'), id: 'inbox', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_DRAFT'), id: 'draft', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_TITLE_PARTICIPATED'), id: 'participated', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_UNASSIGNED'), id: 'unassigned', width: 250},
+ {xtype: 'label', fieldLabel: _('ID_PAUSED'), id: 'pause', width: 250}
+ ]
+ });
+
+ viewForm = new Ext.FormPanel({
+ frame: true,
+ //autoScroll: true,
+ //autoWidth: true,
+ layout: 'fit',
+ items:[{
+ layout: 'column',
+ autoScroll: true,
+ items:[
+ {columnWidth:.6, padding: 3, layout: 'form', items: [userFields]},
+ {columnWidth:.4, padding: 3, layout: 'form', items: [caseFields]}
+ ]
+ }]
+ });
+
+ SummaryPanel = new Ext.Panel({
+ title: _('ID_SUMMARY'),
+ autoScroll : true,
+ layout : 'fit',
+ items: [viewForm],
+ viewConfig : {forceFit:true},
+ hidden: true,
+ hideLabel: true
+ });
+
+ //NORTH PANEL WITH TITLE AND ROLE DETAILS
+ northPanel = new Ext.Panel({
+ region: 'north',
+ xtype: 'panel',
+ tbar: [''+_('ID_USER') + ' : ' + parseFullName(USERS.USR_USERNAME,USERS.USR_FIRSTNAME,USERS.USR_LASTNAME,USERS.fullNameFormat) + '',{xtype: 'tbfill'},backButton]
+ });
+
+ //TABS PANEL
+ tabsPanel = new Ext.TabPanel({
+ region: 'center',
+ activeTab: USERS.CURRENT_TAB,
+ items:[SummaryPanel,GroupsPanel,AuthenticationPanel],
+ listeners:{
+ beforetabchange: function(p,t,c){
+ switch(t.title){
+ case _('ID_GROUPS'):
+ if (sw_form_changed){
+ Ext.Msg.confirm(_('ID_USERS'), _('ID_CONFIRM_DISCARD_CHANGES'),
+ function(btn, text){
+ if (btn=="no"){
+ p.setActiveTab(c);
+ }else{
+ LoadAuthForm();
+ }
+ });
}
+ break;
+ case _('ID_SUMMARY'):
+ if (sw_form_changed){
+ Ext.Msg.confirm(_('ID_USERS'), _('ID_CONFIRM_DISCARD_CHANGES'),
+ function(btn, text){
+ if (btn=="no"){
+ p.setActiveTab(c);
+ }else{
+ LoadAuthForm();
+ }
+ });
+ }
+ break;
}
- }
- });
-
- clearTextButtonP = new Ext.Action({
- text: 'X',
- ctCls:'pm_search_x_button',
- handler: GridByDefaultP
- });
-
- availableGrid = new Ext.grid.GridPanel({
- layout : 'fit',
- region : 'center',
- ddGroup : 'assignedGridDDGroup',
- store : storeA,
- cm : cmodelP,
- sm : smodelA,
- enableDragDrop : true,
- stripeRows : true,
- autoExpandColumn: 'CON_VALUE',
- iconCls : 'icon-grid',
- id : 'availableGrid',
- height : 100,
- autoWidth : true,
- stateful : true,
- stateId : 'grid',
- enableColumnResize : true,
- enableHdMenu : true,
- frame : false,
- columnLines : false,
- viewConfig : {forceFit:true},
- tbar: [TRANSLATIONS.ID_AVAILABLE_GROUPS,{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA],
- bbar: [{xtype: 'tbfill'}, assignAllButton],
- listeners: {rowdblclick: AssignGroupsAction}
- });
-
- assignedGrid = new Ext.grid.GridPanel({
- layout : 'fit',
- ddGroup : 'availableGridDDGroup',
- store : storeP,
- cm : cmodelP,
- sm : smodelP,
- enableDragDrop : true,
- stripeRows : true,
- autoExpandColumn: 'CON_VALUE',
- iconCls : 'icon-grid',
- id : 'assignedGrid',
- height : 100,
- autoWidth : true,
- stateful : true,
- stateId : 'grid',
- enableColumnResize : true,
- enableHdMenu : true,
- frame : false,
- columnLines : false,
- viewConfig : {forceFit:true},
- tbar: [TRANSLATIONS.ID_ASSIGNED_GROUPS,{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP],
- bbar: [{xtype: 'tbfill'},removeAllButton],
- listeners: {rowdblclick: RemoveGroupsAction}
- });
-
- buttonsPanel = new Ext.Panel({
- width : 40,
- layout : {
- type:'vbox',
- padding:'0',
- pack:'center',
- align:'center'
},
- defaults:{margins:'0 0 35 0'},
- items:[
- {xtype:'button',text: '>>', handler: AssignGroupsAction, id: 'assignButton', disabled: true},
- {xtype:'button',text: '<<', handler: RemoveGroupsAction, id: 'removeButton', disabled: true}
- ]
- });
-
- RefreshGroups();
+ tabchange: function(p,t){
+ switch(t.title){
+ case _('ID_GROUPS'):
+ sw_func_groups ? DoNothing() : RefreshGroups();
+ sw_func_groups ? DoNothing() : DDLoadGroups();
+ break;
+ case _('ID_AUTHENTICATION'):
+ //LoadAuthForm();
+ sw_func_auth ? DoNothing() : LoadAuthForm();
+ break;
+ case _('ID_SUMMARY'):
+ sw_user_summary ? DoNothing(): LoadSummary();
+ }
+ }
+ }
+ });
- //GROUPS DRAG AND DROP PANEL
- GroupsPanel = new Ext.Panel({
- title : TRANSLATIONS.ID_GROUPS,
- autoWidth : true,
- layout : 'hbox',
- defaults : { flex : 1 }, //auto stretch
- layoutConfig : { align : 'stretch' },
- items : [availableGrid,buttonsPanel,assignedGrid],
- viewConfig : {forceFit:true}
-
- });
-
- comboAuthSourcesStore = new Ext.data.GroupingStore({
- proxy : new Ext.data.HttpProxy({
- url: 'users_Ajax?function=authSources'
- }),
- reader : new Ext.data.JsonReader( {
- root: 'sources',
- fields : [
- {id: 'AUTH_SOURCE_UID'},
- {name : 'AUTH_SOURCE_UID'},
- {name : 'AUTH_SOURCE_NAME'},
- {name : 'AUTH_SOURCE_PROVIDER'}
- ]
- }),
- autoLoad: true
- });
-
- //AUTHENTICATION FORM
- authForm = new Ext.FormPanel({
- url: 'users_Ajax?function=updateAuthServices',
- frame: true,
- title: TRANSLATIONS.ID_AUTHENTICATION_FORM_TITLE,
- items:[
- {xtype: 'textfield', name: 'usr_uid', hidden: true },
- {
- xtype: 'combo',
- fieldLabel: TRANSLATIONS.ID_AUTHENTICATION_SOURCE,
- hiddenName: 'auth_source',
- name: 'auth_source_uid',
- typeAhead: true,
- mode: 'local',
- store: comboAuthSourcesStore,
- displayField: 'AUTH_SOURCE_NAME',
- valueField:'AUTH_SOURCE_UID',
- allowBlank: false,
- submitValue: true,
- //hiddenValue: 'AUTH_SOURCE_UID',
- triggerAction: 'all',
- emptyText: TRANSLATIONS.ID_SELECT_AUTH_SOURCE,
- selectOnFocus:true,
- listeners:{select: function(c,r,i){
- ReportChanges();
- if (i==0){
- authForm.getForm().findField('auth_dn').disable();
- }else{
- authForm.getForm().findField('auth_dn').enable();
- }
- }}
- },
- {
- xtype: 'textfield',
- fieldLabel: TRANSLATIONS.ID_AUTHENTICATION_DN,
- name: 'auth_dn',
- width: 350,
- allowBlank: true,
- enableKeyEvents: true,
- listeners: {keyup: function(f,e){ ReportChanges(); }}
- }
-
- ],
- buttons: [discardChangesButton,saveChangesButton]
- });
-
- LoadAuthForm();
-
-
- //AUTHENTICATION EDITING PANEL
- AuthenticationPanel = new Ext.Panel({
- title : TRANSLATIONS.ID_AUTHENTICATION,
- autoWidth : true,
- layout : 'hbox',
- defaults : { flex : 1 }, //auto stretch
- layoutConfig : { align : 'stretch' },
- items: [authForm],
- viewConfig : {forceFit:true},
- hidden: true,
- hideLabel: true
- });
-
-
- //NORTH PANEL WITH TITLE AND ROLE DETAILS
- northPanel = new Ext.Panel({
- region: 'north',
- xtype: 'panel',
- tbar: [TRANSLATIONS.ID_USERS + ' : ' + USERS.USR_COMPLETENAME + ' (' + USERS.USR_USERNAME + ')',{xtype: 'tbfill'},backButton]
- });
-
- //TABS PANEL
- tabsPanel = new Ext.TabPanel({
- region: 'center',
- activeTab: USERS.CURRENT_TAB,
- items:[GroupsPanel,AuthenticationPanel],
- listeners:{
- beforetabchange: function(p,t,c){
- switch(t.title){
- case TRANSLATIONS.ID_GROUPS:
- if (sw_form_changed){
- Ext.Msg.confirm(TRANSLATIONS.ID_USERS, 'Do you want discard changes?',
- function(btn, text){
- if (btn=="no"){
- p.setActiveTab(c);
- }else{
- LoadAuthForm();
- }
- });
- }
- break;
- }
- },
- tabchange: function(p,t){
- switch(t.title){
- case TRANSLATIONS.ID_GROUPS:
- sw_func_groups ? DoNothing() : DDLoadGroups();
- break;
- case TRANSLATIONS.ID_AUTHENTICATION:
- sw_func_auth ? DoNothing() : LoadAuthForm();
- break;
- }
- }
- }
- });
-
- //LOAD ALL PANELS
- viewport = new Ext.Viewport({
- layout: 'border',
- items: [northPanel, tabsPanel]
- });
-
+ //LOAD ALL PANELS
+ viewport = new Ext.Viewport({
+ layout: 'border',
+ items: [northPanel, tabsPanel]
+ });
});
//Do Nothing Function
-DoNothing = function(){}
+DoNothing = function(){};
//Return to Roles Main Page
BackToUsers = function(){
- location.href = 'users_List';
-}
+ location.href = 'users_List';
+};
//Loads Drag N Drop Functionality for Permissions
DDLoadGroups = function(){
- //GROUPS DRAG N DROP AVAILABLE
- var availableGridDropTargetEl = availableGrid.getView().scroller.dom;
- var availableGridDropTarget = new Ext.dd.DropTarget(availableGridDropTargetEl, {
- ddGroup : 'availableGridDDGroup',
- notifyDrop : function(ddSource, e, data){
- var records = ddSource.dragData.selections;
- var arrAux = new Array();
- for (var r=0; r < records.length; r++){
- arrAux[r] = records[r].data['GRP_UID'];
- }
- DeleteGroupsUser(arrAux,RefreshGroups,FailureProcess);
- return true;
- }
- });
-
- //GROUPS DRAG N DROP ASSIGNED
- var assignedGridDropTargetEl = assignedGrid.getView().scroller.dom;
- var assignedGridDropTarget = new Ext.dd.DropTarget(assignedGridDropTargetEl, {
- ddGroup : 'assignedGridDDGroup',
- notifyDrop : function(ddSource, e, data){
- var records = ddSource.dragData.selections;
- var arrAux = new Array();
- for (var r=0; r < records.length; r++){
- arrAux[r] = records[r].data['GRP_UID'];
- }
- SaveGroupsUser(arrAux,RefreshGroups,FailureProcess);
- return true;
- }
- });
- sw_func_groups = true;
-}
+ //GROUPS DRAG N DROP AVAILABLE
+ var availableGridDropTargetEl = availableGrid.getView().scroller.dom;
+ var availableGridDropTarget = new Ext.dd.DropTarget(availableGridDropTargetEl, {
+ ddGroup : 'availableGridDDGroup',
+ notifyDrop : function(ddSource, e, data){
+ var records = ddSource.dragData.selections;
+ var arrAux = new Array();
+ for (var r=0; r < records.length; r++){
+ arrAux[r] = records[r].data['GRP_UID'];
+ }
+ DeleteGroupsUser(arrAux,RefreshGroups,FailureProcess);
+ return true;
+ }
+});
+
+ //GROUPS DRAG N DROP ASSIGNED
+ var assignedGridDropTargetEl = assignedGrid.getView().scroller.dom;
+ var assignedGridDropTarget = new Ext.dd.DropTarget(assignedGridDropTargetEl, {
+ ddGroup : 'assignedGridDDGroup',
+ notifyDrop : function(ddSource, e, data){
+ var records = ddSource.dragData.selections;
+ var arrAux = new Array();
+ for (var r=0; r < records.length; r++){
+ arrAux[r] = records[r].data['GRP_UID'];
+ }
+ SaveGroupsUser(arrAux,RefreshGroups,FailureProcess);
+ return true;
+ }
+ });
+ sw_func_groups = true;
+};
//LOAD AUTHTENTICATION FORM DATA
LoadAuthForm = function(){
- Ext.Ajax.request({
- url: 'users_Ajax',
- params: {'function': 'loadAuthSourceByUID', uUID: USERS.USR_UID},
- success: function(resp, opt){
- var user = Ext.util.JSON.decode(resp.responseText);
- authForm.getForm().findField('usr_uid').setValue(user.data.USR_UID);
- authForm.getForm().findField('auth_source').setValue(user.auth.AUTH_SOURCE_NAME);
- authForm.getForm().findField('auth_dn').setValue(user.data.USR_AUTH_USER_DN);
- if (user.auth.AUTH_SOURCE_NAME=='ProcessMaker'){
- authForm.getForm().findField('auth_dn').disable();
- }else{
- authForm.getForm().findField('auth_dn').enable();
- }
- },
- failure: DoNothing
- });
-
- sw_func_auth = true;
- sw_form_changed = false;
- saveChangesButton.disable();
- discardChangesButton.disable();
-}
+ Ext.Ajax.request({
+ url: 'users_Ajax',
+ params: {'function': 'loadAuthSourceByUID', uUID: USERS.USR_UID},
+ success: function(resp, opt){
+ var user = Ext.util.JSON.decode(resp.responseText);
+ authForm.getForm().findField('usr_uid').setValue(user.data.USR_UID);
+ authForm.getForm().findField('auth_source').setValue(user.auth.AUTH_SOURCE_NAME);
+ authForm.getForm().findField('auth_dn').setValue(user.data.USR_AUTH_USER_DN);
+ if (user.auth.AUTH_SOURCE_NAME=='ProcessMaker'){
+ authForm.getForm().findField('auth_dn').disable();
+ }else{
+ authForm.getForm().findField('auth_dn').enable();
+ }
+ },
+ failure: DoNothing
+ });
+ sw_func_auth = true;
+ sw_form_changed = false;
+ saveChangesButton.disable();
+ discardChangesButton.disable();
+};
//ReportChanges
ReportChanges = function(){
- saveChangesButton.enable();
- discardChangesButton.enable();
- sw_form_changed = true;
-}
+ saveChangesButton.enable();
+ discardChangesButton.enable();
+ sw_form_changed = true;
+};
//REFRESH GROUPS GRIDS
RefreshGroups = function(){
- DoSearchA();
- DoSearchP();
-}
+ DoSearchA();
+ DoSearchP();
+};
//SAVE AUTHENTICATION CHANGES
SaveChangesAuthForm = function(){
- viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING);
- authForm.getForm().submit({
- success: function(f,a){
- LoadAuthForm();
- viewport.getEl().unmask();
- },
- failure: function(f,a){
- FailureProcess();
- viewport.getEl().unmask();
- }
- });
-}
+ viewport.getEl().mask(_('ID_PROCESSING'));
+ authForm.getForm().submit({
+ success: function(f,a){
+ LoadAuthForm();
+ viewport.getEl().unmask();
+ },
+ failure: function(f,a){
+ FailureProcess();
+ viewport.getEl().unmask();
+ }
+ });
+};
//FAILURE AJAX FUNCTION
FailureProcess = function(){
- Ext.Msg.alert(TRANSLATIONS.ID_USERS, TRANSLATIONS.ID_MSG_AJAX_FAILURE);
-}
+ Ext.Msg.alert(_('ID_USERS'), _('ID_MSG_AJAX_FAILURE'));
+};
//ASSIGN GROUPS TO A USER
SaveGroupsUser = function(arr_grp, function_success, function_failure){
- var sw_response;
- viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING);
- Ext.Ajax.request({
- url: 'users_Ajax',
- params: {'function': 'assignGroupsToUserMultiple', USR_UID: USERS.USR_UID, GRP_UID: arr_grp.join(',')},
- success: function(){
- function_success();
- viewport.getEl().unmask();
- },
- failure: function(){
- function_failure();
- viewport.getEl().unmask();
- }
- });
-}
+ var sw_response;
+ viewport.getEl().mask(_('ID_PROCESSING'));
+ Ext.Ajax.request({
+ url: 'users_Ajax',
+ params: {'function': 'assignGroupsToUserMultiple', USR_UID: USERS.USR_UID, GRP_UID: arr_grp.join(',')},
+ success: function(){
+ function_success();
+ viewport.getEl().unmask();
+ },
+ failure: function(){
+ function_failure();
+ viewport.getEl().unmask();
+ }
+ });
+};
//REMOVE GROUPS FROM A USER
DeleteGroupsUser = function(arr_grp, function_success, function_failure){
- var sw_response;
- viewport.getEl().mask(TRANSLATIONS.ID_PROCESSING);
- Ext.Ajax.request({
- url: 'users_Ajax',
- params: {'function': 'deleteGroupsToUserMultiple', USR_UID: USERS.USR_UID, GRP_UID: arr_grp.join(',')},
- success: function(){
- function_success();
- viewport.getEl().unmask();
- },
- failure: function(){
- function_failure();
- viewport.getEl().unmask();
- }
- });
-}
+ var sw_response;
+ viewport.getEl().mask(_('ID_PROCESSING'));
+ Ext.Ajax.request({
+ url: 'users_Ajax',
+ params: {'function': 'deleteGroupsToUserMultiple', USR_UID: USERS.USR_UID, GRP_UID: arr_grp.join(',')},
+ success: function(){
+ function_success();
+ viewport.getEl().unmask();
+ },
+ failure: function(){
+ function_failure();
+ viewport.getEl().unmask();
+ }
+ });
+};
//AssignButton Functionality
AssignGroupsAction = function(){
- rowsSelected = availableGrid.getSelectionModel().getSelections();
- var arrAux = new Array();
- for(var a=0; a < rowsSelected.length; a++){
- arrAux[a] = rowsSelected[a].get('GRP_UID');
- }
- SaveGroupsUser(arrAux,RefreshGroups,FailureProcess);
-}
+ rowsSelected = availableGrid.getSelectionModel().getSelections();
+ var arrAux = new Array();
+ for(var a=0; a < rowsSelected.length; a++){
+ arrAux[a] = rowsSelected[a].get('GRP_UID');
+ }
+ SaveGroupsUser(arrAux,RefreshGroups,FailureProcess);
+};
//RemoveButton Functionality
RemoveGroupsAction = function(){
- rowsSelected = assignedGrid.getSelectionModel().getSelections();
- var arrAux = new Array();
- for(var a=0; a < rowsSelected.length; a++){
- arrAux[a] = rowsSelected[a].get('GRP_UID');
- }
- DeleteGroupsUser(arrAux,RefreshGroups,FailureProcess);
-}
+ rowsSelected = assignedGrid.getSelectionModel().getSelections();
+ var arrAux = new Array();
+ for(var a=0; a < rowsSelected.length; a++){
+ arrAux[a] = rowsSelected[a].get('GRP_UID');
+ }
+ DeleteGroupsUser(arrAux,RefreshGroups,FailureProcess);
+};
//AssignALLButton Functionality
AssignAllGroupsAction = function(){
- var allRows = availableGrid.getStore();
- var arrAux = new Array();
- if (allRows.getCount()>0){
- for (var r=0; r < allRows.getCount(); r++){
- row = allRows.getAt(r);
- arrAux[r] = row.data['GRP_UID'];
- }
- SaveGroupsUser(arrAux,RefreshGroups,FailureProcess);
- }
-}
+ var allRows = availableGrid.getStore();
+ var arrAux = new Array();
+ if (allRows.getCount()>0){
+ for (var r=0; r < allRows.getCount(); r++){
+ row = allRows.getAt(r);
+ arrAux[r] = row.data['GRP_UID'];
+ }
+ SaveGroupsUser(arrAux,RefreshGroups,FailureProcess);
+ }
+};
//RevomeALLButton Functionality
RemoveAllGroupsAction = function(){
- var allRows = assignedGrid.getStore();
- var arrAux = new Array();
- if (allRows.getCount()>0){
- for (var r=0; r < allRows.getCount(); r++){
- row = allRows.getAt(r);
- arrAux[r] = row.data['GRP_UID'];
- }
- DeleteGroupsUser(arrAux,RefreshGroups,FailureProcess);
- }
-}
+ var allRows = assignedGrid.getStore();
+ var arrAux = new Array();
+ if (allRows.getCount()>0){
+ for (var r=0; r < allRows.getCount(); r++){
+ row = allRows.getAt(r);
+ arrAux[r] = row.data['GRP_UID'];
+ }
+ DeleteGroupsUser(arrAux,RefreshGroups,FailureProcess);
+ }
+};
//Function DoSearch Available
DoSearchA = function(){
- availableGrid.store.load({params: {textFilter: searchTextA.getValue()}});
-}
+ availableGrid.store.load({params: {textFilter: searchTextA.getValue()}});
+};
//Function DoSearch Assigned
DoSearchP = function(){
- assignedGrid.store.load({params: {textFilter: searchTextP.getValue()}});
-}
+ assignedGrid.store.load({params: {textFilter: searchTextP.getValue()}});
+};
//Load Grid By Default Available Members
GridByDefaultA = function(){
- searchTextA.reset();
- availableGrid.store.load();
-}
+ searchTextA.reset();
+ availableGrid.store.load();
+};
//Load Grid By Default Assigned Members
GridByDefaultP = function(){
- searchTextP.reset();
- assignedGrid.store.load();
-}
\ No newline at end of file
+ searchTextP.reset();
+ assignedGrid.store.load();
+};
+
+//edit members action
+EditMembersAction = function(){
+ availableGrid.show();
+ buttonsPanel.show();
+ editMembersButton.hide();
+ cancelEditMembersButton.show();
+ GroupsPanel.doLayout();
+};
+
+//CancelEditMenbers Function
+CancelEditMenbersAction = function(){
+ availableGrid.hide();
+ buttonsPanel.hide();
+ editMembersButton.show();
+ cancelEditMembersButton.hide();
+ GroupsPanel.doLayout();
+};
+
+//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;
+};
+
+//Load Summary Function
+LoadSummary = function(){
+ //viewport.getEl().mask(_('ID_PROCESSING'));
+ Ext.Ajax.request({
+ url: 'users_Ajax',
+ params: {'function': 'summaryUserData', USR_UID: USERS.USR_UID},
+ success: function(r,o){
+ //viewport.getEl().unmask();
+ sw_user_summary = true;
+ var user = Ext.util.JSON.decode(r.responseText);
+ Ext.getCmp('fname').setText(user.userdata.USR_FIRSTNAME);
+ Ext.getCmp('lname').setText(user.userdata.USR_LASTNAME);
+ Ext.getCmp('uname').setText(user.userdata.USR_USERNAME);
+ Ext.getCmp('email').setText(user.userdata.USR_EMAIL);
+ Ext.getCmp('country').setText(user.userdata.USR_COUNTRY);
+ Ext.getCmp('state').setText(user.userdata.USR_CITY);
+ Ext.getCmp('location').setText(user.userdata.USR_LOCATION);
+ Ext.getCmp('role').setText(user.userdata.USR_ROLE);
+ Ext.getCmp('address').setText(user.userdata.USR_ADDRESS);
+ Ext.getCmp('phone').setText(user.userdata.USR_PHONE);
+ Ext.getCmp('zipcode').setText(user.userdata.USR_ZIP_CODE);
+ Ext.getCmp('duedate').setText(user.userdata.USR_DUE_DATE);
+ Ext.getCmp('status').setText(user.userdata.USR_STATUS);
+ Ext.getCmp('replaced').setText(user.misc.REPLACED_NAME);
+ Ext.getCmp('department').setText(user.misc.DEP_TITLE);
+
+ Ext.getCmp('inbox').setText(user.cases.to_do);
+ Ext.getCmp('draft').setText(user.cases.draft);
+ Ext.getCmp('participated').setText(user.cases.sent);
+ Ext.getCmp('unassigned').setText(user.cases.selfservice);
+ Ext.getCmp('pause').setText(user.cases.paused);
+
+ },
+ failure:function(r,o){
+ //viewport.getEl().unmask();
+ }
+ });
+};
\ No newline at end of file
diff --git a/workflow/engine/templates/users/usersList.js b/workflow/engine/templates/users/usersList.js
index 85e53f7d9..eb4565e6b 100755
--- a/workflow/engine/templates/users/usersList.js
+++ b/workflow/engine/templates/users/usersList.js
@@ -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();
+
+ fullNameFormat = CONFIG.fullNameFormat;
+ dateFormat = CONFIG.dateFormat;
+ pageSize = parseInt(CONFIG.pageSize);
+
+ newButton = new Ext.Action({
+ text: _('ID_NEW'),
+ iconCls: 'button_menu_ext ss_sprite ss_add',
+ handler: NewUserAction
+ });
- newButton = new Ext.Action({
- text: TRANSLATIONS.ID_NEW,
- iconCls: 'button_menu_ext ss_sprite ss_add',
- handler: NewUserAction
- });
+ summaryButton = new Ext.Action({
+ text: _('ID_SUMMARY'),
+ iconCls: 'button_menu_ext ss_sprite ss_table',
+ handler: SummaryTabOpen,
+ disabled: true
+ });
- editButton = new Ext.Action({
- text: TRANSLATIONS.ID_EDIT,
- iconCls: 'button_menu_ext ss_sprite ss_pencil',
- handler: EditUserAction,
- 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: TRANSLATIONS.ID_DELETE,
- iconCls: 'button_menu_ext ss_sprite ss_delete',
- handler: DeleteUserAction,
- 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: TRANSLATIONS.ID_GROUPS,
- iconCls: 'button_menu_ext ss_sprite ss_group_add',
- handler: UsersGroupPage,
- 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();
- },
- rowdeselect: function(sm){
- editButton.disable();
- deleteButton.disable();
- groupsButton.disable();
- //reassignButton.disable();
- authenticationButton.disable();
- }
- }
- });
+ 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();
+ }
+ }
+ });
- 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'}
- ]
- })
- });
+ 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'}
+ ]
+ })
+ });
- 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'}
- ]
- });
+ storePageSize = new Ext.data.SimpleStore({
+ fields: ['size'],
+ data: [['20'],['30'],['40'],['50'],['100']],
+ autoLoad: true
+ });
- 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 = 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.on('rowcontextmenu',
- function (grid, rowIndex, evt) {
- var sm = grid.getSelectionModel();
- sm.selectRow(rowIndex, sm.isSelected(rowIndex));
- },
- this
- );
+ comboPageSize.setValue(pageSize);
+
+ 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.on('rowcontextmenu',
+ function (grid, rowIndex, evt) {
+ var sm = grid.getSelectionModel();
+ sm.selectRow(rowIndex, sm.isSelected(rowIndex));
+ },
+ this
+ );
+
+ infoGrid.on('contextmenu',
+ function (evt) {
+ evt.preventDefault();
+ },
+ this
+ );
+
+ infoGrid.addListener('rowcontextmenu',onMessageContextMenu,this);
- infoGrid.store.load();
+ infoGrid.store.load();
- viewport = new Ext.Viewport({
- layout: 'fit',
- autoScroll: false,
- items: [
- infoGrid
- ]
- });
+ 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 '
';
-}
+ return '
';
+};
+
+//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 '' + _('ID_ACTIVE') + ''; break;
+ case 'INACTIVE': return '' + _('ID_INACTIVE') + '';; break;
+ case 'VACATION': return '' + _('ID_VACATION') + '';; break;
+ }
+};
+
+//Render Due Date
+render_duedate = function(v,x,s){
+ if (s.data.DUE_DATE_OK)
+ return v;
+ else
+ return '' + v + '';
+};
//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
- });
-}
\ No newline at end of file
+ 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;
+};
\ No newline at end of file