#! /usr/bin/perl use CGI qw(:standard); use Pg; $query = new CGI; $dbmain = "ldp"; @row; $message = ''; # Read parameters $doc_id = param('doc_id'); $conn=Pg::connectdb("dbname=$dbmain"); die $conn->errorMessage unless PGRES_CONNECTION_OK eq $conn->status; $result = $conn->exec("SELECT doc_id, title, filename, class, format, dtd, dtd_version, version, last_update, url, isbn, pub_status, review_status, tickle_date, ref_url, pub_date, tech_review_status, maintained, license, abstract FROM document WHERE doc_id = $doc_id"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; @row = $result->fetchrow; # Load from db $doc_id = $row[0]; $title = $row[1]; $title =~ s/\s+$//; $title =~ s/\'//; $filename = $row[2]; $filename =~ s/\s+$//; $class = $row[3]; $class =~ s/\s+$//; $format = $row[4]; $format =~ s/\s+$//; $dtd = $row[5]; $dtd =~ s/\s+$//; $dtd_version = $row[6]; $dtd_version =~ s/\s+$//; $version = $row[7]; $version =~ s/\s+$//; $last_update = $row[8]; $url = $row[9]; $isbn = $row[10]; $pub_status = $row[11]; $review_status = $row[12]; $tickle_date = $row[13]; $ref_url = $row[14]; $pub_date = $row[15]; $tech_review_status = $row[16]; $maintained = $row[17]; $license = $row[18]; $license =~ s/\s+$//; $abstract = $row[19]; $abstract =~ s/\s+$//; # Read the votes $votes_result = $conn->exec("select vote from doc_vote where doc_id = $doc_id"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $votes_result->resultStatus; $vote_count = 0; $vote_total = 0; $vote_avg = 0; while (@row = $votes_result->fetchrow) { $vote = $row[0]; $vote_count++; $vote_total = $vote_total + $vote; } if ($vote_count > 0) { $vote_avg = $vote_total / $vote_count; } $votes_result = $conn->exec("select vote from doc_vote where doc_id = $doc_id"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $votes_result->resultStatus; @row = $votes_result->fetchrow; $vote = $row[0]; print header(-expires=>'now'); print "$title"; print ""; print ""; print ""; print "

$title

\n"; system("./navbar.pl"); #print "

ID: $doc_id"; print "

\n"; print "\n"; print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n"; print ""; print "\n\n"; print ""; print "\n\n"; print ""; print ""; print ""; print "\n\n"; print ""; print ""; print ""; print "\n\n"; print ""; print ""; print ""; print "\n\n"; print ""; print ""; print ""; print "\n\n"; print ""; print ""; print "\n"; print "\n"; print "\n\n"; print ""; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Document Details
Title:
Filename:
URL:
Home:
Status:"; print "Class:\n"; print "Maintained:\n"; if ( $maintained eq "t" ) { print 'Yes'; } else { print 'No' } #print ""; print "
Review Status:"; print "Tech Review:"; print "? License:"; print "
Published:Updated:Version:
Format:"; print "DTD:"; print "DTD Version:"; print ""; print "
Tickle DateISBN:Rating"; if ( $vote > 0 ) { print "\n"; for ( $i = 1; $i <= 10; $i++ ) { print "\n"; } print "
  
\n"; } else { print "Not rated"; } print "
Abstract
WikiTextI am working on ways to provide easy online collaborative editing, and always for new ways to make writing for the LDP easier.

"WikiText" is a kind of specially formatted text used in lots of WikiWikiWebs. It makes writing extremely simple. I've implemented a very basic WikiText-style editing format that can be converted into DocBook.

For more information, read the help page.

\n"; print "

"; print "


"; print "

Versions

"; $rev_result = $conn->exec("SELECT rev_id, version, pub_date, initials, notes FROM document_rev WHERE doc_id=$doc_id ORDER BY pub_date, version"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $rev_result->resultStatus; print "

