Author: housel
Date: Sat May 14 06:08:45 2005
New Revision: 9867
Added:
trunk/documentation/topic/cgi-bin/
trunk/documentation/topic/cgi-bin/topic.cgi (contents, props changed)
Log:
Bug: 7249
Beginning of a simple "content manager" for viewing topic-centered
documentation online.
Added: trunk/documentation/topic/cgi-bin/topic.cgi
==============================================================================
--- (empty file)
+++ trunk/documentation/topic/cgi-bin/topic.cgi Sat May 14 06:08:45 2005
@@ -0,0 +1,58 @@
+#!/usr/local/bin/perl -w
+
+use CGI;
+use CGI::Carp;
+use strict;
+
+my $www = "/usr/local/www";
+my $wwwdata = "$www/data";
+my $wwwtopic = "$www/topic";
+my $uri = "http://www.gwydiondylan.org/cgi-bin/topic.cgi";
+
+open(HEAD, '<', "$wwwdata/header.html") || exit 1;
+my @head = <HEAD>;
+close(HEAD);
+
+open(MENU, '<', "$wwwdata/menu.html") || exit 1;
+my @menu = <MENU>;
+close(MENU);
+
+open(FOOT, '<', "$wwwdata/footer.html") || exit 1;
+my @foot = <FOOT>;
+close(FOOT);
+
+my $q = new CGI;
+my $view = $q->param('view') || 'default';
+my $path = $q->path_info;
+
+if($view eq 'download') {
+ if(($path =~ m|^/reference/|
+ || $path =~ m|^/map/|
+ || $path =~ m|^/concept/|
+ || $path =~ m|^/task/|)
+ && $path =~ m|\.xml$|
+ && -f "$wwwtopic$path"
+ && open(DOWNLOAD, '<', "$wwwtopic$path")) {
+ print $q->header('text/xml'), <DOWNLOAD>;
+ close(DOWNLOAD);
+ exit 0;
+ } else {
+ print $q->header('text/html', '404 Not Found'),
+ $q->start_html('404 Not Found'),
+ $q->h1('404 Not Found'),
+ $q->end_html;
+ exit 0;
+ }
+} elsif($view eq 'default') {
+ print $q->header, @head, @menu;
+
+ print $q->h1("Hello topic"),
+ $q->p($q->path_info);
+
+ print @foot;
+} else {
+ exit 1;
+}
+
+exit 0;
+
--
Gd-chatter mailing list
Gd-chatter@xxxxxxxxxxxxxxxx
https://gauss.gwydiondylan.org/mailman/listinfo/gd-chatter
|
|