From ee3d32b023642b675b66f0e14fa5747bc5671f95 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Sun, 17 Apr 2011 20:00:07 +0200 Subject: [PATCH] Everything nice and active now --- admin/appinfo/app.php | 10 ++++---- admin/apps.php | 5 +++- admin/index.php | 49 -------------------------------------- admin/plugins.php | 1 + admin/system.php | 2 ++ admin/templates/index.php | 19 --------------- files/admin.php | 1 + files/appinfo/app.php | 3 +++ files/index.php | 2 +- help/appinfo/app.php | 10 +++++++- help/index.php | 1 - log/appinfo/app.php | 2 +- log/index.php | 1 + settings/appinfo/app.php | 1 + settings/index.php | 2 +- templates/layout.admin.php | 8 +++++-- 16 files changed, 36 insertions(+), 81 deletions(-) delete mode 100644 admin/index.php delete mode 100644 admin/templates/index.php diff --git a/admin/appinfo/app.php b/admin/appinfo/app.php index 40d8b9188ec..ffe941552b8 100644 --- a/admin/appinfo/app.php +++ b/admin/appinfo/app.php @@ -2,12 +2,12 @@ OC_APP::register( array( "order" => 1, "id" => "admin", "name" => "Administration" )); -OC_APP::addAdminPage( array( "id" => "core_system", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" => "System settings", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); -OC_APP::addAdminPage( array( "id" => "core_users", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); -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" ))); +OC_APP::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" => "System settings", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); +OC_APP::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); +OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); +OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 4, "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" ))); +OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_installed", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php?add=some¶meters=here" ), "name" => "Installed apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); ?> diff --git a/admin/apps.php b/admin/apps.php index 1b777bc246c..7ce3f4c419f 100644 --- a/admin/apps.php +++ b/admin/apps.php @@ -51,11 +51,13 @@ print_r($value); */ +// OC_APP::setActiveNavigationEntry( "core_apps_installed" ); if($id==0) { + OC_APP::setActiveNavigationEntry( "core_apps" ); - if($cat==0){ + if($cat==0){ $numcats=array(); foreach($categories as $key=>$value) $numcats[]=$key; $apps=OC_OCSCLIENT::getApplications($numcats); @@ -72,6 +74,7 @@ if($id==0) { unset($tmpl); }else{ + OC_APP::setActiveNavigationEntry( "core_apps" ); $app=OC_OCSCLIENT::getApplication($id); diff --git a/admin/index.php b/admin/index.php deleted file mode 100644 index 80e70d13f9a..00000000000 --- a/admin/index.php +++ /dev/null @@ -1,49 +0,0 @@ -. -* -*/ - -require_once('../lib/base.php'); -require( 'template.php' ); -if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ - header( "Location: ".OC_HELPER::linkTo( "","index.php" )); - exit(); -} - -$apppages = array(); -$syspages = array(); - -foreach( OC_APP::getAdminPages() as $i ){ - if( substr( $i["id"], 0, 5 ) == "core_" ){ - $syspages[] = $i; - } - else{ - $apppages[] = $i; - } -} - -$tmpl = new OC_TEMPLATE( "admin", "index", "admin" ); -$tmpl->assign( "apppages", $apppages ); -$tmpl->assign( "syspages", $syspages ); -$tmpl->printPage(); - -?> - diff --git a/admin/plugins.php b/admin/plugins.php index 60d23585a4f..fd1933a7fa1 100644 --- a/admin/plugins.php +++ b/admin/plugins.php @@ -28,6 +28,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' exit(); } +OC_APP::setActiveNavigationEntry( "core_plugins" ); $plugins=array(); $blacklist=OC_PLUGIN::loadBlackList(); diff --git a/admin/system.php b/admin/system.php index de62b133f85..310979295f0 100644 --- a/admin/system.php +++ b/admin/system.php @@ -28,6 +28,8 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' exit(); } +OC_APP::setActiveNavigationEntry( "administration" ); + $tmpl = new OC_TEMPLATE( "admin", "system", "admin" ); $tmpl->printPage(); diff --git a/admin/templates/index.php b/admin/templates/index.php deleted file mode 100644 index fa32a67eadb..00000000000 --- a/admin/templates/index.php +++ /dev/null @@ -1,19 +0,0 @@ - -

Administration

- -

System

- -

Applications

