~adamzammit/quexs/quexscativm

« back to all changes in this revision

Viewing changes to include/limesurvey/replacements.php

  • Committer: Adam Zammit
  • Date: 2013-04-29 05:09:55 UTC
  • mto: This revision was merged to the branch mainline in revision 302.
  • Revision ID: adam.zammit@acspri.org.au-20130429050955-05q56eaffgiwkqcn
Only apply automatic text focus when working as an interviewer (otherwise may jump to strange part of page)

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 
53
53
    if (stripos($line, "</head>"))
54
54
    {
 
55
        //queXS Addition
 
56
        $textfocus = "";
 
57
 
 
58
        $interviewer=returnglobal('interviewer');
 
59
        if (!empty($interviewer) || (isset($_SESSION['interviewer']) && $_SESSION['interviewer'] == true))
 
60
        {
 
61
                $interviewer = true;
 
62
                $_SESSION['interviewer'] = true;
 
63
        }
 
64
        else
 
65
        {
 
66
                $interviewer = false;
 
67
        }
 
68
 
 
69
        if ($interviewer)
 
70
        {       
 
71
                $textfocus =
 
72
                '<script type="text/javascript">
 
73
                $(document).ready(function()
 
74
                {
 
75
                        $(".text").focus();
 
76
                        $(".textarea").focus();
 
77
                });
 
78
                </script>';
 
79
        }
 
80
 
55
81
        $line = str_ireplace("</head>",
56
82
            "<script type=\"text/javascript\" src=\"$rooturl/scripts/survey_runtime.js\"></script>\n"
 
83
                        . "$textfocus\n"
57
84
                        . use_firebug()
58
85
                        . "\t</head>", $line);
59
86
    }