Skip to content

Commit

Permalink
Dev Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jan 31, 2018
2 parents 73d53a1 + 3ce3991 commit efcc621
Show file tree
Hide file tree
Showing 55 changed files with 3,352 additions and 3,272 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -70,6 +70,7 @@ chromedriver

# Some global "temporary files" (see
*~
*.map
ehthumbs.db
Thumbs.db

Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -17,6 +17,7 @@ before_script:
- phpenv config-rm xdebug.ini
# Install LimeSurvey.
- phpunit --version
- mysql --version
- touch enabletests
#- rm composer.lock
#- rm -r third_party
Expand Down
4 changes: 2 additions & 2 deletions application/commands/DemomodeCommand.php
Expand Up @@ -84,10 +84,10 @@ private function _resetDatabase()
}

// At last reset the basic themes
foreach (LsDefaultDataSets::getTemplatesData() as $template) {
foreach ($templateData = LsDefaultDataSets::getTemplatesData() as $template) {
Yii::app()->db->createCommand()->insert("{{templates}}", $template);
}
foreach (LsDefaultDataSets::getTemplateConfigurationData() as $templateConfiguration) {
foreach ($templateConfigurationData = LsDefaultDataSets::getTemplateConfigurationData() as $templateConfiguration) {
Yii::app()->db->createCommand()->insert("{{template_configuration}}", $templateConfiguration);
}
}
Expand Down
4 changes: 2 additions & 2 deletions application/config/version.php
Expand Up @@ -12,9 +12,9 @@
*/


$config['versionnumber'] = '3.1.0develop'; //The current version of this branch, LS3
$config['versionnumber'] = '3.1.1develop'; //The current version of this branch, LS3
$config['dbversionnumber'] = 350;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '30009';
$config['assetsversionnumber'] = '30010';
return $config;
1 change: 0 additions & 1 deletion application/controllers/admin/SurveymenuController.php
Expand Up @@ -254,7 +254,6 @@ public function delete()
*/
public function restore()
{

if (!(Permission::model()->hasGlobalPermission('settings', 'delete') && Permission::model()->hasGlobalPermission('settings', 'update'))) {
Yii::app()->user->setFlash('error', gT("Access denied"));
$this->getController()->redirect(Yii::app()->createUrl('/admin'));
Expand Down
79 changes: 29 additions & 50 deletions application/controllers/admin/database.php
Expand Up @@ -129,7 +129,6 @@ public function index()
$this->actionUpdateSurveyLocaleSettingsGeneralSettings($iSurveyID);
}


//$this->getController()->redirect(array("/admin"), "refresh");
}

Expand Down Expand Up @@ -228,6 +227,7 @@ private function actionUpdateDefaultValues($iSurveyID)
}
}
Yii::app()->session['flashmessage'] = gT("Default value settings were successfully saved.");
//This is SUPER important! Recalculating the Expression Manager state!
LimeExpressionManager::SetDirtyFlag();

if (Yii::app()->request->getPost('close-after-save') === 'true') {
Expand Down Expand Up @@ -330,6 +330,7 @@ private function actionUpdateAnswerOptions($iSurveyID)
} else {
Yii::app()->setFlashMessage(gT("Answer options were successfully saved."));
}
//This is SUPER important! Recalculating the Expression Manager state!
LimeExpressionManager::SetDirtyFlag();
if (Yii::app()->request->getPost('close-after-save') === 'true') {
$this->getController()->redirect(array('admin/questions/sa/view/surveyid/'.$iSurveyID.'/gid/'.$this->iQuestionGroupID.'/qid/'.$this->iQuestionID));
Expand Down Expand Up @@ -504,7 +505,8 @@ private function actionSubQuestions($iSurveyID)
Yii::app()->session['flashmessage'] = gT("Subquestions were successfully saved.");
}
}
//$action='editsubquestions';

