Actions

Accessing the source code: Difference between revisions

From LimeSurvey Manual

No edit summary
 
No edit summary
Line 1: Line 1:


===Accessing the LimeSurvey v1/v2 Source Code===
__TOC__
 
=Accessing the LimeSurvey v1/v2 Source Code=


Always be aware that LimeSurvey Source code is '''bleeding edge'''. Do not use it for production purposes!
Always be aware that LimeSurvey Source code is '''bleeding edge'''. Do not use it for production purposes!
Line 10: Line 12:
*For Mac we recommend: [http://subversion.tigris.org/project_packages.html subversion]. Commandline all the way ;)
*For Mac we recommend: [http://subversion.tigris.org/project_packages.html subversion]. Commandline all the way ;)


===Step-by-Step How-To (Windows)===
==Step-by-Step How-To (Windows)==
#Download and install [http://tortoisesvn.sourceforge.net/ TortoiseSVN]. Reboot after install.
#Download and install [http://tortoisesvn.sourceforge.net/ TortoiseSVN]. Reboot after install.
#Create a destination directory for the source
#Create a destination directory for the source
Line 21: Line 23:
#That's it. The source code should be downloading now.
#That's it. The source code should be downloading now.


===Step-by-Step How-To (Mac, Linux, Unix)===
==Step-by-Step How-To (Mac, Linux, Unix)==
# Download and install [http://subversion.tigris.org/project_packages.html subversion].
# Download and install [http://subversion.tigris.org/project_packages.html subversion].
# From a terminal window navigate to a directory that you would like to checkout the code to
# From a terminal window navigate to a directory that you would like to checkout the code to
Line 39: Line 41:
# Once the checkout is complete there will be a folder named 'limsurvey' (or dir_name) in your current terminal working directory containing the source.
# Once the checkout is complete there will be a folder named 'limsurvey' (or dir_name) in your current terminal working directory containing the source.


===Accessing Old Releases===
==Accessing Old Releases==


Old releases are stored in https://limesurvey.svn.sourceforge.net/svnroot/limesurvey/releases .
Old releases are stored in https://limesurvey.svn.sourceforge.net/svnroot/limesurvey/releases .
=Important files=
If you want to get familiar with Limesurvey code these are the most important files:
==Root folder==
'''Configuration files:'''
* config.php
* config-ldap.php
* config-defaults.php
'''Survey core files:'''
* common.php: common functions used in 'survey at runtime' code and in 'admin gui code'
* ldap-functions.php: common functions for ldap connector (currently only used in import tokens)
* qanda.php: functions handling questions (display, ...)
* question.php: code handling '1 question per page' kind of survey
* group.php: code handling '1 group per page' kind of survey
* survey.php: code handling 'All in one page' kind of survey
* register.php: code handling public registration to survey
* verfification.php: code handling captcha registration check(image verification to avoid non human regostration)
* load.php: code handling partial survey completion saving
* save.php: code that actually records answers in the database at survey runtime
==Admin folder==
When accessing the admin GUI the following scripts are used:
* admin.php: main admin script which checks for user rights for the accessed action and reads the 'action' get parameter to call the desired submodule
* login_check.php: security code that checks that the session is authenticated
* access_denied.php: action forbidden screen
The admin section consist of several submodules. To see which one is called the passed 'subaction' value is checked by the "if ($action == ...") statements in admin.php (lines 54-213). A submodule reads the 'subaction' get parameter to process the corresponding part of the code . This submodule writes its output to a variable (for instance $tokenoutput for the tokens.php file) and this variable is then appended by admin.php to the adminoutput
(see admin.php lines 216-274).
==Dealing with languages==
To translate string the language.php class is used. Translated strings can be added in any part of the admin GUI
code by using the global variable $clang.
Examples:
* For htmlized translation of Yes use $clang->gT("Yes")
* For javascript-escaped translation of Yes use $clang->gT("Yes","js")
* For unescaped translation of Yes use $clang->gT("Yes","unescaped"). This one is used when you want to compare a "translated Get param" that was sent as htmlized string but received as unescaped string

Revision as of 19:24, 15 January 2010

Accessing the LimeSurvey v1/v2 Source Code

Always be aware that LimeSurvey Source code is bleeding edge. Do not use it for production purposes!

As for many other free software projects only community support is available.

Access the LimeSurvey source code with a Subversion client for your operating system.

  • For Windows we recommend: TortoiseSVN. TortoiseSVN integrates nicely with explorer and is very easy to use.
  • For Mac we recommend: subversion. Commandline all the way ;)

