Skip to content

Commit

Permalink
Final clean-up for vvexport/vvimport - strips whitespace before expor…
Browse files Browse the repository at this point in the history
…ting, converts tabs and newlines to {tab} and {newline}, strips html tags from human readable first line, icons aligned left in browse menu, import returns user to browse page. Testing shows export/import/export produces identical match indicating no data loss.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@1200 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Sep 20, 2004
1 parent f437824 commit 0a22375
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
14 changes: 10 additions & 4 deletions admin/vvexport.php
Expand Up @@ -74,7 +74,7 @@
}
elseif (isset($sid) && $sid)
{
//Export is happening, first lets do the exporting
//Export is happening
header("Content-Disposition: attachment; filename=vvexport_$sid.xls");
header("Content-type: application/vnd.ms-excel");
$s="\t";
Expand All @@ -101,7 +101,7 @@
//echo "<pre>";print_r($fielddata);echo "</pre>";
if (count($fielddata) < 1) {$firstline.=$field;}
else
{$firstline.=str_replace("\n", " ", str_replace("\t", " ", $fielddata['question']));}
{$firstline.=str_replace("\n", " ", str_replace("\t", " ", strip_tags($fielddata['question'])));}
$firstline .= $s;
$secondline .= $field.$s;
}
Expand All @@ -114,11 +114,17 @@
{
foreach ($fieldnames as $field)
{
$value=str_replace("\n", "{newline}", $row[$field]);
$value=trim($row[$field]);
$value=str_replace("\n", "{newline}", $value);
$value=str_replace("\r", "", $value);
if (strpos($value, "\t")) {echo "[$value] - tab found";}
$value=str_replace("\t", "{tab}", $value);
echo $value.$s;
$sun[]=$value;
//echo $value.$s;
}
$beach=implode($s, $sun);
echo $beach;
unset($sun);
echo "\n";
}

Expand Down
10 changes: 5 additions & 5 deletions admin/vvimport.php
Expand Up @@ -55,11 +55,11 @@
{
echo "<br /><table class='outlinetable' align='center'>
<form enctype='multipart/form-data' method='post'>
<tr><th colspan=2>Import a VV survey file</th></tr>
<tr><td>File:</td><td><input type='file' name='the_file'></td></tr>
<tr><td>Survey ID:</td><td><input type='text' size=2 name='sid' value='$sid' readonly></td></tr>
<tr><td>Exclude id?</td><td><input type='checkbox' name='noid' value='noid' checked></td></tr>
<tr><td>&nbsp;</td><td><input type='submit' value='Upload'></td></tr>
<tr><th colspan=2>"._VV_IMPORTFILE."</th></tr>
<tr><td>"._VV_FILE."</td><td><input type='file' name='the_file'></td></tr>
<tr><td>"._VV_SURVEYID."</td><td><input type='text' size=2 name='sid' value='$sid' readonly></td></tr>
<tr><td>"._VV_EXCLUDEID."</td><td><input type='checkbox' name='noid' value='noid' checked></td></tr>
<tr><td>&nbsp;</td><td><input type='submit' value='"._TP_UPLOADFILE."'></td></tr>
<input type='hidden' name='action' value='upload'>
</form>
</table>";
Expand Down

0 comments on commit 0a22375

Please sign in to comment.