Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/LimeSurvey/LimeSurvey
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Apr 14, 2016
2 parents 65f676f + ba4438b commit 828348e
Show file tree
Hide file tree
Showing 16 changed files with 136 additions and 134 deletions.
22 changes: 0 additions & 22 deletions application/config/republish_assets.php

This file was deleted.

1 change: 1 addition & 0 deletions application/config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
$config['dbversionnumber'] = 258;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = 2;
//$config['updaterversion'] = 1;
return $config;

Expand Down
3 changes: 1 addition & 2 deletions application/core/LSYii_Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public function __construct($config = null)
$email_config = require(__DIR__ . '/../config/email.php');
$version_config = require(__DIR__ . '/../config/version.php');
$updater_version_config = require(__DIR__ . '/../config/updater_version.php');
$republish_assets_config = require(__DIR__ . '/../config/republish_assets.php');
$settings = array_merge($ls_config, $version_config, $email_config, $updater_version_config, $republish_assets_config);
$settings = array_merge($ls_config, $version_config, $email_config, $updater_version_config);


if(file_exists(__DIR__ . '/../config/config.php'))
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2909,7 +2909,7 @@ function questionAttributes($returnByName=false)
"caption"=>gT('Sub-question validation tip'));

$qattributes["exclude_all_others"]=array(
"types"=>":ABCEFMPKQ",
"types"=>"ABCEFMPKQ",
'category'=>gT('Logic'),
'sortorder'=>130,
'inputtype'=>'text',
Expand Down
3 changes: 3 additions & 0 deletions application/helpers/expressions/em_manager_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7197,6 +7197,7 @@ static function GetRelevanceAndTailoringJavaScript()
$relParts[] = " }\n";
$relParts[] = " else {\n";
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').removeAttr('disabled');\n";
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . " th.answertext').removeClass('text-muted');\n";
$relParts[] = " }\n";
}
$relParts[] = " relChange" . $arg['qid'] . "=true;\n";
Expand All @@ -7209,9 +7210,11 @@ static function GetRelevanceAndTailoringJavaScript()
{
$relParts[] = " if ( " . $sq['irrelevantAndExclusiveJS'] . " ) {\n";
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').attr('disabled','disabled');\n";
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . " th.answertext').addClass('text-muted');\n";
$relParts[] = " }\n";
$relParts[] = " else {\n";
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').removeAttr('disabled');\n";
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . " th.answertext').removeClass('text-muted');\n";
if ($afHide)
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n";
Expand Down
69 changes: 37 additions & 32 deletions application/helpers/qanda_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3861,7 +3861,6 @@ function do_gender($ia)
* @param $ia
* @return unknown_type
*/
// TMSW TODO - Can remove DB query by passing in answer list from EM
function do_array_5point($ia)
{
global $thissurvey;
Expand Down Expand Up @@ -3889,19 +3888,6 @@ function do_array_5point($ia)
}

$cellwidth = round((( 100 - $answerwidth ) / $cellwidth) , 1); // convert number of columns to percentage of table width
$sQuery = "SELECT question FROM {{questions}} WHERE parent_qid=".$ia[0]." AND question like '%|%'";
$iCount = Yii::app()->db->createCommand($sQuery)->queryScalar();

if ($iCount>0)
{
$right_exists = true;
$answerwidth = $answerwidth/2;
}
else
{
$right_exists = false;
}


if ($aQuestionAttributes['random_order']==1)
{
Expand All @@ -3916,8 +3902,18 @@ function do_array_5point($ia)
$aSubquestions = $ansresult->readAll();
$anscount = count($aSubquestions);
$fn = 1;
$sColumns = $sHeaders = $sRows = $answer_tds = '';
$sColumns = $sHeaders = $sRows = $answer_tds = '';

// Check if any subquestion use suffix/prefix
$right_exists = false;
foreach ($aSubquestions as $j => $ansrow)
{
$answertext2 = $ansrow['question'];
if (strpos($answertext2,'|'))
{
$right_exists = true;
}
}

for ($xc=1; $xc<=5; $xc++)
{
Expand All @@ -3929,6 +3925,12 @@ function do_array_5point($ia)
$sColumns .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/5point/columns/col', array('cellwidth'=>$cellwidth), true);
}

// Column for suffix
if ($right_exists)
{
$sColumns .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/5point/columns/col', array('cellwidth'=>$cellwidth), true);
}

for ($xc=1; $xc<=5; $xc++)
{
$sHeaders .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/5point/rows/cells/thead', array(
Expand All @@ -3938,6 +3940,7 @@ function do_array_5point($ia)
), true);
}

