Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	application/config/version.php
	application/controllers/admin/expressions.php
	application/core/LSHttpRequest.php
	application/helpers/admin/import_helper.php
  • Loading branch information
olleharstedt committed Jun 29, 2018
2 parents 28a835e + 9aa3315 commit e536ed2
Show file tree
Hide file tree
Showing 124 changed files with 12,858 additions and 2,527 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
!.gitattributes
!.editorconfig
!.travis.yml
!.babelrc


# upload directory : whole except the index.html and readme.txt
Expand Down Expand Up @@ -73,6 +74,7 @@ third_party/**/less/
third_party/**/*.sh
third_party/**/*.md
third_party/**/gulpfile.js
yarn-error.log

# Test stuff
chromedriver
Expand Down
3 changes: 2 additions & 1 deletion application/config/config-sample-dblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
'initSQLs'=>array('SET DATEFORMAT ymd;', 'SET QUOTED_IDENTIFIER ON;'),
),

// Uncomment the following line if you need table-based sessions
// Uncomment the following lines if you need table-based sessions.
// Note: Table-based sessions are currently not supported on MSSQL server.
// 'session' => array (
// 'class' => 'application.core.web.DbHttpSession',
// 'connectionID' => 'db',
Expand Down
3 changes: 2 additions & 1 deletion application/config/config-sample-mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
'tablePrefix' => 'lime_',
),

// Uncomment the following line if you need table-based sessions
// Uncomment the following lines if you need table-based sessions.
// Note: Table-based sessions are currently not supported on MSSQL server.
// 'session' => array (
// 'class' => 'application.core.web.DbHttpSession',
// 'connectionID' => 'db',
Expand Down
3 changes: 2 additions & 1 deletion application/config/config-sample-pgsql.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
'tablePrefix' => 'lime_',
),

// Uncomment the following line if you need table-based sessions
// Uncomment the following lines if you need table-based sessions.
// Note: Table-based sessions are currently not supported on MSSQL server.
// 'session' => array (
// 'class' => 'application.core.web.DbHttpSession',
// 'connectionID' => 'db',
Expand Down
3 changes: 2 additions & 1 deletion application/config/config-sample-sqlsrv.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
'initSQLs'=>array('SET DATEFORMAT ymd;', 'SET QUOTED_IDENTIFIER ON;'),
),

// Uncomment the following line if you need table-based sessions
// Uncomment the following lines if you need table-based sessions.
// Note: Table-based sessions are currently not supported on MSSQL server.
// 'session' => array (
// 'class' => 'application.core.web.DbHttpSession',
// 'connectionID' => 'db',
Expand Down
11 changes: 11 additions & 0 deletions application/config/questiontypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,15 @@
'scripts/array-totalsum'.$minVersion.'.js',
),
),
/* array-numeric question */
'timer-addition'=>array(
'devBaseUrl' => 'assets/packages/questions/timer/',
'basePath' => 'core.questions.timer',
'position' => CClientScript::POS_BEGIN,
'css'=> array(
),
'js'=>array(
'timer'.$minVersion.'.js',
),
),
);
11 changes: 5 additions & 6 deletions application/config/third_party.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
'yiistrap'.$minVersion.'.css',
),
'js'=>array(
'bootstrap'.$minVersion.'.js'
'bootstrap'.$minVersion.'.js',
'plugins/bootstrapconfirm/bootstrapconfirm'.$minVersion.'.js'
),
'depends' => array(
'jquery',
Expand Down Expand Up @@ -344,13 +345,11 @@
),

