mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-23 00:36:52 +01:00
* New switcheable grid visual style for searches. Closes #38
* Fixed wrong height for search results in IE 10. * Fixed not showing accounts field ordering on action switch. * Fixed some visual bugs. * Force page reload on configuration changes. * Copy account password to clipboard is hidden by default on account search list (prevents many ajax queries). * LDAP username is populated from login if it's blank. * Account decrypt counter is updated when password is viewed and not if it's copied to clipboard (working on a better solution).
This commit is contained in:
@@ -59,6 +59,7 @@ if ($frmAction == "config") {
|
||||
$frmAccountCount = SP_Common::parseParams('p', 'account_count', 10);
|
||||
$frmAllowedSize = SP_Common::parseParams('p', 'files_allowed_size', 1024);
|
||||
$frmAllowedExts = SP_Common::parseParams('p', 'files_allowed_exts');
|
||||
$frmResultsAsCards = SP_Common::parseParams('p', 'resultsascards', false, false, true);
|
||||
|
||||
$frmWiki = SP_Common::parseParams('p', 'wiki_enabled', false, false, true);
|
||||
$frmWikiSearchUrl = SP_Common::parseParams('p', 'wiki_searchurl');
|
||||
@@ -147,6 +148,7 @@ if ($frmAction == "config") {
|
||||
SP_Config::setValue("maintenance", $frmMaintenance);
|
||||
SP_Config::setValue("checkupdates", $frmCheckUpdates);
|
||||
SP_Config::setValue("files_enabled", $frmFiles);
|
||||
SP_Config::setValue("resultsascards", $frmResultsAsCards);
|
||||
SP_Config::setValue("globalsearch", $frmGlobalSearch);
|
||||
SP_Config::setValue("files_allowed_size", $frmAllowedSize);
|
||||
|
||||
@@ -155,6 +157,9 @@ if ($frmAction == "config") {
|
||||
SP_Log::wrLogInfo($message);
|
||||
SP_Common::sendEmail($message);
|
||||
|
||||
// Recargar la aplicación completa para establecer nuevos valores
|
||||
SP_Util::reload();
|
||||
|
||||
SP_Common::printJSON(_('Configuración actualizada'), 0, $doActionOnClose);
|
||||
} elseif ($frmAction == "crypt") {
|
||||
$currentMasterPass = SP_Common::parseParams('p', 'curMasterPwd', '', false, false, false);
|
||||
|
||||
@@ -32,6 +32,8 @@ if (!SP_Init::isLoggedIn()) {
|
||||
SP_Util::logout();
|
||||
}
|
||||
|
||||
SP_Util::checkReload();
|
||||
|
||||
if (SP_Common::parseParams('p', 'action', '', true)) {
|
||||
$action = $tplvars['action'] = SP_Common::parseParams('p', 'action');
|
||||
$itemId = $tplvars['id'] = SP_Common::parseParams('p', 'id', 0);
|
||||
|
||||
@@ -51,6 +51,7 @@ if ($wikiEnabled) {
|
||||
$wikiPageUrl = SP_Config::getValue('wiki_pageurl');
|
||||
}
|
||||
$requestEnabled = SP_Util::mailrequestIsEnabled();
|
||||
$maxTextLength = (SP_Util::resultsCardsIsEnabled()) ? 30 : 60;
|
||||
|
||||
// Valores POST
|
||||
$sortKey = SP_Common::parseParams('p', 'skey', 0);
|
||||
@@ -68,6 +69,26 @@ $userId = SP_Common::parseParams('s', 'uid', 0);
|
||||
|
||||
$filterOn = ($sortKey > 1 || $customerId || $categoryId || $searchTxt) ? true : false;
|
||||
|
||||
$colors = array(
|
||||
'FF66CC',
|
||||
'FF99FF',
|
||||
'CC99FF',
|
||||
'9999FF',
|
||||
'6699FF',
|
||||
'3399FF',
|
||||
'0099FF',
|
||||
'6699FF',
|
||||
'3399FF',
|
||||
'00CC66',
|
||||
'00CC66',
|
||||
'00CC99',
|
||||
'00CCCC',
|
||||
'FFCC66',
|
||||
'FF9999',
|
||||
'FF6699',
|
||||
'FF99CC'
|
||||
);
|
||||
|
||||
$objAccount = new SP_Account;
|
||||
$arrSearchFilter = array("txtSearch" => $searchTxt,
|
||||
"userId" => $userId,
|
||||
@@ -133,23 +154,24 @@ foreach ($resQuery as $account) {
|
||||
|
||||
$show = ($accView || $accViewPass || $accEdit || $accCopy || $accDel);
|
||||
|
||||
$randomRGB = array(rand(150, 210), rand(150, 210), rand(150, 210));
|
||||
$color = array($account->account_customerId => array(SP_Html::rgb2hex($randomRGB), $randomRGB));
|
||||
//$randomRGB = array(rand(150, 210), rand(150, 210), rand(150, 210));
|
||||
//$color = array($account->account_customerId => array(SP_Html::rgb2hex($randomRGB), $randomRGB));
|
||||
$color = array_rand($colors);
|
||||
|
||||
if (!isset($customerColor)) {
|
||||
$customerColor = $color;
|
||||
$customerColor[$account->account_customerId] = '#'.$colors[$color];
|
||||
} elseif (isset($customerColor) && !array_key_exists($account->account_customerId, $customerColor)) {
|
||||
$customerColor = $color;
|
||||
$customerColor[$account->account_customerId] = '#'.$colors[$color];
|
||||
}
|
||||
|
||||
$hexColor = $customerColor[$account->account_customerId][0];
|
||||
//$rgbaColor = implode(',',$customerColor[$account->account_customerId][1]).',0.1';
|
||||
//$hexColor = $customerColor[$account->account_customerId][0];
|
||||
$hexColor = $customerColor[$account->account_customerId];
|
||||
|
||||
if ($wikiEnabled) {
|
||||
$wikiLink = $wikiSearchUrl . $account->customer_name;
|
||||
$customerName = '<a href="' . $wikiLink . '" target="blank" title="' . _('Buscar en Wiki') . '<br><br>' . $account->customer_name . '">' . SP_Html::truncate($account->customer_name, 31) . '</a>';
|
||||
$customerName = '<a href="' . $wikiLink . '" target="blank" title="' . _('Buscar en Wiki') . '<br><br>' . $account->customer_name . '">' . SP_Html::truncate($account->customer_name, $maxTextLength) . '</a>';
|
||||
} else {
|
||||
$customerName = SP_Html::truncate($account->customer_name, 31);
|
||||
$customerName = SP_Html::truncate($account->customer_name, $maxTextLength);
|
||||
}
|
||||
|
||||
if ($accountLink && $show) {
|
||||
@@ -163,14 +185,15 @@ foreach ($resQuery as $account) {
|
||||
$accountName = $account->account_name;
|
||||
}
|
||||
|
||||
// Obtenemos datos si el usuario tiene acceso a los datos de la cuenta
|
||||
if ($show) {
|
||||
$vacLogin = (strlen($account->account_login) >= 31) ? SP_Html::truncate($account->account_login, 31) : $account->account_login;
|
||||
$vacLogin = (strlen($account->account_login) >= $maxTextLength) ? SP_Html::truncate($account->account_login, $maxTextLength) : $account->account_login;
|
||||
|
||||
$strAccUrl = $account->account_url;
|
||||
$urlIsLink = ($strAccUrl && preg_match("#^https?://.*#i", $strAccUrl));
|
||||
|
||||
if (strlen($strAccUrl) >= 31) {
|
||||
$strAccUrl_short = SP_Html::truncate($strAccUrl, 31);
|
||||
if (strlen($strAccUrl) >= $maxTextLength) {
|
||||
$strAccUrl_short = SP_Html::truncate($strAccUrl, $maxTextLength);
|
||||
|
||||
$strAccUrl = ($urlIsLink) ? '<a href="' . $strAccUrl . '" target="_blank" title="' . _('Abrir enlace a') . ': ' . $strAccUrl . '">' . $strAccUrl_short . '</a>' : $strAccUrl_short;
|
||||
} else {
|
||||
@@ -200,28 +223,29 @@ foreach ($resQuery as $account) {
|
||||
//echo '<div class="account-label round shadow" onMouseOver="this.style.backgroundColor=\'RGBA('.$rgbaColor.')\'" onMouseOut="this.style.backgroundColor=\'#FFFFFF\'" >';
|
||||
echo '<div class="account-label round shadow">';
|
||||
|
||||
echo '<div class="label-field">';
|
||||
echo '<div class="field-customer label-field">';
|
||||
echo '<div class="field-name">' . _('Cliente') . '</div>';
|
||||
echo '<div class="field-text round5 no-link" style="background-color: ' . $hexColor . ';">' . $customerName . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="label-field">';
|
||||
echo '<div class="field-account label-field">';
|
||||
echo '<div class="field-name">' . _('Nombre') . '</div>';
|
||||
echo '<div class="field-text">' . $accountName . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="label-field">';
|
||||
echo '<div class="field-category label-field">';
|
||||
echo '<div class="field-name">' . _('Categoría') . '</div>';
|
||||
echo '<div class="field-text">' . $account->category_name . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
// Mostramos datos si el usuario tiene acceso a los datos de la cuenta
|
||||
if ($show) {
|
||||
echo '<div class="label-field">';
|
||||
echo '<div class="field-user label-field">';
|
||||
echo '<div class="field-name">' . _('Usuario') . '</div>';
|
||||
echo '<div class="field-text">' . $vacLogin . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="label-field">';
|
||||
echo '<div class="field-url label-field">';
|
||||
echo '<div class="field-name">' . _('URL / IP') . '</div>';
|
||||
echo '<div class="field-text">' . $strAccUrl . '</div>';
|
||||
echo '</div>';
|
||||
@@ -261,10 +285,10 @@ foreach ($resQuery as $account) {
|
||||
|
||||
if ($accViewPass) {
|
||||
echo '<img src="imgs/user-pass.png" title="' . _('Ver Clave') . '" onClick="viewPass(' . $account->account_id . ', 1)" />';
|
||||
echo '<img src="imgs/clipboard.png" title="' . _('Copiar Clave en Portapapeles') . '" onmouseover="viewPass(' . $account->account_id . ', 0)" onmouseout="passToClip = 0;" class="clip_pass_button" data-clipboard-target="clip_pass_text" />';
|
||||
echo '<img src="imgs/clipboard.png" title="' . _('Copiar Clave en Portapapeles') . '" onmouseover="viewPass(' . $account->account_id . ', 0)" onmouseout="passToClip = 0;" class="actions-optional clip_pass_button" data-clipboard-target="clip_pass_text" />';
|
||||
}
|
||||
|
||||
if ($accEdit || $accCopy || $accDel) {
|
||||
if ($accEdit || $accCopy || $accDel || $accViewPass) {
|
||||
echo '<img src="imgs/action.png" title="' . _('Más Acciones') . '" OnClick="showOptional(this)" />';
|
||||
}
|
||||
|
||||
@@ -308,16 +332,15 @@ SP_Html::printQuerySearchNavBar($sortKey, $arrSearchFilter["limitStart"], $objAc
|
||||
|
||||
var client = new ZeroClipboard( $('.clip_pass_button'), {
|
||||
moviePath: "js/ZeroClipboard.swf",
|
||||
debug: true
|
||||
} );
|
||||
debug: false
|
||||
});
|
||||
|
||||
//client.setText(data);
|
||||
client.on( 'load', function(client) {
|
||||
$('#global-zeroclipboard-html-bridge').attr('rel', 'tooltip').attr('title', '<?php echo _('Copiar Clave en Portapapeles'); ?>');
|
||||
} );
|
||||
});
|
||||
|
||||
client.on( "complete", function(client, args) {
|
||||
resMsg("ok", "<?php echo _('Clave Copiada al Portapapeles'); ?>");
|
||||
//console.log("Copied text to clipboard: " + args.text );
|
||||
} );
|
||||
});
|
||||
</script>
|
||||
@@ -29,7 +29,7 @@ require_once APP_ROOT.DIRECTORY_SEPARATOR.'inc'.DIRECTORY_SEPARATOR.'init.php';
|
||||
SP_Util::checkReferer('POST');
|
||||
|
||||
if (!SP_Init::isLoggedIn()) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
$accountId = SP_Common::parseParams('p', 'accountid', false);
|
||||
@@ -75,18 +75,16 @@ $crypt = new SP_Crypt;
|
||||
$masterPass = $crypt->getSessionMasterPass();
|
||||
$accountClearPass = $crypt->decrypt($accountData->account_pass, $masterPass, $accountData->account_IV);
|
||||
|
||||
|
||||
if (!$isHistory) {
|
||||
if (!$isHistory && $fullTxt) {
|
||||
$account->incrementDecryptCounter();
|
||||
|
||||
$message['action'] = _('Ver Clave');
|
||||
$message['text'][] = _('ID') . ': ' . $accountId;
|
||||
$message['text'][] = _('Cuenta') . ': ' . $accountData->customer_name . " / " . $accountData->account_name;
|
||||
|
||||
SP_Log::wrLogInfo($message);
|
||||
}
|
||||
|
||||
$message['action'] = _('Ver Clave');
|
||||
$message['text'][] = _('ID') . ': ' . $accountId;
|
||||
$message['text'][] = _('Cuenta') . ': ' . $accountData->customer_name . " / " . $accountData->account_name;
|
||||
$message['text'][] = _('IP') . ': ' . $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
SP_Log::wrLogInfo($message);
|
||||
|
||||
if ($fullTxt) {
|
||||
?>
|
||||
<div id="fancyMsg" class="msgInfo">
|
||||
|
||||
54
css/search-grid.css
Normal file
54
css/search-grid.css
Normal file
@@ -0,0 +1,54 @@
|
||||
#content #data-search .account-info img,
|
||||
#content #data-search .account-actions img {width: 24px; height: 24px;margin: 0 0.5em;}
|
||||
|
||||
#content #data-search {text-align: center; padding: 0.5em 0;}
|
||||
#content #data-search .account-label{
|
||||
width: 95%;
|
||||
height: 70px;
|
||||
text-align: left;
|
||||
margin: 0;
|
||||
margin-bottom: 0.2em;
|
||||
padding: 0.5em;
|
||||
color: #696969;
|
||||
background-color: #fcfcfc;
|
||||
display: inline-block;
|
||||
}
|
||||
#content #data-search .account-label .label-field{float: left; width: 18%; height: 3em;}
|
||||
#content #data-search .account-label .field-name{float: left; width: 80px; padding: 0.3em 0.2em; color: #b9b9b9; display: none}
|
||||
#content #data-search .account-label .field-text{float: left; width: 95%; padding: 0.3em 0.3em; word-wrap: break-word;}
|
||||
#content #data-search .account-label .header .field-name{color: white; font-weight: bold}
|
||||
|
||||
#content #data-search .account-label .field-text a{color: #4895FA}
|
||||
#content #data-search .account-label .no-link a{color: white; font-weight: bold;}
|
||||
|
||||
#content #data-search .field-customer .field-text{height: 2.5em}
|
||||
|
||||
#content #data-search .field-category{width: 10% !important;}
|
||||
|
||||
#content #data-search .account-info{
|
||||
float: left;
|
||||
clear: left;
|
||||
width: 20%;
|
||||
/*height: 2em;*/
|
||||
padding: 0.5em 0;
|
||||
text-align: left;
|
||||
/*border-top: 1px solid #d9d9d9;*/
|
||||
border: none;
|
||||
}
|
||||
|
||||
#content #data-search .account-actions{
|
||||
float: right;
|
||||
position: relative;
|
||||
top: -3em;
|
||||
width: auto;
|
||||
max-width: 18%;
|
||||
height: auto;
|
||||
padding: 0.5em;
|
||||
text-align: right;
|
||||
/*border-top: 1px solid #c9c9c9;*/
|
||||
background-color: transparent;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.075) inset;
|
||||
}
|
||||
#content #data-search .account-actions img{margin:3px 5px;}
|
||||
#content .actions-optional{display: none;}
|
||||
#content #data-search .account-spacer{width: 100%; height: 8em;}
|
||||
@@ -235,9 +235,9 @@ A:focus {text-decoration: none; color: #FF0000;}
|
||||
|
||||
#content TD.valField, #fancyContainer TD.valField { padding-left:20px; width: 100%;}
|
||||
|
||||
#content #tblTools{min-width: 875px; height: 5em; padding-left: 15px;padding: 5px;}
|
||||
#content #tblTools{min-width: 875px; height: 5em; padding: 5px; padding-left: 15px;}
|
||||
|
||||
#content #resBuscar{ min-width: 875px; min-height: 450px;}
|
||||
#content #resBuscar{ min-width: 875px; min-height: 450px; margin-bottom: 50px;}
|
||||
#content #resBuscar IMG {vertical-align:middle;}
|
||||
|
||||
#content #pageNav {
|
||||
@@ -615,14 +615,15 @@ A:focus {text-decoration: none; color: #FF0000;}
|
||||
.fancydata {min-width: 400px; border: none; text-align: left;}
|
||||
.fancydata .descField{min-width: 100px; font-weight: bold;}
|
||||
|
||||
#footer{
|
||||
footer{
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
z-index: 100;
|
||||
float:left;
|
||||
width:100%;
|
||||
margin:0 auto;
|
||||
padding: 1em 0;
|
||||
height: 1.5em;
|
||||
margin: 0 auto;
|
||||
padding: .5em 0;
|
||||
background-color: #F5F5F5;
|
||||
color:#b9b9b9;
|
||||
font-size:13px;
|
||||
@@ -631,14 +632,14 @@ A:focus {text-decoration: none; color: #FF0000;}
|
||||
-moz-box-shadow: 0px -8px 6px -6px #c9c9c9;
|
||||
}
|
||||
|
||||
#footer #project{float: right;width: 40%;text-align:right; padding-right: 20px;}
|
||||
#footer #updates{float: left;width: 20%;text-align:left; padding-left: 20px;}
|
||||
#footer #status{float: left;width: 20%;text-align:left;color: #ffbbb4;}
|
||||
footer #project{float: right;width: 40%;text-align:right; padding-right: 20px;}
|
||||
footer #updates{float: left;width: 20%;text-align:left; padding-left: 20px;}
|
||||
footer #status{float: left;width: 20%;text-align:left;color: #ffbbb4;}
|
||||
|
||||
#footer A{color:#b9b9b9;}
|
||||
#footer #project A:hover{color:#a9c1d7;border-bottom: 1px solid #a9c1d7;}
|
||||
#footer #updates A:hover{color:#a9c1d7;}
|
||||
#footer IMG{border: none;width: 16px;height: 16px;vertical-align: middle;}
|
||||
footer a, footer a:visited{color:#b9b9b9;}
|
||||
footer #project a:hover{color:#a9c1d7;border-bottom: 1px solid #a9c1d7;}
|
||||
footer #updates a:hover{color:#a9c1d7;}
|
||||
footer img{border: none;width: 16px;height: 16px;vertical-align: middle;}
|
||||
|
||||
|
||||
/* GENERIC CLASSES */
|
||||
|
||||
@@ -226,6 +226,8 @@ class SP_Common
|
||||
$msgHelp[21] = _('Comprobar actualizaciones de la aplicación (sólo para los usuarios administradores)');
|
||||
$msgHelp[22] = _('Extensiones de máximo 4 caracteres.') . "<br><br>" . _('Escribir extensión y pulsar intro para añadir.');
|
||||
$msgHelp[23] = _('Importar desde un archivo CSV con el formato') . ":<br><br>" . _('nombre_de_cuenta;cliente;categoría;url;usuario;clave;notas') . "<br><br>" . _('Si el cliente o la categoría no están creados, se crean automáticamente.');
|
||||
$msgHelp[24] = _('Permite que las cuentas sin acceso sean visibles sólo para las búsquedas.');
|
||||
$msgHelp[25] = _('Muestra los resultados de búsqueda de cuentas en formato tarjeta.');
|
||||
|
||||
if (array_key_exists($id, $msgHelp)) {
|
||||
echo '<img src="imgs/help.png" title="' . $msgHelp[$id] . '" class="inputImgMini" />';
|
||||
|
||||
@@ -183,6 +183,10 @@ class SP_Html
|
||||
array("href" => "js/fancybox/jquery.fancybox.css", "media" => "screen"),
|
||||
array("href" => "css/styles.css", "media" => ""));
|
||||
|
||||
if ( ! SP_Util::resultsCardsIsEnabled() ){
|
||||
array_push($cssProp,array("href" => "css/search-grid.css", "media" => ""));
|
||||
}
|
||||
|
||||
foreach ($cssProp as $css) {
|
||||
self::$htmlPage[] = '<link rel="stylesheet" href="' . SP_Init::$WEBROOT . "/" . $css["href"] . $versionParameter . '" media="' . $css["media"] . '" />';
|
||||
}
|
||||
@@ -261,14 +265,14 @@ class SP_Html
|
||||
{
|
||||
$info = self::getAppInfo();
|
||||
|
||||
self::$htmlPage[] = '<div id="footer">';
|
||||
self::$htmlPage[] = '<footer>';
|
||||
self::$htmlPage[] = '<div id="updates"></div>';
|
||||
self::$htmlPage[] = '<div id="project">';
|
||||
self::$htmlPage[] = '<a href="' . $info['appwebsite'] . '" target="_blank" title="' . _('Ayuda :: FAQ :: Changelog') . '">' . $info['appname'] . ' ' . SP_Util::getVersionString() . '</a> ';
|
||||
self::$htmlPage[] = ' :: ';
|
||||
self::$htmlPage[] = '<a href="' . $info['appblog'] . '" target="_blank" title="' . _('Un proyecto de cygnux.org') . '" >cygnux.org</a>';
|
||||
self::$htmlPage[] = '</div> <!-- Close Project -->';
|
||||
self::$htmlPage[] = '</div> <!-- Close footer -->';
|
||||
self::$htmlPage[] = '</footer> <!-- Close footer -->';
|
||||
self::$htmlPage[] = '<script>$(\'input[type="text"], select, textarea\').placeholder().mouseenter(function(){ $(this).focus(); });</script>';
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ $chkLdap = ( SP_Config::getValue('ldap_enabled') ) ? 'checked="checked"' : '';
|
||||
$chkMail = ( SP_Config::getValue('mail_enabled') ) ? 'checked="checked"' : '';
|
||||
$chkMailRequests = ( SP_Config::getValue('mail_requestsenabled') ) ? 'checked="checked"' : '';
|
||||
$chkMailAuth = ( SP_Config::getValue('mail_authenabled') ) ? 'checked="checked"' : '';
|
||||
$chkResultsAsCards = ( SP_Config::getValue('resultsascards') ) ? 'checked="checked"' : '';
|
||||
$allowedExts = SP_Config::getValue('files_allowed_exts');
|
||||
?>
|
||||
|
||||
@@ -190,6 +191,16 @@ $allowedExts = SP_Config::getValue('files_allowed_exts');
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="descField">
|
||||
<?php echo _('Resultados en Tarjetas'); ?>
|
||||
<?php SP_Common::printHelpButton("config", 25); ?>
|
||||
</td>
|
||||
<td class="valField">
|
||||
<label for="resultsascards"><?php echo ($chkResultsAsCards) ? 'ON' : 'OFF'; ?></label>
|
||||
<input type="checkbox" name="resultsascards" id="resultsascards" class="checkbox" <?php echo $chkResultsAsCards.' '.$txtDisabled; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!--WIKI-->
|
||||
|
||||
@@ -254,7 +254,7 @@ class SP_Util
|
||||
*/
|
||||
public static function getVersion($retBuild = false)
|
||||
{
|
||||
$build = 5;
|
||||
$build = 7;
|
||||
$version = array(1, 1, 2);
|
||||
|
||||
if ($retBuild) {
|
||||
@@ -368,4 +368,36 @@ class SP_Util
|
||||
{
|
||||
return SP_Config::getValue('log_enabled', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Comprobar si está habilitado el formato de tarjeta en los resultados
|
||||
* @return bool
|
||||
*/
|
||||
public static function resultsCardsIsEnabled()
|
||||
{
|
||||
return SP_Config::getValue('resultsascards', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Establecer variable de sesión para recargar la aplicación
|
||||
* @return none
|
||||
*/
|
||||
public static function reload()
|
||||
{
|
||||
if (!isset($_SESSION["reload"]) || $_SESSION["reload"] === 0) {
|
||||
$_SESSION["reload"] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Comprobar si se necesita recargar la aplicación
|
||||
* @return none
|
||||
*/
|
||||
public static function checkReload()
|
||||
{
|
||||
if (isset($_SESSION["reload"]) && $_SESSION["reload"] === 1) {
|
||||
$_SESSION["reload"] = 0;
|
||||
exit("<script>window.location.href = 'index.php';</script>");
|
||||
}
|
||||
}
|
||||
}
|
||||
105
js/functions.js
105
js/functions.js
@@ -5,7 +5,10 @@ var order = {};
|
||||
order.key = 0;
|
||||
order.dir = 0;
|
||||
|
||||
// Variable para determinar si una clave de cuenta ha sido copiada al portapapeles
|
||||
var passToClip = 0;
|
||||
// Variable para el ajuste óptimo del contenido a la altura del documento
|
||||
var windowAdjustSize = 350;
|
||||
|
||||
var strPassword;
|
||||
var charPassword;
|
||||
@@ -45,11 +48,13 @@ $(document).ready(function () {
|
||||
$("[title]").powerTip(powertipOptions);
|
||||
$('input, textarea').placeholder();
|
||||
setContentSize();
|
||||
setWindowAdjustSize();
|
||||
}).ajaxComplete(function () {
|
||||
$("[title]").powerTip(powertipOptions);
|
||||
$('input, textarea').placeholder();
|
||||
});
|
||||
|
||||
// Función para cargar el contenido de la acción del menú seleccionada
|
||||
function doAction(action, lastAction, id) {
|
||||
var data = {'action': action, 'lastAction': lastAction, 'id': id, isAjax: 1};
|
||||
|
||||
@@ -75,16 +80,26 @@ function doAction(action, lastAction, id) {
|
||||
});
|
||||
}
|
||||
|
||||
// Función para establecer la altura del contenedor ajax
|
||||
function setContentSize() {
|
||||
// Calculate total height for full body resize
|
||||
var totalHeight = $("#content").height() + 100;
|
||||
//var totalWidth = $("#wrap").width();
|
||||
|
||||
// alert(totalWidth + 'x' + totalHeight);
|
||||
$("#container").css("height", totalHeight);
|
||||
// $("#wrap").css("width",totalWidth);
|
||||
}
|
||||
|
||||
// Función para establecer la variable de ajuste óptimo de altura
|
||||
function setWindowAdjustSize() {
|
||||
var browser = getBrowser();
|
||||
|
||||
if ( browser == "MSIE" ){
|
||||
windowAdjustSize = 150;
|
||||
}
|
||||
console.log(windowAdjustSize);
|
||||
}
|
||||
|
||||
// Función para retornar el scroll a la posición inicial
|
||||
function scrollUp() {
|
||||
$('html, body').animate({ scrollTop: 0 }, 'slow');
|
||||
}
|
||||
@@ -100,6 +115,8 @@ function Clear(id, search) {
|
||||
$('#frmSearch').find('input[name="skey"]').val(0);
|
||||
$('#frmSearch').find('input[name="sorder"]').val(0);
|
||||
$(".select-box").val('').trigger("chosen:updated");
|
||||
order.key = 0;
|
||||
order.dir = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +130,7 @@ function mkChosen(options) {
|
||||
});
|
||||
}
|
||||
|
||||
// Función para realizar una búsqueda
|
||||
// Función para la búsqueda de cuentas mediante filtros
|
||||
function accSearch(continous, event) {
|
||||
var lenTxtSearch = $('#txtSearch').val().length;
|
||||
|
||||
@@ -127,33 +144,13 @@ function accSearch(continous, event) {
|
||||
|
||||
window.lastlen = lenTxtSearch;
|
||||
|
||||
var datos = $("#frmSearch").serialize();
|
||||
$.fancybox.showLoading();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'html',
|
||||
url: APP_ROOT + '/ajax/ajax_search.php',
|
||||
data: datos,
|
||||
success: function (response) {
|
||||
$('#resBuscar').html(response);
|
||||
$('#data-search').css("max-height", $('html').height() - 300);
|
||||
},
|
||||
error: function () {
|
||||
$('#resBuscar').html(resMsg("nofancyerror"));
|
||||
},
|
||||
complete: function () {
|
||||
$.fancybox.hideLoading();
|
||||
}
|
||||
});
|
||||
doSearch();
|
||||
}
|
||||
|
||||
// Función para buscar con la ordenación por campos
|
||||
// Función para la búsqueda de cuentas mediante ordenación
|
||||
function searchSort(skey, start, nav) {
|
||||
if (typeof(skey) === "undefined" || typeof(start) === "undefined") return false;
|
||||
|
||||
var sorder = 0;
|
||||
|
||||
if (order.key > 0 && order.key != skey) {
|
||||
order.key = skey;
|
||||
order.dir = 0;
|
||||
@@ -164,14 +161,18 @@ function searchSort(skey, start, nav) {
|
||||
order.dir = 0;
|
||||
} else {
|
||||
order.dir = 1;
|
||||
sorder = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$('#frmSearch').find('input[name="skey"]').val(skey);
|
||||
$('#frmSearch').find('input[name="sorder"]').val(sorder);
|
||||
$('#frmSearch').find('input[name="skey"]').val(order.key);
|
||||
$('#frmSearch').find('input[name="sorder"]').val(order.dir);
|
||||
$('#frmSearch').find('input[name="start"]').val(start);
|
||||
|
||||
doSearch();
|
||||
}
|
||||
|
||||
// Función para la búsqueda de cuentas
|
||||
function doSearch(){
|
||||
var frmData = $("#frmSearch").serialize();
|
||||
|
||||
$.fancybox.showLoading();
|
||||
@@ -183,12 +184,15 @@ function searchSort(skey, start, nav) {
|
||||
data: frmData,
|
||||
success: function (response) {
|
||||
$('#resBuscar').html(response);
|
||||
$('#data-search').css("max-height", $('html').height() - 300);
|
||||
$('#search-sort-' + skey).addClass('filterOn');
|
||||
if (order.dir == 0) {
|
||||
$('#search-sort-' + skey).append('<img src="imgs/arrow_down.png" style="width:17px;height:12px;" />');
|
||||
} else {
|
||||
$('#search-sort-' + skey).append('<img src="imgs/arrow_up.png" style="width:17px;height:12px;" />');
|
||||
$('#resBuscar').css("max-height", $('html').height() - windowAdjustSize);
|
||||
|
||||
if ( order.key ){
|
||||
$('#search-sort-' + order.key).addClass('filterOn');
|
||||
if (order.dir == 0) {
|
||||
$('#search-sort-' + order.key).append('<img src="imgs/arrow_down.png" style="width:17px;height:12px;" />');
|
||||
} else {
|
||||
$('#search-sort-' + order.key).append('<img src="imgs/arrow_up.png" style="width:17px;height:12px;" />');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
@@ -201,7 +205,7 @@ function searchSort(skey, start, nav) {
|
||||
});
|
||||
}
|
||||
|
||||
// Función para buscar con la ordenación por campos
|
||||
// Función para navegar por el log de eventos
|
||||
function navLog(start, current) {
|
||||
if (typeof(start) === "undefined") return false;
|
||||
|
||||
@@ -239,7 +243,7 @@ function viewPass(id, full, history) {
|
||||
async: false,
|
||||
data: {'accountid': id, 'full': full, 'isHistory': history},
|
||||
success: function(data){
|
||||
if (data.length === 0) {
|
||||
if (data === "-1") {
|
||||
doLogout();
|
||||
} else {
|
||||
if ( full === 0 ){
|
||||
@@ -254,7 +258,7 @@ function viewPass(id, full, history) {
|
||||
});
|
||||
}
|
||||
|
||||
// Función para las variables de la URL y parsearlas a un array.
|
||||
// Función para obtener las variables de la URL y parsearlas a un array.
|
||||
function getUrlVars() {
|
||||
var vars = [], hash;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
@@ -311,6 +315,7 @@ function doLogin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Función para salir de la sesión
|
||||
function doLogout() {
|
||||
var url = window.location.search;
|
||||
|
||||
@@ -321,6 +326,7 @@ function doLogout() {
|
||||
}
|
||||
}
|
||||
|
||||
// Función para comprobar si se ha salido de la sesión
|
||||
function checkLogout() {
|
||||
var session = getUrlVars()["session"];
|
||||
|
||||
@@ -498,6 +504,7 @@ function delFile(id, sk, accid) {
|
||||
});
|
||||
}
|
||||
|
||||
// Función para activar el Drag&Drop de archivos en las cuentas
|
||||
function dropFile(accountId, sk, maxsize) {
|
||||
var dropfiles = $('#dropzone');
|
||||
var file_exts_ok = dropfiles.attr('data-files-ext').toLowerCase().split(',');
|
||||
@@ -547,6 +554,7 @@ function dropFile(accountId, sk, maxsize) {
|
||||
});
|
||||
}
|
||||
|
||||
// Función para activar el Drag&Drop de archivos en la importación de cuentas
|
||||
function importFile(sk) {
|
||||
var dropfiles = $('#dropzone');
|
||||
var file_exts_ok = ['csv'];
|
||||
@@ -602,7 +610,7 @@ function importFile(sk) {
|
||||
});
|
||||
}
|
||||
|
||||
// Función para realizar la petición ajax
|
||||
// Función para realizar una petición ajax
|
||||
function sendAjax(data, url) {
|
||||
$.fancybox.showLoading();
|
||||
|
||||
@@ -902,7 +910,7 @@ function outputResult(dstId) {
|
||||
}
|
||||
}
|
||||
|
||||
// Función para mostrar mensaje con Fancybox
|
||||
// Función para mostrar mensaje con alertify
|
||||
function resMsg(type, txt, url, action) {
|
||||
if (typeof(url) !== "undefined") {
|
||||
$.ajax({ url: url, type: 'get', dataType: 'html', async: false, success: function (data) {
|
||||
@@ -916,15 +924,12 @@ function resMsg(type, txt, url, action) {
|
||||
|
||||
switch (type) {
|
||||
case "ok":
|
||||
//html = '<div id="fancyMsg" class="msgOk">' + txt + '</div>';
|
||||
alertify.set({ beforeCloseAction: action });
|
||||
return alertify.success(txt);
|
||||
case "error":
|
||||
//html = '<div id="fancyMsg" class="msgError">' + txt + '</div>';
|
||||
alertify.set({ beforeCloseAction: action });
|
||||
return alertify.error(txt);
|
||||
case "warn":
|
||||
//html = '<div id="fancyMsg" class="msgWarn">' + txt + '</div>';
|
||||
alertify.set({ beforeCloseAction: action });
|
||||
return alertify.log(txt);
|
||||
case "info":
|
||||
@@ -938,7 +943,6 @@ function resMsg(type, txt, url, action) {
|
||||
return html;
|
||||
break;
|
||||
default:
|
||||
//html = '<div id="fancyMsg" class="msgError">Oops...<br /' + LANG[1] + '</div>';
|
||||
alertify.set({ beforeCloseAction: action });
|
||||
return alertify.error(txt);
|
||||
}
|
||||
@@ -966,4 +970,19 @@ function checkLdapConn() {
|
||||
// Función para volver al login
|
||||
function goLogin() {
|
||||
setTimeout(function () { location.href = "index.php";}, 2000);
|
||||
}
|
||||
|
||||
// Función para obtener el navegador usado
|
||||
function getBrowser()
|
||||
{
|
||||
var version = -1; // Return value assumes failure.
|
||||
var ua = navigator.userAgent;
|
||||
var re = new RegExp("(MSIE|Firefox)[ /]?([0-9]{1,}[\.0-9]{0,})", "i");
|
||||
if (re.exec(ua) != null) {
|
||||
var browser = RegExp.$1;
|
||||
//version = parseFloat( RegExp.$2 );
|
||||
}
|
||||
|
||||
return browser;
|
||||
//return version;
|
||||
}
|
||||
Reference in New Issue
Block a user