]> source.dussan.org Git - nextcloud-server.git/commitdiff
dont use a different navigation page for settings stuff
authorRobin Appelman <icewind1991@gmail.com>
Mon, 8 Aug 2011 19:42:25 +0000 (21:42 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Mon, 8 Aug 2011 19:43:31 +0000 (21:43 +0200)
admin/appinfo/app.php
apps/files_publiclink/appinfo/app.php
apps/user_ldap/appinfo/app.php
core/templates/layout.admin.php [deleted file]
core/templates/layout.user.php
files/appinfo/app.php
help/appinfo/app.php
lib/app.php
lib/template.php
settings/appinfo/app.php

index 08a36060fe3375321e20ece0c12d8642720e8ec1..80850638f71da3b077cc8138591c22a0caa2f94f 100644 (file)
@@ -2,11 +2,4 @@
 
 OC_App::register( array( "order" => 1, "id" => "admin", "name" => "Administration" ));
 
-// OC_App::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_Helper::linkTo( "admin", "system.php" ), "name" =>"System", "icon" => OC_Helper::imagePath( "admin", "administration.png" )));
-OC_App::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_Helper::imagePath( "admin", "users.png" )));
-OC_App::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "admin", "apps.php?installed" ), "name" => "Apps", "icon" => OC_Helper::imagePath( "admin", "apps.png" )));
-
-// Add subentries for App installer
-//OC_App::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_get", "order" => 4, "href" => OC_Helper::linkTo( "admin", "apps.php" ), "name" => "Get new apps", "icon" => OC_Helper::imagePath( "admin", "navicon.png" )));
-
 ?>
index 17646b3e5b52e551509f738e2fd1912b8cbd2beb..e2d8d27c0072b744f814c3bbd58b334bdc71af62 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-OC_App::addNavigationSubEntry('files_index', array( "id" => "files_publiclink_administration", "order" => 1, "href" => OC_Helper::linkTo( "files_publiclink", "admin.php" ), "name" => "Public Links"));
+OC_App::addNavigationEntry(array( "id" => "files_publiclink_administration", "order" => 2, "href" => OC_Helper::linkTo( "files_publiclink", "admin.php" ), "name" => "Public Links"));
 
 
 ?>
index 7f20372ea8dd8bde14e47ba26bec4dc283e6c456..a6fca4150127152446187b62367fedeadfe6b8ea 100644 (file)
@@ -36,4 +36,4 @@ $entry = array(
        'href' => OC_Helper::linkTo( "user_ldap", "settings.php" ),
        'name' => 'LDAP'
 );