// Header for suffix
if ($right_exists)
{
$sHeaders .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/5point/rows/cells/thead', array(
Expand Down Expand Up @@ -3978,7 +3981,6 @@ function do_array_5point($ia)
// Value
$value = (isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname])) ? $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname] : '';

// ==> tds
for ($i=1; $i<=5; $i++)
{
$CHECKED = (isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname]) && $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname] == $i)?'CHECKED':'';
Expand All @@ -3991,8 +3993,8 @@ function do_array_5point($ia)
), true);
}

// => tds
$answertext2 = $ansrow['question'];
// Suffix
$answertext2 = $ansrow['question'];
if (strpos($answertext2,'|'))
{
$answertext2=substr($answertext2,strpos($answertext2,'|')+1);
Expand Down Expand Up @@ -4024,14 +4026,14 @@ function do_array_5point($ia)
}

$sRows .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/5point/rows/answer_row', array(
'answer_tds'=>$answer_tds,
'myfname'=>$myfname,
'answerwidth'=>$answerwidth,
'answertext'=>$answertext,
'value'=>$value,
'error'=>$error,
'sDisplayStyle'=>$sDisplayStyle,
'zebra' => 2 - ($j % 2)
'answer_tds' => $answer_tds,
'myfname' => $myfname,
'answerwidth' => $answerwidth,
'answertext' => $answertext,
'value' => $value,
'error' => $error,
'sDisplayStyle' => $sDisplayStyle,
'zebra' => 2 - ($j % 2)
), true);

$answer_tds = '';
Expand All @@ -4040,10 +4042,10 @@ function do_array_5point($ia)
}

$answer = Yii::app()->getController()->renderPartial('/survey/questions/arrays/5point/answer', array(
'extraclass'=>$extraclass,
'sColumns'=>$sColumns,
'sHeaders'=>$sHeaders,
'sRows'=>$sRows,
'extraclass' => $extraclass,
'sColumns' => $sColumns,
'sHeaders' => $sHeaders,
'sRows' => $sRows,
), true);

//$answer .= $answer_t_content;
Expand Down Expand Up @@ -5253,6 +5255,7 @@ function do_array_multiflexi($ia)

$checkboxlayout = false;
$inputboxlayout = false;
$textAlignment = 'right';

if ($aQuestionAttributes['multiflexible_checkbox']!=0)
{
Expand All @@ -5261,13 +5264,15 @@ function do_array_multiflexi($ia)
$checkboxlayout = true;
$answertypeclass = " checkbox";
$caption .= gT("Check or uncheck the answer for each subquestion. ");
$textAlignment = 'center';
}
elseif ($aQuestionAttributes['input_boxes']!=0 )
{
$inputboxlayout = true;
$answertypeclass .= " numeric-item text";
$extraclass .= " numberonly";
$caption .= gT("Each answers are a number. ");
$textAlignment = 'right';
}
else
{
Expand Down Expand Up @@ -5397,6 +5402,7 @@ function do_array_multiflexi($ia)
'right_exists' => $right_exists,
'cellwidth' => $cellwidth,
'answerwidth' => $answerwidth,
'textAlignment' => $textAlignment,
), true);
}
}
Expand Down Expand Up @@ -5527,7 +5533,6 @@ function do_array_multiflexi($ia)
$rightTd = true;
}

// answer_row
$sAnswerRows .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/multiflexi/rows/answer_row', array(
'sDisplayStyle' => $sDisplayStyle,
'useAnswerWidth' => $useAnswerWidth,
Expand All @@ -5552,12 +5557,12 @@ function do_array_multiflexi($ia)
'cellwidth' => $cellwidth,
'right_exists' => $right_exists,
'sAnswerRows' => $sAnswerRows,
'textAlignment' => $textAlignment,
), true);

}
else
{
//$answer = "\n<p class=\"error\">".gT("Error: There are no answer options for this question and/or they don't exist in this language.")."</p>\n";
$answer = Yii::app()->getController()->renderPartial('/survey/questions/arrays/multiflexi/empty_error', array(), true);
$inputnames = '';
}
Expand Down
37 changes: 17 additions & 20 deletions application/models/UpdateForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,21 +365,6 @@ public function republishAssets()
{
// Republish the template assets
Template::model()->forceAssets();

// Edit the file republish_assets.php
@ini_set('auto_detect_line_endings', true);
$versionlines = file($this->rootdir.DIRECTORY_SEPARATOR.'application'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'republish_assets.php');
$handle = fopen($this->rootdir.DIRECTORY_SEPARATOR.'application'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'republish_assets.php', "w");
foreach ($versionlines as $line)
{
if(strpos($line,'republish_assets')!==false)
{
$line='$config[\'republish_assets\'] = false;'."\r\n";
}
fwrite($handle,$line);
}
fclose($handle);

}

