View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
04602Bug reportsTheme editorpublic2010-09-29 16:29
Reporterronvdburg Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.90+ 
Fixed in Version1.90+ 
Summary04602: Templaterootdir is referring to templatedir and thus gaines templatename twice
Description

print_img_radio.png is not being found

Steps To Reproduce

Edit template, select screen 'Printable survey page', check Apache's error log.

Look at common.php and search for function 'sGetTemplateURL'.
Check that the function returns the actual template URL including the subdirectory <templatename>.

Now look at admin/templates.php and search for 'sGetTemplateURL'.
Check that the value is stored in $templaterooturl.
Check that this variable is used three times to address print_img_radio.png.
These three references include an extra $templatename in the path, so the <templatename> subdir occurs twice.

Additional Information

Included is a patch that does the following:
1) The three occurrences of print_img_radio.png use:
"'.$templateurl.'/print_img_radio.png"
in stead of
"'.$templaterooturl.'/'.$templatename.'/print_img_radio.png"

2) Variable $templaterooturl is renamed to $templateurl. This is to help the developer remind that the templatename is already included.
3) Variable $templaterootdir is renamed to $templatedir. See (2).

Please note, there are also variables $usertemplaterootdir and $standardtemplaterootdir. These variables do refer to the rootdir (.../templates/) and not to the actual subdir <templatename>. So, these variables are not renamed.

TagsNo tags attached.
Attached Files
templateroot-to-template.patch (7,391 bytes)   
Index: source/limesurvey/admin/templates.php
===================================================================
--- source/limesurvey/admin/templates.php	(revision 9133)
+++ source/limesurvey/admin/templates.php	(working copy)
@@ -458,8 +458,8 @@
     </tr>
 </table>";
 $addbr=false;
