Skip to content

Commit

Permalink
Add project dashboards and reports
Browse files Browse the repository at this point in the history
  • Loading branch information
grezniczek committed Aug 26, 2022
1 parent 9d611e0 commit 45f2338
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
9 changes: 9 additions & 0 deletions ExternalModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.<br>Disable branching logic.<br>Add instructions for testing the module.
Expand Down
12 changes: 12 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 0 additions & 14 deletions redcap_js_injector.code-workspace

This file was deleted.

0 comments on commit 45f2338

Please sign in to comment.