diff --git a/lang/en/admin.php b/lang/en/admin.php index 23a2ec83e4b..7f234713b8b 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -663,6 +663,7 @@ $string['logstoressupported'] = 'Log stores that support this report'; $string['longtimewarning'] = 'Please note that this process can take a long time.'; $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'; diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index c4d7bb8f466..9ac6a6502f6 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -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; diff --git a/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer-debug.js b/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer-debug.js index 2305097ef8d..430f15982af 100644 --- a/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer-debug.js +++ b/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer-debug.js @@ -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) { diff --git a/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer-min.js b/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer-min.js index 086e091f5ce..9435047b816 100644 --- a/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer-min.js +++ b/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer-min.js @@ -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"]}); diff --git a/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer.js b/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer.js index 2305097ef8d..430f15982af 100644 --- a/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer.js +++ b/lib/yui/build/moodle-core-maintenancemodetimer/moodle-core-maintenancemodetimer.js @@ -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) { diff --git a/lib/yui/src/maintenancemodetimer/js/maintenancemodetimer.js b/lib/yui/src/maintenancemodetimer/js/maintenancemodetimer.js index ddd352a6433..9d4899de1b7 100644 --- a/lib/yui/src/maintenancemodetimer/js/maintenancemodetimer.js +++ b/lib/yui/src/maintenancemodetimer/js/maintenancemodetimer.js @@ -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) {