\n"; print ""; while (@row = $rev_result->fetchrow) { $rev_id = $row[0]; $rev_version = $row[1]; $rev_version =~ s/\s+$//; $rev_date = $row[2]; $rev_init = $row[3]; $rev_note = $row[4]; print ""; print ""; print ""; print ""; print ""; print "\n"; print "\n"; print "\n"; print ""; print "\n"; print ""; print "\n"; } # For creating a new version #print ""; print ""; print ""; print ""; print ""; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ""; print "\n"; print "
VersionDateInitialsNotes
\n"; print "Del
New Version
\n"; print "
\n"; print "


"; print "

Contributors

"; $authors_result = $conn->exec("SELECT maintainer.maintainer_id, role, active, document_maintainer.email, maintainer.email as author_email, maintainer_name FROM document_maintainer, maintainer WHERE doc_id = $doc_id and document_maintainer.maintainer_id = maintainer.maintainer_id ORDER BY active desc, maintainer_name"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $authors_result->resultStatus; print "

\n"; print ""; while (@row = $authors_result->fetchrow) { $maintainer_id = $row[0]; if ( $maintainer_list ) { $maintainer_list =+ " OR " } $maintainer_list =+ "maintainer_notes.maintainer_id = $maintainer_id"; $role = $row[1]; $role =~ s/\s*$//; if ( $row[2] eq 't' ) { $active = "Active" } else { $active = "Inactive" } $feedback_email = $row[3]; $email = $row[4]; if ( $row[5] eq '' ) { $maintainer_name = 'J. Doe' } else { $maintainer_name = "$row[5]" } print ""; print ""; print ""; print ""; print ""; print '"; print "\n"; print "\n"; print "\n"; print ""; print "\n"; print ""; print "\n"; } # For assigning a new contributor #print ""; print ""; print ""; print ""; print ""; print '"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ""; print "\n"; print "
StatusRoleNameFeedback EmailAction
$maintainer_nameDel
New Contributor
"; $sql = "SELECT maintainer_id, maintainer_name FROM maintainer ORDER BY maintainer_name"; $authors_result = $conn->exec($sql); die $conn->errorMessage unless PGRES_TUPLES_OK eq $authors_result->resultStatus; print "\n"; print "
\n"; print "
Note: Deleting a record here doesn't delete the maintainer. It only deletes the association between the maintainer and this document.\n"; print "


"; print "

Topic Assignments

\n"; @topics; @topic_names; $topic_count = 0; $topic_result = $conn->exec("SELECT topic.topic_num, subtopic.subtopic_num, topic.topic_name, subtopic.subtopic_name FROM topic, subtopic WHERE subtopic.topic_num = topic.topic_num ORDER BY topic_num, subtopic_num"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $topic_result->resultStatus; while (@row = $topic_result->fetchrow) { $topic_count++; $topics[$topic_count] = $row[0] . "." . $row[1]; $topic_names[$topic_count] = $row[2] . ": " . $row[3]; # print "

found: " . $topics[$rownum] . " = " . $topic_names[$rownum]; } print "

\n"; print "\n"; $document_topic_result = $conn->exec("SELECT topic.topic_num, topic.topic_name, subtopic.subtopic_num, subtopic.subtopic_name FROM document_topic, subtopic, topic WHERE document_topic.topic_num = subtopic.topic_num and document_topic.subtopic_num = subtopic.subtopic_num AND subtopic.topic_num = topic.topic_num AND doc_id=$doc_id ORDER BY topic_num, subtopic_num"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $document_topic_result->resultStatus; while (@row = $document_topic_result->fetchrow) { $topic_num = $row[0]; $topic_name = $row[1]; $subtopic_num = $row[2]; $subtopic_name = $row[3]; print "\n"; print "\n"; print ""; print ""; print ""; print ""; print ""; print "\n"; print "\n"; print "\n"; } print ""; print ""; print ""; print ""; print '\n"; print "\n"; print "\n"; print "
TopicAction
$topic_num.$subtopic_num $topic_name: $subtopic_name
\n"; print "


"; print "

Audience Assignments

\n"; print "

under construction. move along..."; #print "

