From 45f2338d06a250a72811c28f31eaee27652268c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Rezniczek?= Date: Fri, 26 Aug 2022 13:00:31 +0200 Subject: [PATCH] Add project dashboards and reports --- ExternalModule.php | 9 +++++++++ README.md | 3 ++- config.json | 12 ++++++++++++ redcap_js_injector.code-workspace | 14 -------------- 4 files changed, 23 insertions(+), 15 deletions(-) delete mode 100644 redcap_js_injector.code-workspace diff --git a/ExternalModule.php b/ExternalModule.php index e5e3d78..a95406a 100644 --- a/ExternalModule.php +++ b/ExternalModule.php @@ -37,6 +37,15 @@ function redcap_every_page_top ($project_id) { else if (PAGE === "DataEntry/record_home.php" && isset($_GET["id"])) { $this->injectJS("rhp", null); } + else if (strpos(PAGE, "ProjectDashController:view") !== false && isset($_GET["dash_id"])) { + $this->injectJS("db", null); + } + else if (strpos(PAGE, "surveys/index.php") !== false && isset($_GET["__dashboard"])) { + $this->injectJS("dbp", null); + } + else if (strpos(PAGE, "DataExport/index.php") !== false && isset($_GET["report_id"])) { + $this->injectJS("report", null); + } // All project pages. if ($project_id !== null) { $this->injectJS("all", null); diff --git a/README.md b/README.md index dfb0000..2ef8467 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ A REDCap External Module that allows injection of JavaScript on pages. In a project, go to _Applications > External Modules_ and click the _Configure_ button for the REDCap JS Injector module. -In the configuration dialog, you can define JavaScript snippets for your project that are injected in different contexts. Each context is defined by a page type (_Project Home Page_, _Record Status Dashboard_, _Add / Edit Records_, _Record Home Page_, and _Surveys_, _Data Entry Pages_, _Both, Surveys and Data Entry Pages_, or _All project pages_. For data entry and survey pages, the context can be further limited by specifying one or more instruments. +In the configuration dialog, you can define JavaScript snippets for your project that are injected in different contexts. Each context is defined by a page type (_Project Home Page_, _Record Status Dashboard_, _Add / Edit Records_, _Record Home Page_, and _Surveys_, _Data Entry Pages_, _Both, Surveys and Data Entry Pages_, _Project Dashboards_, _Reports_, or _All project pages_. For data entry and survey pages, the context can be further limited by specifying one or more instruments. The configuration options include a checkbox to enable/disable each of the JavaScript snippets. Make sure to enable the ones you want to be injected. @@ -38,6 +38,7 @@ Instructions for testing the module can be found [here](?prefix=redcap_javascrip Version | Description ------- | ------------------ +1.1.4 | Added additional injection options. 1.1.3 | Fix an issue where a (silent, but logged) exception would be thrown. 1.1.2 | Add system setting for limiting project configuration access to super users only. 1.1.1 | Fix the _All project pages_ behavior that was broken in version 1.1.0.
Disable branching logic.
Add instructions for testing the module. diff --git a/config.json b/config.json index 0e829f9..f5af307 100644 --- a/config.json +++ b/config.json @@ -68,6 +68,18 @@ "value": "survey,data_entry", "name": "Both, Surveys and Data Entry Pages" }, + { + "value": "report", + "name": "Reports" + }, + { + "value": "db", + "name": "Project Dashboards (authenticated)" + }, + { + "value": "dbp", + "name": "Project Dashboards (public)" + }, { "value": "all", "name": "All project pages" diff --git a/redcap_js_injector.code-workspace b/redcap_js_injector.code-workspace deleted file mode 100644 index aa99b57..0000000 --- a/redcap_js_injector.code-workspace +++ /dev/null @@ -1,14 +0,0 @@ -{ - "folders": [ - { - "path": "." - }, - { - "path": "..\\..\\external_modules", - "name": "EM Framework" - } - ], - "settings": { - "php.suggest.basic": false - } -} \ No newline at end of file