MDL-16348 Reorganise admin tree:

* New Capability report put under Users -> Permissions
* Miscellaneous category renamed to Development
* Unit tests and Functional DB test moved to be under Development.
* The hard-coded hack that was used to change the permission that controls the Backups and stats reports replaced with settings.php files.
* There were two hidden Miscellaneous things in the old category, so I moved them. Multilan upgrade now under Lanuages, and Online assignment cleanup now under Plugins -> Activity modules. Both still hidden.

There was already a way for admin report plugins to control where they appeared in the tree, but it was not documented, so see http://docs.moodle.org/en/Development:Admin_reports
This commit is contained in:
tjhunt
2008-09-08 11:32:31 +00:00
parent c8b2ab1b00
commit b032b49099
10 changed files with 41 additions and 45 deletions
+3
View File
@@ -0,0 +1,3 @@
<?php // $Id$
$ADMIN->add('reports', new admin_externalpage('reportbackups', get_string('backups', 'admin'), "$CFG->wwwroot/$CFG->admin/report/backups/index.php",'moodle/site:backup'));
?>
+3
View File
@@ -0,0 +1,3 @@
<?php // $Id$
$ADMIN->add('roles', new admin_externalpage('reportcapability', get_string('capability', 'report_capability'), "$CFG->wwwroot/$CFG->admin/report/capability/index.php",'moodle/role:manage'));
?>
+2 -9
View File
@@ -1,10 +1,3 @@
<?php //$Id$
$reportname = get_string('simpletest', 'report_simpletest');
if ($reportname[1] == '[') {
$reportname = get_string('simpletest', 'admin');
}
$ADMIN->add('reports', new admin_externalpage('reportsimpletest', $reportname, "$CFG->wwwroot/$CFG->admin/report/simpletest/index.php",'moodle/site:config'));
//TODO: localise
$ADMIN->add('reports', new admin_externalpage('reportdbtest', 'Functional DB tests', "$CFG->wwwroot/$CFG->admin/report/simpletest/dbtest.php",'moodle/site:config'));
$ADMIN->add('development', new admin_externalpage('reportsimpletest', get_string('simpletest', 'admin'), "$CFG->wwwroot/$CFG->admin/report/simpletest/index.php",'moodle/site:config'));
$ADMIN->add('development', new admin_externalpage('reportdbtest', get_string('dbtest', 'admin'), "$CFG->wwwroot/$CFG->admin/report/simpletest/dbtest.php",'moodle/site:config'));
+5
View File
@@ -0,0 +1,5 @@
<?php // $Id$
if (!empty($CFG->enablestats)) {
$ADMIN->add('reports', new admin_externalpage('reportstats', get_string('stats', 'admin'), "$CFG->wwwroot/$CFG->admin/report/stats/index.php",'moodle/site:viewreports'));
}
?>
@@ -5,7 +5,7 @@
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// Experimental settings page
$ADMIN->add('misc', new admin_category('experimental', get_string('experimental','admin')));
$ADMIN->add('development', new admin_category('experimental', get_string('experimental','admin')));
$temp = new admin_settingpage('experimentalsettings', get_string('experimentalsettings', 'admin'));
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
@@ -22,16 +22,11 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$ADMIN->add('experimental', $temp);
// DB transfer related pages
$ADMIN->add('experimental', new admin_externalpage('dbtransfer', get_string('dbtransfer', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/index.php', 'moodle/site:config', false));
$ADMIN->add('experimental', new admin_externalpage('dbexport', get_string('dbexport', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/dbexport.php', 'moodle/site:config', false));
$ADMIN->add('experimental', new admin_externalpage('dbtransfer', get_string('dbtransfer', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/index.php', 'moodle/site:config'));
$ADMIN->add('experimental', new admin_externalpage('dbexport', get_string('dbexport', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/dbexport.php', 'moodle/site:config'));
// XMLDB editor
$ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
// hidden scripts linked from elsewhere
$ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
$ADMIN->add('misc', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
$ADMIN->add('development', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
} // end of speedup
+3 -3
View File
@@ -14,16 +14,16 @@ if ($hassiteconfig
$temp->add(new admin_setting_langlist());
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
// new CFG variable for excel encoding
$temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
$ADMIN->add('language', $temp);
$ADMIN->add('language', new admin_externalpage('langedit', get_string('langedit', 'admin'), "$CFG->wwwroot/$CFG->admin/lang.php", array('moodle/site:langeditmaster', 'moodle/site:langeditlocal') ));
$ADMIN->add('language', new admin_externalpage('langimport', get_string('langpacks', 'admin'), "$CFG->wwwroot/$CFG->admin/langimport.php"));
// Hidden multilang upgrade page.
$ADMIN->add('language', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
} // end of speedup
?>
+2
View File
@@ -33,6 +33,8 @@ if ($hassiteconfig) {
}
}
// hidden script for converting journals to online assignments (or something like that) linked from elsewhere
$ADMIN->add('modsettings', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
$ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks')));
$ADMIN->add('blocksettings', new admin_page_manageblocks());
+1 -24
View File
@@ -33,34 +33,11 @@ $ADMIN->add('root', new admin_category('security', get_string('security','admin'
$ADMIN->add('root', new admin_category('appearance', get_string('appearance','admin')));
$ADMIN->add('root', new admin_category('frontpage', get_string('frontpage','admin')));
$ADMIN->add('root', new admin_category('server', get_string('server','admin')));
$ADMIN->add('root', new admin_category('mnet', get_string('net','mnet'), (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode === 'off')));
$ADMIN->add('root', new admin_category('reports', get_string('reports')));
foreach (get_list_of_plugins($CFG->admin.'/report') as $plugin) {
$settingsfile = "$CFG->dirroot/$CFG->admin/report/$plugin/settings.php";
if (file_exists($settingsfile)) {
include($settingsfile);
} else {
$reportname = get_string($plugin, 'report_' . $plugin);
if ($reportname[1] == '[') {
$reportname = get_string($plugin, 'admin');
}
// ugly hack for special access control in reports
switch($plugin) {
case 'backups': $cap = 'moodle/site:backup'; break;
case 'stats': if (empty($CFG->enablestats)) {continue 2;};
default: $cap = 'moodle/site:viewreports';
}
$ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php",$cap));
}
}
$ADMIN->add('root', new admin_category('misc', get_string('miscellaneous')));
$ADMIN->add('root', new admin_category('development', get_string('development', 'admin')));
// hidden unsupported category
$ADMIN->add('root', new admin_category('unsupported', get_string('unsupported', 'admin'), true));
// hidden search script
$ADMIN->add('root', new admin_externalpage('search', get_string('searchresults'), "$CFG->wwwroot/$CFG->admin/search.php", 'moodle/site:config', true));
+2
View File
@@ -308,6 +308,7 @@ $string['deleteunconfirmed'] = 'Delete not fully setup users after';
$string['deleteuser'] = 'Delete user';
$string['density'] = 'Density';
$string['denyemailaddresses'] = 'Denied email domains';
$string['development'] = 'Development';
$string['digestmailtime'] = 'Hour to send digest emails';
$string['disablecourseajax'] = 'Disable AJAX course editing';
$string['disableuserimages'] = 'Disable User Profile Images';
@@ -659,6 +660,7 @@ $string['sessionhandling'] = 'Session Handling';
$string['sessiontimeout'] = 'Timeout';
$string['showblocksonmodpages'] = 'Show blocks on module pages';
$string['simpletest'] = 'Unit tests';
$string['dbtest'] = 'Functional DB tests';
$string['sitelangchanged'] = 'Site language setting changed successfully';
$string['sitemailcharset'] = 'Character set';
$string['sitemaintenance'] = 'The site is undergoing maintenance and is currently not available';
+16
View File
@@ -4950,6 +4950,22 @@ function &admin_get_root($reload=false, $requirefulltree=true) {
include($file);
}
}
// Add all the report plugings. Do this last so they can choose where in the tree
// they want to be added.
foreach (get_list_of_plugins($CFG->admin.'/report') as $plugin) {
$settingsfile = "$CFG->dirroot/$CFG->admin/report/$plugin/settings.php";
if (file_exists($settingsfile)) {
include($settingsfile);
} else {
$reportname = get_string($plugin, 'report_' . $plugin);
if ($reportname[1] == '[') {
$reportname = get_string($plugin, 'admin');
}
$ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php",'moodle/site:viewreports'));
}
}
if (file_exists($CFG->dirroot.'/local/settings.php')) {
include_once($CFG->dirroot.'/local/settings.php');
}