From: tjhunt Date: Mon, 8 Sep 2008 11:32:31 +0000 (+0000) Subject: MDL-16348 Reorganise admin tree: X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b032b49099487f4925313ce2cc282224f7a55b9b;p=moodle.git 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 --- diff --git a/admin/report/backups/settings.php b/admin/report/backups/settings.php new file mode 100644 index 0000000000..e80322b060 --- /dev/null +++ b/admin/report/backups/settings.php @@ -0,0 +1,3 @@ +add('reports', new admin_externalpage('reportbackups', get_string('backups', 'admin'), "$CFG->wwwroot/$CFG->admin/report/backups/index.php",'moodle/site:backup')); +?> \ No newline at end of file diff --git a/admin/report/capability/settings.php b/admin/report/capability/settings.php new file mode 100644 index 0000000000..0a1eeb34b8 --- /dev/null +++ b/admin/report/capability/settings.php @@ -0,0 +1,3 @@ +add('roles', new admin_externalpage('reportcapability', get_string('capability', 'report_capability'), "$CFG->wwwroot/$CFG->admin/report/capability/index.php",'moodle/role:manage')); +?> \ No newline at end of file diff --git a/admin/report/simpletest/settings.php b/admin/report/simpletest/settings.php index 437a2788d4..375f952e2b 100644 --- a/admin/report/simpletest/settings.php +++ b/admin/report/simpletest/settings.php @@ -1,10 +1,3 @@ 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')); \ No newline at end of file diff --git a/admin/report/stats/settings.php b/admin/report/stats/settings.php new file mode 100644 index 0000000000..beb5c038bb --- /dev/null +++ b/admin/report/stats/settings.php @@ -0,0 +1,5 @@ +enablestats)) { + $ADMIN->add('reports', new admin_externalpage('reportstats', get_string('stats', 'admin'), "$CFG->wwwroot/$CFG->admin/report/stats/index.php",'moodle/site:viewreports')); +} +?> \ No newline at end of file diff --git a/admin/settings/misc.php b/admin/settings/development.php similarity index 67% rename from admin/settings/misc.php rename to admin/settings/development.php index 21ef81e0d4..c246d3980e 100644 --- a/admin/settings/misc.php +++ b/admin/settings/development.php @@ -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 diff --git a/admin/settings/language.php b/admin/settings/language.php index 51fd03c8ae..3c82865013 100644 --- a/admin/settings/language.php +++ b/admin/settings/language.php @@ -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 ?> diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index e24c59ceb1..20e31f91bb 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -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()); diff --git a/admin/settings/top.php b/admin/settings/top.php index 782ce43429..e295eae035 100644 --- a/admin/settings/top.php +++ b/admin/settings/top.php @@ -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)); diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 88f29d7f06..79b364da57 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -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'; diff --git a/lib/adminlib.php b/lib/adminlib.php index b72c2f9893..f9b653c01f 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -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'); }