Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #3 from tarekdj/tarekdj
Move main menu to sidebar
  • Loading branch information
tarekdj committed Jul 19, 2016
2 parents 5eed164 + 3d8355c commit d02d88e
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 11 deletions.
2 changes: 1 addition & 1 deletion css/style.css

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions functions.php
@@ -0,0 +1,73 @@
<?php
/**
* @Todo: move this to core.
*/

function _topMenu()
{
$current_page = htmlentities($_GET['page']);
if (empty($_SESSION['logindetails'])) {
return '';
}

if ($_SESSION['logindetails']['superuser']) { // we don't have a system yet to distinguish access to plugins
if (count($GLOBALS['plugins'])) {
foreach ($GLOBALS['plugins'] as $pluginName => $plugin) {
//if (isset($GLOBALS['pagecategories']['plugins'])) {
//array_push($GLOBALS['pagecategories']['plugins']['menulinks'],'main&pi='.$pluginName);
//}
$menulinks = $plugin->topMenuLinks;
foreach ($menulinks as $link => $linkDetails) {
if (isset($GLOBALS['pagecategories'][$linkDetails['category']])) {
array_push($GLOBALS['pagecategories'][$linkDetails['category']]['menulinks'],
$link . '&pi=' . $pluginName);
}
}
}
}
}

$topmenu = '';
$topmenu .= '<div id="menuTop">';
if (!DEVVERSION) {
unset($GLOBALS['pagecategories']['develop']);
}

foreach ($GLOBALS['pagecategories'] as $category => $categoryDetails) {
if ($category == 'hide'
## hmm, this also suppresses the "dashboard" item
# || count($categoryDetails['menulinks']) == 0
) {
continue;
}

$thismenu = '';
foreach ($categoryDetails['menulinks'] as $page) {
$title = $GLOBALS['I18N']->pageTitle($page);
$active = '';
if ($page == $current_page) {
$active = ' class="active"';
}
$link = PageLink2($page, $title, '', true);
if ($link) {
$thismenu .= '<li' . $active . '>' . $link . '</li>';
}
}
if (!empty($thismenu)) {
$thismenu = '<ul>' . $thismenu . '</ul>';
}

if (!empty($categoryDetails['toplink'])) {
$categoryurl = PageUrl2($categoryDetails['toplink'], '', '', true);
if ($categoryurl) {
$topmenu .= '<ul><li><a href="' . $categoryurl . '" title="' . $GLOBALS['I18N']->pageTitleHover($category) . '">' . ucfirst($GLOBALS['I18N']->get($category)) . '</a>' . $thismenu . '</li></ul>';
} else {
$topmenu .= '<ul><li><span>' . $GLOBALS['I18N']->get($category) . $categoryurl . '</span>' . $thismenu . '</li></ul>';
}
}
}

$topmenu .= '</div>';

return $topmenu;
}
9 changes: 5 additions & 4 deletions header_minified.inc
@@ -1,3 +1,4 @@
<?php include_once "functions.php"; ?>
</head>
<body class="invisible <?php if(isset($GLOBALS['page'])) print $GLOBALS['page'];else print "home-not-auth"; ?>">
<div id="dialog"></div><div id="hiddendiv"></div>
Expand All @@ -13,7 +14,7 @@
</button>
<a href="http://www.phplist.com" target="_blank" class="navbar-brand"><img src="ui/dressprow/images/branding.png" alt="phpList, email newsletter manager, logo" title="phpList, the world's most popular Open Source newsletter manager" /></a>
</div>
<?php print topMenu(); ?>
<?php //print topMenu(); ?>
<div id="logged" class="navbar-right">
<?php
if ($GLOBALS["require_login"] && (!isset ($_SESSION["adminloggedin"]) || !$_SESSION["adminloggedin"])) {
Expand Down Expand Up @@ -46,11 +47,11 @@
<div id="language">
<?php print $languageswitcher; ?>
</div>
<div id="context-menu" class="menutableright block">
<div id="context-menu" class="menu block">
<h3>Navigation</h3>
<?php print contextMenu(); ?>
<?php print _topMenu(); ?>
</div>
<div id="recent" class="menutableright block">
<div id="recent" class="menu visited block">
<?php print recentlyVisited(); ?>
</div>
<div class="clear"></div>
Expand Down
4 changes: 2 additions & 2 deletions js/phpList3ToBootstrap.js
Expand Up @@ -8,12 +8,12 @@ var myfunction = function() {


/* MAIN MENU */
$('#menuTop').addClass('collapse navbar-collapse navbar-left');
/*$('#menuTop').addClass('collapse navbar-collapse navbar-left');
$('#menuTop ul li ul').parent().parent().addClass('nav navbar-nav');
$('#menuTop ul li ul').parent().addClass('dropdown');
$('#menuTop ul li ul').addClass('dropdown-menu');
$('#menuTop ul li ul').parent().find('a:first').addClass('dropdown-toggle').attr({ 'data-toggle':'dropdown','aria-haspopup':'true','aria-expanded':'false' });

*/
/* BUTTONS */
$('button, #prev.prevtab, #next.nexttab').addClass('btn');
$('.submit, input[type=submit]').not('p.submit').addClass('btn btn-primary');
Expand Down
3 changes: 2 additions & 1 deletion js/phplist.js
Expand Up @@ -41,6 +41,8 @@ $(document).ready(function() {
$(this).next("div.content").toggle("slow");
});
});
// Set active link
$('.sidebar li.active').parents('li').addClass('active open');

/* // open/close div global help
$("#globalhelp").click(function(){
Expand Down Expand Up @@ -111,5 +113,4 @@ $(document).ready(function() {
}
*/

});
26 changes: 26 additions & 0 deletions less/base.less
Expand Up @@ -3,4 +3,30 @@
body {
font-family: 'genlight',"Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 15px;
}

#container {
width:100%;
margin-bottom:0;
}
#footer {
display: block;
width: 100%;
clear: both;
}

#globalhelp {
.alert {
margin: 0;
}
button {
margin-bottom: -20px;
z-index: 10;
}

}
#container {
.clearfix {
height: 0;
}
}
25 changes: 24 additions & 1 deletion less/sidebar.less
@@ -1,4 +1,5 @@
.sidebar {
background-color: lighten(@grey, 35%);
padding-top:20px;
.block {
margin: auto -15px;
Expand All @@ -15,7 +16,10 @@
padding:0;
li {
&:hover {
background-color: lighten(@grey, 35%);
background-color: lighten(@grey, 30%);
}
&.active {
//background-color: red;
}
}
a {
Expand All @@ -35,6 +39,25 @@
}
}
}
.menu {
#menuTop > ul {
margin-bottom: 0;
ul {
display: none;
}
li.open {
ul {
display:block;
li {
margin-left: 20px;
a {
border: 0;
}
}
}
}
}
}
}

.login {
Expand Down
2 changes: 1 addition & 1 deletion less/style.less
@@ -1,8 +1,8 @@
@import "../bootstrap/less/bootstrap.less";
@import "gen";
@import "var";
@import "base";
@import "legacy";
@import "base";
@import "navbar";
@import "sidebar";

Expand Down
2 changes: 1 addition & 1 deletion less/var.less
Expand Up @@ -11,4 +11,4 @@

/* Custom variables */
@menucolor: lighten(@black, 10%);
@greylight: lighten(@grey, 40%);
@greylight: lighten(@grey, 42%);

0 comments on commit d02d88e

Please sign in to comment.