Merge branch 'MDL-56442-master' of https://github.com/StudiUM/moodle

This commit is contained in:
Dan Poltawski 2016-10-25 06:56:44 +01:00
commit 3b89ce210d
6 changed files with 32 additions and 10 deletions

View File

@ -663,6 +663,7 @@ $string['logstoressupported'] = 'Log stores that support this report';
$string['longtimewarning'] = '<b>Please note that this process can take a long time.</b>';
$string['maintenancemode'] = 'In maintenance mode';
$string['maintenancemodeisscheduled'] = 'This site will be switched to maintenance mode in {$a->min} mins {$a->sec} secs';
$string['maintenancemodeisscheduledlong'] = 'This site will be switched to maintenance mode in {$a->hour} hours {$a->min} mins {$a->sec} secs';
$string['maintfileopenerror'] = 'Error opening maintenance files!';
$string['maintinprogress'] = 'Maintenance is in progress...';
$string['manageformats'] = 'Manage course formats';

View File

@ -659,14 +659,20 @@ class core_renderer extends renderer_base {
$errorclass = ($timeleft < 30) ? 'error' : 'warning';
$output .= $this->box_start($errorclass . ' moodle-has-zindex maintenancewarning');
$a = new stdClass();
$a->min = (int)($timeleft/60);
$a->hour = (int)($timeleft / 3600);
$a->min = (int)(($timeleft / 60) % 60);
$a->sec = (int)($timeleft % 60);
$output .= get_string('maintenancemodeisscheduled', 'admin', $a) ;
if ($a->hour > 0) {
$output .= get_string('maintenancemodeisscheduledlong', 'admin', $a);
} else {
$output .= get_string('maintenancemodeisscheduled', 'admin', $a);
}
$output .= $this->box_end();
$this->page->requires->yui_module('moodle-core-maintenancemodetimer', 'M.core.maintenancemodetimer',
array(array('timeleftinsec' => $timeleft)));
$this->page->requires->strings_for_js(
array('maintenancemodeisscheduled', 'sitemaintenance'),
array('maintenancemodeisscheduled', 'maintenancemodeisscheduledlong', 'sitemaintenance'),
'admin');
}
return $output;

View File

@ -39,8 +39,13 @@ Y.extend(MAINTENANCEMODETIMER, Y.Base, {
} else {
var a = {};
a.sec = this.timeleftinsec % 60;
a.min = Math.floor(this.timeleftinsec / 60);
this.maintenancenode.set('text', M.util.get_string('maintenancemodeisscheduled', 'admin', a));
a.min = Math.floor(this.timeleftinsec / 60) % 60;
a.hour = Math.floor(this.timeleftinsec / 3600);
if (a.hour > 0) {
this.maintenancenode.set('text', M.util.get_string('maintenancemodeisscheduledlong', 'admin', a));
} else {
this.maintenancenode.set('text', M.util.get_string('maintenancemodeisscheduled', 'admin', a));
}
}
// Set error class to highlight the importance.
if (this.timeleftinsec < 30) {

View File

@ -1 +1 @@
YUI.add("moodle-core-maintenancemodetimer",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{timeleftinsec:0,maintenancenode:e.one(".box.maintenancewarning"),initializer:function(t){this.maintenancenode&&(this.timeleftinsec=t.timeleftinsec,this.maintenancenode.setAttribute("aria-live","polite"),e.later(1e3,this,"updatetimer",null,!0))},updatetimer:function(){this.timeleftinsec-=1;if(this.timeleftinsec<=0)this.maintenancenode.set("text",M.util.get_string("sitemaintenance","admin"));else{var e={};e.sec=this.timeleftinsec%60,e.min=Math.floor(this.timeleftinsec/60),this.maintenancenode.set("text",M.util.get_string("maintenancemodeisscheduled","admin",e))}this.timeleftinsec<30?this.maintenancenode.addClass("error").removeClass("warning"):this.maintenancenode.addClass("warning").removeClass("error")}}),M.core=M.core||{},M.core.maintenancemodetimer=M.core.maintenancemodetimer||function(e){return new n(e)}},"@VERSION@",{requires:["base","node"]});
YUI.add("moodle-core-maintenancemodetimer",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{timeleftinsec:0,maintenancenode:e.one(".box.maintenancewarning"),initializer:function(t){this.maintenancenode&&(this.timeleftinsec=t.timeleftinsec,this.maintenancenode.setAttribute("aria-live","polite"),e.later(1e3,this,"updatetimer",null,!0))},updatetimer:function(){this.timeleftinsec-=1;if(this.timeleftinsec<=0)this.maintenancenode.set("text",M.util.get_string("sitemaintenance","admin"));else{var e={};e.sec=this.timeleftinsec%60,e.min=Math.floor(this.timeleftinsec/60)%60,e.hour=Math.floor(this.timeleftinsec/3600),e.hour>0?this.maintenancenode.set("text",M.util.get_string("maintenancemodeisscheduledlong","admin",e)):this.maintenancenode.set("text",M.util.get_string("maintenancemodeisscheduled","admin",e))}this.timeleftinsec<30?this.maintenancenode.addClass("error").removeClass("warning"):this.maintenancenode.addClass("warning").removeClass("error")}}),M.core=M.core||{},M.core.maintenancemodetimer=M.core.maintenancemodetimer||function(e){return new n(e)}},"@VERSION@",{requires:["base","node"]});

View File

@ -39,8 +39,13 @@ Y.extend(MAINTENANCEMODETIMER, Y.Base, {
} else {
var a = {};
a.sec = this.timeleftinsec % 60;
a.min = Math.floor(this.timeleftinsec / 60);
this.maintenancenode.set('text', M.util.get_string('maintenancemodeisscheduled', 'admin', a));
a.min = Math.floor(this.timeleftinsec / 60) % 60;
a.hour = Math.floor(this.timeleftinsec / 3600);
if (a.hour > 0) {
this.maintenancenode.set('text', M.util.get_string('maintenancemodeisscheduledlong', 'admin', a));
} else {
this.maintenancenode.set('text', M.util.get_string('maintenancemodeisscheduled', 'admin', a));
}
}
// Set error class to highlight the importance.
if (this.timeleftinsec < 30) {

View File

@ -37,8 +37,13 @@ Y.extend(MAINTENANCEMODETIMER, Y.Base, {
} else {
var a = {};
a.sec = this.timeleftinsec % 60;
a.min = Math.floor(this.timeleftinsec / 60);
this.maintenancenode.set('text', M.util.get_string('maintenancemodeisscheduled', 'admin', a));
a.min = Math.floor(this.timeleftinsec / 60) % 60;
a.hour = Math.floor(this.timeleftinsec / 3600);
if (a.hour > 0) {
this.maintenancenode.set('text', M.util.get_string('maintenancemodeisscheduledlong', 'admin', a));
} else {
this.maintenancenode.set('text', M.util.get_string('maintenancemodeisscheduled', 'admin', a));
}
}
// Set error class to highlight the importance.
if (this.timeleftinsec < 30) {