Commit cf5b5329 authored by Chenu Denis's avatar Chenu Denis

[feature] Translation

parent 2e43c46f
......@@ -19,12 +19,20 @@ This add a new advanced setting in all question where user can just put javascri
- Extract : `unzip addScriptToQuestion.zip`
- Move the directory to plugins/ directory inside LimeSurvey
## Contribute
Contribution are welcome, for patch and issue : use [gitlab](https://gitlab.com/SondagesPro/addScriptToQuestion) still the preferred solution.
Translation can be done at [translate.sondages.pro](https://translate.sondages.pro/projects/addscripttoquestion/).
If there are issue with english string : it's a PHP issue, not a language issue.
## Home page & Copyright
- HomePage <http://extensions.sondages.pro/>
- Copyright © 2016 Denis Chenu <http://sondages.pro>
- Licence : GNU Affero General Public License <https://www.gnu.org/licenses/agpl-3.0.html>
## Changelog
- 2018-03-09 [2.2.0] Translation
- 2018-03-09 [2.1.0] Usage of XSS security
- 2018-03-08 [2.0.0] LimeSurvey 3.X version (tested on 3.4.4)
- 2017-06-27 [1.0.2] Fix {SGQ} replacement
......
<?php
/**
* Allow to add script to question.
* @todo Show (and update/add) the settings according to XSS
*
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2016-2018 Denis Chenu <http://www.sondages.pro>
* @license AGPL v3
* @version 2.1.0
* @version 2.2.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
......@@ -82,6 +81,7 @@ class addScriptToQuestion extends PluginBase
*/
public function addScriptAttribute()
{
$readonly = Yii::app()->getConfig('filterxsshtml') && !Permission::model()->hasGlobalPermission('superadmin', 'read');
$scriptAttributes = array(
'javascript'=>array(
'types'=>'15ABCDEFGHIKLMNOPQRSTUWXYZ!:;|*', /* Whole question type */
......@@ -90,28 +90,28 @@ class addScriptToQuestion extends PluginBase
'inputtype'=>'textarea',
'default'=>'', /* not needed (it's already the default) */
'expression'=>1,/* As static */
'readonly'=>Yii::app()->getConfig('filterxsshtml') && !Permission::model()->hasGlobalPermission('superadmin', 'read'),
'help'=>gT('You don\'t have to add script tag, script is register by LimeSurvey. You can use Expression, this expression is static (no update during runtime).'),
'caption'=>gT('Javascript for this question'),
'readonly'=>$readonly,
'help'=>$this->gT("You don't have to add script tag, script is register by LimeSurvey. You can use expressions, this one is static (no update during run-time)."),
'caption'=>$this->gT('Javascript for this question'),
),
);
if($this->get('scriptPositionAvailable',null,null,$this->settings['scriptPositionAvailable']['default'])){
if($this->get('scriptPositionAvailable',null,null,$this->settings['scriptPositionAvailable']['default']) && !$readonly){
$scriptAttributes['scriptPosition']=array(
'types'=>'15ABCDEFGHIKLMNOPQRSTUWXYZ!:;|*', /* Whole question type */
'category'=>gT('Script'),
'sortorder'=>1,
'inputtype'=>'singleselect',
'options'=>array(
CClientScript::POS_HEAD=>"The script is inserted in the head section right before the title element (POS_HEAD).",
CClientScript::POS_BEGIN=>"The script is inserted at the beginning of the body section (POS_BEGIN).",
CClientScript::POS_END=>"The script is inserted at the end of the body section (POS_END).",
CClientScript::POS_LOAD=>"the script is inserted in the window.onload() function (POS_LOAD).",
CClientScript::POS_READY=>"the script is inserted in the jQuery's ready function (POS_READY).",
CClientScript::POS_HEAD=>$this->gT("The script is inserted in the head section right before the title element (POS_HEAD)."),
CClientScript::POS_BEGIN=>$this->gT("The script is inserted at the beginning of the body section (POS_BEGIN)."),
CClientScript::POS_END=>$this->gT("The script is inserted at the end of the body section (POS_END)."),
CClientScript::POS_LOAD=>$this->gT("The script is inserted in the window.onload() function (POS_LOAD)."),
CClientScript::POS_READY=>$this->gT("The script is inserted in the jQuery's ready function (POS_READY)."),
),
'default'=>$this->get('scriptPositionDefault',null,null,$this->settings['scriptPositionDefault']['default']),
'readonly'=>Yii::app()->getConfig('filterxsshtml') && !Permission::model()->hasGlobalPermission('superadmin', 'read'),
'help'=>gT('Set the position of the script, see http://www.yiiframework.com/doc/api/1.1/CClientScript#registerScript-detail .'),
'caption'=>gT('Position for the script'),
'help'=>sprintf($this->gT('Set the position of the script, see <a href="%s">Yii manual</a>.'),'http://www.yiiframework.com/doc/api/1.1/CClientScript#registerScript-detail'),
'caption'=>$this->gT('Position for the script'),
);
}
......
File added
msgid ""
msgstr ""
"Project-Id-Version: addScriptToQuestion\n"
"POT-Creation-Date: 2018-03-09 16:07+0100\n"
"PO-Revision-Date: 2018-03-09 16:17+0100\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.6\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: gT\n"
"Last-Translator: Denis Chenu <contact@sondages.pro>\n"
"Language: fr\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: locale\n"
#: addScriptToQuestion.php:88 addScriptToQuestion.php:101
msgid "Script"
msgstr "Script"
#: addScriptToQuestion.php:94
msgid ""
"You don't have to add script tag, script is register by LimeSurvey. You can "
"use expressions, this one is static (no update during run-time)."
msgstr ""
"Vous n‘avez pas à ajouter la balise script, celle-ci est gérée par "
"LimeSurvey. Vous pouvez utiliser les expressions, celles-ci sont statiques "
"(pas de mise à jour en réel)."
#: addScriptToQuestion.php:95
msgid "Javascript for this question"
msgstr "Java-script pour cette question"
#: addScriptToQuestion.php:105
msgid ""
"The script is inserted in the head section right before the title element "
"(POS_HEAD)."
msgstr ""
"Le script est inséré dans la partie head juste avant la balise title "
"(POS_HEAD)."
#: addScriptToQuestion.php:106
msgid ""
"The script is inserted at the beginning of the body section (POS_BEGIN)."
msgstr "Le script est inséré au début de la partie body (POS_BEGIN)."
#: addScriptToQuestion.php:107
msgid "The script is inserted at the end of the body section (POS_END)."
msgstr "Le script est inséré à la fin de la partie body (POS_END)."
#: addScriptToQuestion.php:108
msgid "The script is inserted in the window.onload() function (POS_LOAD)."
msgstr "Le script est inséré dans la fonction windows.onload() (POS_LOAD)."
#: addScriptToQuestion.php:109
msgid "The script is inserted in the jQuery's ready function (POS_READY)."
msgstr "Le script est inséré dans la fonction de jQuery ready (POS_READY)."
#: addScriptToQuestion.php:113
#, php-format
msgid "Set the position of the script, see <a href=\"%s\">Yii manual</a>."
msgstr ""
"Décider de la position du script, voir <a href=\"%s\">la manuel de Yii</a>."
#: addScriptToQuestion.php:114
msgid "Position for the script"
msgstr "Position du script"
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: addScriptToQuestion\n"
"POT-Creation-Date: 2018-03-09 16:07+0100\n"
"PO-Revision-Date: 2018-03-09 08:54+0100\n"
"Last-Translator: Denis Chenu <contact@sondages.pro>\n"
"Language-Team: \n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.6\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: gT\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: locale\n"
#: addScriptToQuestion.php:88 addScriptToQuestion.php:101
msgid "Script"
msgstr ""
#: addScriptToQuestion.php:94
msgid ""
"You don't have to add script tag, script is register by LimeSurvey. You can "
"use expressions, this one is static (no update during run-time)."
msgstr ""
#: addScriptToQuestion.php:95
msgid "Javascript for this question"
msgstr ""
#: addScriptToQuestion.php:105
msgid ""
"The script is inserted in the head section right before the title element "
"(POS_HEAD)."
msgstr ""
#: addScriptToQuestion.php:106
msgid ""
"The script is inserted at the beginning of the body section (POS_BEGIN)."
msgstr ""
#: addScriptToQuestion.php:107
msgid "The script is inserted at the end of the body section (POS_END)."
msgstr ""
#: addScriptToQuestion.php:108
msgid "The script is inserted in the window.onload() function (POS_LOAD)."
msgstr ""
#: addScriptToQuestion.php:109
msgid "The script is inserted in the jQuery's ready function (POS_READY)."
msgstr ""
#: addScriptToQuestion.php:113
#, php-format
msgid "Set the position of the script, see <a href=\"%s\">Yii manual</a>."
msgstr ""
#: addScriptToQuestion.php:114
msgid "Position for the script"
msgstr ""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment