View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 04249 | Bug reports | Other | public | 2010-03-27 07:07 | 2010-05-05 10:28 |
| Reporter | Assigned To | c_schmitz | |||
| Priority | normal | Severity | minor | ||
| Status | closed | Resolution | suspended | ||
| Product Version | 1.87+ | ||||
| Summary | 04249: 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. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 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&editfile=$editfile&screenname=".urlencode($screenname)."&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&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&editfile=$editfile&screenname=".urlencode($screenname)."&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&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&templatename=$templatename&editfile=$editfile&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) {
| ||||
| Bug heat | 4 | ||||
| Complete LimeSurvey version number (& build) | 8498 | ||||
| I will donate to the project if issue is resolved | |||||
| Browser | Firefox | ||||
| Database type & version | Mysql 5.1.37 | ||||
| Server OS (if known) | Ubuntu | ||||
| Webserver software & version (if known) | Apache | ||||
| PHP Version | 5.2.10 | ||||
| Git branch / Pull Request URL | |||||
|
Please provide a patch. |
|
|
The patch is provided,this patch is more efficient than the patch of the bug 04248 |
|
|
hi carsten patched again according to our talk at the irc, Please review. bye |
|
|
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. |
|
|
patch updated according to the conversation at the irc, please review |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-03-27 07:07 |
|
New Issue | |
| 2010-03-27 07:07 |
|
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 |
|
File Added: errormessage.patch | |
| 2010-03-27 21:57 |
|
Note Added: 11527 | |
| 2010-03-27 21:57 |
|
Note Edited: 11527 | |
| 2010-03-27 22:15 |
|
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 |
|
File Added: disable_icons.patch | |
| 2010-03-29 19:06 |
|
Note Added: 11538 | |
| 2010-03-29 19:08 |
|
File Added: import_disabled.png | |
| 2010-03-29 19:08 |
|
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 |
|
Note Added: 11558 | |
| 2010-03-31 18:52 |
|
File Added: disable_icon.patch | |
| 2010-03-31 18:52 |
|
File Added: error.html | |
| 2010-03-31 22:08 | c_schmitz | File Deleted: disable_icons.patch | |
| 2010-04-01 18:21 |
|
File Deleted: disable_icon.patch | |
| 2010-04-01 18:21 |
|
File Added: disable_icon.patch | |
| 2010-04-01 18:21 |
|
File Deleted: error.html | |
| 2010-04-01 20:10 |
|
File Deleted: disable_icon.patch | |
| 2010-04-01 20:10 |
|
File Added: disable_icon.patch | |
| 2010-04-01 22:32 |
|
File Deleted: disable_icon.patch | |
| 2010-04-01 22:32 |
|
File Added: disable_icon.patch | |
| 2010-04-03 21:55 |
|
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 |