Feb 06
Bringing back the dashboard nav

I saw a post today that I thought I would pass along. How to add back in the old dashboard nav. Thanks to Tristen/datagri for the original code.
Open up /root/concrete/themes/dashboard/elements/header.php and paste this on line 118
<style type="text/css">
div#ccm-dashboard-content {
margin-left: 200px;
margin-top: 63px;
}
/*
uncomment this to "disable" the popup dashboard dialog
//////////////////////////////////////////////////////
div#ccm-quick-nav {
display: none !important;
}
div#ccm-dashboard-overlay {
display: none !important;
}
*/
div#ccm-dashboard-nav, div#ccm-dashboard-nav ul,
div#ccm-dashboard-subnav, div#ccm-dashboard-subnav ul {
font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;
font-size: 13px;
}
div#ccm-dashboard-nav ul, div#ccm-dashboard-nav li,
div#ccm-dashboard-subnav ul, div#ccm-dashboard-subnav li {
margin: 0;
padding: 0;
}
div#ccm-dashboard-nav {
left: 0;
position: absolute;
top: 50px;
width: 200px;
z-index: 2;
}
div#ccm-dashboard-nav li {
background: url("/concrete/images/dashboard/bg_nav.png") repeat-x scroll 0 0 #EDEDED;
border-bottom: 1px solid #E1E1E1;
display: block;
width: 200px;
}
div#ccm-dashboard-nav li a {
color: #787878;
display: block;
font-size: 13px;
font-weight: bold;
height: 40px;
overflow: hidden;
padding: 6px 11px 0 12px;
text-decoration: none;
}
div#ccm-dashboard-nav li a:hover {
background: url("/concrete/images/dashboard/bg_header_active.png") repeat-x scroll 0 0 #A2DAFD;
}
div#ccm-dashboard-nav li.ccm-nav-active a {
background: url("/concrete/images/dashboard/bg_nav_active.png") repeat-x scroll right bottom #CDD9DD;
}
div#ccm-dashboard-nav li a span {
color: #A8A8A8;
display: block;
font-family: "Helvetica Neue",Arial,Helvetica;
font-size: 11px;
font-weight: normal;
height: 14px;
margin-top: 1px;
overflow: hidden;
}
div#ccm-dashboard-subnav {
background: url("/concrete/images/dashboard/subnav_bg.png") repeat-x scroll center top transparent;
margin: 50px 0 -48px 201px;
padding-bottom: 5px;
}
div#ccm-dashboard-subnav div.ccm-spacer {
height: 0;
line-height: 0;
margin: 0;
}
div#ccm-dashboard-subnav ul {
color: #666666;
font-size: 12px;
font-weight: bold;
list-style-type: none;
padding: 0;
}
div#ccm-dashboard-subnav li {
border-right: 1px solid #9B9B9B;
float: left;
height: 19px;
padding: 8px 20px 3px;
}
div#ccm-dashboard-subnav a {
color: #FFFFFF;
text-decoration: none;
}
div#ccm-dashboard-subnav a:hover {
text-decoration: underline;
}
div#ccm-dashboard-subnav li.nav-selected {
background: url("/concrete/images/dashboard/subnav_button_on_bg.png") repeat-x scroll 0 0 transparent;
}
div#ccm-dashboard-subnav li.nav-selected a {
color: #FFFFFF;
font-weight: bold;
}
</style>
<div id="ccm-dashboard-nav">
<ul>
<?php
$exclude_pages = array(
'/dashboard/home',
'/dashboard/welcome',
'/dashboard/system',
'/dashboard/reports'
);
$nav = AutonavBlockController::getChildPages($dashboard);
foreach($nav as $n2) {
$cp = new Permissions($n2);
if ($cp->canRead() && !in_array($n2->getCollectionPath(),$exclude_pages)) {
$isActive = ($c->getCollectionPath() == $n2->getCollectionPath() || strpos($c->getCollectionPath(), $n2->getCollectionPath() . '/') === 0);
?>
<li <?php if ($isActive) { ?> class="ccm-nav-active" <?php } ?>><a href="<?php echo $nh->getLinkToCollection($n2, false, true)?>"><?php echo t($n2->getCollectionName())?> <span><?php echo t($n2->getCollectionDescription())?></span></a></li>
<?php }
}?>
</ul>
</div>
<?php if (!$disableSecondLevelNav) { ?>
<?php if (isset($subnav)) { ?>
<div id="ccm-dashboard-subnav">
<ul><?php foreach($subnav as $item) { ?><li <?php if (isset($item[2]) && $item[2] == true) { ?> class="nav-selected" <?php } ?>><a href="<?php echo $item[0]?>"><?php echo $item[1]?></a></li><?php } ?></ul>
<br/><div class="ccm-spacer"> </div>
</div>
<?php } else if ($c->getCollectionID() != $dashboard->getCollectionID()) {
// we auto-gen the subnav
// if we're right under the dashboard, we get items beneath us. If not we get items at our same level
$pcs = $nh->getTrailToCollection($c);
$pcs = array_reverse($pcs);
if (count($pcs) == 1) {
$parent = $c;
} else {
$parent = $pcs[1];
}
$subpages = AutonavBlockController::getChildPages($parent);
$subpagesP = array();
foreach($subpages as $sc) {
$cp = new Permissions($sc);
if ($cp->canRead()) {
$subpagesP[] = $sc;
}
}
if (count($subpagesP) > 0) {
?>
<div id="ccm-dashboard-subnav">
<ul><?php foreach($subpagesP as $sc) {
$isActive = ($c->getCollectionPath() == $sc->getCollectionPath() || strpos($c->getCollectionPath(), $sc->getCollectionPath() . '/') === 0);
?><li <?php if ($isActive) { ?> class="nav-selected" <?php } ?>><a href="<?php echo $nh->getLinkToCollection($sc, false, true)?>"><?php echo t($sc->getCollectionName())?></a></li><?php } ?></ul>
<br/><div class="ccm-spacer"> </div>
</div>
<?php
}
}
} ?>
Tags: Concrete5
Code
Dashboard
Category: Programming
Chad Cantrell
Chad Cantrell, aka ChadStrat, has been developing Concrete5 addons for over 3 years. With over 30 products for sale in the C5 marketplace, ChadStrat continues to be one of the top developers in the C5 community.