'jquery-datatable' => array(
'basePath' => 'third_party.jquery-datatable',
'basePath' => 'third_party.datatables',
'position' => CClientScript::POS_BEGIN,
'css' => array(
'datatables.min.css'
),
'js' => array(
'datatables.js'
'js/jquery.dataTables'.$minVersion.'.js',
'js/dataTables.bootstrap'.$minVersion.'.js'
),
'depends' => array(
'jquery',
Expand Down
2 changes: 1 addition & 1 deletion application/config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
$config['dbversionnumber'] = 403;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '30045';
$config['assetsversionnumber'] = '30046';
return $config;
3 changes: 2 additions & 1 deletion application/controllers/InstallerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,8 @@ private function _writeConfigFile()
$sConfig .= "\t\t"."),"."\n"
."\t\t".""."\n"

."\t\t"."// Uncomment the following line if you need table-based sessions"."\n"
."\t\t"."// Uncomment the following lines if you need table-based sessions."."\n"
."\t\t"."// Note: Table-based sessions are currently not supported on MSSQL server."."\n"
."\t\t"."// 'session' => array ("."\n"
."\t\t\t"."// 'class' => 'application.core.web.DbHttpSession',"."\n"
."\t\t\t"."// 'connectionID' => 'db',"."\n"
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function actionIndex($sid = null)
$directLogin = $event->get('directLogin', false);
if ($directLogin == true) {
$oToken = Token::model($iSurveyId)->findByPk($iTokenId);
$redirectUrl = Yii::app()->getController()->createUrl('/'.$iSurveyId.'/', array('token' => $oToken->token, 'lang'=>$sLanguage));
$redirectUrl = Yii::app()->getController()->createUrl('/survey/', array('sid' => $iSurveyId,'token' => $oToken->token, 'lang'=>$sLanguage));
Yii::app()->getController()->redirect($redirectUrl);
Yii::app()->end();
}
Expand Down
12 changes: 7 additions & 5 deletions application/controllers/admin/expressions.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,31 @@ function index()
{
$aData = array();
$needpermission = false;

$iSurveyID = sanitize_int(Yii::app()->request->getQuery('surveyid', false));
if (!$iSurveyID) {
$iSurveyID = sanitize_int(Yii::app()->request->getQuery('sid'));
}

$aData['sa'] = $sa = sanitize_paranoid_string(Yii::app()->request->getQuery('sa', 'index'));

$aData['fullpagebar']['closebutton']['url'] = 'admin/'; // Close button

if (($aData['sa'] == 'survey_logic_file' || $aData['sa'] == 'navigation_test') && $iSurveyID) {
$needpermission = true;
}

if ($needpermission && !Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'read')) {
$message['title'] = gT('Access denied!');
$message['message'] = gT('You do not have permission to access this page.');
$message['class'] = "error";
$this->_renderWrappedTemplate('survey', array("message"=>$message), $aData);
} else {


App()->getClientScript()->registerPackage('jqueryui');
App()->getClientScript()->registerPackage('decimal');
App()->getClientScript()->registerPackage('expressions');/* Why we need it ? */
App()->getClientScript()->registerPackage('decimal');
App()->getClientScript()->registerScriptFile(App()->getConfig('generalscripts').'survey_runtime.js');
$this->_printOnLoad(Yii::app()->request->getQuery('sa', 'index'));
$aData['pagetitle'] = "ExpressionManager: {$aData['sa']}";
Expand Down
1 change: 0 additions & 1 deletion application/controllers/admin/surveyadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ public function newsurvey()
$arrayed_data['data'] = $aData;
$arrayed_data['title_bar']['title'] = gT('New survey');
$arrayed_data['fullpagebar']['savebutton']['form'] = 'addnewsurvey';
$arrayed_data['fullpagebar']['saveandclosebutton']['form'] = 'addnewsurvey';
$arrayed_data['fullpagebar']['closebutton']['url'] = 'admin/index'; // Close button

$this->_renderWrappedTemplate('survey', $aViewUrls, $arrayed_data);
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/useraction.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ private function _refreshtemplates()
// if not create it with current user as creator (user with rights "create user" can assign template rights)
$result = Template::model()->findByPk($tp);

if (count($result) == 0) {
if ($result == NULL) {
$post = new Template;
$post->folder = $tp;
$post->owner_id = Yii::app()->session['loginID'];
Expand Down
22 changes: 20 additions & 2 deletions application/core/LSETwigViewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ public function addExtensions($extensions)

/**
* get a twig file and return html produced
* @param string $twigView twigfile to be used (without twig extension) (example ./subviews/ajax/messages)
* @param string $twigView twigfile to be used (with twig extension)
* @param array $aData to be used
* @return string
*/
Expand All @@ -522,7 +522,25 @@ public function renderPartial($twigView,$aData)
$oTemplate = Template::model()->getInstance();
$aDatas = $this->getAdditionalInfos($aDatas, $oTemplate);
$this->addRecursiveTemplatesPath($oTemplate);
return $this->_twig->loadTemplate($twigView.'.twig')->render($aData);
return $this->_twig->loadTemplate($twigView)->render($aData);
}

/**
* Get the final source file for current context
* Currently used in theme editor
* @param string $twigView twigfile to be used (with twig extension)
* @param TemplateConfiguration $oTemplate
* @return string complete filename to be used
*/
public function getPathOfFile($twigView,$oTemplate=null)
{
if(!$oTemplate) {
$oTemplate = Template::model()->getInstance();
}
$this->addRecursiveTemplatesPath($oTemplate);
if(!$this->_twig->getLoader()->exists($twigView)) {
return null;
}
return $this->_twig->getLoader()->getSourceContext($twigView)->getPath();
}
}
23 changes: 12 additions & 11 deletions application/core/LSHttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,18 @@ protected function normalizeRequest()
$validationRoutes = $this->noCsrfValidationRoutes;
$validationParams = [];

if(preg_match('/admin/', $route)){
$beforeUrlCheck = new PluginEvent('beforeUrlCheck');
$beforeUrlCheck->set('routes', $validationRoutes);
$beforeUrlCheck->set('params', $validationParams);
App()->getPluginManager()->dispatchEvent($beforeUrlCheck);
$validationRoutes = $beforeUrlCheck->get('routes');
$validationParams = $beforeUrlCheck->get('params', []);
} else {
$validationRoutes = [];
$validationParams = [];
}
// if(preg_match('/admin/', $route)){
// $beforeUrlCheck = new PluginEvent('beforeUrlCheck');
// $beforeUrlCheck->set('routes', $validationRoutes);
// $beforeUrlCheck->set('params', $validationParams);
// App()->getPluginManager()->dispatchEvent($beforeUrlCheck);
// $validationRoutes = $beforeUrlCheck->get('routes');
// $validationParams = $beforeUrlCheck->get('params', []);
// }
//} else {
// $validationRoutes = [];
// $validationParams = [];
//}

foreach ($validationRoutes as $cr) {
if (preg_match('#'.$cr.'#', $route)) {
Expand Down
5 changes: 3 additions & 2 deletions application/core/LsDefaultDataSets.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ public static function getTutorialEntryData()
'redirect' => false,
'onNext' => "(function(tour){
tour.setCurrentStep(8);
$('#save-form-button').trigger('click');
if(!$('#save-form-button').hasClass('disabled'))
$('#save-form-button').trigger('click');
return new Promise(function(res,rej){});
})",
))
Expand Down Expand Up @@ -650,7 +651,7 @@ public static function getTutorialEntryData()
.gT("This type of question allows you to add multiple subquestions and a set of answers.")
.'<p class="alert bg-warning">'.gT("Please select the 'Array'-type.").'</p>',
'settings' => json_encode(array(
'element' => '#question_type_button',
'element' => '#trigger_questionTypeSelector_button',
'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']],
'placement' => 'left',
'redirect' => false,
Expand Down
2 changes: 2 additions & 0 deletions application/core/db/MssqlSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public function __construct($conn)
$this->columnTypes['autoincrement'] = 'integer NOT NULL IDENTITY (1,1)';

$this->columnTypes['longbinary'] = 'varbinary(max)';

$this->columnTypes['binary'] = 'varbinary(max)';
}


