Fix updates checking.

Change fancybox to alertify for non-locking messages.
Fix error on removing groups.
Set version string in DB and config file.
Update translations.
Add scroll to search, users, groups and profiles results.
Update to 1.0rc3
This commit is contained in:
nuxsmin
2013-10-28 02:20:47 +01:00
parent bdbf9e81a2
commit 017ebe2a20
15 changed files with 443 additions and 142 deletions

View File

@@ -1,3 +1,12 @@
=== ** v1.0rc3 ** ===
* [BUG] Corregidos fallos en la comprobación de actualizaciones.
* [BUG] Corregido error al borrar grupos.
* [MOD] Cambio de fancybox por alertify para los mensajes que no requieren de bloqueo.
* [MOD] Ecribir versión en BD y archivo de configuración.
* [MOD] Añadir scroll en resultados de cuentas, usuarios, grupos y perfiles.
* [MOD] Actualizadas las traducciones.
=== ** v1.0rc2 ** ===
* [MOD] Mejor manejo de peticiones GET/POST.
@@ -109,6 +118,15 @@
---
=== ** v1.0rc3 ** ===
* [BUG] Fix updates checking.
* [BUG] Fix error on removing groups.
* [MOD] Change fancybox to alertify for non-locking messages.
* [MOD] Set version string in DB and config file
* [MOD] Update translations
* [MOD] Add scroll to search, users, groups and profiles results.
=== ** v1.0rc2 ** ===
* [MOD] Better GET/POST variable handling.

View File

