View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 05535 | Bug reports | Survey taking | public | 2011-10-27 15:28 | 2012-01-24 21:44 | 
| Reporter | tpartner | Assigned To | dionet | ||
| Priority | normal | Severity | partial_block | ||
| Status | closed | Resolution | duplicate | ||
| Product Version | 2.00a1 | ||||
| Target Version | 2.00a1 | Fixed in Version | 1.92RC3 | ||
| Summary | 05535: Timers don't work | ||||
| Description | The timers in short-text, long-text and huge-text do not work because coookies.js is not being included. This seems to be the same as bug 5470 where function getHeader($meta = false) seems to be broken - it's not inserting the $js_header_includes. | ||||
| Steps To Reproduce | Test attached survey with timers. | ||||
| Tags | No tags attached. | ||||
| Attached Files |  bug_05535_with_star_rating_fixed_v2.patch (6,612 bytes)   
 Index: common_helper.php
===================================================================
--- common_helper.php	(revision 11289)
+++ common_helper.php	(working copy)
@@ -8036,6 +8036,22 @@
     echo getHeader();
 }
 
+function addToJsAdminIncludes($addedfile)
+{
+    $CI =& get_instance();
+	$js_admin_includes = $CI->config->item("js_admin_includes");
+	$js_admin_includes[] = $addedfile;
+	$CI->config->set_item("js_admin_includes", array_unique($js_admin_includes));
+}
+
+function addToCssAdminIncludes($addedfile)
+{
+    $CI =& get_instance();
+	$css_admin_includes = $CI->config->item("css_admin_includes");
+	$css_admin_includes[] = $addedfile;
+	$CI->config->set_item("css_admin_includes", array_unique($css_admin_includes));
+}
+
 /**
 * This function returns the header for the printable survey
 * @return String
Index: frontend_helper.php
===================================================================
--- frontend_helper.php	(revision 11289)
+++ frontend_helper.php	(working copy)
@@ -135,7 +135,7 @@
     $js_header_includes[] = '/scripts/jquery/jquery-ui.js';
     $CI->config->set_item("js_admin_includes", $js_admin_includes);
 
-    $css_admin_includes = $CI->config->item("js_admin_includes");
+    $css_admin_includes = $CI->config->item("css_admin_includes");
     $css_header_includes[]= '/scripts/jquery/css/start/jquery-ui.css';
     $css_header_includes[]= '/scripts/jquery/css/start/lime-progress.css';
     $CI->config->set_item("css_admin_includes", $css_admin_includes);
Index: qanda_helper.php
===================================================================
--- qanda_helper.php	(revision 11289)
+++ qanda_helper.php	(working copy)
@@ -1670,7 +1670,7 @@
 
     if (trim($aQuestionAttributes['time_limit'])!='')
     {
-        $js_header_includes[] = '/scripts/coookies.js';
+		addToJsAdminIncludes('/scripts/coookies.js');
         $answer .= return_timer_script($aQuestionAttributes, $ia);
     }
 
@@ -1733,8 +1733,8 @@
     $answer .= "</ul>\n<input type=\"hidden\" name=\"java$ia[1]\" id=\"java$ia[1]\" value=\"".$_SESSION[$ia[1]]."\" />\n";
     $inputnames[]=$ia[1];
     if($aQuestionAttributes['slider_rating']==1){
-        $css_header_includes[]= '/admin/scripts/rating/jquery.rating.css';
-        $js_header_includes[]='/admin/scripts/rating/jquery.rating.js';
+		addToCssAdminIncludes('/scripts/admin/rating/jquery.rating.css');
+		addToJsAdminIncludes('/scripts/admin/rating/jquery.rating.js');
         $answer.='<br/><center><div id="'.$id.'div"><input type="radio" id="stars1" name="stars" class="'.$id.'st" value="1"/><input type="radio" id="stars2" name="stars" class="'.$id.'st" value="2"/><input type="radio" name="stars" id="stars3" class="'.$id.'st" value="3"/><input type="radio" id="stars4" name="stars" class="'.$id.'st" value="4"/><input type="radio" name="stars" id="stars5" class="'.$id.'st" value="5"/></div></center><br/>';
         $answer.="
         <script type=\"text/javascript\">
@@ -4472,8 +4472,9 @@
     if ($aQuestionAttributes['slider_layout']==1)
     {
         $slider_layout=true;
-        $css_header_includes[]= '/scripts/jquery/css/start/jquery-ui.css';
 
+		//addToJsAdminIncludes('/scripts/jquery/jquery-ui.js');
+		addToJsAdminIncludes('/scripts/jquery/lime-slider.js');
 
         if (trim($aQuestionAttributes['slider_accuracy'])!='')
         {
@@ -4646,9 +4647,6 @@
                     $slider_showmax='';
                 }
 
-                $js_header_includes[] = '/scripts/jquery/jquery-ui.js';
-                $js_header_includes[] = '/scripts/jquery/lime-slider.js';
-
                 if (isset($_SESSION[$myfname]) && $_SESSION[$myfname] != '')
                 {
                     $slider_startvalue = $_SESSION[$myfname] * $slider_divisor;
@@ -4733,9 +4731,6 @@
             $answer_main.=$answer_computed;
         }
         $answer .= $question_tip."<ul>\n".$answer_main."</ul>\n";
-        if($slider_layout){
-            $answer .= "<script type='text/javascript' src='".base_url()."/scripts/jquery/lime-slider.js'></script>";
-        }
     }
     //just added these here so its easy to change in one place
     $errorClass = 'tip problem';
@@ -5108,13 +5103,13 @@
         <div id=\"gmap_canvas_$ia[1]_c\" style=\"width: {$aQuestionAttributes['location_mapwidth']}px; height: {$aQuestionAttributes['location_mapheight']}px\"></div>";
 
         if ($aQuestionAttributes['location_mapservice']==1 && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off")
-            $js_header_includes[] = "https://maps.googleapis.com/maps/api/js?sensor=false";
+		    addToJsAdminIncludes('https://maps.googleapis.com/maps/api/js?sensor=false');
         else if ($aQuestionAttributes['location_mapservice']==1)
-                $js_header_includes[] = "http://maps.googleapis.com/maps/api/js?sensor=false";
-            elseif ($aQuestionAttributes['location_mapservice']==2)
-                $js_header_includes[] = "http://www.openlayers.org/api/OpenLayers.js";
+		    addToJsAdminIncludes('http://maps.googleapis.com/maps/api/js?sensor=false');
+        elseif ($aQuestionAttributes['location_mapservice']==2)
+		    addToJsAdminIncludes('http://www.openlayers.org/api/OpenLayers.js');
 
-            if (isset($aQuestionAttributes['hide_tip']) && $aQuestionAttributes['hide_tip']==0)
+        if (isset($aQuestionAttributes['hide_tip']) && $aQuestionAttributes['hide_tip']==0)
         {
             $answer .= "<br />\n<span class=\"questionhelp\">"
             . $clang->gT('Drag and drop the pin to the desired location. You may also right click on the map to move the pin.').'</span>';
@@ -5134,7 +5129,7 @@
 
     if (trim($aQuestionAttributes['time_limit'])!='')
     {
-        $js_header_includes[] = '/scripts/coookies.js';
+		addToJsAdminIncludes('/scripts/coookies.js');
         $answer .= return_timer_script($aQuestionAttributes, $ia, "answer".$ia[1]);
     }
 
@@ -5232,7 +5227,7 @@
 
     if (trim($aQuestionAttributes['time_limit'])!='')
     {
-        $js_header_includes[] = '/scripts/coookies.js';
+		addToJsAdminIncludes('/scripts/coookies.js');
         $answer .= return_timer_script($aQuestionAttributes, $ia, "answer".$ia[1]);
     }
 
@@ -5313,7 +5308,7 @@
 
     if (trim($aQuestionAttributes['time_limit']) != '')
     {
-        $js_header_includes[] = '/scripts/coookies.js';
+		addToJsAdminIncludes('/scripts/coookies.js');
         $answer .= return_timer_script($aQuestionAttributes, $ia, "answer".$ia[1]);
     }
 
 | ||||
| Bug heat | 4 | ||||
| Complete LimeSurvey version number (& build) | 11286 | ||||
| I will donate to the project if issue is resolved | No | ||||
| Browser | FF & IE | ||||
| Database type & version | MySQL 5.1.41 | ||||
| Server OS (if known) | Win | ||||
| Webserver software & version (if known) | Apache/2.2.14 | ||||
| PHP Version | 5.3.1 | ||||
| dionet, I have uploaded a patch that fixes this and the outstanding issue in 05470. There may be a better way to do it but please have a look. | |
| And another patch with the star rating feature fixed. | |
| Timers work fine in 1.92 | |
| Date Modified | Username | Field | Change | 
|---|---|---|---|
| 2011-10-27 15:28 | tpartner | New Issue | |
| 2011-10-27 15:28 | tpartner | Status | new => assigned | 
| 2011-10-27 15:28 | tpartner | Assigned To | => dionet | 
| 2011-10-27 15:28 | tpartner | File Added: limesurvey_survey_334964.lss | |
| 2011-10-27 15:29 | tpartner | Relationship added | related to 05470 | 
| 2011-10-27 17:47 | tpartner | File Added: bug_05535_patch.patch | |
| 2011-10-27 17:50 | tpartner | Note Added: 16547 | |
| 2011-10-27 18:08 | tpartner | File Added: bug_05535_patch_with_star_rating_fixed.patch | |
| 2011-10-27 18:08 | tpartner | Note Added: 16549 | |
| 2011-10-27 19:43 | tpartner | File Added: bug_05535_with_star_rating_fixed_v2.patch | |
| 2011-10-27 19:43 | tpartner | File Deleted: bug_05535_patch.patch | |
| 2011-10-27 19:43 | tpartner | File Deleted: bug_05535_patch_with_star_rating_fixed.patch | |
| 2012-01-20 17:46 | TMSWhite | Note Added: 16879 | |
| 2012-01-20 17:46 | TMSWhite | Status | assigned => resolved | 
| 2012-01-20 17:46 | TMSWhite | Resolution | open => fixed | 
| 2012-01-20 17:47 | TMSWhite | Relationship added | has duplicate 05528 | 
| 2012-01-24 21:43 | c_schmitz | Fixed in Version | => 1.92RC3 | 
| 2012-01-24 21:43 | c_schmitz | Status | resolved => closed | 
| 2012-01-24 21:43 | c_schmitz | Resolution | fixed => duplicate | 
| 2012-01-24 21:44 | c_schmitz | Relationship replaced | duplicate of 05528 | 


