Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Aug 4, 2022
2 parents 5fdfe6f + c8ffd47 commit ae0d4f1
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 26 deletions.
7 changes: 2 additions & 5 deletions application/controllers/QuestionAdministrationController.php
Expand Up @@ -96,12 +96,9 @@ public function actionCreate($surveyid)
$this->aData['showSaveAndNewGroupButton'] = true;
$this->aData['showSaveAndNewQuestionButton'] = true;
$this->aData['closeUrl'] = Yii::app()->createUrl(
'questionGroupsAdministration/view/',
'questionAdministration/listquestions',
[
'surveyid' => $oQuestion->sid,
'gid' => $oQuestion->gid,
'landOnSideMenuTab' => 'structure',
'mode' => 'overview',
'surveyid' => $surveyid
]
);

Expand Down
1 change: 1 addition & 0 deletions application/controllers/admin/Statistics.php
Expand Up @@ -757,6 +757,7 @@ public function simpleStatistics($surveyid)
case Question::QT_U_HUGE_FREE_TEXT: // Huge free text
case Question::QT_Q_MULTIPLE_SHORT_TEXT:
case Question::QT_SEMICOLON_ARRAY_TEXT:
case Question::QT_X_TEXT_DISPLAY:
break;


Expand Down
13 changes: 13 additions & 0 deletions application/extensions/LimeGridView/LimeGridView.php
Expand Up @@ -66,6 +66,19 @@ public function registerClientScript()
$cs->registerCoreScript('history');
$cs->registerScriptFile($this->baseScriptUrl.'/jquery.yiigridview.js',LSYii_ClientScript::POS_PREBEGIN);
$cs->registerScript(__CLASS__.'#'.$id,"jQuery('#$id').yiiGridView($options);",LSYii_ClientScript::POS_POSTSCRIPT);

$script = '
jQuery(document).on("change", "#' . $id . ' .changePageSize", function(){
var pageSizeName = $(this).attr("name");
if (!pageSizeName) {
pageSizeName = "pageSize";
}
var data = $("#' . $id . ' .filters input, #' . $id . ' .filters select").serialize();
data += (data ? "&" : "") + pageSizeName + "=" + $(this).val();
$.fn.yiiGridView.update("' . $id . '", {data: data});
});
';
Yii::app()->getClientScript()->registerScript('pageChanger#' . $id, $script, LSYii_ClientScript::POS_POSTSCRIPT);
}

}
Expand Up @@ -19,10 +19,17 @@

<!-- Close -->
<?php if(!empty($showCloseButton)): ?>
<a class="btn btn-default" href="#" role="button" onclick="LS.questionEditor.showOverview(); return false;">
<span class="fa fa-close"></span>
<?php eT("Close");?>
</a>
<?php if (!empty($oQuestion->qid)): ?>
<a class="btn btn-default" href="#" role="button" onclick="LS.questionEditor.showOverview(); return false;">
<span class="fa fa-close"></span>
<?php eT("Close");?>
</a>
<?php else: ?>
<a class="btn btn-default" href="<?= $closeUrl ?>" role="button">
<span class="fa fa-close"></span>
<?php eT("Close");?>
</a>
<?php endif; ?>
<?php endif;?>

<!-- Save and close -->
Expand Down
18 changes: 17 additions & 1 deletion application/helpers/admin/statistics_helper.php
Expand Up @@ -584,6 +584,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$qtitle = "";
$qquestion = "";
$qtype = "";
$subquestionText = "";
$sQuestionType = substr($rt, 0, 1);
$fieldmap = createFieldMap($survey, "full", false, false, $language);
$sDatabaseType = Yii::app()->db->getDriverName();
Expand Down Expand Up @@ -1162,6 +1163,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
//list IDs and answer codes in brackets
$qquestion .= $linefeed;
$qtitle .= "($qanswer)" . "[" . $atext . "]";
$subquestionText = $atext;
break;


Expand All @@ -1179,6 +1181,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,

$qquestion .= $linefeed;
$qtitle .= "({$qanswer})" . "[" . $atext . "]";
$subquestionText = $atext;
break;


Expand All @@ -1197,6 +1200,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
//output
$qquestion .= $linefeed;
$qtitle .= "({$qanswer})" . "[" . $atext . "]";
$subquestionText = $atext;
break;


