ossp-pkg/quos/quos.cgi 1.1 -> 1.2
--- quos.cgi 2004/10/25 14:35:11 1.1
+++ quos.cgi 2004/10/25 15:42:43 1.2
@@ -28,16 +28,73 @@
require 5.008;
use CGI;
use String::Divert;
+use IO::File;
-# ...FIXME...
+# create objects
+my $cgi = new CGI;
+my $html = new String::Divert;
+$html->overload(1);
-my $html = '';
-$html .= "<div class=\"quos\">";
-$html .= "...";
-$html .= "<span class=titlebrowse>Browse</span>";
-$html .= "...";
-$html .= "</div>";
-print STDOUT $html;
+# generate outer canvas
+$html .= "<div class=\"quos\">\n";
+$html->fold("quos");
+$html .= "</div>\n";
+$html >> "quos";
+
+# generate browse part
+$html .= "<p>";
+$html .= "<span class=\"browse\">";
+$html .= "<span class=\"title\">Browse</span>\n";
+$html->fold("browse");
+$html .= "</span>\n";
+$html .= "</span>\n";
+
+# generate query part
+$html .= "<p>";
+$html .= "<span class=\"query\">";
+$html .= "<span class=\"title\">Query</span>\n";
+$html->fold("query");
+$html .= "</span>\n";
+$html .= "</span>\n";
+
+# generate view part
+$html .= "<p>";
+$html .= "<span class=\"view\">";
+$html .= "<span class=\"title\">View</span>\n";
+$html->fold("view");
+$html .= "</span>\n";
+$html .= "</span>\n";
+
+# generate result part
+$html .= "<p>";
+$html .= "<span class=\"result\">";
+$html .= "<span class=\"title\">Result</span>\n";
+$html->fold("result");
+$html .= "</span>\n";
+$html .= "</span>\n";
+
+# sample
+$html >> "query";
+$html .= "this is the query part";
+$html << 1;
+
+# read HTML skeleton
+my $io = new IO::File "<quos.html"
+ or die "unable to read HTML skeleton file \"quos.html\"";
+my $skel = '';
+$skel .= $_ while (<$io>);
+$io->close();
+$html->undivert(0);
+$skel =~ s|\%BODY\%|$html|s;
+$html = $skel;
+
+# create HTTP response
+my $http = $cgi->header(
+ -type => 'text/html',
+ -expires => '+10s'
+);
+$http .= $html;
+print STDOUT $http;
__END__
|
|