@@ -28,7 +28,7 @@ include_once (APP_ROOT."/inc/init.php");
SP_Util::checkReferer('GET');
$checkVersion = SP_Common::parseParams('s', 'UPDATED', FALSE);
$checkVersion = SP_Common::parseParams('s', 'UPDATED', FALSE, TRUE);
// Una vez por sesión
if ( ! $checkVersion ){

137
css/alertify.core.css Normal file
View File

@@ -0,0 +1,137 @@
.alertify,
.alertify-show,
.alertify-log {
-webkit-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275);
-moz-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275);
-ms-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275);
-o-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275);
transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); /* easeOutBack */
}
.alertify-hide {
-webkit-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045);
-moz-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045);
-ms-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045);
-o-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045);
transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); /* easeInBack */
}
.alertify-log-hide {
-webkit-transition: all 500ms cubic-bezier(0.600, -0.280, 0.735, 0.045);
-moz-transition: all 500ms cubic-bezier(0.600, -0.280, 0.735, 0.045);
-ms-transition: all 500ms cubic-bezier(0.600, -0.280, 0.735, 0.045);
-o-transition: all 500ms cubic-bezier(0.600, -0.280, 0.735, 0.045);
transition: all 500ms cubic-bezier(0.600, -0.280, 0.735, 0.045); /* easeInBack */
}
.alertify-cover {
position: fixed; z-index: 99999;
top: 0; right: 0; bottom: 0; left: 0;
background-color:white;
filter:alpha(opacity=0);
opacity:0;
}
.alertify-cover-hidden {
display: none;
}
.alertify {
position: fixed; z-index: 99999;
top: 50px; left: 50%;
width: 550px;
margin-left: -275px;
opacity: 1;
}
.alertify-hidden {
-webkit-transform: translate(0,-150px);
-moz-transform: translate(0,-150px);
-ms-transform: translate(0,-150px);
-o-transform: translate(0,-150px);
transform: translate(0,-150px);
opacity: 0;
display: none;
}
/* overwrite display: none; for everything except IE6-8 */
:root *> .alertify-hidden {
display: block;
visibility: hidden;
}
.alertify-logs {
position: fixed;
z-index: 5000;
bottom: 10px;
right: 10px;
width: 300px;
}
.alertify-logs-hidden {
display: none;
}
.alertify-log {
display: block;
margin-top: 10px;
position: relative;
right: -300px;
opacity: 0;
}
.alertify-log-show {
right: 0;
opacity: 1;
}
.alertify-log-hide {
-webkit-transform: translate(300px, 0);
-moz-transform: translate(300px, 0);
-ms-transform: translate(300px, 0);
-o-transform: translate(300px, 0);
transform: translate(300px, 0);
opacity: 0;
}
.alertify-dialog {
padding: 25px;
}
.alertify-resetFocus {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.alertify-inner {
text-align: center;
}
.alertify-text {
margin-bottom: 15px;
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
font-size: 100%;
}
.alertify-buttons {
}
.alertify-button,
.alertify-button:hover,
.alertify-button:active,
.alertify-button:visited {
background: none;
text-decoration: none;
border: none;
/* line-height and font-size for input button */
line-height: 1.5;
font-size: 100%;
display: inline-block;
cursor: pointer;
margin-left: 5px;
}
@media only screen and (max-width: 680px) {
.alertify,
.alertify-logs {
width: 90%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.alertify {
left: 5%;
margin: 0;
}
}

82
css/alertify.default.css Normal file
View File

@@ -0,0 +1,82 @@
/**
* Default Look and Feel
*/
.alertify,
.alertify-log {
font-family: sans-serif;
}
.alertify {
background: #FFF;
border: 10px solid #333; /* browsers that don't support rgba */
border: 10px solid rgba(0,0,0,.7);
border-radius: 8px;
box-shadow: 0 3px 3px rgba(0,0,0,.3);
-webkit-background-clip: padding; /* Safari 4? Chrome 6? */
-moz-background-clip: padding; /* Firefox 3.6 */
background-clip: padding-box; /* Firefox 4, Safari 5, Opera 10, IE 9 */
}
.alertify-text {
border: 1px solid #CCC;
padding: 10px;
border-radius: 4px;
}
.alertify-button {
border-radius: 4px;
color: #FFF;
font-weight: bold;
padding: 6px 15px;
text-decoration: none;
text-shadow: 1px 1px 0 rgba(0,0,0,.5);
box-shadow: inset 0 1px 0 0 rgba(255,255,255,.5);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));
background-image: -o-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));
background-image: linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));
}
.alertify-button:hover,
.alertify-button:focus {
outline: none;
background-image: -webkit-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0));
background-image: -moz-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0));
background-image: -ms-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0));
background-image: -o-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0));
background-image: linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0));
}
.alertify-button:focus {
box-shadow: 0 0 15px #2B72D5;
}
.alertify-button:active {
position: relative;
box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
}
.alertify-button-cancel,
.alertify-button-cancel:hover,
.alertify-button-cancel:focus {
background-color: #FE1A00;
border: 1px solid #D83526;
}
.alertify-button-ok,
.alertify-button-ok:hover,
.alertify-button-ok:focus {
background-color: #5CB811;
border: 1px solid #3B7808;
}
.alertify-log {
background: #1F1F1F;
background: rgba(0,0,0,.9);
padding: 15px;
border-radius: 4px;
color: #FFF;
font-weight: bold;
text-shadow: -1px -1px 0 rgba(0,0,0,.5);
}
.alertify-log-error {
background: #FE1A00;
background: rgba(254,26,0,.9);
}
.alertify-log-success {
background: #5CB811;
background: rgba(92,184,17,.9);
}

View File

