]> source.dussan.org Git - nextcloud-server.git/commitdiff
some more changes for navigation subentries
authorRobin Appelman <icewind1991@gmail.com>
Fri, 29 Jul 2011 17:38:01 +0000 (19:38 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Fri, 29 Jul 2011 17:43:06 +0000 (19:43 +0200)
core/css/styles.css
core/templates/layout.admin.php
core/templates/layout.user.php
lib/app.php

index 99090b9171e513e67ce058abfa6de7259aedcd94..00433979d2461f30897ec309257ea79b6549d2d8 100644 (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; }
index 8077fd304f34378a3341caa048174dcba1358f40..3aac4c98ac58c9c92020981d4ea5f97380564502 100644 (file)
                                        <?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>
index 4440ae28b27e96c193f245706e55fd7f14d02c59..8f073914a1f85887545a9dd48332e6aa6c9bf609 100644 (file)
                        <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>
index bccd0c665fa3c3d25c8053bb47f121d1a9b0c9da..b6c2512e79a8e1f7798bc8e66d0e948d50561c8f 100644 (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;
        }