Commit 649c5801 authored by Son Nguyen's avatar Son Nguyen

Prompt to register site again after upgrading to 1.9.8. Bug 1450334

- Display the registration site page after upgrading
- Show the register box in the admin index page for reminding
- Show data sent after successful registeration

Change-Id: I0b950957a8d451593fd29de5088aac56c6cf5b60
parent c7139c0c
......@@ -38,7 +38,8 @@ if (isset($upgrades['core']) && !empty($upgrades['core']->install)) {
exit;
}
if (!get_config('registration_lastsent')) {
if (!get_config('registration_lastsent')
|| get_config('new_registration_policy')) {
$register = true;
}
......
......@@ -21,7 +21,8 @@ require_once('pieforms/pieform.php');
require(get_config('libroot') . 'registration.php');
define('TITLE', get_string('Register', 'admin'));
if (!get_config('registration_lastsent')) {
if (!get_config('registration_lastsent')
|| get_config('new_registration_policy')) {
$register = register_site();
}
......
......@@ -26,6 +26,9 @@ if (param_integer('finished', 0)) {
$message .= ' ' . get_string('ensurepluginsexist', 'admin', get_config('docroot'));
$SESSION->add_error_msg($message);
}
if (get_config('new_registration_policy')) {
redirect('/admin/registersite.php');
}
redirect();
}
......
......@@ -212,6 +212,7 @@ $string['addnewgroupcategory'] = 'Enter new group category';
$string['Field'] = 'Field';
$string['Value'] = 'Value';
$string['datathatwillbesent'] = 'Data that will be sent';
$string['datathathavebeensent'] = 'Data that have been sent';
$string['sendweeklyupdates'] = 'Send weekly updates?';
$string['sendweeklyupdatesdescription'] = 'If checked, your site will send weekly updates to mahara.org with some statistics about your site';
$string['Register'] = 'Register';
......@@ -227,6 +228,7 @@ $string['registeryourmaharasitedetail'] = '
<p>If you tick &quot;send weekly updates&quot;, Mahara will automatically send an update to mahara.org once a week with your updated information.</p>
<p>Registering will remove this notice. You will be able to change whether you send weekly updates on the <a href="%sadmin/site/options.php">site options</a> page.</p>';
$string['siteregistered'] = 'Your site has been registered. You can turn weekly updates on and off on the <a href="%sadmin/site/options.php">site options</a> page.</p>';
$string['newsiteregistrationpolicy'] = '<p>Recently, we have updated the policy to send data to mahara.org. Please confirm your registration.</p>';
// Close site
$string['Close'] = 'Close';
......
......@@ -3229,5 +3229,14 @@ function xmldb_core_upgrade($oldversion=0) {
@unlink(get_config('dataroot') . 'dwoo/compile/default' . get_config('docroot') . 'theme/raw/' . 'templates/admin/users/accesslistitem.tpl.d'.Dwoo::RELEASE_TAG.'.php');
}
if ($oldversion < 2014032726) {
// As we changed the registration site policy,
// We need to remind the site admins to register the site again with the new policy.
set_config('new_registration_policy', true);
if (get_config('registration_sendweeklyupdates')) {
set_config('registration_sendweeklyupdates', false);
}
}
return $status;
}
......@@ -83,7 +83,28 @@ function register_submit(Pieform $form, $values) {
else {
set_config('registration_lastsent', time());
set_config('registration_sendweeklyupdates', $values['sendweeklyupdates']);
if (get_config('new_registration_policy')) {
set_config('new_registration_policy', false);
}
$SESSION->add_ok_msg(get_string('registrationsuccessfulthanksforregistering', 'admin'));
$info = '
<h4>' . get_string('datathathavebeensent', 'admin') . '</h4>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th> ' . get_string('Field', 'admin') . '</th>
<th> ' . get_string('Value', 'admin') . '</th>
</tr>
</thead>
<tbody>
';
$datasent = registration_data();
foreach($datasent as $key => $val) {
$info .= '<tr><th>'. hsc($key) . '</th><td>' . hsc($val) . "</td></tr>\n";
}
$info .= '</tbody></table>';
$SESSION->add_ok_msg($info, false);
}
redirect('/admin/');
}
......
......@@ -15,7 +15,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2014032725;
$config->version = 2014032726;
$config->series = '1.9';
$config->release = '1.9.8testing';
$config->minupgradefrom = 2009022600;
......
......@@ -3,6 +3,9 @@
<div id="register-site-full">
<h1>{str tag=registeryourmaharasite section=admin}</h1>
{if get_config('new_registration_policy')}
{str tag=newsiteregistrationpolicy section=admin}
{/if}
{if $register}
{str tag=registeryourmaharasitedetail section=admin args=$WWWROOT}
{$register|safe}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment