View Issue Details

This issue affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
04249Bug reportsOtherpublic2010-05-05 10:28
Reporteruser7171Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionsuspended 
Product Version1.87+ 
Summary04249: Export Template Error
Description

When no template is selected for export then there are no proper error messages appear, clearly giving the idea of what is wrong.

Steps To Reproduce

just go to export template option without selecting any template, not even the default one.

TagsNo tags attached.
Attached Files
import_disabled.png (1,008 bytes)   
import_disabled.png (1,008 bytes)   
export_disabled.png (1,099 bytes)   
export_disabled.png (1,099 bytes)   
disable_icon.patch (7,696 bytes)   
Index: admin/templates.php
===================================================================
--- admin/templates.php	(revision 8546)
+++ admin/templates.php	(working copy)
@@ -874,19 +874,37 @@
              "<img name='DeleteTemplate' src='$imagefiles/delete.png' alt='".$clang->gT("Delete this template")."' " .
              " /></a>";
                                }
-                               $templatesoutput.= "\t<img src='$imagefiles/blank.gif' alt='' width='20' height='10' />\n"
-                               ."\t<a href='#' onclick='javascript:window.open(\"admin.php?action=templatezip&amp;editfile=$editfile&amp;screenname=".urlencode($screenname)."&amp;templatename=$templatename\", \"_top\")'"
-                               ." title=\"".$clang->gTview("Export Template")."\" >"
-                               ."<img name='Export' src='$imagefiles/export.png' alt='".$clang->gT("Export Template")."' /></a>\n"
-                               ."<a href='#' onclick='javascript:window.open(\"admin.php?action=templates&amp;subaction=templateupload\", \"_top\")'"
-                               ." title=\"".$clang->gTview("Import template")."\" >"
-                               ."<img name='ImportTemplate' src='$imagefiles/import.png' alt='".$clang->gT("Import template")."' title='' /></a>\n"
-                               ."\t<img src='$imagefiles/seperator.gif' alt='' border='0' />\n"
-                               ."<a href='#' title=\"".$clang->gTview("Copy Template")."\" "
-                               ."onclick=\"javascript: copyprompt('".$clang->gT("Please enter the name for the copied template:")."', '".$clang->gT("copy_of_")."$templatename', '$templatename', 'copy')\">"
-                               ."<img name='MakeCopy' src='$imagefiles/copy.png' alt='".$clang->gT("Copy Template")."' /></a>"
-                               ."</div>\n"
-                               ."<div class='menubar-right'>\n"
+$templatesoutput.= "\t<img src='$imagefiles/blank.gif' alt='' width='20' height='10' />\n";
+if(is_writable($tempdir) && is_writable($templaterootdir))
+{
+$templatesoutput.="\t<a href='#' onclick='javascript:window.open(\"admin.php?action=templatezip&amp;editfile=$editfile&amp;screenname=".urlencode($screenname)."&amp;templatename=$templatename\", \"_top\")'"
+    ." title=\"".$clang->gTview("Export Template")."\" >" 
+    ."<img name='Export' src='$imagefiles/export.png' alt='".$clang->gT("Export Template")."' /></a>\n"
+    ."<a href='#' onclick='javascript:window.open(\"admin.php?action=templates&amp;subaction=templateupload\", \"_top\")'"
+    ." title=\"".$clang->gTview("Import template")."\" >" 
+    ."<img name='ImportTemplate' src='$imagefiles/import.png' alt='".$clang->gT("Import template")."' title='' /></a>\n"
+    ."\t<img src='$imagefiles/seperator.gif' alt='' border='0' />\n"
+    ."<a href='#' title=\"".$clang->gTview("Copy Template")."\" " 
+    ."onclick=\"javascript: copyprompt('".$clang->gT("Please enter the name for the copied template:")."', '".$clang->gT("copy_of_")."$templatename', 	   	'$templatename', 'copy')\">" 
+    ."<img name='MakeCopy' src='$imagefiles/copy.png' alt='".$clang->gT("Copy Template")."' /></a>";
+}
+elseif(is_writable($templaterootdir))
+{
+$templatesoutput.="<img name='Export' src='$imagefiles/export_disabled.png' alt='".$clang->gT("Please change the directory permissions of tmp folder in order to enable this option")."' /></a>\n"
+    ."<img name='ImportTemplate' src='$imagefiles/import_disabled.png' alt='".$clang->gT("Please change the directory permissions of tmp folder in order to enable this option")."' title='' />\n"
+."\t<img src='$imagefiles/seperator.gif' alt='' border='0' />\n"
+    ."<a href='#' title=\"".$clang->gTview("Copy Template")."\" " 
+    ."onclick=\"javascript: copyprompt('".$clang->gT("Please enter the name for the copied template:")."', '".$clang->gT("copy_of_")."$templatename', '$templatename', 'copy')\">" 
+    ."<img name='MakeCopy' src='$imagefiles/copy.png' alt='".$clang->gT("Copy Template")."' /></a>";
+}
+else
+{
+
+$templatesoutput.="<img name='Export' src='$imagefiles/export_disabled.png' alt='".$clang->gT("Please change the directory permissions of tmp folder amd templates folder in order to enable this option")."' /></a>\n"
+	."<img name='ImportTemplate' src='$imagefiles/import_disabled.png' alt='".$clang->gT("Please change the directory permissions of tmp folder amd templates folder in order to enable this option")."' title='' />\n"
+	."\t<img src='$imagefiles/seperator.gif' alt='' border='0' />\n"
+	."<img name='MakeCopy' src='$imagefiles/copy_disabled.png' alt='".$clang->gT("Please change the directory permissions of tmp folder amd templates folder in order to enable this option")."' /></a>";}
+				$templatesoutput.= "</div>\n<div class='menubar-right'>\n"
                                ."<font style='boxcaption'><strong>".$clang->gT("Screen:")."</strong> </font>"
                                . "<select class=\"listboxtemplates\" name='screenname' onchange='javascript: window.open(\"admin.php?action=templates&amp;templatename=$templatename&amp;editfile=$editfile&amp;screenname=\"+escape(this.value), \"_top\")'>\n"
                                . makeoptions($screens, "id", "name", html_escape($screenname) )
@@ -1026,23 +1044,31 @@
 
                                    // The following lines are forcing the browser to refresh the templates on each save
                                    $time=date("ymdHis");
-                                   $fnew=fopen("$tempdir/template_temp_$time.html", "w+");
-                                   fwrite ($fnew, getHeader());
-                                   foreach ($cssfiles as $cssfile)
-                                   {
-                                       $myoutput=str_replace($cssfile['name'],$cssfile['name']."?t=$time",$myoutput);
-                                   }
+                           @$fnew=fopen("$tempdir/template_temp_$time.html", "w+");
+if(!$fnew)
+{
+$templatesoutput.= "<p>\n"."<strong><font color='red'>".$clang->gT("Please change the directory permission of /tmp folder in order to view the standard template")."</font></strong><br />"
+."</div>\n";
 
-                                   foreach($myoutput as $line) {
-                                       fwrite($fnew, $line);
-                                   }
-                                   fclose($fnew);
-                                   $langdir_template="$publicurl/locale/".$_SESSION['adminlang']."/help";
-                                   $templatesoutput.= "<p>\n"
-                                   ."<iframe id='previewiframe' src='$tempurl/template_temp_$time.html' width='95%' height='768' name='previewiframe' style='background-color: white;'>Embedded Frame</iframe>\n"
-                                   ."</p></div>\n";
-                               }
+}
+else
+{
+@fwrite ($fnew, getHeader());
+foreach ($cssfiles as $cssfile)
+{
+    $myoutput=str_replace($cssfile['name'],$cssfile['name']."?t=$time",$myoutput);
+}
 
+foreach($myoutput as $line) {
+	@fwrite($fnew, $line);
+}
+@fclose($fnew);
+$langdir_template="$publicurl/locale/".$_SESSION['adminlang']."/help";
+$templatesoutput.= "<p>\n"."<iframe id='previewiframe' src='$tempurl/template_temp_$time.html' width='95%' height='768' name='previewiframe' style='background-color: white;'>Embedded Frame</iframe>\n"
+."</div>\n";
+}
+}
+
                                function doreplacement($file) { //Produce sample page from template file
                                    $output=array();
                                    foreach(file($file) as $op) {
disable_icon.patch (7,696 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)8498
I will donate to the project if issue is resolved
BrowserFirefox
Database type & versionMysql 5.1.37
Server OS (if known)Ubuntu
Webserver software & version (if known)Apache
PHP Version5.2.10
Git branch / Pull Request URL

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2010-03-27 11:14

administrator   ~11525

Please provide a patch.

user7171

2010-03-27 21:57

  ~11527

Last edited: 2010-03-27 21:57

The patch is provided,this patch is more efficient than the patch of the bug 04248

user7171

2010-03-29 19:06

  ~11538

hi carsten

patched again according to our talk at the irc, Please review.

bye

c_schmitz

c_schmitz

2010-03-31 16:39

administrator   ~11555

I checked the patch.

Please change the way the 'Please change your permissions' message is shown - it is totally out of the current HTML bounds - not even inside the body tag. I think it would be easiest to put it into the hint of the disabled icons, don't you think? Don't cut corners.

user7171

2010-03-31 18:51

  ~11558

patch updated according to the conversation at the irc, please review

Issue History

Date Modified Username Field Change
2010-03-27 07:07 user7171 New Issue
2010-03-27 07:07 user7171 File Added: exporttemplate.patch
2010-03-27 10:05 jcleeland File Deleted: exporttemplate.patch
2010-03-27 11:13 c_schmitz Status new => assigned
2010-03-27 11:13 c_schmitz Assigned To => user7171
2010-03-27 11:14 c_schmitz Note Added: 11525
2010-03-27 21:56 user7171 File Added: errormessage.patch
2010-03-27 21:57 user7171 Note Added: 11527
2010-03-27 21:57 user7171 Note Edited: 11527
2010-03-27 22:15 user7171 Status assigned => resolved
2010-03-27 23:54 c_schmitz Status resolved => assigned
2010-03-27 23:54 c_schmitz Assigned To user7171 => c_schmitz
2010-03-29 19:06 user7171 File Added: disable_icons.patch
2010-03-29 19:06 user7171 Note Added: 11538
2010-03-29 19:08 user7171 File Added: import_disabled.png
2010-03-29 19:08 user7171 File Added: export_disabled.png
2010-03-31 16:30 c_schmitz File Deleted: errormessage.patch
2010-03-31 16:39 c_schmitz Note Added: 11555
2010-03-31 18:51 user7171 Note Added: 11558
2010-03-31 18:52 user7171 File Added: disable_icon.patch
2010-03-31 18:52 user7171 File Added: error.html
2010-03-31 22:08 c_schmitz File Deleted: disable_icons.patch
2010-04-01 18:21 user7171 File Deleted: disable_icon.patch
2010-04-01 18:21 user7171 File Added: disable_icon.patch
2010-04-01 18:21 user7171 File Deleted: error.html
2010-04-01 20:10 user7171 File Deleted: disable_icon.patch
2010-04-01 20:10 user7171 File Added: disable_icon.patch
2010-04-01 22:32 user7171 File Deleted: disable_icon.patch
2010-04-01 22:32 user7171 File Added: disable_icon.patch
2010-04-03 21:55 user7171 Status assigned => resolved
2010-05-05 10:28 c_schmitz Status resolved => closed
2010-05-06 10:27 c_schmitz Category Import / Export => (No Category)
2026-10-25 16:41 c_schmitz Resolution open => suspended