/**
Expand Down Expand Up @@ -563,6 +548,22 @@ public function backupDb($destionationBuild)

}

/**
* Checl if assets needs to be updated
*/
private function checkAssets()
{
$iAssetVersionNumber = Yii::app()->getConfig('assetsversionnumber'); // From version.php
$iCurrentAssetVersion = GetGlobalSetting('AssetsVersion'); // From setting_global table

if ( intval($iAssetVersionNumber) > intval($iCurrentAssetVersion) )
{
self::republishAssets();
setGlobalSetting('AssetsVersion',$iAssetVersionNumber);
}
}



/**
* Check if an update is available, and prints the update notification
Expand All @@ -573,11 +574,7 @@ public function backupDb($destionationBuild)
*/
public function getUpdateNotification()
{
if(Yii::app()->getConfig("republish_assets"))
{
self::republishAssets();
}

$this->checkAssets();
if(Yii::app()->getConfig('updatable'))
{
$today = new DateTime("now");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/
?>

<!-- td_answertext -->
<!-- answer_td_answertext -->
<td class="answertextright" style='text-align:left; width: <?php echo $answerwidth; ?>%;'>
<?php echo $answertext2;?>
</td>
<!-- endof td_answertext -->
<!-- endof answer_td_answertext -->
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @var $labelans
* @var $cellwidth
* @var $right_exists
* @var $textAlignment
*
*/
?>
Expand All @@ -33,13 +34,13 @@
<th class="text-center">&nbsp;</th>

<?php foreach ($labelans as $ld): ?>
<th class='th-11 text-center'>
<th class='th-11 text-<?php echo $textAlignment; ?>'>
<?php echo $ld;?>
</th>
<?php endforeach;?>

<?php if ($right_exists):?>
<th class="text-center">
<th class="text-<?php echo $textAlignment; ?>">
&nbsp;
</th>
<?php endif;?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,28 @@
?>

<!-- answer_td -->
<td data-title="<?php echo $dataTitle;?>" class="answer-cell-5 answer_cell_<?php echo $ld;?> question-item answer-item <?php echo $answertypeclass; ?>-item <?php echo $extraclass; ?>">
<label for="answer<?php echo $myfname2;?>" class='col-xs-12 col-sm-12'>

<td class="answer-cell-5 answer_cell_<?php echo $ld;?> question-item answer-item <?php echo $answertypeclass; ?>-item <?php echo $extraclass; ?>">
<input
type="hidden"
name="java<?php echo $myfname2;?>"
id="java<?php echo $myfname2;?>"
value="<?php echo $value; ?>"
/>

<label for="answer<?php echo $myfname2;?>" class='col-xs-12 col-sm-12'></label>

<div class="text-right visible-xs" id="label-answer<?php echo $myfname2;?>">
<?php echo $dataTitle;?>
</div>
<?php if($inputboxlayout == false):?>
<!-- InputBox Layout False -->
<select
class="multiflexiselect form-control"
name="<?php echo $myfname2; ?>"
id="answer<?php echo $myfname2;?>"
onchange="<?php echo $checkconditionFunction; ?>(this.value, this.name, this.type)">
onchange="<?php echo $checkconditionFunction; ?>(this.value, this.name, this.type)"
aria-labelledby="label-answer<?php echo $myfname2;?>"
>

<option value="">
<?php eT('...'); ?>
Expand All @@ -57,7 +62,7 @@ class="multiflexiselect form-control"
<!-- InputBox Layout -->
<input
type='text'
class="multiflexitext text form-control <?php echo $kpclass;?>"
class="multiflexitext text form-control <?php echo $kpclass;?> text-right"
name="<?php echo $myfname2; ?>"
id="answer<?php echo $myfname2;?>"
<?php echo $maxlength; ?>
Expand All @@ -66,6 +71,5 @@ class="multiflexitext text form-control <?php echo $kpclass;?>"
value="<?php echo $value; ?>"
/>
<?php endif; ?>
</label>
</td>
<!-- end of answer_td -->

0 comments on commit 828348e

Please sign in to comment.