Expand All @@ -1213,6 +1217,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
}
$qquestion .= $linefeed;
$qtitle .= "({$qanswer})" . "[" . $atext . "]";
$subquestionText = $atext;
break;


Expand All @@ -1231,6 +1236,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,

$qquestion .= $linefeed;
$qtitle .= "($qanswer)" . "[" . $atext . "] [" . $ltext . "]";
$subquestionText = $atext;
break;

case Question::QT_COLON_ARRAY_NUMBERS: // Array (Multiple Flexi) (Numbers)
Expand Down Expand Up @@ -1287,6 +1293,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
//output
$qquestion .= $linefeed;
$qtitle .= "($qanswer)" . "[" . $atext . "]";
$subquestionText = $atext;
break;


Expand Down Expand Up @@ -1380,6 +1387,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
//adapt title and question
$qtitle = $qtitle . " [" . $sSubquestion . "][" . $labelno . "]";
$qquestion = $qastring . $labelheader;
$subquestionText = $sSubquestion;
break;


Expand Down Expand Up @@ -1409,7 +1417,15 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$alist[] = array("", gT("No answer"), false, 'is_no_answer');
}

return array("alist" => $alist, "qtitle" => $qtitle, "qquestion" => $qquestion, "qtype" => $qtype, "statisticsoutput" => $statisticsoutput, "parentqid" => (int)$qqid);
return [
"alist" => $alist,
"qtitle" => $qtitle,
"qquestion" => $qquestion,
"qtype" => $qtype,
"statisticsoutput" => $statisticsoutput,
"parentqid" => (int)$qqid,
"subquestionText" => $subquestionText,
];
}

