more database interface changes for the Wiki, plus help

This commit is contained in:
david 2002-01-18 01:13:18 +00:00
parent 17232da14f
commit 09c3998dc8
5 changed files with 188 additions and 0 deletions

View File

@ -1,3 +1,4 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

View File

@ -0,0 +1,66 @@
#! /usr/bin/perl
use CGI qw(:standard);
use Pg;
$query = new CGI;
$dbmain = "ldp";
@row;
# Read parameters
$doc_id = param('doc_id');
print header(-expires=>'now');
$conn=Pg::connectdb("dbname=$dbmain");
die $conn->errorMessage unless PGRES_CONNECTION_OK eq $conn->status;
$result = $conn->exec("SELECT title, filename FROM document WHERE doc_id = $doc_id");
die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus;
@row = $result->fetchrow;
$title = $row[0];
$title =~ s/\s+$//;
$filename = $row[1];
print "<html><head><title>$title Wiki</title>";
print "<link rel=stylesheet href='../ldp.css' type='text/css'>";
print "</head>";
print "<body>";
print "<h1>$title Wiki</h1>\n";
print "<p><a href='/index.html'>Index</a> ";
print "<a href='/cgi-bin/document_list.pl'>Documents</a> ";
print "<a href='/cgi-bin/topic_list.pl'>Topics</a> ";
print "<a href='/cgi-bin/maintainer_list.pl'>Maintainers</a> ";
print "<a href='/cgi-bin/editor_list.pl'>Editors</a> ";
print "<a href='/cgi-bin/ldp_stats.pl'>Statistics</a> ";
print "<a href='/help/'>Help</a> ";
print "<p>";
print "<a href='document_edit.pl?doc_id=$doc_id'>Meta-Data</a>\n";
print "&nbsp;|&nbsp;";
print "<a href='document_wiki.pl?doc_id=$doc_id'>Edit</a>\n";
print "<p><table>\n";
print "<tr><th align=right>Revision</th><th>Saved</th><th>Comment</th><th>User</th></tr>\n";
$result = $conn->exec("SELECT revision, date_entered, wiki, notes, username FROM document_wiki WHERE doc_id = $doc_id ORDER BY revision DESC LIMIT 10, 0");
die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus;
while (@row = $result->fetchrow) {
$revision = $row[0];
$date_entered = $row[1];
$wiki = $row[2];
$wiki =~ s/\s+$//;
$notes = $row[3];
$username = $row[4];
print "<tr><td align=right>$revision</td>\n";
print "<td>$date_entered</td>\n";
print "<td>$notes</td>\n";
print "<td>$username</td></tr>\n";
}
print "</table>\n";
print end_html;

View File

@ -21,6 +21,7 @@
<p><ul>
<li><a href="../newaccount.html">Getting an account</a></li>
<li><a href="license.html">Licensing</a></li>
<li><a href="wiki.html">Wiki</a></li>
</ul>
</body>

87
LDP/lampadas/www/wiki.html Executable file
View File

