some more changes for navigation subentries

This commit is contained in:
Robin Appelman 2011-07-29 19:38:01 +02:00
parent 8b872e326a
commit d12d08e2f3
4 changed files with 43 additions and 20 deletions

View File

@ -89,6 +89,7 @@ input[type="search"] { font-size:1em; padding-left:2em; background:#eee url('../
#plugins a:active { outline:0; }
#plugins .subentry { background-color:#ddd; border-top:1px solid #aaa; border-bottom:1px solid #ccc; color:#000; outline:0; }
#plugins .subentry.active { background-color:#bbb; border-top:1px solid #aaa; border-bottom:1px solid #ccc; color:#000; outline:0; }
#plugins li.subentry a {padding-left:4em;}
/* CONTENT ------------------------------------------------------------------ */
#content { margin:3.5em 0 0 15.7em; }

View File

@ -48,12 +48,15 @@
<?php endforeach; ?>
<?php if(isset($_['adminnavigation'])):?>
<?php foreach($_['adminnavigation'] as $entry):?>
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li>
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a>
<?php if( sizeof( $entry["subnavigation"] )): ?>
<?php foreach($entry["subnavigation"] as $subentry):?>
<li><a class="subentry<?php if( $subentry['active'] ): ?> active<?php endif; ?>" href="<?php echo $subentry['href']; ?>" title=""><?php echo $subentry['name'] ?></a></li>
<?php endforeach; ?>
<ul>
<?php foreach($entry["subnavigation"] as $subentry):?>
<li class="subentry"><a class="subentry<?php if( $subentry['active'] ): ?> active<?php endif; ?>" href="<?php echo $subentry['href']; ?>" title=""><?php echo $subentry['name'] ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>

View File

@ -43,12 +43,15 @@
<div id="plugins">
<ul>
<?php foreach($_['navigation'] as $entry): ?>
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>><?php echo $entry['name']; ?></a></li>
<?php if( sizeof( $entry["subnavigation"] )): ?>
<?php foreach($entry["subnavigation"] as $subentry):?>
<li><a style="background-image:url(<?php echo $subentry['icon']; ?>)" href="<?php echo $subentry['href']; ?>" title="" <?php if( $subentry['active'] ): ?>class="active"<?php endif; ?>><?php echo $subentry['name'] ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>><?php echo $entry['name']; ?></a>
<?php if( sizeof( $entry["subnavigation"] )): ?>
<ul>
<?php foreach($entry["subnavigation"] as $subentry):?>
<li class="subentry"><a style="background-image:url(<?php echo $subentry['icon']; ?>)" href="<?php echo $subentry['href']; ?>" title="" <?php if( $subentry['active'] ): ?>class="active"<?php endif; ?>><?php echo $subentry['name'] ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>

View File

@ -158,7 +158,10 @@ class OC_APP{
* the navigation. Lower values come first.
*/
public static function addNavigationEntry( $data ){
// TODO: write function
$data['active']=false;
if(!isset($data['icon'])){
$data['icon']='';
}
OC_APP::$navigation[] = $data;
return true;
}
@ -184,6 +187,10 @@ class OC_APP{
* the navigation. Lower values come first.
*/
public static function addNavigationSubEntry( $parent, $data ){
$data['active']=false;
if(!isset($data['icon'])){
$data['icon']='';
}
if( !array_key_exists( $parent, self::$subnavigation )){
self::$subnavigation[$parent] = array();
}
@ -318,16 +325,25 @@ class OC_APP{
$naventry['subnavigation'] = $subNav;
}
}
}
// Mark subentry as active
foreach( $list as &$naventry ){
if( $naventry['active'] ){
foreach( $naventry['subnavigation'] as &$subnaventry ){
$subnaventry['active'] = $subnaventry['id'] == self::$activeapp? true : false;
} unset( $subnaventry );
}else{
foreach(self::$subnavigation as $parent=>$entries){
$activeParent=false;
foreach($entries as &$subNav){
$subNav['active']=$subNav['id'] == self::$activeapp;
if($subNav['active']){
$activeParent=true;
}
}
if($activeParent){
foreach( $list as &$naventry ){
if( $naventry['id'] == $parent ){
$naventry['active'] = true;
$naventry['subnavigation'] = $entries;
}
}
}
}
} unset( $naventry );
}
return $list;
}