-OC_App::addNavigationSubEntry( "core_users", $entry);
+// OC_App::addNavigationSubEntry( "core_users", $entry);
diff --git a/core/templates/layout.admin.php b/core/templates/layout.admin.php
deleted file mode 100644 (file)
index 853fcff..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<html>
-       <head>
-               <title>ownCloud</title>
-               <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-               <link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" />
-               <?php foreach($_['cssfiles'] as $cssfile): ?>
-                       <link rel="stylesheet" href="<?php echo $cssfile; ?>" type="text/css" media="screen" />
-               <?php endforeach; ?>
-               <script type="text/javascript">
-                       var oc_webroot = '<?php global $WEBROOT; echo $WEBROOT; ?>';
-                       var oc_current_user = '<?php echo OC_User::getUser() ?>';
-               // </script>
-               <?php foreach($_['jsfiles'] as $jsfile): ?>
-                       <script type="text/javascript" src="<?php echo $jsfile; ?>"></script>
-               <?php endforeach; ?>
-               <?php foreach($_['headers'] as $header): ?>
-                       <?php
-                               echo '<'.$header['tag'].' ';
-                               foreach($header['attributes'] as $name=>$value){
-                                       echo "$name='$value' ";
-                               };
-                               echo '>';
-                               echo $header['text'];
-                               echo '</'.$header['tag'].'>';
-                       ?>
-               <?php endforeach; ?>
-       </head>
-
-       <body id="body-settings">
-               <div id="header">
-                       <a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img src="<?php echo image_path('', 'owncloud-logo-small-white.png'); ?>" alt="ownCloud" /></a>
-                       <ul id="metanav">
-                               <li><a href="<?php echo link_to('', 'index.php'); ?>" title="Back to files"><img class='svg' src="<?php echo image_path('', 'actions/back.svg'); ?>"></a></li>
-                               <li><a href="<?php echo link_to('', 'index.php?logout=true'); ?>" title="Log out"><img class='svg' src="<?php echo image_path('', 'actions/logout.svg'); ?>"></a></li>
-                       </ul>
-               </div>
-
-               <div id="navigation">
-                       <ul>
-                               <?php foreach($_['settingsnavigation'] as $entry):?>
-                                       <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li>
-                                       <?php if( sizeof( $entry["subnavigation"] )): ?>
-                                               <?php foreach($entry["subnavigation"] as $subentry):?>
-                                                       <li><a href="<?php echo $subentry['href']; ?>" title="" <?php if( $subentry['active'] ): ?>class="active"<?php endif; ?>><?php echo $subentry['name'] ?></a></li>
-                                               <?php endforeach; ?>
-                                       <?php endif; ?>
-                               <?php endforeach; ?>
-                               <?php if(isset($_['adminnavigation'])):?>
-                                       <?php foreach($_['adminnavigation'] as $entry):?>
-                                               <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a>
-                                               <?php if( sizeof( $entry["subnavigation"] )): ?>
-                                                       <ul>
-                                                               <?php foreach($entry["subnavigation"] as $subentry):?>
-                                                                       <li class="subentry"><a class="subentry<?php if( $subentry['active'] ): ?> active<?php endif; ?>" href="<?php echo $subentry['href']; ?>" title=""><?php echo $subentry['name'] ?></a></li>
-                                                               <?php endforeach; ?>
-                                                       </ul>
-                                               <?php endif; ?>
-                                               </li>
-                                       <?php endforeach; ?>
-                               <?php endif; ?>
-                       </ul>
-               </div>
-
-               <div id="content">
-                       <?php echo $_['content']; ?>
-               </div>
-       </body>
-</html>
index 57c48563bd8f615f69155e5c634895f1601643f2..db142241d644ee4c36caaffce7e32ccac612f83d 100644 (file)
                        <a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img src="<?php echo image_path('', 'owncloud-logo-small-white.png'); ?>" alt="ownCloud" /></a>
                        <?php echo $_['searchbox']?>
                        <ul id="metanav">
-                               <li><a href="<?php echo link_to('settings', 'index.php'); ?>" title="Settings"><img class='svg' src="<?php echo image_path('', 'actions/settings.svg'); ?>"></a></li>
                                <li><a href="<?php echo link_to('', 'index.php'); ?>?logout=true" title="Log out"><img class='svg' src="<?php echo image_path('', 'actions/logout.svg'); ?>"></a></li>
                        </ul>
                </div>
 
                <div id="navigation">
-                       <ul>
+                       <ul id="apps">
                                <?php foreach($_['navigation'] as $entry): ?>
                                        <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>><?php echo $entry['name']; ?></a>
                                                <?php if( sizeof( $entry["subnavigation"] )): ?>
                                        </li>
                                <?php endforeach; ?>
                        </ul>
+                       <ul id="settings">
+                               <?php foreach($_['settingsnavigation'] as $entry):?>
+                                       <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li>
+                                       <?php if( sizeof( $entry["subnavigation"] )): ?>
+                                               <?php foreach($entry["subnavigation"] as $subentry):?>
+                                                       <li><a href="<?php echo $subentry['href']; ?>" title="" <?php if( $subentry['active'] ): ?>class="active"<?php endif; ?>><?php echo $subentry['name'] ?></a></li>
+                                               <?php endforeach; ?>
+                                       <?php endif; ?>
+                               <?php endforeach; ?>
+                       </ul>
                </div>
                <div id="content">
                        <?php echo $_['content']; ?>
index 0f95b19f59226d001e31717eaaacdfa51f09925b..a4cec3d6ec2812590b72209c183dd788966b04bd 100644 (file)
@@ -3,10 +3,5 @@
 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", "home.png" ), "name" => "Files" ));
-OC_App::addAdminPage( array( "id" => "files_administration", "order" => 3, "href" => OC_Helper::linkTo( "files", "admin.php" ), "name" => "Files", "icon" => OC_Helper::imagePath( "files", "folder.png" )));
-
-
-// To add navigation sub entries use
-// OC_App::addNavigationSubEntry( "files_index", array( ... ));
 
 ?>
