]> source.dussan.org Git - nextcloud-server.git/commitdiff
Base for a more flexible navigation
authorJakob Sack <kde@jakobsack.de>
Thu, 3 Mar 2011 22:08:11 +0000 (23:08 +0100)
committerJakob Sack <kde@jakobsack.de>
Thu, 3 Mar 2011 22:08:11 +0000 (23:08 +0100)
16 files changed:
admin/appinfo/app.php
admin/img/navicon.png [new file with mode: 0644]
admin/index.php
admin/templates/index.php
files/appinfo/app.php
files/img/navicon.png [new file with mode: 0644]
img/actions/arrow-down.png [new file with mode: 0644]
img/actions/arrow-left.png [new file with mode: 0644]
img/actions/arrow-right.png [new file with mode: 0644]
img/actions/arrow-up.png [new file with mode: 0644]
lib/app.php
lib/base.php
log/appinfo/app.php
settings/appinfo/app.php
templates/layout.admin.php
templates/layout.user.php

index befe8e678f0ad79cd15fb0b229b44d8d9cadf26d..3221e276c5f0d56e18cdbc9d680f858111ad56f5 100644 (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" ));
 
 ?>
diff --git a/admin/img/navicon.png b/admin/img/navicon.png
new file mode 100644 (file)
index 0000000..f2c7c08
Binary files /dev/null and b/admin/img/navicon.png differ
index 96fa20072441b5779227dc7336403bc4cb6ce58c..cfcb70d056b6a7498cb9276b7f34a6cf4a8c68db 100644 (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;
 }
index 56f85cbbbc5ffe354474f9149fbdc7d7b02e6a38..f13d5634eac795a03723bf336ea080cca81f3aab 100644 (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>
index aa0054fc43da4760a3b86addd681b3479d4e8e88..8b1a806b7bed80a8b7645a67e58a0f94797290de 100644 (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" ));
 
 ?>
diff --git a/files/img/navicon.png b/files/img/navicon.png
new file mode 100644 (file)
index 0000000..9ee717c
Binary files /dev/null and b/files/img/navicon.png differ
diff --git a/img/actions/arrow-down.png b/img/actions/arrow-down.png
new file mode 100644 (file)
index 0000000..03f2014
Binary files /dev/null and b/img/actions/arrow-down.png differ
diff --git a/img/actions/arrow-left.png b/img/actions/arrow-left.png
new file mode 100644 (file)
index 0000000..b56cfee
Binary files /dev/null and b/img/actions/arrow-left.png differ
diff --git a/img/actions/arrow-right.png b/img/actions/arrow-right.png
new file mode 100644 (file)
index 0000000..0acee70
Binary files /dev/null and b/img/actions/arrow-right.png differ
diff --git a/img/actions/arrow-up.png b/img/actions/arrow-up.png
new file mode 100644 (file)
index 0000000..5e42321
Binary files /dev/null and b/img/actions/arrow-up.png differ
index 181af8a4faf57f4a233a9e6863818b52418e7da8..0bef73812626382dec44999fece4812d4b64b253 100644 (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;
        }
 
 }
index c7f0fea6820d065e51be80e4f1eefe634e0fb66c..09e0a1e299a3bf3ae128546edf92e11ea6429668 100644 (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;
        }
 
index 292d59ee578478ca08bfee865fa0a3ce493763e8..e639982a89ca8c5d18faf4bbf7057d1e767c8e1e 100644 (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" ));
 
 ?>
index 0db99441574f4da954cba4c2124bbe3eac68bd38..c43d47f0dd6d590d539c2ad59b3a50f33c416cdb 100644 (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" ));
 
 ?>
index b4fcc9158829dc8bde8a5ed7d970b9dc93437da1..849ed6656be926786d71ee9751a9edfd7a88fe32 100644 (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>
 
index 0643c99e9332f441bc3a962090d01a5af8552463..ff845a9b957e568de473fdc8a1d6467405e87ee7 100644 (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>