Skip to content

Commit

Permalink
Dev: cleansed more views for inline scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Dec 4, 2017
1 parent a2dcace commit 197e494
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 29 deletions.
19 changes: 8 additions & 11 deletions application/controllers/admin/conditionsaction.php
Expand Up @@ -1707,20 +1707,19 @@ protected function getEditConditionForm(array $args)
);
$result .= $this->getController()->renderPartial('/admin/conditions/includes/form_editconditions_header', $data, true);

$result .= "<script type='text/javascript'>\n"
. "<!--\n"
$scriptResult = ""
. "\t".$js_getAnswers_onload."\n";
if (isset($p_method)) {
$result .= "\tdocument.getElementById('method').value='".$p_method."';\n";
$scriptResult .= "\tdocument.getElementById('method').value='".$p_method."';\n";
}

$result .= $this->getEditFormJavascript($subaction);
$scriptResult .= $this->getEditFormJavascript($subaction);

if (isset($p_scenario)) {
$result .= "\tdocument.getElementById('scenario').value='".$p_scenario."';\n";
$scriptResult .= "\tdocument.getElementById('scenario').value='".$p_scenario."';\n";
}
$result .= "-->\n"
. "</script>\n";
$scriptResult .= "\n";
App()->getClientScript()->registerScript('conditionsaction_onstartscripts', $scriptResult , LSYii_ClientScript::POS_END );

return $result;
}
Expand Down Expand Up @@ -1991,8 +1990,7 @@ protected function createNavigatorUrl($gid, $qid)
*/
protected function getJavascriptForMatching(array $canswers, array $cquestions, $surveyIsAnonymized)
{
$javascriptpre = CHtml::openTag('script', array('type' => 'text/javascript'))
. "<!--\n"
$javascriptpre = ""
. "\tvar Fieldnames = new Array();\n"
. "\tvar Codes = new Array();\n"
. "\tvar Answers = new Array();\n"
Expand Down Expand Up @@ -2024,8 +2022,7 @@ protected function getJavascriptForMatching(array $canswers, array $cquestions,
$javascriptpre .= "isAnonymousSurvey = false;";
}

$javascriptpre .= "//-->\n"
.CHtml::closeTag('script');
$javascriptpre .= "\n";

return $javascriptpre;
}
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/admin/expressions.php
Expand Up @@ -65,7 +65,8 @@ public function survey_logic_file()

$aData = array();

$sid = Yii::app()->request->getParam('surveyid', 0, 'integer');
$sid = Yii::app()->request->getParam('sid', 0, 'integer');
$surveyid = Yii::app()->request->getParam('surveyid', $sid, 'integer');

if (!Permission::model()->hasSurveyPermission($sid, 'surveycontent', 'read')) {
$message['title'] = gT('Access denied!');
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/conditions/conditionshead_view.php
Expand Up @@ -52,7 +52,7 @@ class='btn btn-default pull-right condition-header-button'


<?php echo $conditionsoutput_action_error;?>
<?php echo $javascriptpre;?>
<?php App()->getClientScript()->registerScript("conditionshead_prepared_javascript", $javascriptpre, LSYii_ClientScript::POS_BEGIN);?>

<!-- Modal for quick add -->
<div id="quick-add-condition-modal" class="modal fade" role="dialog">
Expand Down
8 changes: 4 additions & 4 deletions application/views/admin/conditions/includes/copyform.php
Expand Up @@ -39,14 +39,14 @@

</form>

<script type="text/javascript">
<?php App()->getClientScript()->registerScript("conditionshead_prepared_javascript","
function prepareCopyconditions() {
$("input:checked[name^='aConditionFromScenario']").each(function(i,val) {
$('input:checked[name^=\"aConditionFromScenario\"]').each(function(i,val) {
var thecid = val.value;
var theform = document.getElementById('copyconditions');
addHiddenElement(theform,'copyconditionsfrom[]',thecid);
return true;
});
}
</script>

", LSYii_ClientScript::POS_BEGIN);?>
4 changes: 1 addition & 3 deletions application/views/admin/conditions/includes/navigator.php
Expand Up @@ -36,6 +36,4 @@
window.dispatchEvent( triggerEvent );
});", LSYii_ClientScript::POS_POSTSCRIPT);
?>
<script>
//onchange="window.open(this.options[this.selectedIndex].value,'_top')"
</script>

@@ -1,4 +1,5 @@
<script type='text/javascript'>
<?php
App()->getClientScript()->registerScript("EditQuestionView_question_jsviews_prepare" ,"
var qtypes = new Array();
var qnames = new Array();
var qhelp = new Array();
Expand Down Expand Up @@ -77,5 +78,6 @@ function OtherSelection(QuestionType)
document.getElementById('MandatorySelection').style.display='';
}
}
OtherSelection('<?php echo $type; ?>');
</script>
", LSYii_ClientScript::POS_END );

App()->getClientScript()->registerScript("EditQuestionView_question_jsviews" ,"OtherSelection('".$type."');", LSYii_ClientScript::POS_POSTSCRIPT );
Expand Up @@ -2,10 +2,10 @@
/**
* This view render the needed variables for the ajax process of the creation of a new question
*/

App()->getClientScript()->registerScript("EditQuestionView_basic_variables" ,"
var attr_url = '".$this->createUrl('admin/questions', array('sa' => 'ajaxquestionattributes'))."';
var imgurl = '".Yii::app()->getConfig('imageurl')."';
var validateUrl = '".$sValidateUrl."';
".$qTypeOutput.";", LSYii_ClientScript::POS_BEGIN );
?>
<script type='text/javascript'>
var attr_url = "<?php echo $this->createUrl('admin/questions', array('sa' => 'ajaxquestionattributes')); ?>";
var imgurl = '<?php echo Yii::app()->getConfig('imageurl'); ?>';
var validateUrl = "<?php echo $sValidateUrl; ?>";
<?php echo $qTypeOutput; ?>
</script>

0 comments on commit 197e494

Please sign in to comment.