-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,361 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ _site/ | |
.jekyll-cache/ | ||
.jekyll-metadata | ||
Gemfile.lock | ||
*.gem | ||
*.gem | ||
_config_local.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Change Log | ||
All notable changes to the REDCap External Module Development Guide project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
|
||
## [1.0.0] - 2020-02-24 | ||
### Added | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ul.authors { | ||
list-style:none; | ||
padding:0; | ||
} | ||
|
||
.authors li { | ||
font-size:11px; | ||
} | ||
|
||
p.authors { | ||
margin:0 0 3px; | ||
font-weight:bold; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
--- | ||
|
||
@import "jekyll-theme-minimal"; | ||
@import "em-guide"; |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# To override variables in _config.yml for use in your local environment, | ||
# set those variables in _config_local.yaml. E.g. add a line like this to | ||
# link to the root of the develop branch of the CTSIT fork: | ||
# | ||
# repo_root: https://github.com/ctsit/redcap_external_module_development_guide/tree/develop/ | ||
# | ||
# This script will load the contents of _config_local.yaml last if it exists. | ||
# Github will only reference _config.yaml when building the site. | ||
|
||
# Note: You might need to tell rvm which ruby to use before running this script. e.g. | ||
# | ||
# rvm use 2.6.3 | ||
# | ||
|
||
LOCAL_CONFIG_YAML=_config_local.yaml | ||
|
||
if [ -e ${LOCAL_CONFIG_YAML} ]; then | ||
bundle exec jekyll serve --config _config.yml,${LOCAL_CONFIG_YAML} | ||
else | ||
bundle exec jekyll serve | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# External Module Development Exercises | ||
|
||
The External Module Development Guide includes a set of development exercises to use as a guide for module development. Each exercise teaches a different facet of module development. The majority of the exercises are missing essential functionality with comments denoting the regions where the functionality should be added. | ||
|
||
## Preface | ||
|
||
For guidance in developing modules and resources for completing these exercises, see [REDCap External Module Development Guide](https://ctsit.github.io/redcap_external_module_development_guide/). | ||
|
||
## Modules | ||
|
||
All of module development exercises reside in the Git repo that houses this document at [`https://github.com/ctsit/redcap_external_module_development_guide/exercises/`](https://github.com/ctsit/redcap_external_module_development_guide/exercises/) | ||
|
||
### Hello World | ||
This is a "complete" module intended to be used to make sure your development pipeline is set up properly. | ||
|
||
Read the section on [module requirements](https://github.com/vanderbilt/redcap-external-modules/blob/testing/docs/official-documentation.md#module-requirement) until the section on hooks. | ||
|
||
### Hello Hook | ||
|
||
Read [the official documentation on calling hooks](https://github.com/vanderbilt/redcap-external-modules/blob/testing/docs/official-documentation.md#how-to-call-redcap-hooks). | ||
|
||
### Intro JS | ||
|
||
Read [the official documentation on module functions, specifically `getUrl`](https://github.com/vanderbilt/redcap-external-modules/blob/testing/docs/framework/v3.md). You may also find it helpful to refer to previous exercises where JavaScript was used. | ||
|
||
## Hello Plugin | ||
|
||
Read [the official documentation on creating plugin pages](https://github.com/vanderbilt/redcap-external-modules/blob/testing/docs/official-documentation.md#how-to-create-plugin-pages-for-your-module). | ||
|
||
## Accessing Variables | ||
|
||
Read [the official documentation on module functions](https://github.com/vanderbilt/redcap-external-modules/blob/testing/docs/framework/intro.md). Search for functions containing `User` and `ProjectSetting`. | ||
|
||
## Record Wrangling | ||
|
||
Read the source code of the following files (relative to the root of your `redcap_vx.y.z` folder), searching for phrases `getData`, `saveData`. | ||
- `ExternalModules/` | ||
- `AbstractExternalModule.php` | ||
- `ExternalModules.php` | ||
- `Classes/` | ||
- `REDCap.php` | ||
- `Records.php` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace AccessingVariables\ExternalModule; | ||
|
||
use ExternalModules\AbstractExternalModule; | ||
|
||
class ExternalModule extends AbstractExternalModule { | ||
|
||
//FIXME: Write and use functions to show users pertinent information | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Accessing Variables | ||
|
||
Displays information relevant to users. | ||
|
||
## Prerequisites | ||
- REDCap >= 8.0.3 (for versions < 8.0, [REDCap Modules](https://github.com/vanderbilt/redcap-external-modules) is required). | ||
|
||
## Installation | ||
- Clone this repo into to `<redcap-root>/modules/accessing_variables_v0.0.0`. | ||
- Go to **Control Center > Manage External Modules** and enable **Accessing Variables**. | ||
- For each project you want to use this module, go to the project home page, click on **Manage External Modules** link, and then enable **Accessing Variables** for that project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "Accessing Variables", | ||
"description": "Module that describes users to themselves", | ||
"namespace": "AccessingVariables\\ExternalModule", | ||
"framework-version": 3, | ||
"authors": [ | ||
{ | ||
"name": "Kyle Chesney", | ||
"email": "[email protected]", | ||
"institution": "University of Florida - CTSI" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace HelloWorld\ExternalModule; | ||
|
||
use ExternalModules\AbstractExternalModule; | ||
|
||
class ExternalModule extends AbstractExternalModule { | ||
|
||
// This is generally where your module's hooks will live | ||
function redcap_every_page_top($project_id) { | ||
print_r('Hello world! I am a message produced by a hook!'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Hello World | ||
|
||
Provides a page that says "Hello, world" in the control center and on projects. | ||
|
||
Shows admin view of a handful of configuration options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Hello world", | ||
"description": "Hello world page to ensure your development tools are working", | ||
"namespace": "HelloWorld\\ExternalModule", | ||
"framework-version": 3, | ||
"permissions": [ | ||
"redcap_every_page_top" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Kyle Chesney", | ||
"email": "[email protected]", | ||
"institution": "University of Florida - CTSI" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace HelloHook\ExternalModule; | ||
|
||
use ExternalModules\AbstractExternalModule; | ||
|
||
class ExternalModule extends AbstractExternalModule { | ||
|
||
// Test out using the hooks in the documentation to make an alert appear in different contexts | ||
// FIXME | ||
/* Write your code here */ | ||
function a_real_redcap_hook() { | ||
/* Stop writing code here */ | ||
|
||
// create an empty JS object for the module's variables | ||
echo '<script>helloHook = {};</script>'; | ||
$this->setSingleJsSetting('message', 'Hello world!'); | ||
$this->includeJs('js/hello_hook.js'); | ||
} | ||
|
||
protected function includeJs($file) { | ||
// Use this function to use your JavaScript files in the frontend | ||
echo '<script src="' . $this->getUrl($file) . '"></script>'; | ||
} | ||
|
||
protected function setSingleJsSetting($key, $value) { | ||
// Use this function to send variables to the frontend scoped within an object | ||
echo '<script>helloHook.' . $key . '=' . json_encode($value) . ';</script>'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Hello Hook | ||
|
||
This module provides an alert that notifies users it is active with a friendly "Hello world!" message. | ||
|
||
## Prerequisites | ||
- REDCap >= 8.0.3 (for versions < 8.0, [REDCap Modules](https://github.com/vanderbilt/redcap-external-modules) is required). | ||
|
||
## Installation | ||
- Clone this repo into to `<redcap-root>/modules/hello_hook_v0.0.0`. | ||
- Go to **Control Center > Manage External Modules** and enable **Hello Hook**. | ||
- For each project you want to use this module, go to the project home page, click on **Manage External Modules** link, and then enable **Hello Hook** for that project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "Hello Hook", | ||
"description": "Provide a friendly alert to REDCap users", | ||
"namespace": "HelloHook\\ExternalModule", | ||
"framework-version": 3, | ||
"permissions": [ | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Kyle Chesney", | ||
"email": "[email protected]", | ||
"institution": "University of Florida - CTSI" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
$( document ).ready(function() { | ||
alert(helloHook.message); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace IntroJS\ExternalModule; | ||
|
||
use ExternalModules\AbstractExternalModule; | ||
use RCView; | ||
|
||
class ExternalModule extends AbstractExternalModule { | ||
|
||
function redcap_project_home_page($project_id) { | ||
|
||
// Define attributes for html elements | ||
$button_attributes = [ | ||
'class' => 'btn btn-primary', | ||
'id' => 'incrementButton' | ||
]; | ||
$button_text = "Click to increment"; | ||
|
||
// call a prebuilt button maker | ||
echo RCView::button($button_attributes, $button_text); | ||
|
||
echo RCView::p(['id' => 'incrementValue'], '0'); | ||
|
||
// FIXME | ||
// include a JavaScript file that increments the contents of incrementValue | ||
// upon clicking the incrementButton | ||
/* write your code below */ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Intro JS | ||
|
||
This module adds a clickable counter to the home page of projects for which it is enabled. | ||
|
||
## Prerequisites | ||
- REDCap >= 8.0.3 (for versions < 8.0, [REDCap Modules](https://github.com/vanderbilt/redcap-external-modules) is required). | ||
|
||
## Installation | ||
- Clone this repo into to `<redcap-root>/modules/intro_to_js_v0.0.0`. | ||
- Go to **Control Center > Manage External Modules** and enable **Intro JS**. | ||
- For each project you want to use this module, go to the project home page, click on **Manage External Modules** link, and then enable **Intro JS** for that project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Intro JS", | ||
"description": "Adds a counter to the project home page", | ||
"namespace": "IntroJS\\ExternalModule", | ||
"framework-version": 3, | ||
"permissions": [ | ||
"redcap_project_home_page" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Kyle Chesney", | ||
"email": "[email protected]", | ||
"institution": "University of Florida - CTSI" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
$( document ).ready(function() { | ||
/* Write your code below */ | ||
|
||
}); | ||
|
||
/* If you wish, make a function */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace HelloPlugin\ExternalModule; | ||
|
||
use ExternalModules\AbstractExternalModule; | ||
|
||
class ExternalModule extends AbstractExternalModule { | ||
|
||
function sayHello() { | ||
print_r("Hello, world!"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Hello Plugin | ||
|
||
Provides a page that says "Hello, world" in the control center. | ||
|
||
## Prerequisites | ||
- REDCap >= 8.0.3 (for versions < 8.0, [REDCap Modules](https://github.com/vanderbilt/redcap-external-modules) is required). | ||
|
||
## Installation | ||
- Clone this repo into to `<redcap-root>/modules/intro_to_plugins_v0.0.0`. | ||
- Go to **Control Center > Manage External Modules** and enable **Hello Plugin**. | ||
- For each project you want to use this module, go to the project home page, click on **Manage External Modules** link, and then enable **Hello Plugin** for that project. | ||
|
Oops, something went wrong.