mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Only apply automatic text focus when working as an interviewer (otherwise may jump to strange part of page)
This commit is contained in:
@@ -52,8 +52,35 @@ function templatereplace($line, $replacements=array(), $anonymized=false, $quest
|
|||||||
|
|
||||||
if (stripos($line, "</head>"))
|
if (stripos($line, "</head>"))
|
||||||
{
|
{
|
||||||
|
//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 =
|
||||||
|
'<script type="text/javascript">
|
||||||
|
$(document).ready(function()
|
||||||
|
{
|
||||||
|
$(".text").focus();
|
||||||
|
$(".textarea").focus();
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
}
|
||||||
|
|
||||||
$line = str_ireplace("</head>",
|
$line = str_ireplace("</head>",
|
||||||
"<script type=\"text/javascript\" src=\"$rooturl/scripts/survey_runtime.js\"></script>\n"
|
"<script type=\"text/javascript\" src=\"$rooturl/scripts/survey_runtime.js\"></script>\n"
|
||||||
|
. "$textfocus\n"
|
||||||
. use_firebug()
|
. use_firebug()
|
||||||
. "\t</head>", $line);
|
. "\t</head>", $line);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ $(document).ready(function()
|
|||||||
if (typeof checkconditions!='undefined') checkconditions();
|
if (typeof checkconditions!='undefined') checkconditions();
|
||||||
if (typeof template_onload!='undefined') template_onload();
|
if (typeof template_onload!='undefined') template_onload();
|
||||||
prepareCellAdapters();
|
prepareCellAdapters();
|
||||||
$(".text").focus();
|
|
||||||
$(".textarea").focus();
|
|
||||||
document['onkeypress'] = checkEnter;
|
document['onkeypress'] = checkEnter;
|
||||||
if (typeof(focus_element) != 'undefined')
|
if (typeof(focus_element) != 'undefined')
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user