Skip to content

Commit

Permalink
MDL-29509 move timezoneimport to admin tools
Browse files Browse the repository at this point in the history
AMOS BEGIN
 MOV [configintrotimezones,core_admin],[configintrotimezones,tool_timezoneimport]
 MOV [importtimezones,core_admin],[importtimezones,tool_timezoneimport]
 MOV [importtimezonescount,core_admin],[importtimezonescount,tool_timezoneimport]
 MOV [importtimezonesfailed,core_admin],[importtimezonesfailed,tool_timezoneimport]
 MOV [updatetimezones,core_admin],[updatetimezones,tool_timezoneimport]
AMOS END
  • Loading branch information
skodak committed Sep 26, 2011
1 parent 17a14fb commit 9597e00
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 20 deletions.
1 change: 0 additions & 1 deletion admin/settings/location.php
Expand Up @@ -19,6 +19,5 @@
$temp->add(new admin_setting_configtext('allcountrycodes', get_string('allcountrycodes', 'admin'), get_string('configallcountrycodes', 'admin'), '', '/^(?:\w+(?:,\w+)*)?$/'));

$ADMIN->add('location', $temp);
$ADMIN->add('location', new admin_externalpage('timezoneimport', get_string('updatetimezones', 'admin'), "$CFG->wwwroot/$CFG->admin/timezoneimport.php"));

} // end of speedup
45 changes: 33 additions & 12 deletions admin/timezoneimport.php → admin/tool/timezoneimport/index.php
@@ -1,20 +1,41 @@
<?php

// Automatic update of Timezones from a new source

require_once('../config.php');
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Automatic update of Timezones from a new source
*
* @package tool
* @subpackage timezoneimport
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/olson.php');

admin_externalpage_setup('timezoneimport');
admin_externalpage_setup('tooltimezoneimport');

$ok = optional_param('ok', 0, PARAM_BOOL);


/// Print headings

$strimporttimezones = get_string('importtimezones', 'admin');
$strimporttimezones = get_string('importtimezones', 'tool_timezoneimport');

echo $OUTPUT->header();

Expand All @@ -28,9 +49,9 @@
$message .= '<a href="'.$CFG->wwwroot.'/lib/timezone.txt">'.$CFG->dirroot.'/lib/timezone.txt</a><br />';
$message .= '<br />';

$message = get_string("configintrotimezones", 'admin', $message);
$message = get_string("configintrotimezones", 'tool_timezoneimport', $message);

echo $OUTPUT->confirm($message, 'timezoneimport.php?ok=1', 'index.php');
echo $OUTPUT->confirm($message, 'index.php?ok=1', new moodle_url('/admin/index.php'));

echo $OUTPUT->footer();
exit;
Expand Down Expand Up @@ -92,9 +113,9 @@
$a = null;
$a->count = count($timezones);
$a->source = $importdone;
echo $OUTPUT->heading(get_string('importtimezonescount', 'admin', $a), 3);
echo $OUTPUT->heading(get_string('importtimezonescount', 'tool_timezoneimport', $a), 3);

echo $OUTPUT->continue_button('index.php');
echo $OUTPUT->continue_button(new moodle_url('/admin/index.php'));

$timezonelist = array();
foreach ($timezones as $timezone) {
Expand All @@ -117,8 +138,8 @@
echo $OUTPUT->box_end();

} else {
echo $OUTPUT->heading(get_string('importtimezonesfailed', 'admin'), 3);
echo $OUTPUT->continue_button('index.php');
echo $OUTPUT->heading(get_string('importtimezonesfailed', 'tool_timezoneimport'), 3);
echo $OUTPUT->continue_button(new moodle_url('/admin/index.php'));
}

echo $OUTPUT->footer();
Expand Down
31 changes: 31 additions & 0 deletions admin/tool/timezoneimport/lang/en/tool_timezoneimport.php
@@ -0,0 +1,31 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Strings for component 'tool_timezoneimport', language 'en', branch 'MOODLE_22_STABLE'
*
* @package tool
* @subpackage timezoneimport
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['configintrotimezones'] = 'This page will search for new information about world timezones (including daylight savings time rules) and update your local database with this information. These locations will be checked, in order: {$a} This procedure is generally very safe and can not break normal installations. Do you wish to update your timezones now?';
$string['importtimezones'] = 'Update complete list of timezones';
$string['importtimezonescount'] = '{$a->count} entries imported from {$a->source}';
$string['importtimezonesfailed'] = 'No sources found! (Bad news)';
$string['pluginname'] = 'Timezones updater';
$string['updatetimezones'] = 'Update timezones';
31 changes: 31 additions & 0 deletions admin/tool/timezoneimport/settings.php
@@ -0,0 +1,31 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Plugin version info
*
* @package tool
* @subpackage timezoneimport
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;

