summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-07-29 13:58:13 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-07-29 13:58:13 -0400
commit5fd77084c44bf1d51939a71dcd57297bf4e8bd32 (patch)
treec7563d9866699c07f94993dee7fee4faaba4c66b /lib
parent45222f34a6ad8e94aa3d5358adf3c8272d78df20 (diff)
parentd12d08e2f3553b06df6371535f971c9f193bd388 (diff)
downloadnextcloud-server-5fd77084c44bf1d51939a71dcd57297bf4e8bd32.tar.gz
nextcloud-server-5fd77084c44bf1d51939a71dcd57297bf4e8bd32.zip
Merge branch 'master' into sharing
Conflicts: core/templates/layout.user.php
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php48
1 files changed, 28 insertions, 20 deletions
diff --git a/lib/app.php b/lib/app.php
index 475015f6779..b6c2512e79a 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -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();
}
@@ -310,33 +317,34 @@ class OC_APP{
/// Private foo
private static function addSubNavigation( $list ){
- $found = false;
- foreach( self::$subnavigation as $parent => $selection ){
- foreach( $selection as $subentry ){
- if( $subentry['id'] == self::$activeapp ){
+ if(isset(self::$subnavigation[self::$activeapp])){
+ $subNav=self::$subnavigation[self::$activeapp];
+ foreach( $list as &$naventry ){
+ if( $naventry['id'] == self::$activeapp ){
+ $naventry['active'] = true;
+ $naventry['subnavigation'] = $subNav;
+ }
+ }
+ }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'] = $selection;
- }
- else{
- $naventry['active'] = false;
+ $naventry['subnavigation'] = $entries;
}
- } unset( $naventry );
- $found = true;
+ }
}
}
}
- // 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 );
- }
- } unset( $naventry );
-
return $list;
}