From 2b0cdce5f83c408cc5c08da9a78787dbcebb1e19 Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Mon, 29 Apr 2013 15:09:55 +1000 Subject: [PATCH] Only apply automatic text focus when working as an interviewer (otherwise may jump to strange part of page) --- include/limesurvey/replacements.php | 27 ++++++++++++++++++++ include/limesurvey/scripts/survey_runtime.js | 2 -- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/limesurvey/replacements.php b/include/limesurvey/replacements.php index 93e82351..74446df5 100644 --- a/include/limesurvey/replacements.php +++ b/include/limesurvey/replacements.php @@ -52,8 +52,35 @@ function templatereplace($line, $replacements=array(), $anonymized=false, $quest if (stripos($line, "")) { + //queXS Addition + $textfocus = ""; + + $interviewer=returnglobal('interviewer'); + if (!empty($interviewer) || (isset($_SESSION['interviewer']) && $_SESSION['interviewer'] == true)) + { + $interviewer = true; + $_SESSION['interviewer'] = true; + } + else + { + $interviewer = false; + } + + if ($interviewer) + { + $textfocus = + ''; + } + $line = str_ireplace("", "\n" + . "$textfocus\n" . use_firebug() . "\t", $line); } diff --git a/include/limesurvey/scripts/survey_runtime.js b/include/limesurvey/scripts/survey_runtime.js index 26542790..a5ce8aa7 100644 --- a/include/limesurvey/scripts/survey_runtime.js +++ b/include/limesurvey/scripts/survey_runtime.js @@ -6,8 +6,6 @@ $(document).ready(function() if (typeof checkconditions!='undefined') checkconditions(); if (typeof template_onload!='undefined') template_onload(); prepareCellAdapters(); - $(".text").focus(); - $(".textarea").focus(); document['onkeypress'] = checkEnter; if (typeof(focus_element) != 'undefined') {