Handle active page design

This commit is contained in:
HWFord
2025-09-12 12:25:04 +02:00
parent cf7d59b49a
commit 96746ca6f7
2 changed files with 48 additions and 7 deletions
+42 -1
View File
@@ -116,6 +116,47 @@ if ($conf['external_authentification'])
// | Variables init |
// +-----------------------------------------------------------------------+
//Active_page is used for the menu and showing to the user which section is active
$active_page = 'dashboard';
//To display which section is active for the menu we need to know what pages correspond to which section
//Map array of all the possibilites for the $_GET['page'] for the different sections
$sections = array(
'photo' => array('photos_add','batch_manager','tags'),
'album' => array('albums','cat_options', 'permalinks'),
'user' => array('user_list','user_activity', 'group_list','group_perm','notification_by_mail'),
'plugin' => array('plugins'),
'tool' => array('site_update','stats', 'maintenance','comments','updates'),
'configuration' => array('configuration','menubar', 'languages','themes'),
);
if (isset($_GET['page']))
{
$active_page_name = $_GET['page'];
// Special cases for photos and albums that can have the id in the url
if (preg_match('/^photo-\d+$/', $active_page_name))
{
$active_page = 'photo';
}
else if (preg_match('/^album-\d+$/', $active_page_name))
{
$active_page = 'album';
}
else
{
// loop through our different sections and check which section the page matches
foreach ($sections as $sectionName => $sectionList)
{
if (in_array($active_page_name, $sectionList))
{
$active_page = $sectionName;
break;
}
}
}
}
$change_theme_url = PHPWG_ROOT_PATH.'admin.php?';
//Check if we are on another admin page to be able to redirect user to same page
@@ -244,7 +285,7 @@ $template->assign(
'U_SHOW_TEMPLATE_TAB' => $conf['show_template_in_side_menu'],
'SHOW_RATING' => $conf['rate'],
'PHPWG_URL' => defined('PHPWG_URL') ? str_replace('http:', 'https:', PHPWG_URL) : '',
'ACTIVE_PAGE' => isset($_GET['page']) ? $_GET['page'] : 'dashboard',
'ACTIVE_PAGE' => $active_page,
'U_PERMALINKS'=> $link_start.'permalinks',
'U_ACTIVITY' => $link_start.'user_activity',
'U_PROFILE' => get_root_url().'profile.php',
+6 -6
View File
@@ -139,7 +139,7 @@ let username = '{$USERNAME}'
</div>
{* Photos section *}
<div class="page-link">
<div class="page-link {if "photo" == $ACTIVE_PAGE}active{/if}" title="{'Photos'|translate}">
<span>
<i class="icon-picture"></i><span class="reduced-hidden">{'Photos'|@translate}&nbsp;</span>
<span class="hover">
@@ -166,7 +166,7 @@ let username = '{$USERNAME}'
</div>
{* Albums section *}
<div class="page-link">
<div class="page-link {if "album" == $ACTIVE_PAGE}active{/if}">
<span>
<i class="icon-sitemap"></i><span class="reduced-hidden">{'Albums'|@translate}&nbsp;</span>
<span class="hover">
@@ -183,7 +183,7 @@ let username = '{$USERNAME}'
</div>
{* Users section *}
<div class="page-link">
<div class="page-link {if "user" == $ACTIVE_PAGE}active{/if}">
<span>
<i class="icon-users"></i><span class="reduced-hidden">{'Users'|@translate}&nbsp;</span>
<span class="hover">
@@ -201,14 +201,14 @@ let username = '{$USERNAME}'
</div>
{* Plugins section *}
<div class="page-link">
<div class="page-link {if "plugin" == $ACTIVE_PAGE}active{/if}">
<span class="active-border"></span>
<a href="{$U_PLUGINS}"><i class="icon-puzzle"></i><span class="reduced-hidden">{'Plugins'|@translate}&nbsp;</span></a>
<span class="hover"></span>
</div>
{* Tools section *}
<div class="page-link">
<div class="page-link {if "tool" == $ACTIVE_PAGE}active{/if}">
<span>
<i class="icon-wrench"></i><span class="reduced-hidden">{'Tools'|@translate}&nbsp;</span>
<span class="hover">
@@ -238,7 +238,7 @@ let username = '{$USERNAME}'
</div>
{* Configuration section *}
<div class="page-link">
<div class="page-link {if "configuration" == $ACTIVE_PAGE}active{/if}">
<span>
<i class="icon-cog"></i><span class="reduced-hidden">{'Configuration'|@translate}&nbsp;</span>
<span class="hover">