mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-08 01:16:56 +01:00
* [MOD] UI tweaks and set user preferences precedence over global settings. Closes #528
This commit is contained in:
@@ -174,9 +174,11 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
|
||||
|| $this->view->searchFavorites
|
||||
|| $Search->isSortViews());
|
||||
|
||||
AccountsSearchItem::$accountLink = Session::getUserPreferences()->isAccountLink();
|
||||
AccountsSearchItem::$topNavbar = Session::getUserPreferences()->isTopNavbar();
|
||||
AccountsSearchItem::$optionalActions = Session::getUserPreferences()->isOptionalActions();
|
||||
$UserPreferences = Session::getUserPreferences();
|
||||
|
||||
AccountsSearchItem::$accountLink = $UserPreferences->isAccountLink();
|
||||
AccountsSearchItem::$topNavbar = $UserPreferences->isTopNavbar();
|
||||
AccountsSearchItem::$optionalActions = $UserPreferences->isOptionalActions();
|
||||
AccountsSearchItem::$wikiEnabled = Checks::wikiIsEnabled();
|
||||
AccountsSearchItem::$dokuWikiEnabled = Checks::dokuWikiIsEnabled();
|
||||
AccountsSearchItem::$isDemoMode = Checks::demoIsEnabled();
|
||||
@@ -313,9 +315,9 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
|
||||
$GridPager->setFilterOn($this->filterOn);
|
||||
$GridPager->setSourceAction(new DataGridActionSearch(self::ACTION_ACC_SEARCH));
|
||||
|
||||
$Preferences = Session::getUserPreferences();
|
||||
$UserPreferences = Session::getUserPreferences();
|
||||
|
||||
$showOptionalActions = $Preferences->isOptionalActions() || $Preferences->isResultsAsCards() || Checks::resultsCardsIsEnabled();
|
||||
$showOptionalActions = $UserPreferences->isOptionalActions() || $UserPreferences->isResultsAsCards() || ($UserPreferences->getUserId() === 0 && Checks::resultsCardsIsEnabled());
|
||||
|
||||
$Grid = new DataGrid();
|
||||
$Grid->setId('gridSearch');
|
||||
|
||||
@@ -68,8 +68,8 @@ class MainController extends ControllerBase implements ActionsInterface
|
||||
* Constructor
|
||||
*
|
||||
* @param $template Template con instancia de plantilla
|
||||
* @param string $page El nombre de página para la clase del body
|
||||
* @param bool $initialize Si es una inicialización completa
|
||||
* @param string $page El nombre de página para la clase del body
|
||||
* @param bool $initialize Si es una inicialización completa
|
||||
*/
|
||||
public function __construct(Template $template = null, $page = '', $initialize = true)
|
||||
{
|
||||
@@ -138,26 +138,33 @@ class MainController extends ControllerBase implements ActionsInterface
|
||||
*/
|
||||
public function getResourcesLinks()
|
||||
{
|
||||
$jsVersionHash = md5(implode(Util::getVersion(true)));
|
||||
$version = implode('', Util::getVersion(true));
|
||||
$theme = DiFactory::getTheme();
|
||||
|
||||
$jsVersionHash = md5($version);
|
||||
$this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?v=' . $jsVersionHash);
|
||||
$this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?g=1&v=' . $jsVersionHash);
|
||||
|
||||
$themeInfo = DiFactory::getTheme()->getThemeInfo();
|
||||
$themeInfo = $theme->getThemeInfo();
|
||||
|
||||
if (isset($themeInfo['js'])) {
|
||||
$themeJsBase = urlencode(DiFactory::getTheme()->getThemePath() . DIRECTORY_SEPARATOR . 'js');
|
||||
$themeJsBase = urlencode($theme->getThemePath() . DIRECTORY_SEPARATOR . 'js');
|
||||
$themeJsFiles = urlencode(implode(',', $themeInfo['js']));
|
||||
|
||||
$this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?f=' . $themeJsFiles . '&b=' . $themeJsBase . '&v=' . $jsVersionHash);
|
||||
}
|
||||
|
||||
$resultsAsCards = Init::isLoggedIn() && Session::getUserPreferences()->isResultsAsCards();
|
||||
if (Init::isLoggedIn() && Session::getUserPreferences()->getUserId() > 0) {
|
||||
$resultsAsCards = Session::getUserPreferences()->isResultsAsCards();
|
||||
} else {
|
||||
$resultsAsCards = Checks::resultsCardsIsEnabled();
|
||||
}
|
||||
|
||||
$cssVersionHash = md5(implode(Util::getVersion(true)) . Checks::resultsCardsIsEnabled() . $resultsAsCards);
|
||||
$cssVersionHash = md5($version . $resultsAsCards);
|
||||
$this->view->append('cssLinks', Init::$WEBROOT . '/css/css.php?v=' . $cssVersionHash);
|
||||
|
||||
if (isset($themeInfo['css'])) {
|
||||
if (Checks::resultsCardsIsEnabled() || $resultsAsCards) {
|
||||
if ($resultsAsCards) {
|
||||
$themeInfo['css'][] = 'search-card.min.css';
|
||||
} else {
|
||||
$themeInfo['css'][] = 'search-grid.min.css';
|
||||
@@ -167,7 +174,7 @@ class MainController extends ControllerBase implements ActionsInterface
|
||||
$themeInfo['css'][] = 'styles-wiki.min.css';
|
||||
}
|
||||
|
||||
$themeCssBase = urlencode(DiFactory::getTheme()->getThemePath() . DIRECTORY_SEPARATOR . 'css');
|
||||
$themeCssBase = urlencode($theme->getThemePath() . DIRECTORY_SEPARATOR . 'css');
|
||||
$themeCssFiles = urlencode(implode(',', $themeInfo['css']));
|
||||
|
||||
$this->view->append('cssLinks', Init::$WEBROOT . '/css/css.php?f=' . $themeCssFiles . '&b=' . $themeCssBase . '&v=' . $jsVersionHash);
|
||||
|
||||
@@ -407,7 +407,7 @@ class Util
|
||||
*/
|
||||
public static function getVersion($retBuild = false, $normalized = false)
|
||||
{
|
||||
$build = 17042002;
|
||||
$build = 17042003;
|
||||
$version = [2, 1, 7];
|
||||
|
||||
if ($normalized === true) {
|
||||
|
||||
Reference in New Issue
Block a user