Skip to content

Commit

Permalink
Fixed issue #06169 - Timer message not displayed correctly. The js_he…
Browse files Browse the repository at this point in the history
…ader_includes function was adding extra directory information to any call to include js files that didn't start with http - breaking any relative url's included.
  • Loading branch information
jcleeland committed Jun 5, 2012
1 parent 826d1fd commit 2e45beb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions application/helpers/qanda_helper.php
Expand Up @@ -568,7 +568,8 @@ function return_timer_script($aQuestionAttributes, $ia, $disable=null) {
global $thissurvey;

$clang = Yii::app()->lang;
header_includes(Yii::app()->getConfig("generalscripts").'coookies.js');
header_includes(Yii::app()->getConfig("generalscripts").'coookies.js', 'js');

/* The following lines cover for previewing questions, because no $_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['fieldarray'] exists.
This just stops error messages occuring */
if(!isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['fieldarray']))
Expand Down Expand Up @@ -1324,7 +1325,6 @@ function do_language($ia)
function do_list_dropdown($ia)
{
global $dropdownthreshold;
global $js_header_includes;

$clang=Yii::app()->lang;

Expand All @@ -1351,7 +1351,6 @@ function do_list_dropdown($ia)
//Time Limit Code
if (trim($aQuestionAttributes['time_limit'])!='')
{
$js_header_includes[] = '/scripts/coookies.js';
$answer .= return_timer_script($aQuestionAttributes, $ia);
}
//End Time Limit Code
Expand Down Expand Up @@ -1608,7 +1607,6 @@ function do_list_dropdown($ia)
function do_list_radio($ia)
{
global $dropdownthreshold;
global $js_header_includes;
global $thissurvey;
$clang=Yii::app()->lang;
if ($thissurvey['nokeyboard']=='Y')
Expand Down Expand Up @@ -1678,7 +1676,6 @@ function do_list_radio($ia)
//Time Limit Code
if (trim($aQuestionAttributes['time_limit'])!='')
{
$js_header_includes[] = '/scripts/coookies.js';
$answer .= return_timer_script($aQuestionAttributes, $ia);
}
//End Time Limit Code
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/replacements_helper.php
Expand Up @@ -166,7 +166,7 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
if($js_header_includes){
foreach ($js_header_includes as $jsinclude)
{
if (substr($jsinclude,0,4) == 'http')
if (substr($jsinclude,0,4) == 'http' || substr($jsinclude,0,strlen(Yii::app()->getConfig('generalscripts'))) == Yii::app()->getConfig('generalscripts'))

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Jun 5, 2012

Collaborator

Without testing substr, with only http testing, i don't have probem of link ?

My : Yii::app()->baseUrl was empty.

Denis

$_templatejs .= "<script type='text/javascript' src='{$jsinclude}'></script>\n";
else
$_templatejs .= "<script type='text/javascript' src='".Yii::app()->baseUrl.$jsinclude."'></script>\n";
Expand Down

0 comments on commit 2e45beb

Please sign in to comment.