Convert menu entries of settings pages to use router
This commit is contained in:
parent
dbdf3bde7c
commit
d0bd2bbf27
8 changed files with 34 additions and 14 deletions
|
@ -6,6 +6,21 @@
|
||||||
* See the COPYING-README file.
|
* 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}')
|
$this->create('app_css', '/apps/{app}/{file}')
|
||||||
->requirements(array('file' => '.*.css'))
|
->requirements(array('file' => '.*.css'))
|
||||||
->action('OC', 'loadCSSFile');
|
->action('OC', 'loadCSSFile');
|
||||||
|
|
18
lib/app.php
18
lib/app.php
|
@ -282,33 +282,33 @@ class OC_App{
|
||||||
// by default, settings only contain the help menu
|
// by default, settings only contain the help menu
|
||||||
if(OC_Config::getValue('knowledgebaseenabled', true)==true) {
|
if(OC_Config::getValue('knowledgebaseenabled', true)==true) {
|
||||||
$settings = array(
|
$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 the user is logged-in
|
||||||
if (OC_User::isLoggedIn()) {
|
if (OC_User::isLoggedIn()) {
|
||||||
// personal menu
|
// 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 there are some settings forms
|
||||||
if(!empty(self::$settingsForms))
|
if(!empty(self::$settingsForms))
|
||||||
// settings menu
|
// 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
|
//SubAdmins are also allowed to access user management
|
||||||
if(OC_SubAdmin::isSubAdmin($_SESSION["user_id"]) || OC_Group::inGroup( $_SESSION["user_id"], "admin" )) {
|
if(OC_SubAdmin::isSubAdmin($_SESSION["user_id"]) || OC_Group::inGroup( $_SESSION["user_id"], "admin" )) {
|
||||||
// admin users menu
|
// 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 the user is an admin
|
||||||
if(OC_Group::inGroup( $_SESSION["user_id"], "admin" )) {
|
if(OC_Group::inGroup( $_SESSION["user_id"], "admin" )) {
|
||||||
// admin apps menu
|
// 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() {
|
public static function getCurrentApp() {
|
||||||
$script=substr($_SERVER["SCRIPT_NAME"], strlen(OC::$WEBROOT)+1);
|
$script=substr($_SERVER["SCRIPT_NAME"], strlen(OC::$WEBROOT)+1);
|
||||||
$topFolder=substr($script, 0, strpos($script, '/'));
|
$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') {
|
if($topFolder=='apps') {
|
||||||
$length=strlen($topFolder);
|
$length=strlen($topFolder);
|
||||||
return substr($script, $length+1, strpos($script, '/', $length+1)-$length-1);
|
return substr($script, $length+1, strpos($script, '/', $length+1)-$length-1);
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once '../lib/base.php';
|
|
||||||
OC_Util::checkAdminUser();
|
OC_Util::checkAdminUser();
|
||||||
|
OC_App::loadApps();
|
||||||
|
|
||||||
OC_Util::addStyle( "settings", "settings" );
|
OC_Util::addStyle( "settings", "settings" );
|
||||||
OC_Util::addScript( "settings", "admin" );
|
OC_Util::addScript( "settings", "admin" );
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once '../lib/base.php';
|
|
||||||
OC_Util::checkAdminUser();
|
OC_Util::checkAdminUser();
|
||||||
|
OC_App::loadApps();
|
||||||
|
|
||||||
// Load the files we need
|
// Load the files we need
|
||||||
OC_Util::addStyle( "settings", "settings" );
|
OC_Util::addStyle( "settings", "settings" );
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once '../lib/base.php';
|
|
||||||
OC_Util::checkLoggedIn();
|
OC_Util::checkLoggedIn();
|
||||||
|
OC_App::loadApps();
|
||||||
|
|
||||||
// Load the files we need
|
// Load the files we need
|
||||||
OC_Util::addStyle( "settings", "settings" );
|
OC_Util::addStyle( "settings", "settings" );
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once '../lib/base.php';
|
|
||||||
OC_Util::checkLoggedIn();
|
OC_Util::checkLoggedIn();
|
||||||
|
OC_App::loadApps();
|
||||||
|
|
||||||
// Highlight navigation entry
|
// Highlight navigation entry
|
||||||
OC_Util::addScript( 'settings', 'personal' );
|
OC_Util::addScript( 'settings', 'personal' );
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once '../lib/base.php';
|
|
||||||
OC_Util::checkLoggedIn();
|
OC_Util::checkLoggedIn();
|
||||||
|
OC_App::loadApps();
|
||||||
|
|
||||||
OC_Util::addStyle( 'settings', 'settings' );
|
OC_Util::addStyle( 'settings', 'settings' );
|
||||||
OC_App::setActiveNavigationEntry( 'settings' );
|
OC_App::setActiveNavigationEntry( 'settings' );
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once '../lib/base.php';
|
|
||||||
OC_Util::checkSubAdminUser();
|
OC_Util::checkSubAdminUser();
|
||||||
|
OC_App::loadApps();
|
||||||
|
|
||||||
// We have some javascript foo!
|
// We have some javascript foo!
|
||||||
OC_Util::addScript( 'settings', 'users' );
|
OC_Util::addScript( 'settings', 'users' );
|
||||||
|
@ -57,4 +57,4 @@ $tmpl->assign( 'subadmins', $subadmins);
|
||||||
$tmpl->assign( 'numofgroups', count($accessiblegroups));
|
$tmpl->assign( 'numofgroups', count($accessiblegroups));
|
||||||
$tmpl->assign( 'quota_preset', $quotaPreset);
|
$tmpl->assign( 'quota_preset', $quotaPreset);
|
||||||
$tmpl->assign( 'default_quota', $defaultQuota);
|
$tmpl->assign( 'default_quota', $defaultQuota);
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
|
|
Loading…
Reference in a new issue