Extension:Shiny

The Shiny extension allows to embed Shiny apps in pages. The Shiny server itself uses the programming language R, which is a free software environment for statistical computing and graphics.

Requirements

 * R is a free software environment for statistical computing and graphics. It needs to be installed (probably available in your Linux distribution) and in the PATH: the command  should work on the command line.


 * The Shiny server lets you put shiny web applications online. It needs to be installed separately.

Download
You can obtain the extension from GitHub.

Installation
The following subpages describe the installation process for


 * Ubuntu 14.04 and
 * CentOS 7

with an Apache web server. For other linux systems or web servers the description needs to be adapted.

Extension files

 * stores the setup instructions.
 * stores the setup instructions.


 * stores the execution code for the extension.
 * stores the execution code for the extension.

All other files in the  could be deleted.

Configuration
The file  contains three configuration variables which could be set:

"config": { "ShinyR":     "/usr/bin/R", "ShinyAppDir": "/srv/shiny-server/mediawiki", "ShinyUrl":   "http://localhost/shiny/mediawiki" },


 * the path and command to execute R. You may query for it in your system by using the command
 * the path and command to execute R. You may query for it in your system by using the command


 * the path where the Shiny apps are stored. Note that the actual path where  is stored is
 * the path where the Shiny apps are stored. Note that the actual path where  is stored is


 * the URL which is called to access a Shiny app. Note that the actual URL for a shiny app is
 * the URL which is called to access a Shiny app. Note that the actual URL for a shiny app is

Usage
For a simple example put into a wiki page:  hist(rnorm(314)) It shows a histogram of 314 random values according to a standard normal distribution.

Some hints for development:
 * For developing a Shiny app you are urged to use RStudio. If the app runs under RStudio then it will also work with MediaWiki.

tag
The  tag can have the following attributes:



!  || corresponds to
 * || and
 * || and
 * || and
 * || and
 * || and
 * || and
 * }
 * Note if  is omitted then between the start and end tag is a fully fledged shiny app is expected.
 * || and
 * || and
 * }
 * Note if  is omitted then between the start and end tag is a fully fledged shiny app is expected.
 * }
 * Note if  is omitted then between the start and end tag is a fully fledged shiny app is expected.
 * }
 * Note if  is omitted then between the start and end tag is a fully fledged shiny app is expected.


 * the name of the Shiny app. If not set then a hash value from the R program is derived.
 * CAUTION: Omitting the name may lead to a lot of sub-directories for the shiny server, therefore choose a name!
 * CAUTION: Omitting the name may lead to a lot of sub-directories for the shiny server, therefore choose a name!


 * the width of the windows in pixel (default: 800)
 * the width of the windows in pixel (default: 800)


 * the height of the windows in pixel (default: 600)
 * the height of the windows in pixel (default: 600)


 * if the Shiny app is embedded seamlessly (, default) or not (any other text for seamless)
 * if the Shiny app is embedded seamlessly (, default) or not (any other text for seamless)


 * enables extra restrictions on the content that can appear in the inline frame. (default: ). The value of the attribute can either be an empty string (all the restrictions are applied), or a space-separated list of tokens that lift particular restrictions. Valid tokens are:
 * enables extra restrictions on the content that can appear in the inline frame. (default: ). The value of the attribute can either be an empty string (all the restrictions are applied), or a space-separated list of tokens that lift particular restrictions. Valid tokens are:

! Token || Allows
 * || the embedded browsing context to submit forms
 * || the embedded browsing context to submit forms


 * || to open popups (like from window.open, target="_blank", showModalDialog)
 * || the content to be treated as being from its normal origin
 * || the embedded browsing context to run scripts (but not create pop-up windows)
 * || the embedded browsing context to navigate (load) content to the top-level browsing context.
 * }
 * || the embedded browsing context to navigate (load) content to the top-level browsing context.
 * }
 * }

Errors

 * In the wiki page only an  is shown instead of the Shiny app.
 * In case that this error occurs the extension shows the resulting HTML code instead of embedding. Check for typos/errors in the options or in your R program.


 * In the Shiny app only  is displayed
 * Delete from your R code the  line.

Security
Currently no security measures are implemented.