Difference between revisions of "RReportGenerator on the Web"

From Wikili
Jump to: navigation, search
 
(9 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
   [http://lbgi.igbmc.fr/rreportgenerator http://lbgi.igbmc.fr/rreportgenerator]
 
   [http://lbgi.igbmc.fr/rreportgenerator http://lbgi.igbmc.fr/rreportgenerator]
  
=How it works=
 
The main tcl program '''rrg.tcl''' (mostly code by Luc Moulinier) remains nearly unchanged. We replaced the call to 'main' with following lines :
 
<source lang="tcl">
 
global env
 
if {! [info exists env(QUERY_STRING)] && $argv=={}} {
 
    package require Tk
 
    main
 
} else {
 
    source "[file dirname [info script]]/rrg_web.tcl"
 
    MainWeb
 
}
 
</source>
 
  
* (We should find a better way to test if it concerns http ...)
 
* If launched as local program, '''rrg.tcl''' requires the package Tk and runs normally
 
* If launched by the web server, '''rrg.tcl''' sources the additional file '''rrg_web.tcl''' (code written by Raymond Ripp) and sends a html page to the web browser.
 
* Any action from the user through his web browser will rerun '''rrg.tcl''', the arguments are always transfered within the web page and users queries, avoiding use of session variables.   
 
* The user can switch between existing projects (if he knows the password) or create a new project.
 
* Within a project he can select, delete or create scenarios and input files.
 
* After selection of a scenario and input file the user can run RReportGenarator. This lauches the normal '''rrg.tcl''' from Luc and stores the result in the OutputDir of the project.
 
* These output files can be shown, downloaded and deleted by any user knowing the password of the project.
 
 
=Installation=
 
 
==To run RReportGenerator on the Web you need==
 
==To run RReportGenerator on the Web you need==
 
* A http web server (we use Apache)
 
* A http web server (we use Apache)
* The compiled RReportGenerator distribution rrg.tgz which contains
 
** the executable rrg.exe (=rrg.tcl + rrg_web.tcl + tcl runtime library)
 
** the logos RRG_logoTransparent.gif, RRG_generateReport.gif, LogoIGBMC.gif '''and your LocalLogo.png'''
 
** a directory containing Scenarios and Indata
 
 
* Access to R, latex and pdflatex
 
* Access to R, latex and pdflatex
 
** for Linux we use ''which R'' , ''which latex'' and ''which pdflatex''
 
** for Linux we use ''which R'' , ''which latex'' and ''which pdflatex''
 
** for Windows we search in the directory defined as the environment variable ProgramFiles
 
** for Windows we search in the directory defined as the environment variable ProgramFiles
 
+
* The '''unique file rrg.tcl''' (it's not the source file but the compiled file !!!)
 +
** It contains all what you need (=rrg_main.tcl + rrg_web.tcl + tcl runtime library + index.html + Logos + test scenarios and indata)
 +
** At first run it extracts automatically the logos, index.html and creates the Web directory where the Scenarios, Indata and Outdata will be stored
 
==Installation on Linux==
 
==Installation on Linux==
 
* we need a '''directory accessible''' by the web server. We call it ''/var/www/rreportgenerator''
 
* we need a '''directory accessible''' by the web server. We call it ''/var/www/rreportgenerator''
Line 45: Line 21:
 
mv rreportgenerator rreportgenerator.OLD
 
mv rreportgenerator rreportgenerator.OLD
 
mkdir rreportgenerator
 
mkdir rreportgenerator
wget -O rrg.tgz "http://lbgi.igbmc.fr/rreportgenerator/rrg.tgz"
+
cd rreportgenerator
tar -zxvf rrg.tgz
+
wget -O rrg.tcl "http://lbgi.igbmc.fr/rreportgenerator/rrg.distrib"
ls -l
+
# please notice the '.distrib' extension (it's the stable version)
#Uncomment following lines if your want your own Web subdirectory located somewhere else
 
#mv Web WebFromDistribution
 
#ln -s /some/where/else/MyWeb Web
 
 
</source>
 
</source>
  
* '''rrg.exe''', index.html and the logos (with your LocalLogo.png) have to be in that directory (if not in the same directory you can use unix links to simulate it)
+
* '''rrg.tcl''', index.html and the logos (with your LocalLogo.png) have to be in that directory (if not in the same directory you can use unix links to simulate it)
 
* the '''sub directory called Web''' contains the scenarios, input and ouput files for all projects. (use links if they are elsewhere)
 
* the '''sub directory called Web''' contains the scenarios, input and ouput files for all projects. (use links if they are elsewhere)
  
We can now use the url  http://''http_server''/''rreportgenerator''/rrg.exe
+
We can now use the url  http://''http_server''/''rreportgenerator''/rrg.tcl
  
* To allow the execution of the rrg.exe as cgi-bin you need following line in the apache configuration file
+
If this is done you can even use the url http://''http_server''/''rreportgenerator''
  
  ScriptAliasMatch ^/''rreportgenerator''/rrg.exe /real/path/to/the/directory/''rreportgenerator''/rrg.exe
+
* To allow the execution of the rrg.tcl as cgi-bin you need following line in the apache configuration file
  
* to allow the url http://''http_server''/''rreportgenerator''  
+
  ScriptAliasMatch ^/''rreportgenerator''/rrg.tcl /real/path/to/the/directory/''rreportgenerator''/rrg.tcl
 +
 
 +
* Notice : to allow the url http://''http_server''/''rreportgenerator''  
 
** do it in the apache configuration or ...
 
** do it in the apache configuration or ...
** use the file index.html in ''rreportgenerator'' with the redirection to rrg.exe
+
** use the file index.html in ''rreportgenerator'' with the redirection to rrg.tcl
  
 
   &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;
 
   &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;
 
   &lt;html&gt;
 
   &lt;html&gt;
 
   &lt;head&gt;
 
   &lt;head&gt;
   &lt;meta http-equiv="REFRESH" content="0;url=./rrg.exe?commande=WebForm"&gt;
+
   &lt;meta http-equiv="REFRESH" content="0;url=./rrg.tcl?commande=WebForm"&gt;
 
   &lt;/head&gt;
 
   &lt;/head&gt;
 
   &lt;/html&gt;
 
   &lt;/html&gt;
 +
 +
==Write permissions==
 +
===For the Web version===
 +
The user running the http server needs to have write permissions to
 +
* /var/www/rreportgenerator/Web where he creates
 +
** /var/www/rreportgenerator/Web/web.log
 +
** /var/www/rreportgenerator/Web/RRGDataForWeb containing the temporary files and RRG_config (can be modified)
 +
** /var/www/rreportgenerator/Web/''ProjectX'' created when the user creates a new project ''ProjectX''
 +
 +
===For the standalone version===
 +
When a user runs rrg.tcl he creates
 +
* ~user/RRGConfiguration containing RRG_config and the temporary files
 +
* the Output files in the directory defined as ''Output Folder''
 +
 +
=How it works=
 +
The main tcl program '''rrg_main.tcl''' (mostly code by Luc Moulinier) remains nearly unchanged. We replaced the call to 'main' with following lines :
 +
<source lang="tcl">
 +
global env
 +
if {! [info exists env(QUERY_STRING)] && $argv=={}} {
 +
    package require Tk
 +
    main
 +
} else {
 +
    source "[file dirname [info script]]/rrg_web.tcl"
 +
    MainWeb
 +
}
 +
</source>
 +
 +
* If launched as local program, '''rrg_main.tcl''' requires the package Tk and runs normally
 +
* If launched by the web server, '''rrg.tcl''' sources the additional file '''rrg_web.tcl''' (code written by Raymond Ripp) and sends a html page to the web browser.
 +
* Any action from the user through his web browser will rerun '''rrg.tcl''', the arguments are always transfered within the web page and users queries, avoiding use of session variables.   
 +
* The user can switch between existing projects (if he knows the password) or create a new project.
 +
* Within a project he can select, delete or create scenarios and input files.
 +
* After selection of a scenario and input file the user can run RReportGenarator. This lauches the normal '''rrg.tcl''' from Luc and stores the result in the OutputDir of the project.
 +
* These output files can be shown, downloaded and deleted by any user knowing the password of the project.

Latest revision as of 16:02, 13 December 2010

While the original RReportGenerator is/was designed as stand-alone, now we've developed a version that is available through a web interface. This should allow users to benefit of servers that are much more powerful, in particular if the applications are memory consuming.

 http://lbgi.igbmc.fr/rreportgenerator


To run RReportGenerator on the Web you need

  • A http web server (we use Apache)
  • Access to R, latex and pdflatex
    • for Linux we use which R , which latex and which pdflatex
    • for Windows we search in the directory defined as the environment variable ProgramFiles
  • The unique file rrg.tcl (it's not the source file but the compiled file !!!)
    • It contains all what you need (=rrg_main.tcl + rrg_web.tcl + tcl runtime library + index.html + Logos + test scenarios and indata)
    • At first run it extracts automatically the logos, index.html and creates the Web directory where the Scenarios, Indata and Outdata will be stored

Installation on Linux

  • we need a directory accessible by the web server. We call it /var/www/rreportgenerator
#suppose www-data is the user running the web server
sudo su - www-data
cd /var/www
mv rreportgenerator rreportgenerator.OLD
mkdir rreportgenerator
cd rreportgenerator
wget -O rrg.tcl "http://lbgi.igbmc.fr/rreportgenerator/rrg.distrib"
# please notice the '.distrib' extension (it's the stable version)
  • rrg.tcl, index.html and the logos (with your LocalLogo.png) have to be in that directory (if not in the same directory you can use unix links to simulate it)
  • the sub directory called Web contains the scenarios, input and ouput files for all projects. (use links if they are elsewhere)

We can now use the url http://http_server/rreportgenerator/rrg.tcl

If this is done you can even use the url http://http_server/rreportgenerator

  • To allow the execution of the rrg.tcl as cgi-bin you need following line in the apache configuration file
  ScriptAliasMatch ^/rreportgenerator/rrg.tcl /real/path/to/the/directory/rreportgenerator/rrg.tcl
  • Notice : to allow the url http://http_server/rreportgenerator
    • do it in the apache configuration or ...
    • use the file index.html in rreportgenerator with the redirection to rrg.tcl
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <html>
 <head>
 <meta http-equiv="REFRESH" content="0;url=./rrg.tcl?commande=WebForm">
 </head>
 </html>

Write permissions

For the Web version

The user running the http server needs to have write permissions to

  • /var/www/rreportgenerator/Web where he creates
    • /var/www/rreportgenerator/Web/web.log
    • /var/www/rreportgenerator/Web/RRGDataForWeb containing the temporary files and RRG_config (can be modified)
    • /var/www/rreportgenerator/Web/ProjectX created when the user creates a new project ProjectX

For the standalone version

When a user runs rrg.tcl he creates

  • ~user/RRGConfiguration containing RRG_config and the temporary files
  • the Output files in the directory defined as Output Folder

How it works

The main tcl program rrg_main.tcl (mostly code by Luc Moulinier) remains nearly unchanged. We replaced the call to 'main' with following lines :

global env
if {! [info exists env(QUERY_STRING)] && $argv=={}} {
    package require Tk
    main
} else {
    source "[file dirname [info script]]/rrg_web.tcl"
    MainWeb
}
  • If launched as local program, rrg_main.tcl requires the package Tk and runs normally
  • If launched by the web server, rrg.tcl sources the additional file rrg_web.tcl (code written by Raymond Ripp) and sends a html page to the web browser.
  • Any action from the user through his web browser will rerun rrg.tcl, the arguments are always transfered within the web page and users queries, avoiding use of session variables.
  • The user can switch between existing projects (if he knows the password) or create a new project.
  • Within a project he can select, delete or create scenarios and input files.
  • After selection of a scenario and input file the user can run RReportGenarator. This lauches the normal rrg.tcl from Luc and stores the result in the OutputDir of the project.
  • These output files can be shown, downloaded and deleted by any user knowing the password of the project.