diff --git a/application/config/packages.php b/application/config/packages.php
index 41e5fcc0a87..7d7460bec89 100644
--- a/application/config/packages.php
+++ b/application/config/packages.php
@@ -641,6 +641,17 @@
'decimal',
)
),
+ 'expressionscript' => array(
+ 'devBaseUrl' => 'assets/packages/expressionscript/',
+ 'basePath' => 'core.expressionscript',
+ 'position' =>CClientScript::POS_END,
+ 'js' => array(
+ 'expression.js',
+ ),
+ 'css' => array(
+ 'expressions.css'
+ )
+ ),
/* Replace bbq package from Yii core to set position */
'bbq'=>array(
'position' => CClientScript::POS_BEGIN,
diff --git a/application/controllers/admin/ExpressionValidate.php b/application/controllers/admin/ExpressionValidate.php
index 9f1571bc423..49548008eea 100644
--- a/application/controllers/admin/ExpressionValidate.php
+++ b/application/controllers/admin/ExpressionValidate.php
@@ -270,9 +270,9 @@ private function getHtmlExpression($sExpression, $aReplacement = array(), $sDebu
}
// TODO : Find error in class name, style etc ....
// need: templatereplace without any filter and find if there are error but $bHaveError=$LEM->em->HasErrors() is Private
+ templatereplace(viewHelper::filterScript($sExpression), $aReplacement, $aReData, $sDebugSource, false, null, array(), true);
$oFilter = new CHtmlPurifier();
- templatereplace($oFilter->purify(viewHelper::filterScript($sExpression)), $aReplacement, $aReData, $sDebugSource, false, null, array(), true);
- return $LEM::GetLastPrettyPrintExpression();
+ return $oFilter->purify($LEM::GetLastPrettyPrintExpression());
}
}
diff --git a/application/controllers/admin/emailtemplates.php b/application/controllers/admin/emailtemplates.php
index 8cc3a2f7175..c392609677f 100644
--- a/application/controllers/admin/emailtemplates.php
+++ b/application/controllers/admin/emailtemplates.php
@@ -189,7 +189,8 @@ function view($iSurveyId)
$aData['grplangs'] = $grplangs;
App()->getClientScript()->registerPackage('emailtemplatesold');
-
+ App()->getClientScript()->registerPackage('expressionscript');
+
$this->_renderWrappedTemplate('emailtemplates', array('output' => $sEditScript, 'emailtemplates_view'), $aData);
}
diff --git a/application/controllers/admin/expressions.php b/application/controllers/admin/expressions.php
index 2389959d9dc..cf9396ed80c 100644
--- a/application/controllers/admin/expressions.php
+++ b/application/controllers/admin/expressions.php
@@ -103,8 +103,7 @@ public function survey_logic_file()
$aData['subaction'] = gT("Survey logic file");
$aData['sidemenu']['state'] = false;
$aData['survey'] = $oSurvey;
-
- $LEM_DEBUG_TIMING = Yii::app()->request->getParam('LEM_DEBUG_TIMING', LEM_DEBUG_TIMING);
+ $LEM_DEBUG_TIMING = Yii::app()->request->getParam('LEM_DEBUG_TIMING',(App()->getConfig('debug')>0)?LEM_DEBUG_TIMING:0);
$LEM_DEBUG_VALIDATION_SUMMARY = Yii::app()->request->getParam('LEM_DEBUG_VALIDATION_SUMMARY', LEM_DEBUG_VALIDATION_SUMMARY);
$LEM_DEBUG_VALIDATION_DETAIL = Yii::app()->request->getParam('LEM_DEBUG_VALIDATION_DETAIL', LEM_DEBUG_VALIDATION_DETAIL);
$LEM_PRETTY_PRINT_ALL_SYNTAX = Yii::app()->request->getParam('LEM_PRETTY_PRINT_ALL_SYNTAX', LEM_PRETTY_PRINT_ALL_SYNTAX);
diff --git a/application/controllers/admin/themeoptions.php b/application/controllers/admin/themeoptions.php
index b7f67550d89..357522a5c73 100644
--- a/application/controllers/admin/themeoptions.php
+++ b/application/controllers/admin/themeoptions.php
@@ -634,8 +634,8 @@ private function updateCommon(TemplateConfiguration $model, $sid = null, $gsid =
$aData['surveybar']['buttons']['view'] = true;
$aData['surveybar']['savebutton']['form'] = true;
$aData['surveyid'] = $sid;
- $aData['title_bar']['title'] = gT("Survey template options");
- $aData['subaction'] = gT("Survey template options");
+ $aData['title_bar']['title'] = gT("Survey theme options");
+ $aData['subaction'] = gT("Survey theme options");
}
$this->_renderWrappedTemplate('themeoptions', 'update', $aData);
diff --git a/application/core/LS_Twig_Extension.php b/application/core/LS_Twig_Extension.php
index 1474c2a5268..a8f8982c677 100644
--- a/application/core/LS_Twig_Extension.php
+++ b/application/core/LS_Twig_Extension.php
@@ -475,9 +475,9 @@ public static function unregisterScriptForAjax()
self::unregisterPackage('fontawesome');
self::unregisterPackage('template-default-ltr');
self::unregisterPackage('decimal');
- self::unregisterPackage('expressions');
+ self::unregisterPackage('expressions');
+ self::unregisterPackage('expressionscript');
self::unregisterScriptFile('/assets/scripts/survey_runtime.js');
- self::unregisterScriptFile('/assets/scripts/admin/expression.js');
self::unregisterScriptFile('/assets/scripts/nojs.js');
}
diff --git a/application/helpers/expressions/em_core_helper.php b/application/helpers/expressions/em_core_helper.php
index eb8b7ef2988..e47e4e5d677 100644
--- a/application/helpers/expressions/em_core_helper.php
+++ b/application/helpers/expressions/em_core_helper.php
@@ -1493,7 +1493,7 @@ public function GetPrettyPrintString()
$stringParts[] = CHtml::tag('span',array(
'title' => !empty( $messages) ? implode('; ', $messages) : null,
'class'=> 'em-var-string'
- ),"'".$token[0]."'");
+ ),"'".CHtml::encode($token[0])."'");
break;
case 'SGQA':
case 'WORD':
@@ -1638,8 +1638,7 @@ public function GetPrettyPrintString()
}
}
if ($this->sid && Permission::model()->hasSurveyPermission($this->sid, 'surveycontent', 'update') && method_exists(App(), 'getClientScript')) {
- App()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl')."expressions.css");
- App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts')."expression.js");
+ App()->getClientScript()->registerPackage('expressionscript');
}
$sClass = 'em-expression';
$sClass .= ($bHaveError) ? " em-haveerror" : "";
diff --git a/application/helpers/expressions/em_manager_helper.php b/application/helpers/expressions/em_manager_helper.php
index f05c27f1b32..d20f03c1526 100644
--- a/application/helpers/expressions/em_manager_helper.php
+++ b/application/helpers/expressions/em_manager_helper.php
@@ -6710,6 +6710,7 @@ function ($sqRankAnwsers) {
}
if (!($qInfo['type'] == Question::QT_EXCLAMATION_LIST_DROPDOWN || $qInfo['type'] == Question::QT_L_LIST_DROPDOWN))
{
+ $sMandatoryText = $LEM->gT('Please check at least one item.');
$mandatoryTip .= App()->twigRenderer->renderPartial('/survey/questions/question_help/mandatory_tip.twig', array(
'sMandatoryText'=>$sMandatoryText,
'part' => 'multiplechoice',
diff --git a/application/views/admin/survey/prepareEditorScript_view.php b/application/views/admin/survey/prepareEditorScript_view.php
index 624de7090a8..387edc3f248 100644
--- a/application/views/admin/survey/prepareEditorScript_view.php
+++ b/application/views/admin/survey/prepareEditorScript_view.php
@@ -18,6 +18,18 @@
dialogDefinition.removeContents( 'Upload' );
}
});
+ ";
+
+/**
+* @todo This following three JS lines are a hack to keep the most common usage of
in ExpressionScript from breaking the expression,
+* because the HTML editor will insert linebreaks after every
, even if it is inside a ExpressionScript tag {}
+* The proper way to fix this would be to merge a plugin like ShowProtected (https://github.com/IGx89/CKEditor-ShowProtected-Plugin)
+* with LimeReplacementFields and in general use ProtectSource for ExpressionScript
+* See https://stackoverflow.com/questions/2851068/prevent-ckeditor-from-formatting-code-in-source-mode
+*/
+$script.="CKEDITOR.on('instanceReady', function(event) {
+ event.editor.dataProcessor.writer.setRules( 'br', { breakAfterOpen: 0 } );
+ });
var sReplacementFieldTitle = '".gT('Placeholder fields','js')."';
var sReplacementFieldButton = '".gT('Insert/edit placeholder field','js')."';
diff --git a/application/views/admin/survey/subview/accordion/_generaloptions_panel.php b/application/views/admin/survey/subview/accordion/_generaloptions_panel.php
index 7fcc2cf3931..d8cf57990c3 100755
--- a/application/views/admin/survey/subview/accordion/_generaloptions_panel.php
+++ b/application/views/admin/survey/subview/accordion/_generaloptions_panel.php
@@ -323,7 +323,7 @@ function checkSelect2Languages(mylangs) {