Skip to content

Commit

Permalink
Dev: subQuestion js variables subview
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jan 11, 2016
1 parent 4580f76 commit cd26705
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 34 deletions.
2 changes: 2 additions & 0 deletions application/controllers/admin/questions.php
Expand Up @@ -790,6 +790,8 @@ public function _editsubquestion($surveyid, $gid, $qid)
}
}

$aData['jsVariableType'] = 'subQuestions';
$aViewUrls['_subQuestionsAndAnwsersJsVariables'][] = $aData;
$aViewUrls['subQuestion_view'][] = $aData;

return $aViewUrls;
Expand Down
@@ -0,0 +1,39 @@
<script type='text/javascript'>
// Common variables between subquestions / answers options
var cancel = '<?php eT('Cancel'); ?>';
var check = true;
var lafail = '<?php eT('Sorry, the request failed!'); ?>';
var lanameurl = '<?php echo Yii::app()->createUrl('/admin/labels/sa/getAllSets'); ?>';
var langs = '<?php echo implode(';',$anslangs); ?>';
var languagecount = <?php echo count($anslangs); ?>;
var lasaveurl = '<?php echo Yii::app()->createUrl('/admin/labels/sa/ajaxSets'); ?>';
var lasuccess = '<?php eT('The records have been saved successfully!'); ?>';
var lsbrowsertitle = '<?php eT('Label set browser','js'); ?>';
var lsdetailurl = '<?php echo Yii::app()->createUrl('/admin/questions/sa/ajaxlabelsetdetails'); ?>';
var lspickurl = '<?php echo Yii::app()->createUrl('/admin/questions/sa/ajaxlabelsetpicker'); ?>';
var ok = '<?php eT('Ok'); ?>';
var saveaslabletitle = '<?php eT('Save as label set','js'); ?>';
var sCheckLabelURL = '<?php echo Yii::app()->createUrl('/admin/questions/sa/ajaxchecklabel'); ?>';
var sImageURL = '<?php echo Yii::app()->getConfig('adminimageurl'); ?>';
var sLabelSetName = '<?php eT('Label set name','js'); ?>';
var strcode = '<?php eT('Code','js'); ?>';
var strlabel = '<?php eT('Label','js'); ?>';
var strNoLabelSet = '<?php eT('There are no label sets which match the survey default language','js'); ?>';
</script>

<?php if ($jsVariableType=='subQuestions'): ?>
<script>
// variables with different values in subqestions / answer options
var newansweroption_text = '<?php eT('New answer option','js'); ?>';
var quickaddtitle = '<?php eT('Quick-add answers','js'); ?>';
var strCantDeleteLastAnswer = '<?php eT('You cannot delete the last answer option.','js'); ?>';

// answer options variables
var assessmentvisible = <?php echo $assessmentvisible?'true':'false'; ?>;
var duplicateanswercode = '<?php eT('Error: You are trying to use duplicate answer codes.','js'); ?>';
var sAssessmentValue = '<?php eT('Assessment value','js'); ?>';
var scalecount = <?php echo $scalecount; ?>;
</script>
<?php endif; ?>

<?php echo PrepareEditorScript(true, $this); ?>
35 changes: 1 addition & 34 deletions application/views/admin/survey/Question/answerOptions_view.php
@@ -1,37 +1,4 @@
<script type='text/javascript'>
// Common variables between subquestions / answers options
var cancel = '<?php eT('Cancel'); ?>';
var check = true;
var lafail = '<?php eT('Sorry, the request failed!'); ?>';
var lanameurl = '<?php echo Yii::app()->createUrl('/admin/labels/sa/getAllSets'); ?>';
var langs = '<?php echo implode(';',$anslangs); ?>';
var languagecount = <?php echo count($anslangs); ?>;
var lasaveurl = '<?php echo Yii::app()->createUrl('/admin/labels/sa/ajaxSets'); ?>';
var lasuccess = '<?php eT('The records have been saved successfully!'); ?>';
var lsbrowsertitle = '<?php eT('Label set browser','js'); ?>';
var lsdetailurl = '<?php echo Yii::app()->createUrl('/admin/questions/sa/ajaxlabelsetdetails'); ?>';
var lspickurl = '<?php echo Yii::app()->createUrl('/admin/questions/sa/ajaxlabelsetpicker'); ?>';
var ok = '<?php eT('Ok'); ?>';
var saveaslabletitle = '<?php eT('Save as label set','js'); ?>';
var sCheckLabelURL = '<?php echo Yii::app()->createUrl('/admin/questions/sa/ajaxchecklabel'); ?>';
var sImageURL = '<?php echo Yii::app()->getConfig('adminimageurl'); ?>';
var sLabelSetName = '<?php eT('Label set name','js'); ?>';
var strcode = '<?php eT('Code','js'); ?>';
var strlabel = '<?php eT('Label','js'); ?>';
var strNoLabelSet = '<?php eT('There are no label sets which match the survey default language','js'); ?>';

// variables with different values in subqestions / answer options
var newansweroption_text = '<?php eT('New answer option','js'); ?>';
var quickaddtitle = '<?php eT('Quick-add answers','js'); ?>';
var strCantDeleteLastAnswer = '<?php eT('You cannot delete the last answer option.','js'); ?>';

// answer options variables
var assessmentvisible = <?php echo $assessmentvisible?'true':'false'; ?>;
var duplicateanswercode = '<?php eT('Error: You are trying to use duplicate answer codes.','js'); ?>';
var sAssessmentValue = '<?php eT('Assessment value','js'); ?>';
var scalecount = <?php echo $scalecount; ?>;
</script>
<?php echo PrepareEditorScript(true, $this); ?>


<div class="side-body" id="edit-question-body">
<h3>
Expand Down

0 comments on commit cd26705

Please sign in to comment.