index 2e82c0cd18178b5bbe36d2ca5e73907b6b797433..372e28c97bd7aeffa3d4542ef31ed7837e0fb847 100644 (file)
@@ -2,13 +2,4 @@
 
 OC_App::register( array( "order" => 1, "id" => "help", "name" => "Help" ));
 
-// 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( "help", "help.png" ));
-if( isset( $_SESSION["user_id"] ) && OC_Group::inGroup( $_SESSION["user_id"], "admin" )){
-       OC_App::addAdminPage( $entry );
-}
-else{
-       OC_App::addSettingsPage( $entry );
-}
-
 ?>
index 9e81ed8184eb5b4e1aae7de865957d1abfbe4923..51e86c847ddeeb98a106bf6e1e5a29a858022fc8 100644 (file)
@@ -30,10 +30,7 @@ class OC_App{
        static private $init = false;
        static private $apps = array();
        static private $activeapp = '';
-       static private $adminpages = array();
-       static private $settingspages = array();
        static private $navigation = array();
-       static private $subnavigation = array();
 
        /**
         * @brief loads all apps
@@ -166,38 +163,6 @@ class OC_App{
                return true;
        }
 
-       /**
-        * @brief adds a sub entry to the navigation
-        * @param $parent id of the parent
-        * @param $data array containing the data
-        * @returns true/false
-        *
-        * This function adds a new sub entry to the navigation visible to users.
-        * these entries are visible only if the parent navigation entry is marked
-        * as being active (see activateNavigationEntry()). $data is an associative
-        * array.
-        * The following keys are required:
-        *   - id: unique id for this entry ('addressbook_index')
-        *   - href: link to the page
-        *   - name: Human readable name ('Addressbook')
-        *
-        * The following keys are optional:
-        *   - icon: path to the icon of the app
-        *   - order: integer, that influences the position of your application in
-        *     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();
-               }
-               self::$subnavigation[$parent][] = $data;
-               return true;
-       }
-
        /**
         * @brief marks a navigation entry as active
         * @param $id id of the entry
@@ -223,70 +188,6 @@ class OC_App{
                return self::$activeapp;
        }
 
-       /**
-        * @brief registers an admin page
-        * @param $data array containing the data
-        * @returns true/false
-        *
-        * This function registers a admin page that will be shown in the admin
-        * menu. $data is an associative array.
-        * The following keys are required:
-        *   - id: unique id for this entry ('files_admin')
-        *   - href: link to the admin page
-        *   - name: Human readable name ('Files Administration')
-        *
-        * The following keys are optional:
-        *   - order: integer, that influences the position of your application in
-        *     the list. Lower values come first.
-        */
-       public static function addAdminPage( $data = array()){
-               // TODO: write function
-               OC_App::$adminpages[] = $data;
-               return true;
-       }
-
-       /**
-        * @brief registers a settings page
-        * @param $data array containing the data
-        * @returns true/false
-        *
-        * This function registers a settings page. $data is an associative array.
-        * The following keys are required:
-        *   - app: app the settings belong to ('files')
-        *   - id: unique id for this entry ('files_public')
-        *   - href: link to the admin page
-        *   - name: Human readable name ('Public files')
-        *
-        * The following keys are optional:
-        *   - order: integer, that influences the position of your application in
-        *     the list. Lower values come first.
-        *
-        * For the main settings page of an app, the keys 'app' and 'id' have to be
-        * the same.
-        */
-       public static function addSettingsPage( $data = array()){
-               // TODO: write function
-               OC_App::$settingspages[] = $data;
-               return true;
-       }
-
-       /**
-        * @brief Returns the navigation
-        * @returns associative array
-        *
-        * This function returns an array containing all entries added. The
-        * entries are sorted by the key 'order' ascending. Additional to the keys
-        * given for each app the following keys exist:
-        *   - active: boolean, signals if the user is on this navigation entry
-        *   - children: array that is empty if the key 'active' is false or
-        *     contains the subentries if the key 'active' is true
-        */
-       public static function getNavigation(){
-               $navigation = self::proceedNavigation( self::$navigation );
-               $navigation = self::addSubNavigation( $navigation );
-               return $navigation;
-       }
-
        /**
         * @brief Returns the Settings Navigation
         * @returns associative array
@@ -295,57 +196,20 @@ class OC_App{
         * entries are sorted by the key 'order' ascending.
         */
        public static function getSettingsNavigation(){
-               $navigation = self::proceedNavigation( self::$settingspages );
-               $navigation = self::addSubNavigation( $navigation );
-
-               return $navigation;
-       }
-
-       /**
-        * @brief Returns the admin navigation
-        * @returns associative array
-        *
-        * This function returns an array containing all admin pages added. The
-        * entries are sorted by the key 'order' ascending.
-        */
-       public static function getAdminNavigation(){
-               $navigation = self::proceedNavigation( self::$adminpages );
-               $navigation = self::addSubNavigation( $navigation );
-
-               return $navigation;
-       }
-
-       /// Private foo
-       private static function addSubNavigation( $list ){
-               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'] = $entries;
-                                               }
-                                       }
-                               }
-                       }
+               $admin=array(
+                       array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_Helper::imagePath( "admin", "users.png" )),
+                       array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "admin", "apps.php?installed" ), "name" => "Apps", "icon" => OC_Helper::imagePath( "admin", "apps.png" )),
+                       array( "id" => "files_administration", "order" => 3, "href" => OC_Helper::linkTo( "files", "admin.php" ), "name" => "Files", "icon" => OC_Helper::imagePath( "files", "folder.png" )),
+               );
+               $settings=array(
+                       array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_Helper::imagePath( "help", "help.png" )),
+                       array( "id" => "settings", "order" => 1, "href" => OC_Helper::linkTo( "settings", "index.php" ), "name" => "Personal", "icon" => OC_Helper::imagePath( "settings", "personal.png" ))
+               );
+               if( OC_Group::inGroup( $_SESSION["user_id"], "admin" )){
+                       $settings=array_merge($admin,$settings);
                }