\n"; #print "\n"; #$audience_result = $conn->exec("SELECT audience, audience_level, audience_description FROM document_audience, audience WHERE document_audience.doc_id = $doc_id AND document_audience.audience = audience.audience ORDER BY audience_level"); #die $conn->errorMessage unless PGRES_TUPLES_OK eq $audience_result->resultStatus; #while (@row = $Audience_result->fetchrow) { # $audience = $row[0]; # $audience_level = $row[1]; # $audience_description = $row[2]; # print "\n"; # print "\n"; # print ""; # print ""; # print ""; # print ""; # print ""; # print "\n"; # print "\n"; # print "\n"; #} #print ""; #print ""; #print ""; #print ""; #print '\n"; #print "\n"; #print "\n"; #print "
AudienceDescription
$topic_num.$subtopic_num $topic_name: $subtopic_name
\n"; print "


"; print "

Editors

"; $authors_result = $conn->exec("SELECT editor.editor_id, editor_role, active, editor.email, editor.editor_name FROM document_editor, editor WHERE doc_id = $doc_id and document_editor.editor_id = editor.editor_id ORDER BY active desc, editor_name"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $authors_result->resultStatus; print "

\n"; print ""; while (@row = $authors_result->fetchrow) { $editor_id = $row[0]; $editor_role = $row[1]; $editor_role =~ s/\s*$//; if ( $row[2] eq 't' ) { $active = "Active" } else { $active = "Inactive" } if ( $row[4] eq '' ) { $editor_name = 'J. Doe' } else { $editor_name = $row[4] } print ""; print ""; print ""; print ""; print ""; print '"; print "\n"; print "\n"; print "\n"; print ""; print "\n"; print ""; print "\n"; } # For assigning a new editor print ""; print ""; print ""; print ""; print '"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ""; print "\n"; print "
StatusRoleNameEmailAction
$editor_name" . $row[3] . "Del
"; $sql = "SELECT editor_id, editor_name FROM editor ORDER BY editor_name"; $editors_result = $conn->exec($sql); die $conn->errorMessage unless PGRES_TUPLES_OK eq $editors_result->resultStatus; print "\n"; print "  
\n"; print "
Note: Deleting a record here doesn't delete the editor. It only deletes the association between the editor and this document.\n"; print "


"; print "

Rating

\n"; print "

\n"; for ( $i = 1; $i <= 10; $i++ ) { print "\n"; } print "
   
\n"; print "

You can rate each document on a scale from 1 to 10, where 1 is very poor and 10 is excellent.\n"; print "Your vote is averaged with the votes of others to obtain a rating for the document.\n"; print "

"; print "

\n"; print "\n"; print "\n"; print "\n"; print "
Votes:$vote_count
Average:$vote_avg
Your Vote:\n"; print "\n"; print "\n"; print "
"; print "

"; print "


"; $notes_result = $conn->exec("SELECT date_entered, notes, username FROM notes WHERE doc_id = $doc_id ORDER BY date_entered"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $notes_result->resultStatus; print "

Notes

\n"; print "
"; print "

\n"; print ""; while (@row = $notes_result->fetchrow) { $date_entered = $row[0]; $notes = $row[1]; $notes =~ s//>/; $username = $row[2]; print "\n"; } print "\n"; print "\n"; print ""; print "
Date and TimeUserNote
$date_entered$username$notes
To add a note, type the note, then click Save.\n"; print "\n"; print "
\n"; print "

"; print "


"; print "

Author Notes

\n"; print "

\n"; print ""; if ( $maintainer_list ) { $sql = "SELECT date_entered, notes, username, maintainer_name FROM maintainer_notes, maintainer WHERE maintainer.maintainer_id = maintainer_notes.maintainer_id AND $maintainer_list ORDER BY date_entered"; $notes_result = $conn->exec($sql); die $conn->errorMessage unless PGRES_TUPLES_OK eq $notes_result->resultStatus; while (@row = $notes_result->fetchrow) { $date_entered = $row[0]; $notes = $row[1]; $notes =~ s//>/; $username = $row[2]; $maintainer_name = $row[3]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } } print "
Date and TimeUserMaintainerNote
$date_entered$username$maintainer_name$notes
\n"; print end_html;