Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into develop
Conflicts:
	application/helpers/expressions/em_manager_helper.php
	application/libraries/PluginManager/PluginManager.php
  • Loading branch information
olleharstedt committed Oct 25, 2018
2 parents 60669dc + 272a492 commit 3a7bbff
Show file tree
Hide file tree
Showing 46 changed files with 628 additions and 1,075 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Expand Up @@ -21,7 +21,7 @@
/upload/*.*
/upload/uploadsave/**/*.*
!/upload/index.html
!/upload/admintheme/
/upload/admintheme/**/*
!/upload/admintheme/index.html
/upload/labels/**/*.*
!/upload/labels/index.html
Expand All @@ -35,9 +35,11 @@
!/upload/templates/readme.txt
!/upload/themes/index.html
/upload/themes/survey/*
!/upload/themes/survey/index.html
!/upload/themes/survey/generalfiles
/upload/themes/survey/generalfiles/*.*
!/upload/themes/survey/generalfiles/index.html
!/upload/themes/survey/index.html
!/upload/themes/survey/generalfiles/index.html
/upload/themes/question/*.*
/upload/themes/question/**/*.*
!/upload/themes/question/readme.txt
Expand Down
2 changes: 1 addition & 1 deletion application/config/questiontypes.php
Expand Up @@ -34,7 +34,7 @@
'scripts/ranking.js',
),
'depends' => array(
'jquery',
'jquery','jquery-actual',
)
),
/* numeric slider question : numerci question type with slider */
Expand Down
2 changes: 1 addition & 1 deletion application/config/third_party.php
Expand Up @@ -396,7 +396,7 @@
'position' => CClientScript::POS_BEGIN,
'basePath' => 'third_party.jquery-actual', /* for samechoiceheight/samelistheight */
'js' => array(
'jquery.actual.min.js'
'jquery.actual'.$minVersion.'.js'
),
),
/* Used by short text with map by leaflet */
Expand Down
5 changes: 4 additions & 1 deletion application/controllers/admin/dataentry.php
Expand Up @@ -611,7 +611,10 @@ public function editdata($subaction, $id, $surveyid)
case Question::QT_D_DATE: //DATE
$dateformatdetails = getDateFormatDataForQID($qidattributes, $surveyid);
if ($idrow[$fname['fieldname']] != '') {
$datetimeobj = DateTime::createFromFormat("!Y-m-d H:i:s", $idrow[$fname['fieldname']]);
$datetimeobj = DateTime::createFromFormat("Y-m-d H:i:s", $idrow[$fname['fieldname']]);
if($datetimeobj == null) { //MSSQL uses microseconds by default in any datetime object
$datetimeobj = DateTime::createFromFormat("Y-m-d H:i:s.u", $idrow[$fname['fieldname']]);
}
$thisdate = $datetimeobj->format($dateformatdetails['phpdate']);
} else {
$thisdate = '';
Expand Down
3 changes: 1 addition & 2 deletions application/controllers/admin/questions.php
Expand Up @@ -1576,11 +1576,10 @@ public function ajaxquestionattributes()
}
}
}

// INSERTING CUSTOM ATTRIBUTES FROM CORE QUESTION THEME XML FILE
if (!empty($sQuestionTemplate) && $sQuestionTemplate !== 'core') {
$themeAttributes = \LimeSurvey\Helpers\questionHelper::getQuestionThemeAttributeValues($sQuestionTemplate, $questionTypeList[$type]);
$aAttributesWithValues = array_merge_recursive($aAttributesWithValues,$themeAttributes); // theme can update core/plugin attribute
$aAttributesWithValues = array_merge($aAttributesWithValues,$themeAttributes); // theme can update core/plugin attribute
}
uasort($aAttributesWithValues, 'categorySort');
unset($aAttributesWithValues['question_template']);
Expand Down
5 changes: 5 additions & 0 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -7279,6 +7279,11 @@ public static function FinishProcessPublicPage($applyJavaScriptAnyway=false)

Yii::app()->clientScript->registerScript('triggerEmRelevance', "triggerEmRelevance();", LSYii_ClientScript::POS_END);
Yii::app()->clientScript->registerScript('updateMandatoryErrorClass', "updateMandatoryErrorClass();", LSYii_ClientScript::POS_POSTSCRIPT); /* Maybe only if we have mandatory error ?*/

$sHiddenInputs = implode('', $aScriptsAndHiddenInputs['inputs']);
$LEM->FinishProcessingPage();

return $sHiddenInputs;
}
self::resetTempVars();
}
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/frontend_helper.php
Expand Up @@ -287,7 +287,7 @@ function checkUploadedFileValidity($surveyid, $move, $backok = null)
// else, its ajax, don't check, bypass it.

