summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/appinfo/app.php3
-rw-r--r--admin/users.php1
-rw-r--r--files/appinfo/app.php2
-rw-r--r--help/appinfo/app.php2
-rw-r--r--lib/app.php85
-rw-r--r--lib/template.php10
-rw-r--r--log/appinfo/app.php2
-rw-r--r--templates/layout.admin.php10
8 files changed, 72 insertions, 43 deletions
diff --git a/admin/appinfo/app.php b/admin/appinfo/app.php
index 2426adc9f8a..40d8b9188ec 100644
--- a/admin/appinfo/app.php
+++ b/admin/appinfo/app.php
@@ -7,4 +7,7 @@ OC_APP::addAdminPage( array( "id" => "core_users", "order" => 3, "href" => OC_HE
OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" )));
OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 5, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" )));
+// Add subentries for App installer
+OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_installed", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Installed apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" )));
+
?>
diff --git a/admin/users.php b/admin/users.php
index 9529ea74977..a5b08e0ce5c 100644
--- a/admin/users.php
+++ b/admin/users.php
@@ -30,6 +30,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin'
// We have some javascript foo!
OC_UTIL::addScript( "admin", "users" );
+OC_APP::setActiveNavigationEntry( "core_users" );
$users = array();
$groups = array();
diff --git a/files/appinfo/app.php b/files/appinfo/app.php
index eff45cbe6e3..1d83674852d 100644
--- a/files/appinfo/app.php
+++ b/files/appinfo/app.php
@@ -3,6 +3,6 @@
OC_APP::register( array( "order" => 2, "id" => "files", "name" => "Files" ));
OC_APP::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_HELPER::linkTo( "files", "index.php" ), "icon" => OC_HELPER::imagePath( "files", "navicon.png" ), "name" => "Files" ));
-OC_APP::addSettingsPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files" ));
+OC_APP::addSettingsPage( array( "id" => "files_administration", "order" => 1, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files" ));
?>
diff --git a/help/appinfo/app.php b/help/appinfo/app.php
index 12ae59b94c2..952c57f9bc8 100644
--- a/help/appinfo/app.php
+++ b/help/appinfo/app.php
@@ -1,6 +1,6 @@
<?php
OC_APP::register( array( "order" => 1, "id" => "help", "name" => "Help" ));
-OC_APP::addSettingsPage( array( "order" => 2, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_HELPER::imagePath( "settings", "information.png" )));
+OC_APP::addSettingsPage( array( "id" => "help", "order" => 2, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_HELPER::imagePath( "settings", "information.png" )));
?>
diff --git a/lib/app.php b/lib/app.php
index 19e6df77f84..7ce9e919f9a 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -148,7 +148,7 @@ class OC_APP{
* the navigation. Lower values come first.
*/
public static function addNavigationSubEntry( $parent, $data ){
- if( !array_key_exists( self::$subnavigation[$parent] )){
+ if( !array_key_exists( $parent, self::$subnavigation )){
self::$subnavigation[$parent] = array();
}
self::$subnavigation[$parent][] = $data;
@@ -239,57 +239,80 @@ class OC_APP{
* contains the subentries if the key "active" is true
*/
public static function getNavigation(){
- // TODO: write function
- return OC_APP::$navigation;
+ $navigation = self::proceedNavigation( self::$navigation );
+ $navigation = self::addSubNavigation( $navigation );
+ return $navigation;
}
/**
- * @brief Returns the admin pages
+ * @brief Returns the Settings Navigation
* @returns associative array
*
- * This function returns an array containing all admin pages added. The
+ * This function returns an array containing all settings pages added. The
* entries are sorted by the key "order" ascending.
*/
- public static function getAdminPages(){
- // TODO: write function
- return OC_APP::$adminpages;
+ public static function getSettingsNavigation(){
+ $navigation = self::proceedNavigation( self::$settingspages );
+ $navigation = self::addSubNavigation( $navigation );
+
+ return $navigation;
}
/**
- * @brief Returns the admin pages
- * @param $app optional, name of the app we want the settings for
+ * @brief Returns the admin navigation
* @returns associative array
*
- * This function returns an array with the settings pages. If $app is not
- * set, it will return the main settings pages for all apps (where
- * "id" == "app"). Otherwise it will list all settings pages of the app.
- * The entries are sorted by the key "order" ascending.
+ * This function returns an array containing all admin pages added. The
+ * entries are sorted by the key "order" ascending.
*/
- public static function getSettingsPages( $app = null ){
- $return = array();
+ public static function getAdminNavigation(){
+ $navigation = self::proceedNavigation( self::$adminpages );
+ $navigation = self::addSubNavigation( $navigation );
- if( is_null( $app )){
- foreach( OC_APP::$settingspages as $i ){
- if(!isset($i["id"])){
- $i["id"]='';
- }
- if(!isset($i["app"])){
- $i["app"]='';
- }
- if( $i["id"] == $i["app"] ){
- $return[] = $i;
+ return $navigation;
+ }
+
+ /// Private foo
+ private static function addSubNavigation( $list ){
+ $found = false;
+ foreach( self::$subnavigation as $parent => $selection ){
+ foreach( $selection as $subentry ){
+ if( $subentry["id"] == self::$activeapp ){
+ foreach( $list as &$naventry ){
+ if( $naventry["id"] == $parent ){
+ $naventry["active"] = true;
+ $naventry["subnavigation"] = $selection;
+ }
+ else{
+ $naventry["active"] = false;
+ }
+ }
+ $found = true;
}
}
}
- else{
- foreach( OC_APP::$settingspages as $i ){
- if( $i["app"] == $app ){
- $return[] = $i;
+
+ return $list;
+ }
+
+ /// This is private as well. It simply works, so don't ask for more details
+ private static function proceedNavigation( $list ){
+ foreach( $list as &$naventry ){
+ $naventry["subnavigation"] = array();
+ if( $naventry["id"] == self::$activeapp ){
+ $naventry["active"] = true;
+ if( array_key_exists( $naventry["id"], self::$subnavigation )){
+ $naventry["subnavigation"] = self::$subnavigation[$naventry["id"]];
}
}
+ else{
+ $naventry["active"] = false;
+ }
}
- return $return;
+ usort( $list, create_function( '$a, $b', 'if( $a["order"] == $b["order"] ){return 0;}elseif( $a["order"] < $b["order"] ){return -1;}else{return 1;}' ));
+
+ return $list;
}
/**
diff --git a/lib/template.php b/lib/template.php
index 0e1c268efaa..dd1943ae7f5 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -198,16 +198,10 @@ class OC_TEMPLATE{
{
$page = new OC_TEMPLATE( "core", "layout.admin" );
// Add menu data
- $navigation = array();
if( OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){
- foreach( OC_APP::getAdminPages() as $i ){
- $navigation[] = $i;
- }
+ $page->assign( "settingsnavigation", OC_APP::getSettingsNavigation());
}
- foreach( OC_APP::getSettingsPages() as $i ){
- $navigation[] = $i;
- }
- $page->assign( "navigation", $navigation );
+ $page->assign( "adminnavigation", OC_APP::getAdminNavigation());
}
else
{
diff --git a/log/appinfo/app.php b/log/appinfo/app.php
index fd53d1ec225..60769a990ff 100644
--- a/log/appinfo/app.php
+++ b/log/appinfo/app.php
@@ -1,6 +1,6 @@
<?php
OC_APP::register( array( "order" => 1, "id" => "log", "name" => "Log" ));
-OC_APP::addSettingsPage( array( "order" => 2, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" )));
+OC_APP::addSettingsPage( array( "id" => "log", "order" => 2, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" )));
?>
diff --git a/templates/layout.admin.php b/templates/layout.admin.php
index 6b1e73fd3a4..f7392c5de1d 100644
--- a/templates/layout.admin.php
+++ b/templates/layout.admin.php
@@ -26,9 +26,17 @@
<div id="plugins">
<ul>
<li><a style="background-image:url(<?php echo image_path('settings', 'information.png'); ?>)" href="<?php echo link_to('settings', 'index.php'); ?>" title="">Information</a></li>
- <?php foreach($_['navigation'] as $entry):?>
+ <?php foreach($_['settingsnavigation'] as $entry):?>
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title=""><?php echo $entry['name'] ?></a></li>
<?php endforeach; ?>
+ <?php foreach($_['adminnavigation'] as $entry):?>
+ <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title=""><?php echo $entry['name'] ?><?php if( $entry["active"] ) echo "I AM ACTIVE!!!"; ?></a></li>
+ <?php if( sizeof( $entry["subnavigation"] )): ?>
+ <?php foreach($entry["subnavigation"] as $subentry):?>
+ <li><a style="background-color:#FF8800;" href="<?php echo $subentry['href']; ?>" title=""><?php echo $subentry['name'] ?></a></li>
+ <?php endforeach; ?>
+ <?php endif; ?>
+ <?php endforeach; ?>
</ul>
</div>