Step-by-Step How-To (Windows)

  1. Download and install TortoiseSVN. Reboot after install.
  2. Create a destination directory for the source
  3. Change to that directory
  4. Right-click into the directory and choose 'SVN Checkout'
  5. You'll be prompted for the repository URL. Enter the following URL:
    1. For LimeSurvey 1.x latest stable source (including fixes): https://limesurvey.svn.sourceforge.net/svnroot/limesurvey/source/limesurvey
    2. For LimeSurvey 1.x latest development source (unstable, including newer features): https://limesurvey.svn.sourceforge.net/svnroot/limesurvey/source/limesurvey_dev
    3. For LimeSurvey 2.x source: https://limesurvey.svn.sourceforge.net/svnroot/limesurvey/source/limesurvey20
  6. That's it. The source code should be downloading now.

Step-by-Step How-To (Mac, Linux, Unix)

  1. Download and install subversion.
  2. From a terminal window navigate to a directory that you would like to checkout the code to
  3. Type one of the following into the terminal:

+For LimeSurvey 1.x source:

  1.  For LimeSurvey 1.x latest stable source (including fixes):

+svn co https://limesurvey.svn.sourceforge.net/svnroot/limesurvey/source/limesurvey

  1. For LimeSurvey 1.x latest development source (unstable, including newer features):

+svn co https://limesurvey.svn.sourceforge.net/svnroot/limesurvey/source/limesurvey_dev

+For LimeSurvey 2.x source:

  1. Once the checkout is complete there will be a folder named 'limsurvey' (or dir_name) in your current terminal working directory containing the source.

Accessing Old Releases

Old releases are stored in https://limesurvey.svn.sourceforge.net/svnroot/limesurvey/releases .

Important files

If you want to get familiar with Limesurvey code these are the most important files:

Root folder

Configuration files:

  • config.php
  • config-ldap.php
  • config-defaults.php

Survey core files:

  • common.php: common functions used in 'survey at runtime' code and in 'admin gui code'
  • ldap-functions.php: common functions for ldap connector (currently only used in import tokens)
  • qanda.php: functions handling questions (display, ...)
  • question.php: code handling '1 question per page' kind of survey
  • group.php: code handling '1 group per page' kind of survey
  • survey.php: code handling 'All in one page' kind of survey
  • register.php: code handling public registration to survey
  • verfification.php: code handling captcha registration check(image verification to avoid non human regostration)
  • load.php: code handling partial survey completion saving
  • save.php: code that actually records answers in the database at survey runtime

Admin folder

When accessing the admin GUI the following scripts are used:

  • admin.php: main admin script which checks for user rights for the accessed action and reads the 'action' get parameter to call the desired submodule
  • login_check.php: security code that checks that the session is authenticated
  • access_denied.php: action forbidden screen

The admin section consist of several submodules. To see which one is called the passed 'subaction' value is checked by the "if ($action == ...") statements in admin.php (lines 54-213). A submodule reads the 'subaction' get parameter to process the corresponding part of the code . This submodule writes its output to a variable (for instance $tokenoutput for the tokens.php file) and this variable is then appended by admin.php to the adminoutput

(see admin.php lines 216-274).

Dealing with languages

To translate string the language.php class is used. Translated strings can be added in any part of the admin GUI

code by using the global variable $clang.

Examples:

  • For htmlized translation of Yes use $clang->gT("Yes")
  • For javascript-escaped translation of Yes use $clang->gT("Yes","js")
  • For unescaped translation of Yes use $clang->gT("Yes","unescaped"). This one is used when you want to compare a "translated Get param" that was sent as htmlized string but received as unescaped string