if ($json != "" && $json != "[]") {
$phparray = json_decode(stripslashes($json));
$phparray = json_decode(urldecode($json));
if ($phparray[0]->size != "") {
// ajax
$filecount = count($phparray);
Expand Down
1 change: 0 additions & 1 deletion application/helpers/qanda_helper.php
Expand Up @@ -1887,7 +1887,6 @@ function do_ranking($ia)
$inputnames[] = $myfname;
}

Yii::app()->getClientScript()->registerPackage("question-ranking", CClientScript::POS_BEGIN);
$rankingTranslation = 'LSvar.lang.rankhelp="'.gT("Double-click or drag-and-drop items in the left list to move them to the right - your highest ranking item should be on the top right, moving through to your lowest ranking item.", 'js').'";';
App()->getClientScript()->registerScript("rankingTranslation", $rankingTranslation, CClientScript::POS_BEGIN);

Expand Down
2 changes: 1 addition & 1 deletion application/libraries/PluginManager/PluginManager.php
Expand Up @@ -416,7 +416,7 @@ public function loadPlugin($pluginName, $id = null)
// If the id is not set we search for the plugin.
if (!isset($id)) {
foreach ($this->plugins as $plugin) {
if (get_class($plugin) == $pluginName) {
if (!is_null($plugin) && get_class($plugin) == $pluginName) {
$return = $plugin;
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/models/Response.php
Expand Up @@ -57,7 +57,7 @@ public function getFiles($qid = null)
$files = array();
foreach ($questions as $question) {
$field = $question->sid.'X'.$question->gid.'X'.$question->qid;
$data = json_decode(stripslashes($this->getAttribute($field)), true);
$data = json_decode(urldecode($this->getAttribute($field)), true);
if (is_array($data)) {
$files = array_merge($files, $data);
}
Expand Down
Expand Up @@ -23,18 +23,19 @@
<div class="ls-answers row" role="group" aria-labelledby="ls-question-text-{{ basename }}">

<div class="answer-item dropdown-item col-sm-6 col-xs-12">
<!-- This need a label :/ -->
<select
class="select form-control"
name="{{ name }}"
id="{{ id }}"
{% if show_noanswer %}
<option class="noanswer-item" value="" SELECTED>
{{ gT('Please choose...') }}
</option>
{% endif %}
{# rows/option.php #}
{{ sOptions }}
class="select form-control"
name="{{ name }}"
id="{{ id }}"
>
{% if show_noanswer %}
<option class="noanswer-item" value="">
{{ gT('Please choose...') }}
</option>
{% endif %}
{# rows/option.php #}
{{ sOptions }}
</select>
<!-- Input copy for EM : default is radio and EM use id -->
<input type="hidden" name="java{{ name }}" id="java{{ name }}" value="{{ value }}" disabled />
Expand Down
Expand Up @@ -72,7 +72,7 @@ try{
ranking{{qId}}.init()
} catch(e){}
{% endset %}

{{ registerPackage('question-ranking') }}
{{ registerScript( 'RankingQuestion'~qId, script, 'POS_POSTSCRIPT') }}


Expand Down
Expand Up @@ -33,7 +33,7 @@
value="N"
{{ nChecked }}
/>
<label for="answer{{ name }}Y">
<label for="answer{{ name }}N">
<span class="fa fa-ban ls-icon" aria-hidden="true"></span> {{ gT('No') }}
</label>
</li>
Expand All @@ -48,7 +48,7 @@
value=""
{{ naChecked }}
/>
<label for="answer{{ name }}Y">
<label for="answer{{ name }}">
<span class="fa fa-circle-thin ls-icon" aria-hidden="true"></span> {{ gT('No answer') }}
</label>
</li>
Expand Down
44 changes: 19 additions & 25 deletions assets/packages/questions/ranking/scripts/ranking.js
Expand Up @@ -147,32 +147,26 @@ var RankingQuestion = function (options) {
},

fixChoiceListHeight = function() {
//Keep the target field as big as the source field
var minHeight = $('#sortable-choice-' + questionId).height();
$('#sortable-choice-' + questionId).css('min-height', minHeight);
$('#sortable-rank-' + questionId).css('min-height', minHeight);

// if (samechoiceheight) {
// var maxHeight = 0;
// $('#sortable-choice-' + questionId + ' li,#sortable-rank-' + questionId + ' li').each(function () {
// if ($(this).actual('height') > maxHeight) {
// maxHeight = $(this).actual('height');
// }
// });
// $('#sortable-choice-' + questionId + ' li,#sortable-rank-' + questionId + ' li').css('min-height', maxHeight + 'px');
// }

// if (samelistheight) {
// var totalHeight = 0;
// $('#sortable-choice-' + questionId + ' li,#sortable-rank-' + questionId + ' li').each(function () {
// totalHeight = totalHeight + $(this).actual('outerHeight', {
// includeMargin: true
// }); /* Border not inside */
// });
// /* Add the padding to min-height */
// $('#sortable-choice-' + questionId + ',#sortable-rank-' + questionId).css('min-height', totalHeight + 'px').addClass("ls-sameheight");
// }
if (samechoiceheight) {
var maxHeight = 0;
$('#question' + questionId + ' .list-samechoiceheight .ls-choice').each(function () {
if ($(this).actual('height') > maxHeight) {
maxHeight = $(this).actual('height');
}
});
$('#question' + questionId + ' .list-samechoiceheight .ls-choice').height(maxHeight);
}

if (samelistheight) {
var totalHeight = 0;
$('#question' + questionId + ' .list-samelistheight .ls-choice').each(function () {
totalHeight = totalHeight + $(this).actual('outerHeight', {
includeMargin: true
}); /* Border not inside */
});
/* Add the padding to min-height */
$('#sortable-choice-' + questionId + ',#sortable-rank-' + questionId).height(totalHeight);
}
},

triggerEmRelevanceSortable = function() {
Expand Down

0 comments on commit 3a7bbff

Please sign in to comment.