Base for a more flexible navigation

This commit is contained in:
Jakob Sack 2011-03-03 23:08:11 +01:00
parent ae5dc3efdf
commit f7f957abb9
16 changed files with 31 additions and 29 deletions

View File

@ -1,12 +1,12 @@
<?php
OC_APP::register( array( "id" => "admin", "name" => "Administration" ));
OC_APP::register( array( "order" => 1, "id" => "admin", "name" => "Administration" ));
if( OC_USER::ingroup( $_SESSION['username'], 'admin' ))
{
OC_UTIL::addNavigationEntry( array( "app" => "admin", "file" => "index.php", "name" => "Administration" ));
OC_UTIL::addNavigationEntry( array( "id" => "admin_index", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "index.php" ), "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ), "name" => "Administration" ));
}
OC_UTIL::addAdminPage( array( "app" => "admin", "file" => "system.php", "name" => "System Settings" ));
OC_UTIL::addAdminPage( array( "app" => "admin", "file" => "users.php", "name" => "Users" ));
OC_UTIL::addAdminPage( array( "app" => "admin", "file" => "plugins.php", "name" => "Plugins" ));
OC_UTIL::addAdminPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" => "System settings" ));
OC_UTIL::addAdminPage( array( "order" => 2, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users" ));
OC_UTIL::addAdminPage( array( "order" => 3, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins" ));
?>

BIN
admin/img/navicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 874 B

View File

@ -30,7 +30,7 @@ if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin'
$adminpages = array();
foreach( OC_APP::list() as $i ){
foreach( OC_UTIL::$adminpages as $i ){
// Do some more work here soon
$adminpages[] = $i;
}

View File

@ -7,6 +7,6 @@
<ul>
<? foreach( $_["adminpages"] as $i ){ ?>
<li><a href="<? echo link_to( $i["app"], $i["file"] ) ?>"><? echo $i["name"] ?></a></li>
<li><a href="<? echo $i["href"] ?>"><? echo $i["name"] ?></a></li>
<? } ?>
</ul>

View File

@ -1,7 +1,8 @@
<?php
OC_APP::register( array( "id" => "files", "name" => "Files" ));
OC_UTIL::addNavigationEntry( array( "app" => "files", "file" => "index.php", "name" => "Files" ));
OC_UTIL::addAdminPage( array( "app" => "files", "file" => "admin.php", "name" => "Files" ));
OC_APP::register( array( "order" => 2, "id" => "files", "name" => "Files" ));
OC_UTIL::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_HELPER::linkTo( "files", "index.php" ), "icon" => OC_HELPER::imagePath( "files", "navicon.png" ), "name" => "Files" ));
OC_UTIL::addAdminPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files" ));
?>

BIN
files/img/navicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

BIN
img/actions/arrow-down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

BIN
img/actions/arrow-left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

BIN
img/actions/arrow-right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

BIN
img/actions/arrow-up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

View File

@ -6,13 +6,15 @@ class OC_APP{
/**
*
*/
public static function init(){
public static function loadApps(){
global $SERVERROOT;
// Get all appinfo
$dir = opendir( $SERVERROOT );
while( false !== ( $filename = readdir( $dir ))){
if( substr( $filename, 0, 1 ) != '.' ){
if( file_exists( "$SERVERROOT/$filename/appinfo.php" )){
oc_require( "$filename/appinfo.php" );
if( file_exists( "$SERVERROOT/$filename/appinfo/app.php" )){
oc_require( "$filename/appinfo/app.php" );
}
}
}
@ -32,8 +34,8 @@ class OC_APP{
/**
*
*/
public static function list(){
return OC_APP::$apps[];
public static function getApps(){
return OC_APP::$apps;
}
}

View File

@ -77,6 +77,7 @@ if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){
}
// load core libs
oc_require_once('helper.php');
oc_require_once('app.php');
oc_require_once('files.php');
oc_require_once('filesystem.php');
@ -89,7 +90,6 @@ oc_require_once('ocs.php');
oc_require_once('connect.php');
oc_require_once('remotestorage.php');
oc_require_once('plugin.php');
oc_require_once('helper.php');
OC_PLUGIN::loadPlugins( "" );
@ -104,15 +104,15 @@ if( !$RUNTIME_NOSETUPFS ){
}
// Add the stuff we need always
OC_UTIL::addPersonalMenuEntry( array( "file" => "index.php?logout=1", "name" => "Logout" ));
OC_UTIL::addPersonalMenuEntry( array( "order" => 1000, "href" => OC_HELPER::linkTo( "", "index.php?logout=1" ), "name" => "Logout" ));
OC_UTIL::addScript( "jquery-1.5.min" );
OC_UTIL::addScript( "jquery-ui-1.8.10.custom.min" );
OC_UTIL::addScript( "js" );
OC_UTIL::addStyle( "jquery-ui-1.8.10.custom" );
OC_UTIL::addStyle( "styles" );
// Require all appinfo.php
OC_APP::init();
// Load Apps
OC_APP::loadApps();
// check if the server is correctly configured for ownCloud
OC_UTIL::checkserver();
@ -239,7 +239,7 @@ class OC_UTIL {
*
* @param array $entry
*/
public static function addAdminPage( $entry){
public static function addAdminPage( $entry ){
OC_UTIL::$adminpages[] = $entry;
}

View File

@ -1,6 +1,6 @@
<?php
OC_APP::register( array( "id" => "log", "name" => "Log" ));
OC_UTIL::addNavigationEntry( array( "app" => "log", "file" => "index.php", "name" => "Log" ));
OC_APP::register( array( "order" => 1, "id" => "log", "name" => "Log" ));
OC_UTIL::addPersonalMenuEntry( array( "order" => 2, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log" ));
?>

View File

@ -1,6 +1,6 @@
<?php
OC_APP::register( array( "id" => "settings", "name" => "Settings" ));
OC_UTIL::addNavigationEntry( array( "app" => "settings", "file" => "index.php", "name" => "Settings" ));
OC_UTIL::addPersonalMenuEntry( array( "order" => 1, "href" => OC_HELPER::linkTo( "settings", "index.php" ), "name" => "Settings" ));
?>

View File

@ -25,7 +25,7 @@
<a id="user_menu_link" href="" title="">Username</a>
<ul id="user_menu">
<? foreach( $_["personalmenu"] as $entry ){ ?>
<li><a href="<? echo link_to( $entry["app"], $entry["file"] )?>" title=""><? echo $entry["name"] ?></a></li>
<li><a href="<? echo $entry["href"] ?>" title=""><? echo $entry["name"] ?></a></li>
<? } ?>
</ul>
</div>
@ -34,9 +34,8 @@
<div id="main">
<div id="plugins">
<ul>
<? foreach( $_["navigation"] as $entry ){ ?>
<li><a href="<? echo link_to( $entry["app"], $entry["file"] )?>" title=""><? echo $entry["name"] ?></a></li>
<? } ?>
<li><a style="background-image:url(<? echo image_path( "admin", "navicon.png" ) ?>)" href="<? echo link_to( "admin", "index.php" )?>" title="">Administration</a></li>
<li><a style="background-image:url(<? echo image_path( "", "actions/arrow-left.png" ) ?>)" href="<? echo link_to( "", "index.php" )?>" title="">Back</a></li>
</ul>
</div>

View File

@ -25,7 +25,7 @@
<a id="user_menu_link" href="" title="">Username</a>
<ul id="user_menu">
<? foreach( $_["personalmenu"] as $entry ){ ?>
<li><a href="<? echo link_to( $entry["app"], $entry["file"] )?>" title=""><? echo $entry["name"] ?></a></li>
<li><a href="<? echo $entry["href"] ?>" title=""><? echo $entry["name"] ?></a></li>
<? } ?>
</ul>
</div>
@ -35,7 +35,7 @@
<div id="plugins">
<ul>
<? foreach( $_["navigation"] as $entry ){ ?>
<li><a href="<? echo link_to( $entry["app"], $entry["file"] )?>" title=""><? echo $entry["name"] ?></a></li>
<li><a style="background-image:url(<? echo $entry["icon"] ?>)" href="<? echo $entry["href"] ?>" title=""><? echo $entry["name"] ?></a></li>
<? } ?>
</ul>
</div>