//This is SUPER important! Recalculating the Expression Manager state!
LimeExpressionManager::SetDirtyFlag();
if (Yii::app()->request->getPost('close-after-save') === 'true') {
$this->getController()->redirect(array('/admin/questions/sa/view/surveyid/'.$iSurveyID.'/gid/'.$this->iQuestionGroupID.'/qid/'.$this->iQuestionID));
Expand Down Expand Up @@ -756,46 +758,15 @@ private function actionUpdateQuestion($iSurveyID)
// Remove old subquestion scales
Question::model()->deleteAllByAttributes(array('parent_qid' => $this->iQuestionID), 'scale_id >= :scale_id', array(':scale_id' => $iSubquestionScales));
if (!isset($bOnError) || !$bOnError) {
// This really a quick hack and need a better system
// This really a quick hack and need a better system
Yii::app()->setFlashMessage(gT("Question was successfully saved."));
}
// }
// else
// {
//
// // There are conditions constraints: alert the user
// $errormsg="";
// if (!is_null($array_result['notAbove']))
// {
// $errormsg.=gT("This question relies on other question's answers and can't be moved above groupId:","js")
// . " " . $array_result['notAbove'][0][0] . " " . gT("in position","js")." ".$array_result['notAbove'][0][1]."\\n"
// . gT("See conditions:")."\\n";
//
// foreach ($array_result['notAbove'] as $notAboveCond)
// {
// $errormsg.="- cid:". $notAboveCond[3]."\\n";
// }
//
// }
// if (!is_null($array_result['notBelow']))
// {
// $errormsg.=gT("Some questions rely on this question's answers. You can't move this question below groupId:","js")
// . " " . $array_result['notBelow'][0][0] . " " . gT("in position","js")." ".$array_result['notBelow'][0][1]."\\n"
// . gT("See conditions:")."\\n";
//
// foreach ($array_result['notBelow'] as $notBelowCond)
// {
// $errormsg.="- cid:". $notBelowCond[3]."\\n";
// }
// }
//
// $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"$errormsg\")\n //-->\n</script>\n";
// $gid= $oldgid; // group move impossible ==> keep display on oldgid
// }
} else {
Yii::app()->setFlashMessage(gT("Question could not be updated"), 'error');
}
}
//This is SUPER important! Recalculating the Expression Manager state!
LimeExpressionManager::SetDirtyFlag();
LimeExpressionManager::UpgradeConditionsToRelevance($iSurveyID);

$closeAfterSave = Yii::app()->request->getPost('close-after-save') === 'true';
Expand Down Expand Up @@ -897,28 +868,33 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
Yii::app()->loadHelper('surveytranslator');
$formatdata = getDateFormatData(Yii::app()->session['dateformat']);
Yii::app()->loadLibrary('Date_Time_Converter');

$unfilteredStartdate = App()->request->getPost('startdate', null);
$startdate = $this->_filterEmptyFields($oSurvey, 'startdate');
if (trim($startdate) == "") {
$startdate = null;
if ($unfilteredStartdate === null) {
// Not submitted.
} elseif (trim($unfilteredStartdate) == "") {
$oSurvey->startdate = "";
} else {
Yii::app()->loadLibrary('Date_Time_Converter');
$datetimeobj = new date_time_converter($startdate, $formatdata['phpdate'].' H:i'); //new Date_Time_Converter($startdate,$formatdata['phpdate'].' H:i');
$datetimeobj = new date_time_converter($startdate, $formatdata['phpdate'].' H:i');
$startdate = $datetimeobj->convert("Y-m-d H:i:s");
$oSurvey->startdate = $startdate;
}

$unfilteredExpires = App()->request->getPost('expires', null);
$expires = $this->_filterEmptyFields($oSurvey, 'expires');
if (trim($expires) == "") {
$expires = null;
if ($unfilteredExpires === null) {
// Not submitted.
} elseif (trim($unfilteredExpires) == "") {
// Must not convert if empty.
$oSurvey->expires = "";
} else {
$datetimeobj = new date_time_converter($expires, $formatdata['phpdate'].' H:i'); //new Date_Time_Converter($expires, $formatdata['phpdate'].' H:i');
$datetimeobj = new date_time_converter($expires, $formatdata['phpdate'].' H:i');
$expires = $datetimeobj->convert("Y-m-d H:i:s");
$oSurvey->expires = $expires;
}

//$oSurvey, $fieldArray, $newValue
$oSurvey->expires = $expires;
$oSurvey->startdate = $startdate;



$oSurvey->assessments = $this->_filterEmptyFields($oSurvey, 'assessments');

if ($oSurvey->active != 'Y') {
Expand Down Expand Up @@ -1016,7 +992,8 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
$param->save();
}
}

//This is SUPER important! Recalculating the Expression Manager state!
LimeExpressionManager::SetDirtyFlag();
if (Yii::app()->request->getPost('responsejson', 0) == 1) {

$updatedFields = $this->updatedFields;
Expand Down Expand Up @@ -1124,6 +1101,8 @@ protected function actionUpdateSurveyLocaleSettingsGeneralSettings($iSurveyID)
cleanLanguagesFromSurvey($iSurveyID, implode(" ", $oSurvey->additionalLanguages));
fixLanguageConsistency($iSurveyID, implode(" ", $oSurvey->additionalLanguages));

//This is SUPER important! Recalculating the Expression Manager state!
LimeExpressionManager::SetDirtyFlag();
// This will force the generation of the entry for survey group
TemplateConfiguration::checkAndcreateSurveyConfig($iSurveyID);

Expand Down Expand Up @@ -1421,7 +1400,7 @@ private function actionInsertCopyQuestion($iSurveyID)
}

}