-
-               return $list;
+               $navigation = self::proceedNavigation($settings);
+               return $navigation;
        }
 
        /// This is private as well. It simply works, so don't ask for more details
@@ -354,9 +218,6 @@ class OC_App{
                        $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;
@@ -392,6 +253,22 @@ class OC_App{
                return $data;
        }
        
+       /**
+        * @brief Returns the navigation
+        * @returns associative array
+        *
+        * This function returns an array containing all entries added. The
+        * entries are sorted by the key 'order' ascending. Additional to the keys
+        * given for each app the following keys exist:
+        *   - active: boolean, signals if the user is on this navigation entry
+        *   - children: array that is empty if the key 'active' is false or
+        *     contains the subentries if the key 'active' is true
+        */
+       public static function getNavigation(){
+               $navigation = self::proceedNavigation( self::$navigation );
+               return $navigation;
+       }
+       
        /**
         * get the id of loaded app
         * @return string
index 124343bd85ba55eb836778ae17e8f39a7409f736..12047a38a13658a130b36107ab9b21b707a15828 100644 (file)
@@ -242,22 +242,8 @@ class OC_Template{
 
                                // Add navigation entry
                                $page->assign( "navigation", OC_App::getNavigation());
-                       }
-                       elseif( $this->renderas == "admin" )
-                       {
-                               $page = new OC_Template( "core", "layout.admin" );
-                               $search=new OC_Template( 'core', 'part.searchbox');
-                               $search->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' ));
-                               $page->assign('searchbox', $search->fetchPage());
-                               
-                               // Add menu data
-                               if( OC_Group::inGroup( $_SESSION["user_id"], "admin" )){
-                                       $page->assign( "adminnavigation", OC_App::getAdminNavigation());
-                               }
                                $page->assign( "settingsnavigation", OC_App::getSettingsNavigation());
-                       }
-                       else
-                       {
+                       }else{
                                $page = new OC_Template( "core", "layout.guest" );
                        }
 
index db4594dcc2db4098e08b0a719724df971801876f..4ffb944aba3cefade52648de8feec7d3e659acf3 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 
 OC_App::register( array( "id" => "settings", "name" => "Settings" ));
-OC_App::addSettingsPage( array( "id" => "settings", "order" => -1000, "href" => OC_Helper::linkTo( "settings", "index.php" ), "name" => "Personal", "icon" => OC_Helper::imagePath( "settings", "personal.png" )));
 
 ?>