Skip to content

Commit

Permalink
Fixed issue #3994: When importing a survey with an unknown template, …
Browse files Browse the repository at this point in the history
…question preview is mixed up

Dev: Produces a warning on import but doesn't change anything so one can upload the template later. Question preview uses default tpl when it can not find the defined tpl.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@8255 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
mennodekker committed Jan 15, 2010
1 parent 42d0be3 commit 44cfe8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions admin/importsurvey.php
Expand Up @@ -428,7 +428,7 @@
while ($isresult->RecordCount()>0);
}


$importwarning = ""; // used to save the warnings while processing questions
$insert=$surveyarray[0];
if ($importversion>=111)
{
Expand All @@ -447,6 +447,7 @@
$surveyrowdata['sid']=$newsid;
$surveyrowdata['active']='N';

if (validate_templatedir($surveyrowdata['template'])!==$surveyrowdata['template']) $importwarning .= "<li>". sprintf($clang->gT('Template %s not found, please review when activating.'),$surveyrowdata['template']) ."</li>";

if ($importversion<=100)
// find the old language field and replace its contents with the new language shortcuts
Expand Down Expand Up @@ -760,7 +761,6 @@
}
}

$importwarning = ""; // used to save the warnings while processing questions
$qtypes = getqtypelist("" ,"array");

// DO GROUPS, QUESTIONS FOR GROUPS, THEN ANSWERS FOR QUESTIONS IN A NESTED FORMAT!
Expand Down Expand Up @@ -1414,7 +1414,7 @@
echo $clang->gT("Label Sets").": $countlabelsets\n";
if ($deniedcountlabelsets>0) echo $clang->gT("Not imported Label Sets").": $deniedcountlabelsets (".$clang->gT("(Label Sets were not imported since you do not have the permission to create new label sets.)");
echo $clang->gT("Question Attributes").": $countquestion_attributes\n";
echo $clang->gT("Assessments").": $countassessments\n\n";
echo $clang->gT("Assessments").": $countassessments\n\n";

echo $clang->gT("Import of Survey is completed.")."\n";
if ($importwarning != "") echo "\n".$clang->gT("Warnings").":\n" . $importwarning . "\n";
Expand Down
11 changes: 10 additions & 1 deletion admin/preview.php
Expand Up @@ -52,7 +52,16 @@
8 => 'N' ); // ia[8] is usedinconditions

$answers = retrieveAnswers($ia);
$thistpl="$templaterootdir/".$thissurvey['template'];

if (!$thissurvey['template'])
{
$thistpl=$templaterootdir."/".$defaulttemplate;
}
else
{
$thistpl=$templaterootdir."/".validate_templatedir($thissurvey['template']);
}

doHeader();
$dummy_js = '
<!-- JAVASCRIPT FOR CONDITIONAL QUESTIONS -->
Expand Down

0 comments on commit 44cfe8a

Please sign in to comment.