- diff --git a/files/admin.php b/files/admin.php index 3cc8a57d4cb..0333e2c6cb1 100644 --- a/files/admin.php +++ b/files/admin.php @@ -32,6 +32,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' exit(); } +OC_APP::setActiveNavigationEntry( "files_administration" ); // return template $tmpl = new OC_TEMPLATE( "files", "admin", "admin" ); $tmpl->printPage(); diff --git a/files/appinfo/app.php b/files/appinfo/app.php index 1d83674852d..851a774286d 100644 --- a/files/appinfo/app.php +++ b/files/appinfo/app.php @@ -5,4 +5,7 @@ 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( "id" => "files_administration", "order" => 1, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files" )); +// To add navigation sub entries use +// OC_APP::addNavigationSubEntry( "files_index", array( ... )); + ?> diff --git a/files/index.php b/files/index.php index c0f078bd215..2a78e8a438e 100644 --- a/files/index.php +++ b/files/index.php @@ -35,7 +35,7 @@ if( !OC_USER::isLoggedIn()){ // Load the files we need OC_UTIL::addStyle( "files", "files" ); OC_UTIL::addScript( "files", "files" ); - +OC_APP::setActiveNavigationEntry( "files_index" ); // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; diff --git a/help/appinfo/app.php b/help/appinfo/app.php index 952c57f9bc8..4743292ebb7 100644 --- a/help/appinfo/app.php +++ b/help/appinfo/app.php @@ -1,6 +1,14 @@ 1, "id" => "help", "name" => "Help" )); -OC_APP::addSettingsPage( array( "id" => "help", "order" => 2, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_HELPER::imagePath( "settings", "information.png" ))); + +// Workaround for having help as the last entry always +$entry = array( "id" => "help", "order" => 1000, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_HELPER::imagePath( "settings", "information.png" )); +if( OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){ + OC_APP::addAdminPage( $entry ); +} +else{ + OC_APP::addSettingsPage( $entry ); +} ?> diff --git a/help/index.php b/help/index.php index 426abe39560..e6a2d5661f5 100644 --- a/help/index.php +++ b/help/index.php @@ -9,7 +9,6 @@ if( !OC_USER::isLoggedIn()){ // Load the files we need OC_UTIL::addStyle( "help", "help" ); - OC_APP::setActiveNavigationEntry( "help" ); $kbe=OC_OCSCLIENT::getKnownledgebaseEntries(); diff --git a/log/appinfo/app.php b/log/appinfo/app.php index 60769a990ff..7058c6ebc98 100644 --- a/log/appinfo/app.php +++ b/log/appinfo/app.php @@ -1,6 +1,6 @@ 1, "id" => "log", "name" => "Log" )); -OC_APP::addSettingsPage( array( "id" => "log", "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" => 999, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); ?> diff --git a/log/index.php b/log/index.php index 23194f18a61..646dbc0cc59 100644 --- a/log/index.php +++ b/log/index.php @@ -30,6 +30,7 @@ if( !OC_USER::isLoggedIn()){ exit(); } +OC_APP::setActiveNavigationEntry( "log" ); $logs=OC_LOG::get( $dir ); foreach( $logs as &$i ){ diff --git a/settings/appinfo/app.php b/settings/appinfo/app.php index 5f78b83dc23..2eb24b90efa 100644 --- a/settings/appinfo/app.php +++ b/settings/appinfo/app.php @@ -1,5 +1,6 @@ "settings", "name" => "Settings" )); +OC_APP::addSettingsPage( array( "id" => "settings", "order" => -1000, "href" => OC_HELPER::linkTo( "settings", "index.php" ), "name" => "Information", "icon" => OC_HELPER::imagePath( "settings", "information.png" ))); ?> diff --git a/settings/index.php b/settings/index.php index 0e3b3f28550..9bf89145cc3 100644 --- a/settings/index.php +++ b/settings/index.php @@ -7,7 +7,7 @@ if( !OC_USER::isLoggedIn()){ exit(); } - +OC_APP::setActiveNavigationEntry( "settings" ); $tmpl = new OC_TEMPLATE( "settings", "index", "admin"); $used=OC_FILESYSTEM::filesize('/'); $free=OC_FILESYSTEM::free_space(); diff --git a/templates/layout.admin.php b/templates/layout.admin.php index f7392c5de1d..0212419a952 100644 --- a/templates/layout.admin.php +++ b/templates/layout.admin.php @@ -25,9 +25,13 @@