Expand Down
7 changes: 6 additions & 1 deletion application/extensions/LimeScript/LimeScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ public function run()
$data['replacementFields']['path'] = App()->createUrl("admin/limereplacementfields/sa/index/");
$json = json_encode($data, JSON_FORCE_OBJECT);
$script = "LS.data = $json;\n"
. "LS.lang = {};\n"
. "LS.lang = {
confirm: {
confirm_cancel: '".gT('Cancel')."',
confirm_ok: '".gT('OK')."'
}
};\n"
. "$.ajaxSetup({data: {YII_CSRF_TOKEN: LS.data.csrfToken}});";
App()->getClientScript()->registerScript('LimeScript', $script, CClientScript::POS_HEAD);
}
Expand Down
7 changes: 6 additions & 1 deletion application/helpers/SurveyRuntimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,12 @@ public function setJavascriptVar($iSurveyId = '')
$aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
$aRadix = getRadixPointData($aSurveyinfo['surveyls_numberformat']);
$aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
$aLSJavascriptVar['lang'] = new stdClass; // To add more easily some lang string here
$aLSJavascriptVar['lang'] = [
"confirm" => [
"confirm_cancel" => gT('Cancel'),
"confirm_ok" => gT('OK'),
],
]; // To add more easily some lang string here
$aLSJavascriptVar['showpopup'] = (int) Yii::app()->getConfig('showpopups');
$aLSJavascriptVar['startPopups'] = new stdClass;
$aLSJavascriptVar['debugMode'] = Yii::app()->getConfig('debug');
Expand Down
8 changes: 8 additions & 0 deletions application/helpers/admin/import_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ function XMLImportGroup($sFullFilePath, $iNewSID)
$oQuestion->setAttributes($insertdata, false);