if ($hassiteconfig) {
$ADMIN->add('location', new admin_externalpage('tooltimezoneimport', get_string('updatetimezones', 'tool_timezoneimport'), "$CFG->wwwroot/$CFG->admin/tool/timezoneimport/index.php"));
}

31 changes: 31 additions & 0 deletions admin/tool/timezoneimport/version.php
@@ -0,0 +1,31 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Plugin version info
*
* @package tool
* @subpackage timezoneimport
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2011092500;
$plugin->requires = 2011092100;
$plugin->component = 'tool_timezoneimport'; // Full name of the plugin (used for diagnostics)

5 changes: 0 additions & 5 deletions lang/en/admin.php
Expand Up @@ -227,7 +227,6 @@
$string['configintro'] = 'On this page you can specify a number of configuration variables that help make Moodle work properly on your server. Don\'t worry too much about it - the defaults will usually work fine and you can always come back to this page later and change these settings.';
$string['configintroadmin'] = 'On this page you should configure your main administrator account which will have complete control over the site. Make sure you give it a secure username and password as well as a valid email address. You can create more admin accounts later on.';
$string['configintrosite'] = 'This page allows you to configure the front page and name of this new site. You can come back here later to change these settings any time using the Administration menus.';
$string['configintrotimezones'] = 'This page will search for new information about world timezones (including daylight savings time rules) and update your local database with this information. These locations will be checked, in order: {$a} This procedure is generally very safe and can not break normal installations. Do you wish to update your timezones now?';
$string['configiplookup'] = 'When you click on an IP address (such as 34.12.222.93), such as in the logs, you are shown a map with a best guess of where that IP is located. There are different plugins for this that you can choose from, each has benefits and disadvantages.';
$string['configkeeptagnamecase'] = 'Check this if you want tag names to keep the original casing as entered by users who created them';
$string['configlang'] = 'Choose a default language for the whole site. Users can override this setting using the language menu or the setting in their personal profile.';
Expand Down Expand Up @@ -574,9 +573,6 @@
$string['iconvrecommended'] = 'Installing the optional ICONV library is highly recommended in order to improve site performance, particularly if your site is supporting non-Latin languages.';
$string['iconvrequired'] = 'Installing ICONV extension is required.';
$string['ignore'] = 'Ignore';
$string['importtimezones'] = 'Update complete list of timezones';
$string['importtimezonescount'] = '{$a->count} entries imported from {$a->source}';
$string['importtimezonesfailed'] = 'No sources found! (Bad news)';
$string['includemoduleuserdata'] = 'Include module user data';
$string['incompatibleblocks'] = 'Incompatible blocks';
$string['installhijacked'] = 'Installation must be finished from the original IP address, sorry.';
Expand Down Expand Up @@ -947,7 +943,6 @@
$string['unsupported'] = 'Unsupported';
$string['updateaccounts'] = 'Update existing accounts';
$string['updatecomponent'] = 'Update component';
$string['updatetimezones'] = 'Update timezones';
$string['upgradestart'] = 'Upgrade';
$string['upgradeerror'] = 'Unknown error upgrading {$a->plugin} to version {$a->version}, can not continue.';
$string['upgradeforumread'] = 'A new feature has been added in Moodle 1.5 to track read/unread forum posts.<br />To use this functionality you need to <a href="{$a}">update your tables</a>.';
Expand Down
4 changes: 2 additions & 2 deletions lib/pluginlib.php
Expand Up @@ -367,8 +367,8 @@ public static function standard_plugins_list($type) {
'tool' => array(
'bloglevelupgrade', 'capability', 'customlang', 'dbtransfer', 'generator',
'health', 'innodb', 'langimport', 'multilangupgrade', 'profiling',
'qeupgradehelper', 'spamcleaner', 'unittest', 'uploaduser', 'unsuproles',
'xmldb'
'qeupgradehelper', 'spamcleaner', 'timezoneimport', 'unittest',
'uploaduser', 'unsuproles', 'xmldb'
),

'webservice' => array(
Expand Down

0 comments on commit 9597e00

Please sign in to comment.