From c33f1f5b94ad2939ad3815e505646ae098ef504c Mon Sep 17 00:00:00 2001 From: Brendan Heywood Date: Tue, 6 Sep 2016 17:07:26 +1000 Subject: [PATCH 1/6] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1b7f328..4761814 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,15 @@ What is this? ------------- -This is a Moodle plugin which makes the student expereince of planned outages nicer, and provides extra tools for administrators and testers that help before and after the outage window. +This is a Moodle plugin which makes the student experience of planned outages nicer, and provides extra tools for administrators and testers that help before and after the outage window. -The main idea is that instead of an outage being a very booleon on/off situation, this plugin creates the concept of graduated outages where at predefined times before an outage and after, different levels of warning can be provided to students letting them know what is about to happen and why. +The main idea is that instead of an outage being a very booleon on/off situation, this plugin creates the concept of graduated outages where at predefined times before an outage and after, different levels of warning and access can be provided to students and testers letting them know what is about to happen and why. Why it is an auth plugin? ------------------------- -One of the graduated stages this plugin introduces is a 'tester only' mode. This is conceptually similar to the maintenance mode but enables testers to login and confirm the state after an upgrade without needing full admin privileges. +One of the graduated stages this plugin introduces is a 'tester only' mode which disables login for most normal users. This is conceptually similar to the maintenance mode but enables testers to login and confirm the state after an upgrade without needing full admin privileges. Installation @@ -29,7 +29,7 @@ Installation 1. Install the plugin the same as any standard moodle plugin either via the Moodle plugin directory, or you can use git to clone it into your source: - git clone git@github.com:catalyst/moodle-auth_outage.git auth/basic + ```git clone git@github.com:catalyst/moodle-auth_outage.git auth/basic``` Or install via the Moodle plugin directory: From c7f68f3a1097e98f6fd00222fc044ce234709194 Mon Sep 17 00:00:00 2001 From: Brendan Heywood Date: Tue, 6 Sep 2016 16:47:51 +1000 Subject: [PATCH 2/6] Removed br tag --- renderer.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/renderer.php b/renderer.php index d6848b1..0ec3f45 100644 --- a/renderer.php +++ b/renderer.php @@ -58,12 +58,13 @@ class auth_outage_renderer extends plugin_renderer_base $url = new moodle_url('/auth/outage/create.php'); $img = html_writer::empty_tag('img', ['src' => $OUTPUT->pix_url('t/add'), 'alt' => get_string('create'), 'class' => 'iconsmall']); - $html .= html_writer::empty_tag('br') - . html_writer::link( + $html .= html_writer::tag('p', + html_writer::link( $url, $img . ' ' . get_string('outagecreate', 'auth_outage'), - ['title' => get_string('remove')]) - . html_writer::empty_tag('br'); + ['title' => get_string('remove')] + ) + ); return $html; } From 99789a77702d45b594ec4a0a35c0b555642c2ecd Mon Sep 17 00:00:00 2001 From: Brendan Heywood Date: Tue, 6 Sep 2016 17:08:23 +1000 Subject: [PATCH 3/6] Added crumb trail items for edit page --- change.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/change.php b/change.php index 675b05d..af70983 100644 --- a/change.php +++ b/change.php @@ -53,7 +53,7 @@ $data = get_object_vars($outage); $data['description'] = ['text' => $data['description'], 'format' => '1']; $mform->set_data($data); - +$PAGE->navbar->add($outage->title); echo $OUTPUT->header(); echo $renderer->rendersubtitle('modifyoutage'); $mform->display(); From 7150622fcec3c230a6b84a46241fde65a2bda353 Mon Sep 17 00:00:00 2001 From: Brendan Heywood Date: Tue, 6 Sep 2016 17:14:16 +1000 Subject: [PATCH 4/6] Added crumb trail node for new outages --- create.php | 1 + 1 file changed, 1 insertion(+) diff --git a/create.php b/create.php index c48af19..329a938 100644 --- a/create.php +++ b/create.php @@ -43,6 +43,7 @@ if ($mform->is_cancelled()) { redirect('/auth/outage/list.php#auth_outage_id_' . $id); } +$PAGE->navbar->add(get_string('outagecreate', 'auth_outage')); echo $OUTPUT->header(); $mform->display(); From 68cfce9b48dc33420bea17f83f883c42ab870a5d Mon Sep 17 00:00:00 2001 From: Daniel Thee Roperto Date: Wed, 7 Sep 2016 09:51:48 +1000 Subject: [PATCH 5/6] Issue #9 - Fixed outagedb::getactive() to make better usage of Moodle DB API, removing hardcoded LIMIT from SQL Query. --- classes/outagedb.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/classes/outagedb.php b/classes/outagedb.php index f7ef64e..a731367 100644 --- a/classes/outagedb.php +++ b/classes/outagedb.php @@ -154,20 +154,21 @@ final class outagedb { throw new \InvalidArgumentException('$time must be null or an int.'); } - // TODO Is there a way to use Moodle API instead of writing SQL (conditions not equals)? // TODO Query not fully using indexes (starttime + 90) // Gets any active outage (already started or during warning period). // Gets only one record if available, the one that starts(ed) first and that stops last. - $data = $DB->get_record_sql(' - SELECT * - FROM {auth_outage} - WHERE (starttime - warningduration <= :datetime1 AND stoptime >= :datetime2) - ORDER BY starttime ASC, stoptime DESC, title ASC - LIMIT 1 - ', - ['datetime1' => $time, 'datetime2' => $time] + $data = $DB->get_records_select( + 'auth_outage', + '(starttime - warningduration <= :datetime1 AND stoptime >= :datetime2)', + ['datetime1' => $time, 'datetime2' => $time], + 'starttime ASC, stoptime DESC, title ASC', + '*', + 0, + 1 ); - return ($data === false) ? null : new \auth_outage\models\outage($data); + // Not using $DB->get_record_select instead because there is no 'limit' parameter. + // Allowing multiple records still raises an internal error. + return (count($data) == 0) ? null : new \auth_outage\models\outage(array_shift($data)); } } From 5b19d3a0a108988606be8497241d1f7e6af30a2c Mon Sep 17 00:00:00 2001 From: Daniel Thee Roperto Date: Wed, 7 Sep 2016 10:21:33 +1000 Subject: [PATCH 6/6] Explicit content box on CSS - Issue #9 --- res/outage.css | 1 + 1 file changed, 1 insertion(+) diff --git a/res/outage.css b/res/outage.css index d703444..2572bf7 100644 --- a/res/outage.css +++ b/res/outage.css @@ -1,4 +1,5 @@ .auth_outage_warningbar { + box-sizing: content-box; position: fixed; top: 0px; left: 0px;