if (!isset($aQIDReplacements[$iOldQID])) {
switchMSSQLIdentityInsert('questions', false);
// Try to fix question title for valid question code enforcement
if (!$oQuestion->validate(array('title'))) {
$sOldTitle = $oQuestion->title;
Expand Down Expand Up @@ -624,9 +625,16 @@ function XMLImportQuestion($sFullFilePath, $iNewSID, $newgid, $options = array('
unset($sOldTitle);
}
}
if (isset($insertdata['qid'])) {
switchMSSQLIdentityInsert('questions', true);
}

if (!$oQuestion->save()) {
$results['fatalerror'] = CHtml::errorSummary($oQuestion, gT("The question could not be imported for the following reasons:"));
return $results;
}
if (isset($insertdata['qid'])) {
switchMSSQLIdentityInsert('questions', false);
}
$aQIDReplacements[$iOldQID] = $oQuestion->qid; ;
$results['questions']++;
Expand Down
4 changes: 2 additions & 2 deletions application/helpers/export_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ function quexml_create_multi(&$question, $qid, $varname, $iResponseID, $fieldmap
$fixed = $dom->createElement("fixed");
$category = $dom->createElement("category");

$label = $dom->createElement("label", quexml_get_lengthth($qid, "other_replace_text", gT("Other")));
$label = $dom->createElement("label", quexml_get_lengthth($qid, "other_replace_text", gT("Other"), $quexmllang));

$value = $dom->createElement("value", $yesvalue);

Expand All @@ -1232,7 +1232,7 @@ function quexml_create_multi(&$question, $qid, $varname, $iResponseID, $fieldmap
$contingentQuestion = $dom->createElement("contingentQuestion");
$length = $dom->createElement("length", 24);
$format = $dom->createElement("format", "longtext");
$text = $dom->createElement("text", quexml_get_lengthth($qid, "other_replace_text", gT("Other")));
$text = $dom->createElement("text", quexml_get_lengthth($qid, "other_replace_text", gT("Other"), $quexmllang));

$contingentQuestion->appendChild($text);
$contingentQuestion->appendChild($length);
Expand Down
14 changes: 12 additions & 2 deletions application/helpers/expressions/em_core_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2218,9 +2218,9 @@ static function ShowAllowableFunctions()
{
$em = new ExpressionManager();
$output = "<div class='h3'>Functions Available within Expression Manager</div>\n";
$output .= "<table border='1'><tr><th>Function</th><th>Meaning</th><th>Syntax</th><th>Reference</th></tr>\n";
$output .= "<table border='1' class='table'><tr><th>Function</th><th>Meaning</th><th>Syntax</th><th>Reference</th></tr>\n";
foreach ($em->RDP_ValidFunctions as $name => $func) {
$output .= "<tr><td>".$name."</td><td>".$func[2]."</td><td>".$func[3]."</td><td>";
$output .= "<thead><tr><th>".$name."</th><th>".$func[2]."</th><th>".$func[3]."</th><th>";

// 508 fix, don't output empty anchor tags
if ($func[4]) {
Expand All @@ -2233,6 +2233,16 @@ static function ShowAllowableFunctions()
return $output;
}

/**
* Show a table of allowable Expression Manager functions
* @return string
*/
static function GetAllowableFunctions()
{
$em = new ExpressionManager();
return $em->RDP_ValidFunctions;
}

/**
* Show a translated string for admin user, always in admin language #12208
* public for geterrors_exprmgr_regexMatch function only
Expand Down

0 comments on commit e536ed2

Please sign in to comment.