@@ -244,8 +244,12 @@ A:focus {text-decoration: none; color: #FF0000;}
#content #tblTools{width: 100%; height: 5em; padding-left: 15px;padding: 5px;}
#content #resBuscar{ width: 100%; margin-top: 20px; min-height: 500px;}
#content #resBuscar{ width: 100%; margin-top: 20px;}
#content #resBuscar IMG {vertical-align:middle;}
#content #resBuscar #data-search,
#content .data-rows,
#content #resEventLog #resSearch
{overflow-y: auto; max-height: 400px}
#content #pageNav {
float: left;
@@ -714,6 +718,16 @@ A:focus {text-decoration: none; color: #FF0000;}
#passLevel.good, #passLevel.good:hover { background-color: #FFF2D9 !important; color: orange; font-weight: bold; border: #ffe5b3 1px solid;}
#passLevel.weak, #passLevel.weak:hover { background-color: #fee8e6 !important; color: #CC0000; font-weight: bold; border: #fed2ce 1px solid;}
#alert #alert-text{margin: 15px auto; font-size: 14px; font-weight: bold;}
#alert #alert-pass{
width: 50%;
padding: 10px;
margin: 15px auto;
border: 1px solid #c9c9c9;
color: #555;
font-weight: bold;
}
/*Login Page*/
#boxLogin{
width:450px;

View File

@@ -49,14 +49,14 @@ class SP_Config{
static $arrConfigValue;
/**
* @brief Obtener en valor de un parámetro
* @param string $strConfigParam parámetro
* @return string valor
* @brief Obtiene un valor desde la configuración en la BBDD
* @param string $param con el parámetro de configuración
* @return string con el valor
*
* Obtener el valor de un parámetro almacenado en la BBDD
*/
public static function getConfigValue($strConfigParam){
$query = "SELECT config_value FROM config WHERE config_parameter = '$strConfigParam'";
public static function getConfigValue($param){
$query = "SELECT config_value FROM config WHERE config_parameter = '$param'";
$queryRes = DB::getResults($query, __FUNCTION__);
if ( $queryRes === FALSE || ! is_array($queryRes) ){
@@ -65,7 +65,7 @@ class SP_Config{
return $queryRes[0]->config_value;
}
/**
* @brief Obtener array con la configuración
*
@@ -122,7 +122,34 @@ class SP_Config{
return TRUE;
}
/**
* @brief Guardar un parámetro de configuración
* @param string $param con el parámetro a guardar
* @param string $value con el calor a guardar
* @return bool
*/
public static function setConfigValue($param, $value) {
$query = "INSERT INTO config "
. "SET config_parameter = '" . DB::escape($param) . "',"
. "config_value = '" . DB::escape($value) . "'"
. "ON DUPLICATE KEY UPDATE config_value = '" . DB::escape($value) . "' ";
if (DB::doQuery($query, __FUNCTION__) === FALSE) {
return FALSE;
}
$message['action'] = _('Configuración');
$message['text'][] = _('Modificar configuración');
$message['text'][] = _('Parámetro') . ': ' . $param;
$message['text'][] = _('Valor') . ': ' . $value;
SP_Common::wrLogInfo($message);
SP_Common::sendEmail($message);
return TRUE;
}
/**
* @brief Cargar la configuración desde la BBDD
* @param bool $force reescribir la variable global $CFG?
@@ -353,22 +380,6 @@ class SP_Config{
return TRUE;
}
/**
* @brief Obtiene un valor desde la configuración en la BBDD
* @param $param string con el parámetro de configuración
* @return array or false
*/
public static function getConfigParameter($param){
$query = "SELECT config_value FROM config WHERE config_parameter = '$param' ";
$queryRes = DB::getResults($query, __FUNCTION__);
if ( $queryRes === FALSE || ! is_array($queryRes) ){
return FALSE;
}
return $queryRes;
}
/**
* @brief Establece los valores de configuración por defecto en config.php
* @return none

View File

@@ -303,6 +303,8 @@ class SP_Html {
array("href" => "css/jquery.powertip.css", "media" => "screen"),
array("href" => "css/jquery.powertip-yellow.min.css", "media" => "screen"),
array("href" => "css/chosen.css", "media" => "screen"),
array("href" => "css/alertify.core.css", "media" => "screen"),
array("href" => "css/alertify.default.css", "media" => "screen"),
array("href" => "js/fancybox/jquery.fancybox.css", "media" => "screen"),
array("href" => "css/styles.css", "media" => ""));
@@ -326,6 +328,7 @@ class SP_Html {
array("src" => "js/fancybox/jquery.fancybox.pack.js", "params" => ""),
array("src" => "js/jquery.powertip.min.js", "params" => ""),
array("src" => "js/chosen.jquery.min.js", "params" => ""),
array("src" => "js/alertify.min.js", "params" => ""),
array("src" => "js/functions.php", "params" => "&l=" . SP_Init::$LANG . "&r=" . base64_encode(SP_Init::$WEBROOT)));
foreach ($jsProp as $js) {

View File

@@ -118,6 +118,8 @@ class SP_Init {
// Comprobar si el modo mantenimiento está activado
self::checkMaintenanceMode();
// Comprobar la versión y actualizarla
self::checkVersion();
// Inicializar la sesión
self::initSession();
@@ -403,6 +405,36 @@ class SP_Init {
textdomain("messages");
bind_textdomain_codeset("messages", 'UTF-8');
}
/**
* @brief Comrpueba y actualiza la versión de la aplicación
* @returns none
*/
private static function checkVersion(){
$update = FALSE;
$configVersion = SP_Config::getValue('version');
$databaseVersion = SP_Config::getConfigValue('version');
$appVersion = SP_Util::getVersionString();
if ( $configVersion != $appVersion ){
SP_Config::setValue('version', $appVersion);
$update = TRUE;
}
if ( $databaseVersion != $appVersion ){
SP_Config::setConfigValue('version', $appVersion);
$update = TRUE;
}
if ( $update === TRUE ){
$message['action'] = _('Actualización');
$message['text'][] = _('Actualización de versión realizada.');
$message['text'][] = _('Versión') . ': ' . $appVersion;
SP_Common::wrLogInfo($message);
SP_Common::sendEmail($message);
}
}
}
// Empezar a calcular el tiempo y memoria utilizados

View File

@@ -52,7 +52,6 @@ $categoriesSelProp = array("name" => "category",
<label FOR="txtSearch"></label>
<input type="text" name="search" id="txtSearch" onKeyUp="accSearch(1)" value="<? echo SP_Account::$accountSearchTxt; ?>" placeholder="<? echo _('Texto a buscar'); ?>"/>
<img src="imgs/clear.png" title="<? echo _('Limpiar'); ?>" class="inputImg" id="btnLimpiar" onClick="Clear('frmSearch', 1); accSearch(0);" />
<!--<img src="imgs/search.png" title="<? echo _('Buscar'); ?>" class="inputImg" id="btnBuscar" onClick="accSearch(0);" />-->
<input type="hidden" name="start" value="0">
<input type="hidden" name="skey" value="<? echo SP_Account::$accountSearchKey; ?>" />
<input type="hidden" name="sorder" value="<? echo SP_Account::$accountSearchOrder; ?>" />
@@ -65,16 +64,12 @@ $categoriesSelProp = array("name" => "category",
</td>
<td id="toolsRight">
<input type="text" name="rpp" id="rpp" placeholder="<? echo _('CPP'); ?>" title="<? echo _('Cuentas por página'); ?>"/>
</td>
</tr>
</table>
</form>
<script>
accSearch(0);
//$("#selCategory").combobox({dosearch: 1, placeholder: "<? //echo _('Seleccionar Categoría'); ?>"});
//$("#selCustomer").combobox({dosearch: 1, placeholder: "<? //echo _('Seleccionar Cliente'); ?>"});
$("#selCustomer").chosen({
allow_single_deselect: true,
placeholder_text_single: "<? echo _('Seleccionar Cliente'); ?>",

View File

@@ -256,7 +256,7 @@ class SP_Users {
$action_check = array();
$lnkEdit = '<img src="imgs/edit.png" title="' . _('Editar') . '" class="inputImg" Onclick="return usrgrpDetail(' . $intId . ',' . $arrUsersTableProp["actionId"] . ',\'' . $sk . '\', ' . $arrUsersTableProp["active"] . ');" />';
$lnkDel = '<img src="imgs/delete.png" title="' . _('Eliminar') . '" class="inputImg" Onclick="return usersMgmt(\'\', 1,' . $intId . ',' . $arrUsersTableProp["actionId"] . ',\'' . $sk . '\', ' . $arrUsersTableProp["active"] . ');" />';
$lnkDel = '<img src="imgs/delete.png" title="' . _('Eliminar') . '" class="inputImg" Onclick="return usersMgmt(' . $arrUsersTableProp["active"] . ', 1,' . $intId . ',' . $arrUsersTableProp["actionId"] . ',\'' . $sk . '\', ' . $arrUsersTableProp["active"] . ');" />';
$lnkPass = '<img src="imgs/key.png" title="' . _('Cambiar clave') . '" class="inputImg" Onclick="return usrUpdPass(' . $intId . ');" />';
echo '<ul>';
@@ -523,7 +523,7 @@ class SP_Users {
}
// Número de cuentas con el grupo como primario
$query = "SELECT account_id FROM accounts WHERE account_groupId = " . (int) $this->groupId;
$query = "SELECT account_id FROM accounts WHERE account_userGroupId = " . (int) $this->groupId;
if (DB::doQuery($query, __FUNCTION__) === FALSE) {
return FALSE;
@@ -1110,14 +1110,14 @@ class SP_Users {
return FALSE;
}
$configMPass = SP_Config::getConfigParameter("masterPwd");
$configMPass = SP_Config::getConfigValue('masterPwd');
if ($configMPass === FALSE) {
return FALSE;
}
// Comprobamos el hash de la clave del usuario con la guardada
return SP_Crypt::checkHashPass($userMPass, $configMPass[0]->config_value);
return SP_Crypt::checkHashPass($userMPass, $configMPass);
}
/**
@@ -1137,7 +1137,7 @@ class SP_Users {
return FALSE;
}
$configMPassTime = SP_Config::getConfigParameter("lastupdatempass");
$configMPassTime = SP_Config::getConfigValue('lastupdatempass');
if ($configMPassTime === FALSE) {
return FALSE;
@@ -1154,7 +1154,7 @@ class SP_Users {
$userLastUpdateMPass = $userData->user_lastUpdateMPass;
}
if ($configMPassTime[0]->config_value > $userLastUpdateMPass) {
if ($configMPassTime > $userLastUpdateMPass) {
return FALSE;
}
@@ -1166,13 +1166,13 @@ class SP_Users {
* @return bool
*/
public function updateUserMPass($masterPwd) {
$configMPass = SP_Config::getConfigParameter("masterPwd");
$configMPass = SP_Config::getConfigValue('masterPwd');
if (!$configMPass) {
return FALSE;
}
if (SP_Crypt::checkHashPass($masterPwd, $configMPass[0]->config_value)) {
if (SP_Crypt::checkHashPass($masterPwd, $configMPass)) {
$crypt = new SP_Crypt;
$strUserMPwd = $crypt->mkCustomMPassEncrypt($this->getCypherPass(), $masterPwd);
@@ -1201,7 +1201,7 @@ class SP_Users {
* @return string con la clave de cifrado
*/
private function getCypherPass(){
$configSalt = SP_Config::getConfigParameter("passwordsalt");
$configSalt = SP_Config::getConfigValue('passwordsalt');
$cypherPass = substr(sha1($configSalt.$this->userPass), 0, 32);
return $cypherPass;

View File

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

2
js/alertify.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -300,7 +300,7 @@ function saveAccount(frm) {
var status = parseInt($(xml).find("status").text());
var description = $(xml).find("description").text();
if ( status === 0 ){
if ( status === 0 ){
resMsg("ok", description);
if ( savetyp == 1 ){
@@ -330,38 +330,36 @@ function saveAccount(frm) {
// Función para eliminar una cuenta
function delAccount(id,action,sk){
var data = {accountid: id, savetyp: action, sk: sk};
$.fancybox.showLoading();
var atext = '<div id="alert"><p id="alert-text">' + LANG[8] + '</p></div>';
var res = confirm (LANG[8]);
if ( ! res ){
$.fancybox.hideLoading();
return false;
}
alertify.confirm(atext, function (e) {
if (e) {
$.fancybox.showLoading();
$.ajax({
type: 'POST',
dataType: 'xml',
url: APP_ROOT + '/ajax/ajax_accountsave.php',
data: data,
success: function(xml){
var status = parseInt($(xml).find("status").text());
var description = $(xml).find("description").text();
$.ajax({
type: 'POST',
dataType: 'xml',
url: APP_ROOT + '/ajax/ajax_accountsave.php',
data: data,
success: function(xml){
var status = parseInt($(xml).find("status").text());
var description = $(xml).find("description").text();
if ( status === 0 ){
resMsg("ok", description);
doAction('accsearch');
} else if ( status === 10){
resMsg("error", description);
doLogout();
} else {
resMsg("error", description);
}
},
error: function(jqXHR, textStatus, errorThrown){
resMsg("error", 'Oops...' + LANG[0]);
},
complete: function(){$.fancybox.hideLoading();}
if ( status === 0 ){
resMsg("ok", description);
doAction('accsearch');
} else if ( status === 10){
resMsg("error", description);
doLogout();
} else {
resMsg("error", description);
}
},
error: function(jqXHR, textStatus, errorThrown){
resMsg("error", 'Oops...' + LANG[0]);
},
complete: function(){$.fancybox.hideLoading();}
});
}
});
}
@@ -473,16 +471,16 @@ function downFile(fancy){
function getFiles(id, isDel, sk){
var data = {'id' : id, 'del' : isDel, 'sk' : sk};
$.ajax({
type : "GET",
cache : false,
url : APP_ROOT + "/ajax/ajax_getFiles.php",
data : data,
success: function(response) {
$('#downFiles').html(response);
},
complete: function(){$.fancybox.hideLoading();}
});
$.ajax({
type : "GET",
cache : false,
url : APP_ROOT + "/ajax/ajax_getFiles.php",
data : data,
success: function(response) {
$('#downFiles').html(response);
},
complete: function(){$.fancybox.hideLoading();}
});
}
// Función para eliminar archivos de una cuenta
@@ -533,7 +531,6 @@ function upldFile(id){
// Función para mostrar los registros de usuarios y grupos
function usrgrpDetail(id, type, sk, active){
//var active = parseInt($('input:[name=active]').val());
var data = {'id' : id, 'type' : type, 'sk' : sk, 'active' : active};
var url = APP_ROOT + '/ajax/ajax_usersMgmt.php';
@@ -548,7 +545,7 @@ function usrgrpDetail(id, type, sk, active){
$.fancybox(response,{
padding: [0,10,10,10],
afterClose: function(){doAction('usersmenu','',active);}
});
});
},
error:function(jqXHR, textStatus, errorThrown){
var txt = LANG[1] + '<p>' + errorThrown + textStatus + '</p>';
@@ -561,61 +558,71 @@ function usrgrpDetail(id, type, sk, active){
// Función para editar los registros de usuarios y grupos
function usersMgmt(frmId, isDel, id, type, sk){
var data;
var active = parseInt($('input:[name=active]').val());
var url = '/ajax/ajax_usersSave.php';
if ( isDel === 1 ){
var data = {'id' : id, 'type' : type, 'action' : 4, 'sk' : sk };
var atext = '<div id="alert"><p id="alert-text">' + LANG[21] + '</p></div>';
var active = frmId;
var res = confirm (LANG[21]);
if ( ! res ){
return false;
}
alertify.confirm(atext, function (e) {
if ( e) {
usersAjax(data, url);
doAction('usersmenu','',active)
}
});
} else {
data = $("#" + frmId).serialize();
type = parseInt($('input:[name=type]').val());
}
$.fancybox.showLoading();
//type = parseInt($('input:[name=type]').val());
usersAjax(data, url);
}
}
$.ajax({
type: 'POST',
dataType: 'xml',
url: APP_ROOT + url,
data: data,
success: function(xml){
var status = parseInt($(xml).find("status").text());
var description = $(xml).find("description").text();
description = description.replace(/;;/g,"<br />");
// Función para realizar la petición ajax de gestión de usuarios
function usersAjax(data, url){
$.fancybox.showLoading();
switch(status){
case 0:
// doAction('usersmenu','',active);
resMsg("ok", description);
break;
case 1:
resMsg("error", description);
break;
case 2:
$("#resFancyAccion").html('<span class="altTxtError">' + description + '</span>');
$("#resFancyAccion").show();
break;
case 3:
resMsg("warn", description);
break;
case 10:
doLogout();
break;
default:
return;
}
},
error:function(jqXHR, textStatus, errorThrown){
var txt = LANG[1] + '<p>' + errorThrown + textStatus + '</p>';
resMsg("error", txt);
},
complete: function(){$.fancybox.hideLoading();}
});
$.ajax({
type: 'POST',
dataType: 'xml',
url: APP_ROOT + url,
data: data,
success: function(xml){
var status = parseInt($(xml).find("status").text());
var description = $(xml).find("description").text();
description = description.replace(/;;/g,"<br />");
switch(status){
case 0:
$.fancybox.close();
resMsg("ok", description);
break;
case 1:
$.fancybox.close();
resMsg("error", description);
break;
case 2:
$("#resFancyAccion").html('<span class="altTxtError">' + description + '</span>');
$("#resFancyAccion").show();
break;
case 3:
$.fancybox.close();
resMsg("warn", description);
break;
case 10:
doLogout();
break;
default:
return;
}
},
error:function(jqXHR, textStatus, errorThrown){
var txt = LANG[1] + '<p>' + errorThrown + textStatus + '</p>';
resMsg("error", txt);
},
complete: function(){$.fancybox.hideLoading();}
});
}
// Función para mostrar el formulario para cambio de clave de usuario
@@ -724,10 +731,9 @@ function password(length, special, fancy, dstId) {
if ( fancy == true ){
$("#viewPass").attr("title",password);
// var txt = '<span class="altTxtBlue">' + LANG[15] + "</span><br><br>" + password;
// resMsg("info", txt);
//alertify.alert('<div id="alert"><p id="alert-text">' + LANG[15] + '</p><p id="alert-pass"> ' + password + '</p>');
} else {
alert ( LANG[15] + " " + password);
alertify.alert('<div id="alert"><p id="alert-text">' + LANG[15] + '</p><p id="alert-pass"> ' + password + '</p>');
}
if ( dstId ){
@@ -837,14 +843,14 @@ function resMsg(type, txt, url, action){
switch(type){
case "ok":
html = '<div id="fancyMsg" class="msgOk">' + txt + '</div>';
break;
//html = '<div id="fancyMsg" class="msgOk">' + txt + '</div>';
return alertify.success(txt);
case "error":
html = '<div id="fancyMsg" class="msgError">' + txt + '</div>';
break;
//html = '<div id="fancyMsg" class="msgError">' + txt + '</div>';
return alertify.error(txt);
case "warn":
html = '<div id="fancyMsg" class="msgWarn">' + txt + '</div>';
break;
//html = '<div id="fancyMsg" class="msgWarn">' + txt + '</div>';
return alertify.log(txt);
case "info":
html = '<div id="fancyMsg" class="msgInfo">' + txt + '</div>';
break;
@@ -856,9 +862,10 @@ function resMsg(type, txt, url, action){
return html;
break;
default:
html = '<div id="fancyMsg" class="msgError">Oops...<br /' + LANG[1] + '</div>';
//html = '<div id="fancyMsg" class="msgError">Oops...<br /' + LANG[1] + '</div>';
return alertify.error(txt);
}
$.fancybox(html,{afterLoad: function(){
$('.fancybox-skin,.fancybox-outer,.fancybox-inner').css({'border-radius':'25px','-moz-border-radius':'25px','-webkit-border-radius':'25px'});
},afterClose : function() { if ( typeof(action) !== "undefined" ) eval(action);} });

View File

@@ -73,7 +73,7 @@ $locale= array(
'Option not selected',
'Option added<BR \>You should save configuration in order to take effect',
'Option deleted<BR \>You should save configuration in order to take effect',
'Generated Password:',
'Generated Password',
'High level',
'Average level',
'Low level',