Ver código fonte

Convert menu entries of settings pages to use router

tags/v5.0.0alpha1
Bart Visscher 11 anos atrás
pai
commit
d0bd2bbf27
8 arquivos alterados com 34 adições e 14 exclusões
  1. 15
    0
      core/routes.php
  2. 12
    6
      lib/app.php
  3. 1
    1
      settings/admin.php
  4. 1
    1
      settings/apps.php
  5. 1
    2
      settings/help.php
  6. 1
    1
      settings/personal.php
  7. 1
    1
      settings/settings.php
  8. 2
    2
      settings/users.php

+ 15
- 0
core/routes.php Ver arquivo

@@ -6,6 +6,21 @@
* See the COPYING-README file.
*/

// Core settings pages
$this->create('settings_help', '/settings/help')
->actionInclude('settings/help.php');
$this->create('settings_personal', '/settings/personal')
->actionInclude('settings/personal.php');
$this->create('settings_settings', '/settings')
->actionInclude('settings/settings.php');
$this->create('settings_users', '/settings/users')
->actionInclude('settings/users.php');
$this->create('settings_apps', '/settings/apps')
->actionInclude('settings/apps.php');
$this->create('settings_admin', '/settings/admin')
->actionInclude('settings/admin.php');

// Not specifically routed
$this->create('app_css', '/apps/{app}/{file}')
->requirements(array('file' => '.*.css'))
->action('OC', 'loadCSSFile');

+ 12
- 6
lib/app.php Ver arquivo

@@ -282,33 +282,33 @@ class OC_App{
// by default, settings only contain the help menu
if(OC_Config::getValue('knowledgebaseenabled', true)==true) {
$settings = array(
array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "help.php" ), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath( "settings", "help.svg" ))
array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkToRoute( "settings_help" ), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath( "settings", "help.svg" ))
);
}

// if the user is logged-in
if (OC_User::isLoggedIn()) {
// personal menu
$settings[] = array( "id" => "personal", "order" => 1, "href" => OC_Helper::linkTo( "settings", "personal.php" ), "name" => $l->t("Personal"), "icon" => OC_Helper::imagePath( "settings", "personal.svg" ));
$settings[] = array( "id" => "personal", "order" => 1, "href" => OC_Helper::linkToRoute( "settings_personal" ), "name" => $l->t("Personal"), "icon" => OC_Helper::imagePath( "settings", "personal.svg" ));

// if there are some settings forms
if(!empty(self::$settingsForms))
// settings menu
$settings[]=array( "id" => "settings", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "settings.php" ), "name" => $l->t("Settings"), "icon" => OC_Helper::imagePath( "settings", "settings.svg" ));
$settings[]=array( "id" => "settings", "order" => 1000, "href" => OC_Helper::linkToRoute( "settings_settings" ), "name" => $l->t("Settings"), "icon" => OC_Helper::imagePath( "settings", "settings.svg" ));

//SubAdmins are also allowed to access user management
if(OC_SubAdmin::isSubAdmin($_SESSION["user_id"]) || OC_Group::inGroup( $_SESSION["user_id"], "admin" )) {
// admin users menu
$settings[] = array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "settings", "users.php" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" ));
$settings[] = array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkToRoute( "settings_users" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" ));
}


// if the user is an admin
if(OC_Group::inGroup( $_SESSION["user_id"], "admin" )) {
// admin apps menu
$settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php" ).'?installed', "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" ));
$settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkToRoute( "settings_apps" ).'?installed', "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" ));

$settings[]=array( "id" => "admin", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "admin.php" ), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath( "settings", "admin.svg" ));
$settings[]=array( "id" => "admin", "order" => 1000, "href" => OC_Helper::linkToRoute( "settings_admin" ), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath( "settings", "admin.svg" ));
}
}

@@ -485,6 +485,12 @@ class OC_App{
public static function getCurrentApp() {
$script=substr($_SERVER["SCRIPT_NAME"], strlen(OC::$WEBROOT)+1);
$topFolder=substr($script, 0, strpos($script, '/'));
if (empty($topFolder)) {
$path_info = OC_Request::getPathInfo();
if ($path_info) {
$topFolder=substr($path_info, 1, strpos($path_info, '/', 1)-1);
}
}
if($topFolder=='apps') {
$length=strlen($topFolder);
return substr($script, $length+1, strpos($script, '/', $length+1)-$length-1);

+ 1
- 1
settings/admin.php Ver arquivo

@@ -5,8 +5,8 @@
* See the COPYING-README file.
*/

require_once '../lib/base.php';
OC_Util::checkAdminUser();
OC_App::loadApps();

OC_Util::addStyle( "settings", "settings" );
OC_Util::addScript( "settings", "admin" );

+ 1
- 1
settings/apps.php Ver arquivo

@@ -21,8 +21,8 @@
*
*/

require_once '../lib/base.php';
OC_Util::checkAdminUser();
OC_App::loadApps();

// Load the files we need
OC_Util::addStyle( "settings", "settings" );

+ 1
- 2
settings/help.php Ver arquivo

@@ -5,9 +5,8 @@
* See the COPYING-README file.
*/

require_once '../lib/base.php';
OC_Util::checkLoggedIn();
OC_App::loadApps();

// Load the files we need
OC_Util::addStyle( "settings", "settings" );

+ 1
- 1
settings/personal.php Ver arquivo

@@ -5,8 +5,8 @@
* See the COPYING-README file.
*/

require_once '../lib/base.php';
OC_Util::checkLoggedIn();
OC_App::loadApps();

// Highlight navigation entry
OC_Util::addScript( 'settings', 'personal' );

+ 1
- 1
settings/settings.php Ver arquivo

@@ -5,8 +5,8 @@
* See the COPYING-README file.
*/

require_once '../lib/base.php';
OC_Util::checkLoggedIn();
OC_App::loadApps();

OC_Util::addStyle( 'settings', 'settings' );
OC_App::setActiveNavigationEntry( 'settings' );

+ 2
- 2
settings/users.php Ver arquivo

@@ -5,8 +5,8 @@
* See the COPYING-README file.
*/

require_once '../lib/base.php';
OC_Util::checkSubAdminUser();
OC_App::loadApps();

// We have some javascript foo!
OC_Util::addScript( 'settings', 'users' );
@@ -57,4 +57,4 @@ $tmpl->assign( 'subadmins', $subadmins);
$tmpl->assign( 'numofgroups', count($accessiblegroups));
$tmpl->assign( 'quota_preset', $quotaPreset);
$tmpl->assign( 'default_quota', $defaultQuota);
$tmpl->printPage();
$tmpl->printPage();

Carregando…
Cancelar
Salvar