Skip to content

Commit

Permalink
Merge branch 'develop' into bug/OP-674-anonymize-ip-adress
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Apr 20, 2020
2 parents 9388a78 + c117562 commit f1b3ec6
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 470 deletions.
11 changes: 11 additions & 0 deletions application/config/packages.php
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/ExpressionValidate.php
Expand Up @@ -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());
}
}
3 changes: 2 additions & 1 deletion application/controllers/admin/emailtemplates.php
Expand Up @@ -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);
}

Expand Down
3 changes: 1 addition & 2 deletions application/controllers/admin/expressions.php
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/themeoptions.php
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions application/core/LS_Twig_Extension.php
Expand Up @@ -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');
}

Expand Down
5 changes: 2 additions & 3 deletions application/helpers/expressions/em_core_helper.php
Expand Up @@ -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':
Expand Down Expand Up @@ -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" : "";
Expand Down
1 change: 1 addition & 0 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -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',
Expand Down
12 changes: 12 additions & 0 deletions application/views/admin/survey/prepareEditorScript_view.php
Expand Up @@ -18,6 +18,18 @@
dialogDefinition.removeContents( 'Upload' );
}
});
";

/**
* @todo This following three JS lines are a hack to keep the most common usage of <br> in ExpressionScript from breaking the expression,
* because the HTML editor will insert linebreaks after every <br>, 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')."';
Expand Down
Expand Up @@ -323,7 +323,7 @@ function checkSelect2Languages(mylangs) {
<!-- Template -->

<div class="form-group">
<label class=" control-label" for='template'><?php eT("Template:"); ?></label>
<label class=" control-label" for='template'><?php eT("Theme:"); ?></label>
<div class="">
<select id='template' class="form-control" name='template' data-updateurl='<?php echo App()->createUrl('/admin/themeoptions/sa/getpreviewtag') ?>' data-inherit-template-name='<?php echo $oSurveyOptions->template?>'>
<?php if ($bShowInherited){ ?>
Expand Down
Expand Up @@ -6,7 +6,7 @@
* @var qInfo : from ExpressionManager
*/
#}
<div class='ls-question-mandatory text-danger' role='alert'>
<div class='ls-question-mandatory ls-question-mandatory-{{part}} text-danger ' role='alert'>
<span class='fa fa-exclamation-circle' aria-hidden="true"></span>
{{ sMandatoryText }}
</div>

0 comments on commit f1b3ec6

Please sign in to comment.