From: moodler Date: Wed, 10 Dec 2008 06:23:35 +0000 (+0000) Subject: admin MDL-17429 Move registration button to admin menu, and make registration page... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f94824dbbed4db377cc8a18f4e23f499b6e074b6;p=moodle.git admin MDL-17429 Move registration button to admin menu, and make registration page a proper admin page, also fix bad DML call admin MDL-16867 Change "Optional subsystems" menu item to "Advanced features" (Sorry for the mixed checkin) --- diff --git a/admin/index.php b/admin/index.php index 9bd8214514..77f5674dc9 100644 --- a/admin/index.php +++ b/admin/index.php @@ -171,20 +171,6 @@ } -/// Print slightly annoying registration button - $options = array(); - $options['sesskey'] = $USER->sesskey; - print_box_start('generalbox adminwarning'); - if(!isset($CFG->registered)) { - print_string('pleaseregister', 'admin'); - } - else { /* if (isset($CFG->registered) && $CFG->registered < (time() - 3600*24*30*6)) { */ - print_string('pleaserefreshregistration', 'admin', userdate($CFG->registered)); - } - print_single_button('register.php', $options, get_string('registration')); - print_box_end(); - - ////////////////////////////////////////////////////////////////////////////////////////////////// //// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE /// $copyrighttext = 'Moodle '. diff --git a/admin/register.php b/admin/register.php index d6bc2a3ed1..e4217f023a 100644 --- a/admin/register.php +++ b/admin/register.php @@ -2,19 +2,19 @@ // register.php - allows admin to register their site on moodle.org require_once('../config.php'); + require_once($CFG->libdir.'/adminlib.php'); require_login(); require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); + + admin_externalpage_setup('adminregistration'); + if (!$site = get_site()) { redirect("index.php"); } - if (!confirm_sesskey()) { - print_error('confirmsesskeybad', 'error'); - } - if (!$admin = get_admin()) { print_error('noadmins', 'error'); } @@ -27,6 +27,8 @@ set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']); } +/// Print the header stuff + admin_externalpage_print_header(); /// Print headings @@ -37,7 +39,6 @@ $navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc'); $navlinks[] = array('name' => $strregistration, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); - print_header("$site->shortname: $strregistration", $site->fullname, $navigation); print_heading($strregistration); @@ -132,11 +133,11 @@ FROM {role_capabilities} rc, {role_assignments} ra, {user} u - WHERE (rc.capability = 'moodle/course:update' or rc.capability='moodle/site:doanything') + WHERE (rc.capability = ? or rc.capability = ?) AND rc.roleid = ra.roleid AND u.id = ra.userid"; - $count = $DB->count_records_sql($sql); + $count = $DB->count_records_sql($sql, array('moodle/course:update', 'moodle/site:doanything')); echo get_string("teachers").": ".$count; echo "\n"; echo '
'; @@ -187,6 +188,5 @@ echo "\n"; - print_footer(); - -?> +/// Print footer + admin_externalpage_print_footer(); diff --git a/admin/settings/server.php b/admin/settings/server.php index 1468a3b416..1041ae5374 100644 --- a/admin/settings/server.php +++ b/admin/settings/server.php @@ -255,6 +255,8 @@ $temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcache get_string('configmemcachedpconn', 'admin'), 0, array( '0' => get_string('no'), '1' => get_string('yes')))); +$ADMIN->add('server', new admin_externalpage('adminregistration', get_string('registration','admin'), "$CFG->wwwroot/$CFG->admin/register.php")); + $ADMIN->add('server', $temp); $dbfamily = $DB->get_dbfamily(); diff --git a/admin/settings/top.php b/admin/settings/top.php index f179cda7a5..b316f0bb0a 100644 --- a/admin/settings/top.php +++ b/admin/settings/top.php @@ -15,11 +15,16 @@ if (get_site()) { $ADMIN->add('root', new admin_externalpage('adminnotifications', get_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php")); +// Show the annoying registration button if registration hasn't been done or is 6 months old (15552000 seconds) MDL-17429 +if (empty($CFG->registered) || ($CFG->registered < (time() - 15552000))) { + $ADMIN->add('root', new admin_externalpage('adminregistration', get_string('registration','admin'), "$CFG->wwwroot/$CFG->admin/register.php")); +} + // hidden upgrade script $ADMIN->add('root', new admin_externalpage('upgradesettings', get_string('upgradesettings', 'admin'), "$CFG->wwwroot/$CFG->admin/upgradesettings.php", 'moodle/site:config', true)); if ($hassiteconfig) { - $optionalsubsystems = new admin_settingpage('optionalsubsystems', get_string('optionalsubsystems', 'admin')); + $optionalsubsystems = new admin_settingpage('optionalsubsystems', get_string('advancedfeatures', 'admin')); $ADMIN->add('root', $optionalsubsystems); } diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 60e488bfd0..295d973fcd 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -4,6 +4,7 @@ $string['accounts'] = 'Accounts'; $string['adminseesall'] = 'Admins See All'; $string['adminseesallevents'] = 'Administrators see all events'; $string['adminseesownevents'] = 'Administrators are just like other users'; +$string['advancedfeatures'] = 'Advanced features'; $string['allowcategorythemes'] = 'Allow category themes'; $string['allowcoursethemes'] = 'Allow course themes'; $string['allowdeletes'] = 'Allow deletes'; @@ -562,7 +563,6 @@ $string['numquestionsandhidden'] = '$a->numquestions (+$a->numhidden hidden)'; $string['opensslrecommended'] = 'Installing the optional OpenSSL library is highly recommended -- it enables Moodle Networking functionality.'; $string['opentogoogle'] = 'Open to Google'; $string['optionalmaintenancemessage'] = 'Optional maintenance message'; -$string['optionalsubsystems'] = 'Optional subsystems'; $string['order1'] = 'First'; $string['order2'] = 'Second'; $string['order3'] = 'Third'; @@ -657,6 +657,7 @@ $string['rcache'] = 'Record cache'; $string['rcachettl'] = 'Record cache TTL'; $string['recaptchapublickey'] = 'ReCAPTCHA public key'; $string['recaptchaprivatekey'] = 'ReCAPTCHA private key'; +$string['registration'] = 'Registration'; $string['releasenoteslink'] = 'For information about this version of Moodle, please see the online Release Notes'; $string['remotelangnotavailable'] = 'Because Moodle can not connect to download.moodle.org, we are unable to do language pack installation automatically. Please download the appropriate zip file(s) from the list below, copy them to your $a directory and unzip them manually.'; $string['renameerrors'] = 'Rename errors';