mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-17 05:48:43 +02:00
Issue #29 - Fixed javascript redirection.
This commit is contained in:
@@ -17,13 +17,15 @@ If you need to make changes here, remember to update your settings inside Moodle
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#auth_outage_warningbar_box.imminent {
|
||||
background: purple;
|
||||
}
|
||||
|
||||
.auth_outage_warningbar_center {
|
||||
margin-top: -45px;
|
||||
position: relative;
|
||||
top: 50%;
|
||||
margin-top: -45px;
|
||||
}
|
||||
|
||||
#auth_outage_warningbar_countdown {
|
||||
|
||||
@@ -2,9 +2,10 @@ var auth_outage_countdown = {
|
||||
timer: null,
|
||||
clienttime: Date.now(),
|
||||
siteadmin: false,
|
||||
init: function (countdown, siteadmin) {
|
||||
init: function (countdown, siteadmin, redirectto) {
|
||||
this.countdown = countdown;
|
||||
this.siteadmin = siteadmin;
|
||||
this.redirectto = redirectto;
|
||||
this.divtext = document.getElementById('auth_outage_warningbar_countdown');
|
||||
this.divblock = document.getElementById('auth_outage_warningbar_box');
|
||||
this.text = this.divtext.innerHTML;
|
||||
@@ -25,7 +26,7 @@ var auth_outage_countdown = {
|
||||
missing = 0;
|
||||
clearInterval(this.timer);
|
||||
if (!this.siteadmin) {
|
||||
location = '/auth/outage/info.php';
|
||||
window.location = this.redirectto;
|
||||
}
|
||||
}
|
||||
this.divtext.innerHTML = this.text.replace('{{countdown}}', this.seconds2hms(missing));
|
||||
|
||||
@@ -27,6 +27,8 @@ if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); // It must be included from a Moodle page.
|
||||
}
|
||||
|
||||
$infolink = new moodle_url('/auth/outage/info.php', ['id' => $outage->id]);
|
||||
|
||||
echo html_writer::tag('style', get_config('auth_outage', 'css'));
|
||||
?>
|
||||
|
||||
@@ -34,11 +36,7 @@ echo html_writer::tag('style', get_config('auth_outage', 'css'));
|
||||
<div class="auth_outage_warningbar_center">
|
||||
<div id="auth_outage_warningbar_countdown"><?php echo $countdown; ?></div>
|
||||
<div class="auth_outage_warningbar_box_message">
|
||||
<?php echo html_writer::link(
|
||||
new moodle_url('/auth/outage/info.php', ['id' => $outage->id]),
|
||||
$outage->get_title(),
|
||||
['target' => 'outage']
|
||||
); ?>
|
||||
<?php echo html_writer::link($infolink, $outage->get_title(), ['target' => '_blank']); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,8 +45,9 @@ echo html_writer::tag('style', get_config('auth_outage', 'css'));
|
||||
<script>
|
||||
<?php require($CFG->dirroot . '/auth/outage/views/warningbar.js'); ?>
|
||||
auth_outage_countdown.init(
|
||||
<?php echo ($outage->starttime - $time); ?>,
|
||||
<?php echo (is_siteadmin() ? 'true' : 'false'); ?>
|
||||
<?php echo($outage->starttime - $time); ?>,
|
||||
<?php echo(is_siteadmin() ? 'true' : 'false'); ?>,
|
||||
'<?php echo $infolink; ?>'
|
||||
);
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user