/**
Expand Down
7 changes: 7 additions & 0 deletions application/helpers/twig_translation_helper.php
Expand Up @@ -42,6 +42,13 @@ function dummy_twig_translation_helper()
gT("Load label set"); // From /var/www/html/limesurvey/application/views/questionAdministration/subquestions.twig
gT("Save label set"); // From /var/www/html/limesurvey/application/views/questionAdministration/subquestions.twig
gT("Quick add"); // From /var/www/html/limesurvey/application/views/questionAdministration/subquestions.twig
gT("Show Clear All button"); // From themes/survey/fruity/options/options.twig
gT("Question help text position"); // From themes/survey/fruity/options/options.twig
gT("Top"); // From themes/survey/fruity/options/options.twig
gT("Bottom"); // From themes/survey/fruity/options/options.twig
gT("Break tables"); // From themes/survey/fruity/options/options.twig
gT("Always on"); // From themes/survey/fruity/options/options.twig
gT("Small screens"); // From themes/survey/fruity/options/options.twig
gT("After specific subquestion"); // From application/views/survey/questions/answer/multiplechoice/config.xml
gT("Relevance help for printable survey"); // From application/views/survey/questions/answer/5pointchoice/config.xml
gT("Specify how array-filtered sub-questions should be displayed"); // From application/views/survey/questions/answer/arrays/10point/config.xml
Expand Down
Expand Up @@ -10,5 +10,5 @@

<!-- _statisticsoutput_header -->
<div class="col-sm-12 col-md-6 col-lg-4 printable" style="margin-top: 2em;margin-bottom: 2em;">
<h4><?php echo $outputs['qquestion'];?></h4>
<h4><?php echo $outputs['qquestion'];?><?= !empty($outputs['subquestionText']) ? " [{$outputs['subquestionText']}]" : "" ?></h4>
<!-- end of _statisticsoutput_header -->
Expand Up @@ -25,7 +25,7 @@
<select name='survey_id' class='form-control'>
<?php foreach ($surveys as $survey): ?>
<?php if ($hasGlobalPermission || Permission::model()->hasSurveyPermission($survey->sid, 'tokens', 'update')): ?>
<option value='<?php echo $survey->sid; ?>'><?php echo $survey->languagesettings[$survey->language]->surveyls_title; ?></option>
<option value='<?php echo $survey->sid; ?>'><?php echo $survey->languagesettings[$survey->language]->surveyls_title; ?> (<?php echo $survey->sid; ?>)</option>
<?php endif; ?>
<?php endforeach; ?>
</select>
Expand Down
3 changes: 0 additions & 3 deletions application/views/admin/token/browse.php
Expand Up @@ -59,9 +59,6 @@
App()->getClientScript()->registerScript("Tokens:updateRowsPerPage", "
if($('#token-grid').length > 0){
reinstallParticipantsFilterDatePicker();
jQuery(document).on('change', '#pageSizeTokenView', function(){
$.fn.yiiGridView.update('token-grid',{ data:{ pageSizeTokenView: $(this).val() }});
});
}
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
Expand Down
3 changes: 0 additions & 3 deletions application/views/questionAdministration/listquestions.php
Expand Up @@ -149,9 +149,6 @@
<!-- To update rows per page via ajax -->
<?php App()->getClientScript()->registerScript("ListQuestions-pagination", "
var bindPageSizeChange = function(){
$('#pageSize').on('change', function(){
$.fn.yiiGridView.update('question-grid',{ data:{ pageSize: $(this).val() }});
});
$(document).trigger('actions-updated');
};
", LSYii_ClientScript::POS_BEGIN); ?>
Expand Down
5 changes: 4 additions & 1 deletion application/views/questionAdministration/subquestionRow.twig
Expand Up @@ -129,18 +129,21 @@
</div>
</td>

{% set relevanceTooltip = supportsRelevance ? gT("Click to expand") : gT("Relevance is not currently supported for columns") %}

<!-- Relevance equation -->
{% if first and scale_id == 0 %}
<td class="relevance-equation">
<input
data-toggle="tooltip"
data-title="{{ gT("Click to expand") }}"
data-title="{{ relevanceTooltip }}"
type='text'
class='relevance form-control input'
id='subquestions[{{ subquestion.qid }}][{{ scale_id }}][relevance]'
name='subquestions[{{ subquestion.qid }}][{{ scale_id }}][relevance]'
value="{{ subquestion.relevance|escape('html_attr') }}"
onkeypress=" if(event.keyCode==13) { if (event && event.preventDefault) event.preventDefault(); document.getElementById('save-button').click(); return false;}"
{{ supportsRelevance ? '' : 'readonly="readonly"' }}
/>
</td>
{% else %}
Expand Down
1 change: 1 addition & 0 deletions application/views/questionAdministration/subquestions.twig
Expand Up @@ -69,6 +69,7 @@
'subquestionl10n': subquestion.questionl10ns[lang],
'language' : lang,
'oldCode' : true,
'supportsRelevance' : question.questionType.code != 'H',
} %}

{% set position = position + 1 %}
Expand Down
Expand Up @@ -127,9 +127,6 @@ class="btn btn-warning">
<!-- To update rows per page via ajax -->
<?php App()->getClientScript()->registerScript("ListQuestionGroups-pagination", "
var bindPageSizeChange = function(){
$('#pageSize').on('change', function(){
$.fn.yiiGridView.update('question-group-grid',{ data:{ pageSize: $(this).val() }});
});
$(document).trigger('actions-updated');
};
", LSYii_ClientScript::POS_BEGIN); ?>
Expand Down
3 changes: 0 additions & 3 deletions application/views/responses/listResponses_view.php
Expand Up @@ -274,9 +274,6 @@
';
$script = '
var postUrl = "' . Yii::app()->getController()->createUrl("responses/setSession") . '"; // For massive export
jQuery(document).on("change", "#pageSize", function(){
$.fn.yiiGridView.update("responses-grid",{ data:{ pageSize: $(this).val() }});
});
$(".grid-view [data-toggle=\'popover\']").popover();
';
App()->getClientScript()->registerScript('listresponses', $scriptVars, LSYii_ClientScript::POS_BEGIN);
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/admin/questionEditor.js
Expand Up @@ -1701,7 +1701,7 @@ $(document).on('ready pjax:scriptcomplete', function () {

$('.lang-hide').hide();
const languages = languageJson.langs.split(';');
$('.lang-' + languages[0]).show();
$('.lang-switch-button[data-lang="' + languages[0] + '"]').trigger('click');

// TODO: Duplication.
$('.btnaddsubquestion').on('click.subquestions', addSubquestionInput);
Expand Down

0 comments on commit ae0d4f1

Please sign in to comment.