-$templaterootdir=sGetTemplatePath($templatename);
-$templaterooturl=sGetTemplateURL($templatename);
+$templatedir=sGetTemplatePath($templatename);
+$templateurl=sGetTemplateURL($templatename);
 switch($screenname) {
     case 'surveylist':
         unset($files);
@@ -548,19 +548,19 @@
         foreach($Register as $qs) {
            $files[]=array("name"=>$qs);
         }
-        foreach(file("$templaterootdir/startpage.pstpl") as $op)
+        foreach(file("$templatedir/startpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/survey.pstpl") as $op)
+        foreach(file("$templatedir/survey.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/register.pstpl") as $op)
+        foreach(file("$templatedir/register.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/endpage.pstpl") as $op)
+        foreach(file("$templatedir/endpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
@@ -573,15 +573,15 @@
            $files[]=array("name"=>$qs);
         }
 
-        foreach(file("$templaterootdir/startpage.pstpl") as $op)
+        foreach(file("$templatedir/startpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/save.pstpl") as $op)
+        foreach(file("$templatedir/save.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/endpage.pstpl") as $op)
+        foreach(file("$templatedir/endpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
@@ -594,15 +594,15 @@
            $files[]=array("name"=>$qs);
         }
 
-        foreach(file("$templaterootdir/startpage.pstpl") as $op)
+        foreach(file("$templatedir/startpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/load.pstpl") as $op)
+        foreach(file("$templatedir/load.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/endpage.pstpl") as $op)
+        foreach(file("$templatedir/endpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
@@ -615,15 +615,15 @@
            $files[]=array("name"=>$qs);
         }
 
-        foreach(file("$templaterootdir/startpage.pstpl") as $op)
+        foreach(file("$templatedir/startpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/clearall.pstpl") as $op)
+        foreach(file("$templatedir/clearall.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/endpage.pstpl") as $op)
+        foreach(file("$templatedir/endpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
@@ -646,7 +646,7 @@
         }
 
         $questionoutput=array();
-        foreach(file("$templaterootdir/print_question.pstpl") as $op)
+        foreach(file("$templatedir/print_question.pstpl") as $op)
         { // echo '<pre>line '.__LINE__.'$op = '.htmlspecialchars(print_r($op)).'</pre>';
            $questionoutput[]=templatereplace($op, array(
                          'QUESTION_NUMBER'=>'1',
@@ -661,27 +661,27 @@
                          'QUESTIONHELP'=>'This is some help text for this question.',
                          'ANSWER'=>'<ul>
                                                 <li>
-                                                <img src="'.$templaterooturl.'/'.$templatename.'/print_img_radio.png" alt="First choice" class="input-radio" height="14" width="14">
+                                                <img src="'.$templateurl.'/print_img_radio.png" alt="First choice" class="input-radio" height="14" width="14">
                                                     First choice
                                             </li>
 
                                                 <li>
-                                                <img src="'.$templaterooturl.'/'.$templatename.'/print_img_radio.png" alt="Second choice" class="input-radio" height="14" width="14">
+                                                <img src="'.$templateurl.'/print_img_radio.png" alt="Second choice" class="input-radio" height="14" width="14">
                                                     Second choice
                                             </li>
                                                 <li>
-                                                <img src="'.$templaterooturl.'/'.$templatename.'/print_img_radio.png" alt="Third choice" class="input-radio" height="14" width="14">
+                                                <img src="'.$templateurl.'/print_img_radio.png" alt="Third choice" class="input-radio" height="14" width="14">
                                                     Third choice
                                             </li>
                                         </ul>'
                                         ));
         }
         $groupoutput=array();
-        foreach(file("$templaterootdir/print_group.pstpl") as $op)
+        foreach(file("$templatedir/print_group.pstpl") as $op)
         {
            $groupoutput[]=templatereplace($op, array('QUESTIONS'=>implode(' ',$questionoutput)));
         }
-        foreach(file("$templaterootdir/print_survey.pstpl") as $op)
+        foreach(file("$templatedir/print_survey.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op, array('GROUPS'=>implode(' ',$groupoutput),
                    'FAX_TO' => $clang->gT("Please fax your completed survey to:")." 000-000-000",
@@ -699,15 +699,15 @@
         foreach ($printtemplate as $qs) {
             $files[]=array("name"=>$qs);
         }
-        foreach(file("$templaterootdir/startpage.pstpl") as $op)
+        foreach(file("$templatedir/startpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/printanswers.pstpl") as $op)
+        foreach(file("$templatedir/printanswers.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
-        foreach(file("$templaterootdir/endpage.pstpl") as $op)
+        foreach(file("$templatedir/endpage.pstpl") as $op)
         {
            $myoutput[]=templatereplace($op);
         }
@@ -739,10 +739,10 @@
 
 //Get list of 'otherfiles'
 $otherfiles=array();
-if ($handle = opendir($templaterootdir)) {
+if ($handle = opendir($templatedir)) {
    while(false !== ($file = readdir($handle))) {
        if (!array_search($file, $normalfiles)) {
-           if (!is_dir($templaterootdir.DIRECTORY_SEPARATOR.$file)) {
+           if (!is_dir($templatedir.DIRECTORY_SEPARATOR.$file)) {
                $otherfiles[]=array("name"=>$file);
            }
        }
templateroot-to-template.patch (7,391 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)9129
I will donate to the project if issue is resolved
Browser
Database type & versionmysql 5.0.77
Server OS (if known)Centos 5.3 / Linux 2.6.18
Webserver software & version (if known)apache 2.2.3
PHP Version5.1.6

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2010-09-16 11:32

developer   ~12852

Fixed in 9134
Thank's a lot ronvdburg

c_schmitz

c_schmitz

2010-09-29 16:29

administrator   ~12937

New 1.90+ version was released.

Issue History

Date Modified Username Field Change
2010-09-15 13:45 ronvdburg New Issue
2010-09-15 13:45 ronvdburg File Added: templateroot-to-template.patch
2010-09-16 11:09 DenisChenu Assigned To => DenisChenu
2010-09-16 11:09 DenisChenu Status new => confirmed
2010-09-16 11:32 DenisChenu Note Added: 12852
2010-09-16 11:32 DenisChenu Status confirmed => resolved
2010-09-16 11:32 DenisChenu Resolution open => fixed
2010-09-16 11:32 DenisChenu Fixed in Version => 1.90+
2010-09-29 16:29 c_schmitz Note Added: 12937
2010-09-29 16:29 c_schmitz Status resolved => closed
2015-12-11 14:40 c_schmitz Category Templates => Theme editor