Fix message text on deleting accounts/users/groups/profiles.

Fix error on retrieving profile data while closing session.
Give focus to "inputs" after loading content.
Update translations.
This commit is contained in:
nuxsmin
2013-11-04 02:27:41 +01:00
parent 75860d7724
commit 10d11e6fdc
22 changed files with 155 additions and 71 deletions

View File

@@ -1,3 +1,10 @@
=== ** v1.0.1 ** ===
* [BUG] Corregido mensaje al eliminar cuentas/usuarios/grupos/perfiles.
* [BUG] Corregido fallo al obtener el perfil de usuario tras finalizar la sesión.
* [MOD] Dar el foco a los "inputs" tras cargar el contenido.
* [MOD] Revisión de traducción.
=== ** v1.0 ** ===
* [NUEVO] Se muestran los grupos secundarios en el menú contextual de los resultados de búsqueda.
@@ -126,6 +133,13 @@
---
=== ** v1.0.1 ** ===
* [BUG] Fix message text on deleting accounts/users/groups/profiles.
* [BUG] Fix error on retrieving profile data while closing session.
* [MOD] Give focus to "inputs" after loading content.
* [MOD] Update translations.
=== ** v1.0 ** ===
* [NEW] Secondary groups are shown on search results context menu.

View File

@@ -105,7 +105,7 @@ if ($frmSaveType == 1) {
SP_Common::printXML(_('Las claves no coinciden'));
}
} else {
$SP_Common::printXML(_('No es una acción válida'));
$SP_Common::printXML(_('Acción Inválida'));
}
if ($frmSaveType == 1 || $frmSaveType == 4) {
@@ -228,5 +228,5 @@ switch ($frmSaveType) {
SP_Common::printXML(_('Error al actualizar la clave'));
break;
default:
SP_Common::printXML(_('No es una acción válida'));
SP_Common::printXML(_('Acción Inválida'));
}

View File

@@ -38,8 +38,6 @@ if (!$sk || !SP_Common::checkSessionKey($sk)) {
SP_Common::printXML(_('CONSULTA INVÁLIDA'));
}
SP_Users::checkUserAccess("backup") || die ('<DIV CLASS="error">'._('No tiene permisos para acceder a esta página').'</DIV');
$doBackup = SP_Common::parseParams('p', 'backup', 0);
if ( $doBackup ){

View File

@@ -38,8 +38,6 @@ if (!$sk || !SP_Common::checkSessionKey($sk)) {
SP_Common::printXML(_('CONSULTA INVÁLIDA'));
}
SP_Users::checkUserAccess('categories') || SP_Html::showCommonError('unavailable');
$intCategoryFunction = SP_Common::parseParams('p', 'categoryFunction', 0);
$categoryName = SP_Common::parseParams('p', 'categoryName');
$categoryNameNew = SP_Common::parseParams('p', 'categoryNameNew');
@@ -115,5 +113,5 @@ switch ($intCategoryFunction) {
}
break;
default:
SP_Common::printXML(_('No es una acción válida'));
SP_Common::printXML(_('Acción Inválida'));
}

View File

@@ -38,8 +38,6 @@ if (!$sk || !SP_Common::checkSessionKey($sk)) {
SP_Common::printXML(_('CONSULTA INVÁLIDA'));
}
SP_Users::checkUserAccess("config") || SP_Html::showCommonError('nopermission');
$frmAction = SP_Common::parseParams('p', 'action');
if ($frmAction == "config") {
@@ -194,5 +192,5 @@ if ($frmAction == "config") {
SP_Common::printXML(_('Error al guardar el hash de la clave maestra'));
} else {
SP_Common::printXML(_('No es una acción válida'));
SP_Common::printXML(_('Acción Inválida'));
}

View File

@@ -32,8 +32,6 @@ if ( ! SP_Init::isLoggedIn() ) {
return;
}
SP_Users::checkUserAccess("accfiles") || die ('<DIV CLASS="error">'._('No tiene permisos para acceder a esta página').'</DIV');
if ( SP_Config::getValue('filesenabled') == 0 ){
echo _('Gestión de archivos deshabilitada');
return FALSE;

View File

@@ -97,7 +97,7 @@ switch ($action) {
echo ( SP_Users::checkUserAccess("profiles") ) ? '<LI><A HREF="#tabs-3" TITLE="' . _('Gestión de Perfiles') . '">' . _('Gestión de Perfiles') . '</A></LI>' : '';
echo '</UL>';
$tplvars['active'] = 0;
$tplvars['active'] = 0;
if (SP_Users::checkUserAccess("users")) {
$arrUsersTableProp = array(
@@ -191,13 +191,14 @@ switch ($action) {
}
echo '</DIV>';
echo '<script>
$("#tabs").tabs();
$("#tabs").tabs( "option", "active", ' . $itemId . ');
$("#tabs").on("tabsactivate", function( event, ui ) {
setContentSize();
//$("#container").css("height",$("#content").height() + 150);
$("#tabs").tabs({
active: ' . $itemId . ',
create: function( event, ui ) {$("input:visible:first").focus();},
activate: function( event, ui ) {
setContentSize();
}
});
</script>';
break;
@@ -255,13 +256,16 @@ switch ($action) {
echo '</DIV>';
echo '<SCRIPT>
$("#tabs").tabs();
$("#tabs").tabs( "option", "active", ' . $itemId . ');
$("#tabs").on("tabsactivate", function( event, ui ) {
$("#container").css("height",$("#content").height() + 150);
echo '<script>
$("#tabs").tabs({
active: ' . $itemId . ',
create: function( event, ui ) {$("input:visible:first").focus();},
activate: function( event, ui ) {
setContentSize();
$("input:visible:first").focus();
}
});
</SCRIPT>';
</script>';
break;
case "eventlog":
SP_Users::checkUserAccess($action) || SP_Html::showCommonError('unavailable');

View File

@@ -1 +1 @@
<?php
<?php

View File

@@ -184,7 +184,12 @@ foreach ( $resQuery as $account ){
echo'<li class="cell-img">';
$groupsName = _('Grupos').':<br><br>*'.$account->usergroup_name.'<br>';
$groupsName .= implode('<br>', SP_Account::getAccountGroupsName($account->account_id));
$secondaryGroups = SP_Account::getAccountGroupsName($account->account_id);
if ( $secondaryGroups ){
$groupsName .= implode('<br>', $secondaryGroups);
}
echo '<img src="imgs/btn_group.png" title="'.$groupsName.'" />';

View File

@@ -32,7 +32,6 @@ if (!SP_Init::isLoggedIn()) {
SP_Util::logout();
}
if ( SP_Common::parseParams('p', 'id', FALSE, TRUE) && SP_Common::parseParams('p', 'type', FALSE, TRUE) ) {
$tplvars['itemid'] = SP_Common::parseParams('p', 'id', 0);
$itemType = $tplvars['itemtype'] = SP_Common::parseParams('p', 'type', 0);

View File

@@ -44,12 +44,6 @@ $frmSaveType = SP_Common::parseParams('p', 'type', 0);
$frmAction = SP_Common::parseParams('p', 'action', 0);
$frmItemId = SP_Common::parseParams('p', 'id', 0);
if ($frmAction == 3) {
SP_Users::checkUserAccess("acceditpass", $frmItemId) || die('<DIV CLASS="error"' . _('No tiene permisos para acceder') . '</DIV');
} else {
SP_Users::checkUserAccess("users") || die('<DIV CLASS="error"' . _('No tiene permisos para acceder') . '</DIV');
}
$objUser = new SP_Users;
if ($frmSaveType == 1 || $frmSaveType == 2) {
@@ -143,8 +137,14 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
SP_Common::printXML(_('Error al actualizar el usuario'));
}
// Cambio de clave
} elseif ($frmAction == 3 && !SP_Config::getValue('demoenabled', 0)) {
// Cambio de clave
} elseif ($frmAction == 3) {
$userLogin = $objUser->getUserLoginById($frmItemId);
if ( SP_Config::getValue('demoenabled', 0) && $userLogin == 'demo'){
SP_Common::printXML(_('Acción Inválida').'(DEMO)');
}
if (!$frmUsrPass || !$frmUsrPassV) {
SP_Common::printXML(_('La clave no puede estar en blanco'), 2);
}
@@ -158,7 +158,7 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
if ($objUser->manageUser("updatepass")) {
$message['action'] = _('Modificar Clave Usuario');
$message['text'][] = _('Nombre') . ': ' . $frmUsrName . ' (' . $frmUsrLogin . ')';
$message['text'][] = _('Login') . ': ' . $userLogin;
SP_Common::wrLogInfo($message);
SP_Common::sendEmail($message);
@@ -168,8 +168,14 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
SP_Common::printXML(_('Error al modificar la clave'));
// Eliminar usuario
} elseif ($frmAction == 4 && !SP_Config::getValue('demoenabled', 0)) {
} elseif ($frmAction == 4) {
$userLogin = $objUser->getUserLoginById($frmItemId);
if ( SP_Config::getValue('demoenabled', 0) && $userLogin == 'demo' ){
SP_Common::printXML(_('Acción Inválida').'(DEMO)');
}
$objUser->userId = $frmItemId;
if ($frmItemId == $_SESSION["uid"]) {
@@ -178,7 +184,7 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
if ($objUser->manageUser("delete")) {
$message['action'] = _('Eliminar Usuario');
$message['text'][] = _('Login') . ': ' . $frmUsrName . ' (' . $frmUsrLogin . ')';
$message['text'][] = _('Login') . ': ' . $userLogin;
SP_Common::wrLogInfo($message);
SP_Common::sendEmail($message);
@@ -189,11 +195,11 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
SP_Common::printXML(_('Error al eliminar el usuario'));
}
SP_Common::printXML(_('No es una acción válida'));
SP_Common::printXML(_('Acción Inválida'));
} elseif ($frmSaveType == 3 || $frmSaveType == 4) {
// Variables POST del formulario
$frmGrpName = ( isset($_POST["name"]) ) ? SP_Html::sanitize($_POST["name"]) : "";
$frmGrpDesc = ( isset($_POST["description"]) ) ? SP_Html::sanitize($_POST["description"]) : "";
$frmGrpName = SP_Common::parseParams('p', 'name');
$frmGrpDesc = SP_Common::parseParams('p', 'description');
// Nuevo grupo o editar
if ($frmAction == 1 OR $frmAction == 2) {
@@ -235,7 +241,7 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
SP_Common::printXML(_('Error al actualizar el grupo'));
}
// Eliminar grupo
// Eliminar grupo
} elseif ($frmAction == 4) {
$objUser->groupId = $frmItemId;
@@ -244,9 +250,11 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
if (is_string($resGroupUse)) {
SP_Common::printXML(_('No es posible eliminar:Grupo en uso por') . ' ' . $resGroupUse);
} else {
$groupName = $objUser->getGroupNameById($frmItemId);
if ($objUser->manageGroup("delete")) {
$message['action'] = _('Eliminar Grupo');
$message['text'][] = _('Nombre') . ': ' . $frmGrpName;
$message['text'][] = _('Nombre') . ': ' . $groupName;
SP_Common::wrLogInfo($message);
SP_Common::sendEmail($message);
@@ -258,12 +266,12 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
}
}
SP_Common::printXML(_('No es una acción válida'));
SP_Common::printXML(_('Acción Inválida'));
} elseif ($frmSaveType == 5 || $frmSaveType == 6) {
$profileProp = array();
// Variables POST del formulario
$frmProfileName = ( isset($_POST["profile_name"]) ) ? SP_Html::sanitize($_POST["profile_name"]) : "";
$frmProfileName = SP_Common::parseParams('p', 'profile_name');
$objUser->profileId = $frmItemId;
// Profile properties Array
@@ -322,16 +330,18 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
SP_Common::printXML(_('Error al actualizar el perfil'));
}
// Eliminar perfil
// Eliminar perfil
} elseif ($frmAction == 4) {
$resProfileUse = $objUser->checkProfileInUse();
if (is_string($resProfileUse)) {
SP_Common::printXML(_('No es posible eliminar: Perfil en uso por') . ' ' . $resProfileUse);
} else {
$profileName = $objUser->getProfileNameById($frmItemId);
if ($objUser->manageProfiles("delete")) {
$message['action'] = _('Eliminar Perfil');
$message['text'][] = _('Nombre') . ': ' . $frmProfileName;
$message['text'][] = _('Nombre') . ': ' . $profileName;
SP_Common::wrLogInfo($message);
SP_Common::sendEmail($message);
@@ -343,5 +353,5 @@ if ($frmSaveType == 1 || $frmSaveType == 2) {
}
}
SP_Common::printXML(_('No es una acción válida'));
SP_Common::printXML(_('Acción Inválida'));
}

View File

@@ -42,7 +42,6 @@ $strError = '<div id="fancyView" class="msgError">'._('No tiene permisos para re
SP_Users::checkUserAccess("acceditpass",$userId) || die ($strError);
$isDemoMode = SP_Config::getValue('demoenabled', 0);
?>
<div id="fancyContainer" align="center">
@@ -66,11 +65,7 @@ $isDemoMode = SP_Config::getValue('demoenabled', 0);
</td>
</tr>
</table>
<? if ( ! $isDemoMode ): ?>
<input type="hidden" name="action" value="3" />
<? elseif ( $_SESSION['uid'] != $userId && $isDemoMode ): ?>
<input type="hidden" name="id" value="<? echo $userId; ?>" />
<? endif; ?>
<input type="hidden" name="id" value="<? echo $userId; ?>" />
<input type="hidden" name="type" value="1" />
<input type="hidden" name="action" value="3" />
<input type="hidden" name="sk" value="<? echo SP_Common::getSessionKey(); ?>">
@@ -88,5 +83,4 @@ $isDemoMode = SP_Config::getValue('demoenabled', 0);
</li>
</ul>
</div>
</div>
<script type="text/javascript">$("#usrpass").focus();</script>
</div>

View File

@@ -459,7 +459,7 @@ class SP_Account {
$message['action'] = _('Eliminar Cuenta');
$message['text'][] = _('Cliente').": ".$this->cacheParams['customer_name'];
$message['text'][] = _('Cuenta').": $this->accountName ($this->accountId)";
$message['text'][] = _('Cuenta').": ".$this->cacheParams['account_name']." ($this->accountId)";
$query = "DELETE FROM accounts "
. "WHERE account_id = ".(int)$this->accountId." LIMIT 1";
@@ -725,7 +725,6 @@ class SP_Account {
* @return array con los nombres de los grupos ordenados
*/
public static function getAccountGroupsName ($accountId){
$query = "SELECT usergroup_name FROM accGroups "
. "JOIN usrGroups ON accgroup_groupId = usergroup_id "
. "WHERE accgroup_accountId = ".(int)$accountId;
@@ -736,6 +735,10 @@ class SP_Account {
return FALSE;
}
if (!is_array($queryRes)) {
return FALSE;
}
foreach ( $queryRes as $groups ){
$groupsName[] = $groups->usergroup_name;
}

View File

@@ -208,7 +208,7 @@ class SP_Config{
if ( ! is_dir($bakDstDir) ){
if ( ! @mkdir($bakDstDir, 0550) ){
$arrOut['error'] = '<span class="altTxtError">'._('No es posible crear el directorio de backups').' ('.$bakDstDir.')</span>';
$arrOut['error'] = _('No es posible crear el directorio de backups').' ('.$bakDstDir.')';
$message['action'] = _('Copia BBDD');
$message['text'][] = _('No es posible crear el directorio de backups');
@@ -220,7 +220,7 @@ class SP_Config{
}
if ( ! is_writable($bakDstDir) ){
$arrOut['error'] = '<span class="altTxtError">'._('Compruebe los permisos del directorio de backups').'</span>';
$arrOut['error'] = _('Compruebe los permisos del directorio de backups');
$error = 1;
}

View File

@@ -428,5 +428,6 @@ $skey = SP_Common::getSessionKey(TRUE);
$("#selGroups").chosen({
placeholder_text_multiple: "<? echo _('Seleccionar grupos secundarios'); ?>",
});
$('input:text:visible:first').focus();
</script>
<? endif; ?>

View File

@@ -83,4 +83,5 @@ if (!$account->checkAccountAccess("acceditpass") || !SP_Users::checkUserAccess("
<img SRC="imgs/check.png" title="<? echo _('Guardar'); ?>" class="inputImg" id="btnSave" OnClick="saveAccount('frmEditPass');" />
</li>
</ul>
</div>
</div>
<script>$('input:password:visible:first').focus();</script>

View File

@@ -117,10 +117,10 @@ $activeTab = $data['active'];
<input type="hidden" name="is_ajax" value="1">
<script>
$(function() {
$("#btnProfilesAcc").buttonset();
$("#btnProfilesConfig").buttonset();
$("#btnProfilesUsers").buttonset();
$("#btnProfilesOthers").buttonset();
$('#btnProfilesAcc').buttonset();
$('#btnProfilesConfig').buttonset();
$('#btnProfilesUsers').buttonset();
$('#btnProfilesOthers').buttonset();
});
</script>
</form>

View File

@@ -83,6 +83,7 @@ $categoriesSelProp = array("name" => "category",
$("#rpp").spinner({step: 5, max: 50, min: 5, numberFormat: "n", stop: function(event, ui) {
accSearch(0);
}});
$('input:text:visible:first').focus();
</script>
<div id="resBuscar"></div>

View File

@@ -512,8 +512,9 @@ class SP_Users {
// Número de usuarios con el grupo
$query = "SELECT user_id FROM usrData WHERE user_groupId = " . (int) $this->groupId;
if (DB::doQuery($query, __FUNCTION__) === FALSE)
if (DB::doQuery($query, __FUNCTION__) === FALSE){
return FALSE;
}
$numRows = count(DB::$last_result);
$txt = _('Usuarios') . " (" . $numRows . ")";
@@ -985,6 +986,57 @@ class SP_Users {
return (int) $queryRes[0]->user_id;
}
/**
* @brief Obtener el login de usuario a partir del Id
* @return string con el login del usuario
*/
public static function getUserLoginById($id) {
$query = "SELECT user_login FROM usrData
WHERE user_id = " . (int)$id . " LIMIT 1";
$queryRes = DB::getResults($query, __FUNCTION__);
if ($queryRes === FALSE || !is_array($queryRes)) {
return FALSE;
}
return $queryRes[0]->user_login;
}
/**
* @brief Obtener el nombre de un grupo por a partir del Id
* @return string con el nombre del grupo
*/
public static function getGroupNameById($id) {
$query = "SELECT usergroup_name FROM usrGroups
WHERE usergroup_id = " . (int)$id . " LIMIT 1";
$queryRes = DB::getResults($query, __FUNCTION__);
if ($queryRes === FALSE || !is_array($queryRes)) {
return FALSE;
}
return $queryRes[0]->usergroup_name;
}
/**
* @brief Obtener el nombre de un perfil por a partir del Id
* @return string con el nombre del perfil
*/
public static function getProfileNameById($id) {
$query = "SELECT userprofile_name FROM usrProfiles
WHERE userprofile_id = " . (int)$id . " LIMIT 1";
$queryRes = DB::getResults($query, __FUNCTION__);
if ($queryRes === FALSE || !is_array($queryRes)) {
return FALSE;
}
return $queryRes[0]->userprofile_name;
}
/**
* @brief Autentifica al usuario con LDAP
@@ -1252,6 +1304,12 @@ class SP_Users {
* @return object con los permisos del perfil del usuario
*/
public static function getUserProfile() {
$userId = SP_Common::parseParams('s', 'uid', 0);
if ( ! $userId ){
return FALSE;
}
$query = "SELECT user_profileId,
userProfile_pView,
userProfile_pViewPass,
@@ -1273,7 +1331,7 @@ class SP_Users {
userProfile_pEventlog
FROM usrData
JOIN usrProfiles ON userProfile_Id = user_profileId
WHERE user_id = " . $_SESSION['uid'] . " LIMIT 1";
WHERE user_id = " . $userId . " LIMIT 1";
$queryRes = DB::getResults($query, __FUNCTION__);

View File

@@ -169,7 +169,8 @@ class SP_Util {
* @return array con el número de versión
*/
public static function getVersion() {
return array(1, 00, 01);
//return array(1, 00, 01);
return array(1, 00, 'rc3');
}
/**

View File

@@ -33,7 +33,8 @@ jQuery.extend(jQuery.fancybox.defaults, {
autoHeight: 'true',
minHeight: 50,
padding: 0,
helpers: {overlay : { css : { 'background' : 'rgba(0, 0, 0, 0.1)'}}}
helpers: {overlay : { css : { 'background' : 'rgba(0, 0, 0, 0.1)'}}},
afterShow: function(){$('#fancyContainer input:visible:first').focus();}
});
$(document).ready(function(){
@@ -577,7 +578,7 @@ function usersMgmt(frmId, isDel, id, type, sk){
var active = frmId;
alertify.confirm(atext, function (e) {
if ( e) {
if (e) {
usersAjax(data, url);
doAction('usersmenu','',active)
}