//This is SUPER important! Recalculating the Expression Manager state!
LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting
$redirectLink = $this->getController()->createUrl('admin/questions/sa/view/', array('surveyid' => $iSurveyID, 'gid' => $this->iQuestionGroupID, 'qid' => $this->iQuestionID));
if (Yii::app()->request->getPost('saveandnew', '') != '') {
Expand Down
7 changes: 0 additions & 7 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -457,15 +457,8 @@ public function getAjaxMenuArray($surveyid, $position = '')
{
$iSurveyID = sanitize_int($surveyid);

if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'read')) {
Yii::app()->user->setFlash('error', gT("Access denied"));
$this->getController()->redirect(Yii::app()->createUrl('/admin'));
}

$survey = Survey::model()->findByPk($iSurveyID);
$baselang = $survey->language;
$menus = $survey->getSurveyMenus($position);
$userSettings = [];
return Yii::app()->getController()->renderPartial(
'/admin/super/_renderJson',
array(
Expand Down
6 changes: 3 additions & 3 deletions application/core/LSCaptcha.php
Expand Up @@ -26,8 +26,8 @@ protected function renderImage()
$this->imageOptions['id'] = $this->getId();
}

$url = $this->getController()->createUrl($this->captchaAction, array('v'=>uniqid()));
$alt = isset($this->imageOptions['alt']) ? $this->imageOptions['alt'] : '';
return CHtml::image($url, $alt, $this->imageOptions);
$url=$this->getController()->createUrl($this->captchaAction,array('v'=>uniqid()));
$alt=isset($this->imageOptions['alt'])?$this->imageOptions['alt']:'';
return CHtml::image($url,$alt,$this->imageOptions);
}
}
13 changes: 13 additions & 0 deletions application/core/LSYii_ClientScript.php
Expand Up @@ -32,6 +32,7 @@ class LSYii_ClientScript extends CClientScript
{

const POS_POSTSCRIPT = 5;
const POS_PREBEGIN = 6;
/**
* cssFiles is protected on CClientScript. It can be useful to access it for debugin purpose
* @return array
Expand Down Expand Up @@ -448,6 +449,18 @@ public function renderBodyBegin(&$output)
{
$html = '';

if (isset($this->scriptFiles[self::POS_PREBEGIN])) {
foreach ($this->scriptFiles[self::POS_PREBEGIN] as $scriptFileUrl=>$scriptFileValue) {
if (is_array($scriptFileValue)) {
$html .= CHtml::scriptFile($scriptFileUrl, $scriptFileValue)."\n";
} else {
$html .= CHtml::scriptFile($scriptFileUrl)."\n";
}
}
}
if (isset($this->scripts[self::POS_PREBEGIN])) {
$html .= $this->renderScriptBatch($this->scripts[self::POS_PREBEGIN]);
}
if (isset($this->scriptFiles[self::POS_BEGIN])) {
foreach ($this->scriptFiles[self::POS_BEGIN] as $scriptFileUrl=>$scriptFileValue) {
if (is_array($scriptFileValue)) {
Expand Down

0 comments on commit efcc621

Please sign in to comment.