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/helpers/expressions/em_manager_helper.php
	application/views/admin/survey/Question/editQuestion_view.php
  • Loading branch information
olleharstedt committed Mar 29, 2018
2 parents cdd9420 + 2b72013 commit 6f897ac
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 24 deletions.
36 changes: 16 additions & 20 deletions application/helpers/expressions/em_manager_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3922,6 +3922,14 @@ public function setVariableAndTokenMappingsForExpressionManager($surveyid,$force
$csuffix = $fielddata['aid'];
$varName = $fielddata['title'] . '_' . $fielddata['aid'];
$question = $fielddata['subquestion'];
// In M and P , we use $question (sub question) for shown. With other : we show to the user 'other_replace_text' if it's set. see #13505
if($other == "Y") {
if (isset($qattr[$questionNum]['other_replace_text']) && trim($qattr[$questionNum]['other_replace_text']) != '') {
$question = trim($qattr[$questionNum]['other_replace_text']);
} else {
$question = $this->gT('Other:');
}
}
// $question = $fielddata['question'] . ': ' . $fielddata['subquestion'];
if ($type == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS && preg_match("/comment$/", $sgqa)) {
// $rowdivid = substr($sgqa,0,-7);
Expand Down Expand Up @@ -4273,7 +4281,8 @@ public function setVariableAndTokenMappingsForExpressionManager($surveyid,$force

if ($type == Question::QT_M_MULTIPLE_CHOICE || $type == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS)
{
$this->varNameAttr[$jsVarName] .= ",'question':'" . htmlspecialchars(preg_replace('/[[:space:]]/',' ',$question),ENT_QUOTES) . "'";
$question = htmlspecialchars(preg_replace('/[[:space:]]/',' ',$question),ENT_QUOTES);
$this->varNameAttr[$jsVarName] .= ",'question':'" . $question . "'";
}
$this->varNameAttr[$jsVarName] .= "}";
}
Expand Down Expand Up @@ -7851,7 +7860,6 @@ public static function GetRelevanceAndTailoringJavaScript($bReturnArray=false)
$jsParts[] = implode("\n",$valEqns);

$allJsVarsUsed = array_unique($allJsVarsUsed);

// Add JavaScript Mapping Arrays
if (isset($LEM->alias2varName) && count($LEM->alias2varName) > 0)
{
Expand Down Expand Up @@ -8941,12 +8949,9 @@ private function _GetVarAttribute($name,$attr,$default,$gseq,$qseq)
case Question::QT_O_LIST_WITH_COMMENT: //LIST WITH COMMENT drop-down/radio-button list + textarea
case Question::QT_M_MULTIPLE_CHOICE: //Multiple choice checkbox
case Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS: //Multiple choice with comments checkbox + text
if (preg_match('/comment$/',$sgqa) || preg_match('/other$/',$sgqa) || preg_match('/_other$/',$name))
{
if (preg_match('/comment$/',$sgqa) || preg_match('/other$/',$sgqa) || preg_match('/_other$/',$name)) {
return htmlspecialchars($_SESSION[$this->sessid][$sgqa],ENT_NOQUOTES);// Minimum sanitizing the string entered by user
}
else
{
} else {
return $_SESSION[$this->sessid][$sgqa];
}
default:
Expand Down Expand Up @@ -9036,12 +9041,9 @@ private function _GetVarAttribute($name,$attr,$default,$gseq,$qseq)
case 'scale_id':
return (isset($var[$attr])) ? $var[$attr] : $default;
case 'shown':
if (isset($var['shown']))
{
if (isset($var['shown'])) {
return $var['shown']; // for static values like TOKEN
}
else
{
} else {
$type = $var['type'];
$code = $this->_GetVarAttribute($name,'code',$default,$gseq,$qseq);
$shown = $default; // Default value to satisfy Scrutinizer
Expand Down Expand Up @@ -9116,17 +9118,11 @@ private function _GetVarAttribute($name,$attr,$default,$gseq,$qseq)
break;
case Question::QT_M_MULTIPLE_CHOICE: //Multiple choice checkbox
case Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS: //Multiple choice with comments checkbox + text
if ($code == 'Y' && isset($var['question']) && !preg_match('/comment$/',$sgqa))
{
if ($code == 'Y' && isset($var['question']) && !preg_match('/comment$/',$sgqa)) {
$shown = $var['question'];
}
elseif (preg_match('/comment$/',$sgqa)) {
} elseif (preg_match('/comment$/',$sgqa)) {
$shown=$code; // This one return sgqa.code
}
else
{
$shown = $default;
}
break;
case Question::QT_G_GENDER_DROPDOWN: //GENDER drop-down list
case Question::QT_Y_YES_NO_RADIO: //YES/NO radio-buttons
Expand Down
13 changes: 10 additions & 3 deletions application/models/TemplateConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,12 @@ public function getClassAndAttributes()
// Clearall Links
$aClassAndAttributes['class']['clearalllinks'] = ' ls-no-js-hidden ';
$aClassAndAttributes['class']['clearalllink'] = ' ls-link-action ls-link-clearall ';

$aClassAndAttributes['attr']['clearalllinks'] = $aClassAndAttributes['attr']['clearalllink'] = ' ';
// Clearall Buttons
$aClassAndAttributes['class']['clearallwrapper'] = $aClassAndAttributes['class']['clearallconfirm'] = ""; // No need, adding it if need something after
$aClassAndAttributes['attr']['clearallconfirm'] = 'value="confirm" name="confirm-clearall" type="checkbox"';
$aClassAndAttributes['attr']['clearallbutton'] = 'type="submit" value="clearall" name="move" data-confirmedby="confirm-clearall"';
$aClassAndAttributes['class']['clearallbutton'] = "ls-clearaction ls-clearall"; // Not needed, keep it (and adding to twig to be most compatible in future)

// Language changer
$aClassAndAttributes['id']['lctdropdown'] = 'langs-container';
Expand Down Expand Up @@ -815,12 +819,15 @@ public function getClassAndAttributes()
$aClassAndAttributes['class']['loadlinkslia'] = ' ls-link-action ls-link-loadall ';
$aClassAndAttributes['class']['savelinksli'] = ' ls-no-js-hidden ';
$aClassAndAttributes['class']['savelinkslia'] = 'ls-link-action ls-link-saveall';

$aClassAndAttributes['attr']['loadlinksli'] = $aClassAndAttributes['attr']['savelinksli'] = $aClassAndAttributes['class']['savelinkslia'] = '';

// Here you can add metas from core
$aClassAndAttributes['metas'] = ' ';

// Save/Load buttons
$aClassAndAttributes['class']['loadbutton'] = 'ls-saveaction ls-loadall';
$aClassAndAttributes['class']['savebutton'] = 'ls-saveaction ls-saveall';
$aClassAndAttributes['attr']['loadbutton'] = 'type="submit" value="loadall" name="loadall"';
$aClassAndAttributes['attr']['savebutton'] = 'type="submit" value="saveall" name="saveall"';
// Maybe add a plugin event here?
return $aClassAndAttributes;
Expand Down
2 changes: 2 additions & 0 deletions application/views/admin/survey/Question/editQuestion_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@
?>
</select>
<?php elseif($activated == "Y") : ?>
<input type="hidden" id="question_type" name="type" value="<?php echo $eqrow['type']; ?>" />
<!-- TODO : control if we can remove, disable update type must be done by PHP -->
<label class=" control-label" for="question_type_button" title="<?php eT("Question type");?>">
<?php
eT("Question type:");
Expand Down
33 changes: 32 additions & 1 deletion docs/release_notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,37 @@ Thank you to everyone who helped with this new release!
CHANGE LOG
------------------------------------------------------

Changes from 3.5.4 (build 180320) to 3.6.0 (build 180328) Mar 28, 2018
-New feature #13511: Allow new attribute in beforeQuestionRender (Denis Chenu)
-New feature #13537: allow max_execution_time by config (#1026) (Denis Chenu)
-Fixed issue #13395: queXML PDF export missing comments on "Multiple choice with comments" (Adam Zammit)
-Fixed issue #13475: cant export numeric column to SPSS with pgsql (#1015) (Denis Chenu)
-Fixed issue #13488: Not able to save or clear without JavaScript (#1017) (Denis Chenu)
-Fixed issue #13492: Index usage without JavaScript (Denis Chenu)
-Fixed issue #13493: Lot of bug with not installed template (Denis Chenu)
-Fixed issue #13495: Umlauts shown as ? at QueXML-Export (#1023) (Adam Zammit)
-Fixed issue #13500: Upload file in theme options is weird (markusfluer)
-Fixed issue #13510: beforeQuestionRender didn't include Class (Denis Chenu)
-Fixed issue #13524: EM Error on Validation on hidden question and debug (Denis Chenu)
-Fixed issue #13525: Title are not updated by Expression Manager (Denis Chenu)
-Fixed issue #13527: Except at first page : survey text expression usage is broken (Denis Chenu)
-Fixed issue #13541: Error executing admin/checkintegrity (Olle Haerstedt)
-Fixed issue: Allow to use ComfortUpdate on server with disk_free_space disable (Denis Chenu)
-Fixed issue: Cpdb attribute view not working (markusfluer)
-Fixed issue: SQL problem in integrity check (Olle Haerstedt)
-Fixed issue: Survey logic HTML page broken if error (Denis Chenu)
-Fixed issue: User interface optimization (markusfluer)
#Updated translation: Dutch by Han
#Updated translation: Dutch (Informal) by Han
#Updated translation: French (France) by c_schmitz, arnaud21, b00z00
#Updated translation: Italian by lfanfoni
#Updated translation: Italian (Informal) by lfanfoni
#Updated translation: Japanese by nomoto
#Updated translation: Norwegian (Bokmål) by c_schmitz, pmonstad
#Updated translation: Polish by elissa
#Updated translation: Polish (Informal) by elissa
#Updated translation: Russian by c0der, quarrier, vipgroup

Changes from 3.5.3 (build 180316) to 3.5.4 (build 180320) Mar 20, 2018
-Fixed issue #13476: Unable to send individual remind and invite mails (markusfluer)
-Fixed issue #13480: Assessments: wrong windows size and crash after adding a rule (LouisGac)
Expand All @@ -60,7 +91,7 @@ Changes from 3.5.3 (build 180316) to 3.5.4 (build 180320) Mar 20, 2018
#Updated translation: Hungarian by kkd
#Updated translation: Japanese by nomoto
#Updated translation: Myanmar by AlexEDGE1
#Updated translation: Norwegian (Bokmål) by pmonstad
#Updated translation: Norwegian (Bokmål) by pmonstad
#Updated translation: Polish by elissa
#Updated translation: Polish (Informal) by elissa
#Updated translation: Spanish (Spain) by Dhel210, aesteban
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{#
This file is part of LimeSurvey
Copyright (C) 2007-2018 The LimeSurvey Project Team
This file render the exit button accessible without javascript
#}

<div class="{{ aSurveyInfo.class.clearallwrapper }} form-inline">
<label class="form-group ls-js-hidden">
<input {{ aSurveyInfo.attr.clearallconfirm }} class="{{ aSurveyInfo.class.clearallconfirm }}"><span class="control-label">{{gT("Please confirm you want to clear your response?")}}</span>
</label>
<button {{ aSurveyInfo.attr.clearallbutton }} class="{{ aSurveyInfo.class.clearallbutton }} btn btn-link" data-confirmedby="confirm-clearall" title="{{ gT('This action need confirmation.') }}">{{gT("Exit and clear survey")}}</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@
{% endif %}
</div>
</div>
<!-- Extra navigator part -->
{{ include('./subviews/navigation/navigator_complement.twig') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{#
This file is part of LimeSurvey
Copyright (C) 2018 The LimeSurvey Project Team
This file render extra part for navigator
#}
<!-- extra tools, can be shown with javascript too (just remove ls-js-hidden class -->
<div class="row ls-js-hidden">
<!-- Extra button container -->
<div class="col-xs-6 clearall-saveall-wrapper">
{% if aSurveyInfo.aNavigator.load.show == "Y" or aSurveyInfo.bShowClearAll == true %}
{{ include('./subviews/navigation/save_buttons.twig') }}
{% endif %}
{% if aSurveyInfo.bShowClearAll == true %}
{{ include('./subviews/navigation/clearall_buttons.twig') }}
{% endif %}
</div>
<!-- Index container -->
{% if (aSurveyInfo.aQuestionIndex.bShow == true) %}
{{ include('./subviews/navigation/question_index_buttons.twig') }}
{% endif %}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{#
This file is part of LimeSurvey
Copyright (C) 2007-2018 The LimeSurvey Project Team
Show the question index in navigator
#}

<div class="col-sm-6 index-wrapper">
{% if aSurveyInfo.format == 'G' %}
{{ include('./subviews/navigation/question_index_groups_buttons.twig') }}
{% endif %}

{% if aSurveyInfo.format == 'S' %}
{{ include('./subviews/navigation/question_index_questions_buttons.twig') }}
{% endif %}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{#
This file is part of LimeSurvey
Copyright (C) 2018 The LimeSurvey Project Team
This file render group index
#}
<div class="list-group index-button-full">
<div class="list-group-item">
<div class="h4 list-group-item-heading">{{ gT("Question index") }}</div>
</div>
{% for step, indexItem in aSurveyInfo.aQuestionIndex.items %}
{% set templateClass = '' %}
{% if attribute(indexItem.stepStatus, 'index-item-unanswered') is defined and attribute(indexItem.stepStatus, 'index-item-unanswered') == true %}
{% set templateClass = templateClass ~ ' list-group-item-warning' %}
{% endif %}
{% if attribute(indexItem.stepStatus, 'index-item-error') is defined and attribute(indexItem.stepStatus, 'index-item-error') == true %}
{% set templateClass = templateClass ~ ' list-group-item-danger' %}
{% endif %}
{% if attribute(indexItem.stepStatus, 'index-item-current') is defined and attribute(indexItem.stepStatus, 'index-item-current') == true %}
{% set templateClass = statusClass ~ ' disabled' %}
{% endif %}
<button type="submit" name="move" value="{{ indexItem.step }}" class="list-group-item {{ indexItem.coreClass }} {{ templateClass }}" >{{ indexItem.text }}</button>
{% endfor %}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{#
This file is part of LimeSurvey
Copyright (C) 2018 The LimeSurvey Project Team
This file render question index
#}
<div class="list-group index-button index-button-{{ aSurveyInfo.aQuestionIndex.type }}">
<div class="list-group-item">
<div class="h4 list-group-item-heading">{{ gT("Question index") }}</div>
</div>
{% for indexGroup in aSurveyInfo.aQuestionIndex.items %}
<div class="list-group" data-gid="{{ indexGroup.gid }}">
<div class="list-group-item">
<div class="h5 list-group-item-heading">{{ indexGroup.text }}</div>
</div>
{% for indexQuestion in indexGroup.questions %}
{% set templateClass = '' %}
{% if attribute(indexQuestion.stepStatus, 'index-item-unanswered') is defined and attribute(indexQuestion.stepStatus, 'index-item-unanswered') == true %}
{% set templateClass = templateClass ~ ' list-group-item-warning' %}
{% endif %}
{% if attribute(indexQuestion.stepStatus, 'index-item-error') is defined and attribute(indexQuestion.stepStatus, 'index-item-error') == true %}
{% set templateClass = templateClass ~ ' list-group-item-danger' %}
{% endif %}
{% if attribute(indexQuestion.stepStatus, 'index-item-current') is defined and attribute(indexQuestion.stepStatus, 'index-item-current') == true %}
{% set templateClass = statusClass ~ ' disabled' %}
{% endif %}
<button type="submit" name="move" value="{{ indexQuestion.step }}" class="list-group-item {{ indexQuestion.coreClass }} {{ templateClass }}" data-qid="{{ indexQuestion.qid }}">
{{ indexQuestion.text }}
{# flatEllipsizeText(indexQuestion.text, true, 30, " &hellip; ", 0.6 ) broken currently : class 'viewHelper' not found #}
</button>
{% endfor %}
</div>
{% endfor %}
</div>
11 changes: 11 additions & 0 deletions themes/survey/vanilla/views/subviews/navigation/save_buttons.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{#
This file is part of LimeSurvey
Copyright (C) 2007-2018 The LimeSurvey Project Team
This file render the load or save buttons without javascript needed
#}
{% if aSurveyInfo.aNavigator.load.show == "Y" %}
<button {{ aSurveyInfo.attr.loadbutton }} class="{{ aSurveyInfo.class.loadbutton }} btn btn-default">{{ gT("Load unfinished survey") }}</button>
{% endif %}
{% if aSurveyInfo.aNavigator.save.show == "Y" %}
<button {{ aSurveyInfo.attr.savebutton }} class="{{ aSurveyInfo.class.loadbutton }} btn btn-default">{{ gT("Resume later") }}</button>
{% endif %}

0 comments on commit 6f897ac

Please sign in to comment.