From b764737e43bfea537cdf2703a67652c6dff0532f Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Tue, 1 Sep 2020 12:59:26 -0400 Subject: [PATCH 01/17] Changes to help table contents --- raisinbread/RB_files/RB_help.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/raisinbread/RB_files/RB_help.sql b/raisinbread/RB_files/RB_help.sql index 28b5f0e222c..82ab6b5d50e 100644 --- a/raisinbread/RB_files/RB_help.sql +++ b/raisinbread/RB_files/RB_help.sql @@ -1,5 +1,6 @@ SET FOREIGN_KEY_CHECKS=0; TRUNCATE TABLE `help`; LOCK TABLES `help` WRITE; +INSERT INTO `help` (`helpID`, `parentID`, `hash`, `topic`, `content`, `created`, `updated`) VALUES (123,12,'810dc6911c825b55eff684098f2beb19','bmi','The BMI calculator instrument can calculate the BMI and BMI Classification of a visitor. The two required fields for this instrument are the Date of Administration of the instrument and the Examiner name. The height and weight of the visitor must then be entered in either standard or metric units. The instrument will not accept an entry where the height and weight are given in both units. After this information is given, the instrument will calculate the BMI and BMI Classification of the visitor.',NULL,NULL); UNLOCK TABLES; SET FOREIGN_KEY_CHECKS=1; From 5b8f45f7896d7447c37ac04a3b77fd70a2b2e484 Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Wed, 12 Aug 2020 18:14:38 -0400 Subject: [PATCH 02/17] [Raisinbread] Added BMI instructions to RB 'help' table to test help_editor From f374862377092bf5766058cf51a00aa18691e78a Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Tue, 1 Sep 2020 12:59:26 -0400 Subject: [PATCH 03/17] Changes to help table contents From dda4e4f88cd76d6f1ada0364132459a209f4fb0a Mon Sep 17 00:00:00 2001 From: zaliqarosli Date: Thu, 3 Sep 2020 15:16:31 -0400 Subject: [PATCH 04/17] fix front-end bugs --- modules/help_editor/ajax/help.php | 34 ++++++++++++------- .../php/edit_help_content.class.inc | 23 +++++++------ php/libraries/NDB_BVL_Instrument.class.inc | 2 ++ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/modules/help_editor/ajax/help.php b/modules/help_editor/ajax/help.php index ece254af0db..71b9eaba20a 100644 --- a/modules/help_editor/ajax/help.php +++ b/modules/help_editor/ajax/help.php @@ -32,20 +32,28 @@ include_once "helpfile.class.inc"; if (!empty($moduleName)) { - $helpID = \LORIS\help_editor\HelpFile::hashToID( - md5($subpageName ?? $moduleName) - ); - } - - $help_file = \LORIS\help_editor\HelpFile::factory($helpID); - $data = $help_file->toArray(); - $data['content'] = trim($data['content']); + try { + $helpID = \LORIS\help_editor\HelpFile::hashToID( + md5($subpageName ?? $moduleName) + ); + $help_file = \LORIS\help_editor\HelpFile::factory($helpID); + $data = $help_file->toArray(); + $data['content'] = trim($data['content']); - if (empty($data['updated'])) { - $data['updated'] = "-"; - // if document was never updated should display date created - if (!empty($data['created'])) { - $data['updated'] = $data['created']; + if (empty($data['updated'])) { + $data['updated'] = "-"; + // if document was never updated should display date created + if (!empty($data['created'])) { + $data['updated'] = $data['created']; + } + } + } catch (\NotFound $e) { + // Send data with empty strings so that the content can be edited + $data = [ + 'content' => '', + 'topic' => '', + 'updated' => '-' + ]; } } print json_encode($data); diff --git a/modules/help_editor/php/edit_help_content.class.inc b/modules/help_editor/php/edit_help_content.class.inc index b4d726d6b02..99f99561af3 100644 --- a/modules/help_editor/php/edit_help_content.class.inc +++ b/modules/help_editor/php/edit_help_content.class.inc @@ -59,17 +59,21 @@ class Edit_Help_Content extends \NDB_Form if (isset($_REQUEST['helpID'])) { $helpID = htmlspecialchars($_REQUEST['helpID']); } - if (isset($_GET['parentID'])) { - $parentID = htmlspecialchars($_GET['parentID']); - } - if (!empty($_REQUEST['section'])) { - $helpID = HelpFile::hashToID(md5($_REQUEST['section'])); + if (isset($_REQUEST['section']) && !empty($_REQUEST['section'])) { + try { + $helpID = HelpFile::hashToID(md5($_REQUEST['section'])); + } catch (\NotFound $e) { + $helpID = ''; + } } if (!empty($_REQUEST['section']) && $_REQUEST['subsection'] != 'undefined' ) { - $helpID = HelpFile::hashToID(md5($_REQUEST['subsection'])); - $parentID = HelpFile::hashToID(md5($_GET['section'])); + try { + $helpID = HelpFile::hashToID(md5($_REQUEST['subsection'])); + } catch (\NotFound $e) { + $helpID = ''; + } } $this->tpl_data['section'] = $safeSection; $this->tpl_data['subsection'] = $safeSubsection; @@ -128,11 +132,10 @@ class Edit_Help_Content extends \NDB_Form $this->addBasicTextArea( 'content', 'Content', - [], - array( + [ 'cols' => 140, 'rows' => 30, - ) + ] ); } diff --git a/php/libraries/NDB_BVL_Instrument.class.inc b/php/libraries/NDB_BVL_Instrument.class.inc index 2be6ddf4979..0481d23eb81 100644 --- a/php/libraries/NDB_BVL_Instrument.class.inc +++ b/php/libraries/NDB_BVL_Instrument.class.inc @@ -277,6 +277,8 @@ abstract class NDB_BVL_Instrument extends NDB_Page // Sets up page variables such as $this->commentID and $this->form $obj->setup($commentID, $page); + // Set page name to testName + $obj->name = $instrument; if (!empty($commentID)) { $obj->setupCandidateInfoTables(); From 22469b74ba925557fc79ddda55a7790ec61c7668 Mon Sep 17 00:00:00 2001 From: zaliqarosli Date: Thu, 3 Sep 2020 15:24:40 -0400 Subject: [PATCH 05/17] fix rb data --- raisinbread/RB_files/RB_help.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raisinbread/RB_files/RB_help.sql b/raisinbread/RB_files/RB_help.sql index 82ab6b5d50e..27bce990d67 100644 --- a/raisinbread/RB_files/RB_help.sql +++ b/raisinbread/RB_files/RB_help.sql @@ -1,6 +1,6 @@ SET FOREIGN_KEY_CHECKS=0; TRUNCATE TABLE `help`; LOCK TABLES `help` WRITE; -INSERT INTO `help` (`helpID`, `parentID`, `hash`, `topic`, `content`, `created`, `updated`) VALUES (123,12,'810dc6911c825b55eff684098f2beb19','bmi','The BMI calculator instrument can calculate the BMI and BMI Classification of a visitor. The two required fields for this instrument are the Date of Administration of the instrument and the Examiner name. The height and weight of the visitor must then be entered in either standard or metric units. The instrument will not accept an entry where the height and weight are given in both units. After this information is given, the instrument will calculate the BMI and BMI Classification of the visitor.',NULL,NULL); +INSERT INTO `help` (`helpID`, `parentID`, `hash`, `topic`, `content`, `created`, `updated`) VALUES (123,-1,'810dc6911c825b55eff684098f2beb19','bmi','The BMI calculator instrument can calculate the BMI and BMI Classification of a visitor. The two required fields for this instrument are the Date of Administration of the instrument and the Examiner name. The height and weight of the visitor must then be entered in either standard or metric units. The instrument will not accept an entry where the height and weight are given in both units. After this information is given, the instrument will calculate the BMI and BMI Classification of the visitor.','2020-09-01 01:03:09',NULL); UNLOCK TABLES; SET FOREIGN_KEY_CHECKS=1; From 6f2f66003e60e925d0f67c8033d5d9977f27021d Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Mon, 14 Sep 2020 16:09:13 -0400 Subject: [PATCH 06/17] Fixed checkstatic errors causing Travis fail --- modules/help_editor/ajax/help.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/help_editor/ajax/help.php b/modules/help_editor/ajax/help.php index 71b9eaba20a..aca86239527 100644 --- a/modules/help_editor/ajax/help.php +++ b/modules/help_editor/ajax/help.php @@ -33,7 +33,7 @@ if (!empty($moduleName)) { try { - $helpID = \LORIS\help_editor\HelpFile::hashToID( + $helpID = \LORIS\help_editor\HelpFile::hashToID( md5($subpageName ?? $moduleName) ); $help_file = \LORIS\help_editor\HelpFile::factory($helpID); From bc1cfc862e72663e14634174626aead3e4c54825 Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Mon, 14 Sep 2020 16:24:45 -0400 Subject: [PATCH 07/17] Set name before setup function --- php/libraries/NDB_BVL_Instrument.class.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/libraries/NDB_BVL_Instrument.class.inc b/php/libraries/NDB_BVL_Instrument.class.inc index 0481d23eb81..39d244cea8f 100644 --- a/php/libraries/NDB_BVL_Instrument.class.inc +++ b/php/libraries/NDB_BVL_Instrument.class.inc @@ -275,10 +275,10 @@ abstract class NDB_BVL_Instrument extends NDB_Page $obj->displayAllFields = true; } - // Sets up page variables such as $this->commentID and $this->form - $obj->setup($commentID, $page); // Set page name to testName $obj->name = $instrument; + // Sets up page variables such as $this->commentID and $this->form + $obj->setup($commentID, $page); if (!empty($commentID)) { $obj->setupCandidateInfoTables(); From cf3c8e6a159c7c0f66893592e63fa06ce2482d57 Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Tue, 29 Jun 2021 11:16:39 -0400 Subject: [PATCH 08/17] Fixed SQL query --- raisinbread/RB_files/RB_help.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raisinbread/RB_files/RB_help.sql b/raisinbread/RB_files/RB_help.sql index 27bce990d67..241bfa5dcc8 100644 --- a/raisinbread/RB_files/RB_help.sql +++ b/raisinbread/RB_files/RB_help.sql @@ -1,6 +1,6 @@ SET FOREIGN_KEY_CHECKS=0; TRUNCATE TABLE `help`; LOCK TABLES `help` WRITE; -INSERT INTO `help` (`helpID`, `parentID`, `hash`, `topic`, `content`, `created`, `updated`) VALUES (123,-1,'810dc6911c825b55eff684098f2beb19','bmi','The BMI calculator instrument can calculate the BMI and BMI Classification of a visitor. The two required fields for this instrument are the Date of Administration of the instrument and the Examiner name. The height and weight of the visitor must then be entered in either standard or metric units. The instrument will not accept an entry where the height and weight are given in both units. After this information is given, the instrument will calculate the BMI and BMI Classification of the visitor.','2020-09-01 01:03:09',NULL); +INSERT INTO `help` (`helpID`, `hash`, `topic`, `content`, `created`, `updated`) VALUES (123,'810dc6911c825b55eff684098f2beb19','bmi','The BMI calculator instrument can calculate the BMI and BMI Classification of a visitor. The two required fields for this instrument are the Date of Administration of the instrument and the Examiner name. The height and weight of the visitor must then be entered in either standard or metric units. The instrument will not accept an entry where the height and weight are given in both units. After this information is given, the instrument will calculate the BMI and BMI Classification of the visitor.','2020-09-01 01:03:09',NULL); UNLOCK TABLES; SET FOREIGN_KEY_CHECKS=1; From 20d53c86df709fddc157a48ce7a53920d913c93d Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Mon, 5 Jul 2021 11:01:06 -0400 Subject: [PATCH 09/17] Added variable for 23.0 --- modules/help_editor/php/edit_help_content.class.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/help_editor/php/edit_help_content.class.inc b/modules/help_editor/php/edit_help_content.class.inc index 99f99561af3..44b614edb41 100644 --- a/modules/help_editor/php/edit_help_content.class.inc +++ b/modules/help_editor/php/edit_help_content.class.inc @@ -59,7 +59,10 @@ class Edit_Help_Content extends \NDB_Form if (isset($_REQUEST['helpID'])) { $helpID = htmlspecialchars($_REQUEST['helpID']); } - if (isset($_REQUEST['section']) && !empty($_REQUEST['section'])) { + if (isset($_GET['parentID'])) { + $parentID = htmlspecialchars($_GET['parentID']); + } + if (!empty($_REQUEST['section'])) { try { $helpID = HelpFile::hashToID(md5($_REQUEST['section'])); } catch (\NotFound $e) { @@ -71,8 +74,10 @@ class Edit_Help_Content extends \NDB_Form ) { try { $helpID = HelpFile::hashToID(md5($_REQUEST['subsection'])); + $parentID = HelpFile::hashToID(md5($_GET['section'])); } catch (\NotFound $e) { $helpID = ''; + $parentID = ''; } } $this->tpl_data['section'] = $safeSection; From 5c36399b2c9972b40a47c545b8e1812ec9f46469 Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Mon, 5 Jul 2021 11:20:29 -0400 Subject: [PATCH 10/17] Fixing checkstatic errors --- modules/help_editor/php/edit_help_content.class.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/help_editor/php/edit_help_content.class.inc b/modules/help_editor/php/edit_help_content.class.inc index 44b614edb41..b45d5b12f1b 100644 --- a/modules/help_editor/php/edit_help_content.class.inc +++ b/modules/help_editor/php/edit_help_content.class.inc @@ -73,10 +73,10 @@ class Edit_Help_Content extends \NDB_Form && $_REQUEST['subsection'] != 'undefined' ) { try { - $helpID = HelpFile::hashToID(md5($_REQUEST['subsection'])); + $helpID = HelpFile::hashToID(md5($_REQUEST['subsection'])); $parentID = HelpFile::hashToID(md5($_GET['section'])); } catch (\NotFound $e) { - $helpID = ''; + $helpID = ''; $parentID = ''; } } From 4859ceb94079de4201b2756cb153b4e89652c54d Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Tue, 6 Jul 2021 10:42:28 -0400 Subject: [PATCH 11/17] Reorganizing try-catch statement --- modules/help_editor/ajax/help.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/help_editor/ajax/help.php b/modules/help_editor/ajax/help.php index aca86239527..331e84fabdc 100644 --- a/modules/help_editor/ajax/help.php +++ b/modules/help_editor/ajax/help.php @@ -38,15 +38,7 @@ ); $help_file = \LORIS\help_editor\HelpFile::factory($helpID); $data = $help_file->toArray(); - $data['content'] = trim($data['content']); - if (empty($data['updated'])) { - $data['updated'] = "-"; - // if document was never updated should display date created - if (!empty($data['created'])) { - $data['updated'] = $data['created']; - } - } } catch (\NotFound $e) { // Send data with empty strings so that the content can be edited $data = [ @@ -55,6 +47,16 @@ 'updated' => '-' ]; } + + $data['content'] = trim($data['content']); + + if (empty($data['updated'])) { + $data['updated'] = "-"; + // if document was never updated should display date created + if (!empty($data['created'])) { + $data['updated'] = $data['created']; + } + } } print json_encode($data); ob_end_flush(); From a748b7b2d8b56944400eb1b8f89c96b86a166d1f Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Tue, 6 Jul 2021 10:46:03 -0400 Subject: [PATCH 12/17] Rearranging logic --- modules/help_editor/ajax/help.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/help_editor/ajax/help.php b/modules/help_editor/ajax/help.php index 331e84fabdc..72ccd693a87 100644 --- a/modules/help_editor/ajax/help.php +++ b/modules/help_editor/ajax/help.php @@ -47,14 +47,15 @@ 'updated' => '-' ]; } - + $data['content'] = trim($data['content']); if (empty($data['updated'])) { - $data['updated'] = "-"; // if document was never updated should display date created - if (!empty($data['created'])) { + if (!empty($data['created']) && isset($data['created'])) { $data['updated'] = $data['created']; + } else { + $data['updated'] = "-"; } } } From e1f47cbc4a76a072a2be69c701c33a8b9cfc6dab Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Tue, 6 Jul 2021 10:58:46 -0400 Subject: [PATCH 13/17] Checkstatic errors --- modules/help_editor/ajax/help.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/help_editor/ajax/help.php b/modules/help_editor/ajax/help.php index 72ccd693a87..eec2fdabf76 100644 --- a/modules/help_editor/ajax/help.php +++ b/modules/help_editor/ajax/help.php @@ -33,11 +33,11 @@ if (!empty($moduleName)) { try { - $helpID = \LORIS\help_editor\HelpFile::hashToID( + $helpID = \LORIS\help_editor\HelpFile::hashToID( md5($subpageName ?? $moduleName) ); - $help_file = \LORIS\help_editor\HelpFile::factory($helpID); - $data = $help_file->toArray(); + $help_file = \LORIS\help_editor\HelpFile::factory($helpID); + $data = $help_file->toArray(); } catch (\NotFound $e) { // Send data with empty strings so that the content can be edited From d1ce28eb492244f3fb3f9c7b8c8a4d412e6d121a Mon Sep 17 00:00:00 2001 From: Alexandra Livadas Date: Tue, 6 Jul 2021 11:14:17 -0400 Subject: [PATCH 14/17] Remove whitespace Co-authored-by: Zaliqa --- modules/help_editor/ajax/help.php | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/help_editor/ajax/help.php b/modules/help_editor/ajax/help.php index eec2fdabf76..ceb74cbf8da 100644 --- a/modules/help_editor/ajax/help.php +++ b/modules/help_editor/ajax/help.php @@ -38,7 +38,6 @@ ); $help_file = \LORIS\help_editor\HelpFile::factory($helpID); $data = $help_file->toArray(); - } catch (\NotFound $e) { // Send data with empty strings so that the content can be edited $data = [ From 05f44ddbdf19d785ae70a54e1566912edb0256a8 Mon Sep 17 00:00:00 2001 From: AlexandraLivadas Date: Tue, 6 Jul 2021 13:30:37 -0400 Subject: [PATCH 15/17] Adding instructions to md file --- modules/help_editor/help/help_editor.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/help_editor/help/help_editor.md b/modules/help_editor/help/help_editor.md index 242f87e183d..16cea882795 100644 --- a/modules/help_editor/help/help_editor.md +++ b/modules/help_editor/help/help_editor.md @@ -1,7 +1,10 @@ # Help Editor -This module displays existing help content for LORIS modules and pages. +This module displays existing help content for LORIS instrument pages Use the *Selection Filter* section to search by Topic or Content keywords. -Click on the blue link in any *Topic* or *Parent Topic* column to edit the content within. Make your edits within the Edit Help Content page, and click **Save**. +Click on the blue link in any *Topic* or *Parent Topic* column to edit the content within. Make your edits within the Edit Help Content page, and click **Save**. + +To add new help content for an instrument, navigate to the instrument's page from any candidate and any session. Click on the `?` icon in the navigation bar at the top + of the page. In the help pop-up box, click the `Edit` button. This will take you to the *Edit Help Content* page where you can save help content for that instrument. \ No newline at end of file From 0a3a209e37442f96d5d339c53f34b7709020079a Mon Sep 17 00:00:00 2001 From: Alexandra Livadas Date: Tue, 6 Jul 2021 14:40:13 -0400 Subject: [PATCH 16/17] Update help_editor.md --- modules/help_editor/help/help_editor.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/help_editor/help/help_editor.md b/modules/help_editor/help/help_editor.md index 16cea882795..14824172f64 100644 --- a/modules/help_editor/help/help_editor.md +++ b/modules/help_editor/help/help_editor.md @@ -1,10 +1,10 @@ # Help Editor -This module displays existing help content for LORIS instrument pages +This module displays existing help content for LORIS instrument pages. Use the *Selection Filter* section to search by Topic or Content keywords. Click on the blue link in any *Topic* or *Parent Topic* column to edit the content within. Make your edits within the Edit Help Content page, and click **Save**. To add new help content for an instrument, navigate to the instrument's page from any candidate and any session. Click on the `?` icon in the navigation bar at the top - of the page. In the help pop-up box, click the `Edit` button. This will take you to the *Edit Help Content* page where you can save help content for that instrument. \ No newline at end of file + of the page. In the help pop-up box, click the `Edit` button. This will take you to the *Edit Help Content* page where you can save help content for that instrument. From 6bb478c171997b9e37c0c0cb45550d1186823448 Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Thu, 8 Jul 2021 13:51:21 -0400 Subject: [PATCH 17/17] Update modules/help_editor/ajax/help.php --- modules/help_editor/ajax/help.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/help_editor/ajax/help.php b/modules/help_editor/ajax/help.php index ceb74cbf8da..43d29112048 100644 --- a/modules/help_editor/ajax/help.php +++ b/modules/help_editor/ajax/help.php @@ -43,7 +43,7 @@ $data = [ 'content' => '', 'topic' => '', - 'updated' => '-' + 'updated' => '' ]; }