@ -0,0 +1,87 @@
<html>
<head>
<title>LDP Document Database</title>
<link rel=stylesheet href="/ldp.css" type="text/css">
</head>
<body>
<h2>Wiki Help</h2>
<a href="/index.html">Index</a>
<a href="/cgi-bin/document_list.pl">Documents</a>
<a href='/cgi-bin/topic_list.pl'>Topics</a>
<a href='/cgi-bin/maintainer_list.pl'>Maintainers</a>
<a href='/cgi-bin/editor_list.pl'>Editors</a>
<a href='/cgi-bin/ldp_stats.pl'>Statistics</a>
<a href='/help/'>Help</a>
<p>The LDP is currently experimenting with Wiki-style editing for selected documents.
The Wiki functionality allows permitted users to edit documents online, using
a web interface.
<p>To edit your document, click the "Edit" link in the upper right of the Meta-data
area on your document's edit page. Only the administrators and the author of a given
document can edit it.
<p>You can use a simplified text based format to write your documentation, so you
do not need to use DocBook. It uses a utility called txt2db. The following excerpt
from the README for txt2db explains how to use it:
<pre>
TEXT FORMAT DOCBOOK OUTPUT
=Title= &lt;sect1&gt;&lt;title&gt;Title&lt;/title&gt;
&lt;sect1&gt;
=Title|id= &lt;sect1 id='id'&gt;&lt;title&gt;Title&lt;/title&gt;
&lt;sect1&gt;
(works for other sect levels as well)
==Title== &lt;sect2&gt;&lt;title&gt;Title&lt;/title&gt;
&lt;/sect2&gt;
===Title=== &lt;sect3&gt;&lt;title&gt;Title&lt;/title&gt;
&lt;/sect3&gt;
Foo &lt;para&gt;Foo&lt;/para&gt;
#Foo &lt;orderedlist&gt;
#Bar &lt;listitem&gt;&lt;para&gt;Foo&lt;/para&gt;&lt;/listitem&gt;
#Baz &lt;listitem&gt;&lt;para&gt;Bar&lt;/para&gt;&lt;/listitem&gt;
&lt;listitem&gt;&lt;para&gt;Baz&lt;/para&gt;&lt;/listitem&gt;
&lt;/orderedlist&gt;
*Foo &lt;simplelist&gt;
#Bar &lt;listitem&gt;&lt;para&gt;Foo&lt;/para&gt;&lt;/listitem&gt;
#Baz &lt;listitem&gt;&lt;para&gt;Bar&lt;/para&gt;&lt;/listitem&gt;
&lt;listitem&gt;&lt;para&gt;Baz&lt;/para&gt;&lt;/listitem&gt;
&lt;/simplelist&gt;
[[http://foo.org]] &lt;ulink url='http://foo.org'&gt;
&lt;citetitle&gt;http://foo.org&lt;/citetitle&gt;
&lt;/ulink&gt;
[[http://foo.org Foo]] &lt;ulink url='http://foo.org'&gt;
&lt;citetitle&gt;Foo&lt;/citetitle&gt;
&lt;/ulink&gt;
[Foo] &lt;filename&gt;Foo&lt;/filename&gt;
'''Foo''' &lt;emphasis&gt;Foo&lt;/emphasis&gt;
<foo></foo> &lt;foo&gt;&lt;/foo&gt;
Or, you can insert arbitrary DocBook. It cannot be embedded within anything
else, though. In other words, you cannot have DocBook and one of the constructs
above in the same line.
Any text that starts with "&lt;" is considered docbook, until the
close tag is found. Tags can be nested arbitrarily deep. It won't be wrapped
with &lt;para&gt; tags or anything, so you'll need to do that manually if you
insert DocBook.
</pre>
</body>
</html>

View File

@ -0,0 +1,33 @@
<html>
<head>
<title>Insufficient Permissions</title>
<link rel=stylesheet href="ldp.css" type="text/css">
</head>
<body>
<h1>Insufficient Permissions</h1>
<p><a href='/index.html'>Index</a>
<a href='/cgi-bin/document_list.pl'>Documents</a>
<a href='/cgi-bin/topic_list.pl'>Topics</a>
<a href='/cgi-bin/maintainer_list.pl'>Maintainers</a>
<a href='/cgi-bin/editor_list.pl'>Editors</a>
<a href='/cgi-bin/ldp_stats.pl'>Statistics</a>
<a href='/help/'>Help</a>
<p>You have not been granted permission to make the requested change to
the database. If you wish to obtain proper permissions, please write
<a href="mailto:david@lupercalia.net">David Merrill</a> and he will set up
your permissions.
<p>Please note that this is intentionally a manual process, so be patient.
You will receive confirmation by email once the permissions are established.
<p><b>Your email must include your username.
<p><a href="index.html">Return to the LDP Database</a>
</body>
</html>