Commit d35d4490 authored by Son Nguyen's avatar Son Nguyen Committed by Robert Lyon
Browse files

Prompt to register sites again after upgrading to 15.10. 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

behatnotneeded

Change-Id: I0b950957a8d451593fd29de5088aac56c6cf5b60
parent aeffa968
......@@ -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;
}
......
......@@ -22,7 +22,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();
}
......
......@@ -225,6 +225,7 @@ $string['filemissingdesc'] = 'File %s%s is missing from server';
$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['sendweeklyupdatesdescription1'] = 'If set to "On", your site will send weekly updates to mahara.org with some statistics about your site.';
$string['Register'] = 'Register';
......@@ -240,6 +241,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>In Mahara 15.10, we have updated the policy to send data to mahara.org. Please confirm your registration.</p>';
// Close site
$string['Close'] = 'Close';
......
......@@ -4181,5 +4181,14 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2015081700) {
// In 15.10, 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;
}
......@@ -86,7 +86,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" id="register-table">
<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/');
}
......
......@@ -16,7 +16,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 = 2015081000;
$config->version = 2015081700;
$config->series = '15.10';
$config->release = '15.10dev';
$config->minupgradefrom = 2009022600;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -14,6 +14,7 @@
.table {
margin-top:10px;
color: inherit;
background-color: rgba(#fff, 0.75);
>thead{
color: inherit;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{include file='header.tpl'}
<div id="register-site-full">
<h1> {if isset($PAGEICON)}
<span class="{$PAGEICON}"></span>
{/if}
{str tag=registeryourmaharasite section=admin}
</h1>
<div class="panel panel-default col-md-9">
<div class="panel-body ptxl">
{if $register}
{str tag=registeryourmaharasitedetail section=admin args=$WWWROOT}
<button class="btn btn-default" type="button" data-toggle="collapse" data-target="#register_whatsent_container" aria-expanded="false" aria-controls="register_whatsent_container">
<span class="icon icon-chevron-circle-down icon-lg mrs"></span>
{str tag=datathatwillbesent section=admin}
</button>
<h1> {if isset($PAGEICON)}
<span class="{$PAGEICON}"></span>
{/if}
{str tag=registeryourmaharasite section=admin}
</h1>
<div class="panel panel-default col-md-9">
<div class="panel-body ptxl">
{if get_config('new_registration_policy')}
{str tag=newsiteregistrationpolicy section=admin}
{/if}
{if $register}
{str tag=registeryourmaharasitedetail section=admin args=$WWWROOT}
<button class="btn btn-default" type="button" data-toggle="collapse" data-target="#register_whatsent_container" aria-expanded="false" aria-controls="register_whatsent_container">
<span class="icon icon-chevron-circle-down icon-lg mrs"></span>
{str tag=datathatwillbesent section=admin}
</button>
{$register|safe}
{else}
{str tag=siteregistered section=admin args=$WWWROOT}
{/if}
</div>
</div>
{$register|safe}
{else}
{str tag=siteregistered section=admin args=$WWWROOT}
{/if}
</div>
</div>
</div>
{include file='footer.tpl'}
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