[Bio] / FigWebServices / ErdbDocWidget.cgi Repository:
ViewVC logotype

View of /FigWebServices/ErdbDocWidget.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (download) (annotate)
Fri Nov 6 18:42:32 2009 UTC (10 years, 5 months ago) by parrello
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, myrast_rel40, mgrast_dev_05262011, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2010_0526, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, rast_rel_2011_0119, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_02222011, mgrast_dev_10262011
Changes since 1.3: +15 -1 lines
Added ability to display a non-database DBD.

#!/usr/bin/perl -w

#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
#
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License.
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#

use strict;
use Tracer qw(:DEFAULT PrintLine);
use ERDB;
use ERDBPDocPage;
use ERDBExtras;

=head1 ErdbDocWidget Script

This is a small script that generates the documentation widget for an [[ErdbPm]]
database. It is designed to fit inside an embedded frame. The widget appears as
a two-column table with a scrolling select control on the left and the
documentation for the selected component on the right.

The following CGI parameters are used.

=over 4

=item database

Name of the database to document.

=item xmlFileName

Name of the XML file to document. If this option is specified, it overrides
B<database>. In this case, it is presumed the documentation is for a database
in development rather than a live database.

=item rows

The estimated number of rows to display in the select box in order to make the
widget fit comfortably inside the frame.

=back

=cut

# Get the CGI query object.
my $cgi = CGI->new();
# Start the output page.
print CGI::header();
print CGI::start_html(-title => 'ERDB Database Documenter',
                      -style =>  { src => "$ERDBExtras::css_dir/ERDB.css" },
                      -script => { src => "$ERDBExtras::js_dir/ERDB.js" });
# Insure we recover from errors.
eval {
    # Get the parameters.
    my $database = $cgi->param('database') || 'Sapling';
    my $height = $cgi->param('height') || 900;
    my $xmlFileName = $cgi->param('xmlFileName');
    # Get the datanase object.
    my $erdb;
    if ($xmlFileName) {
        # Yes, get a pseudo-database object for that XML file.
        $erdb = ERDB->new(undef, $xmlFileName);
    } else {
        # No, get the live database.
        $erdb = ERDB::GetDatabase($database);
    }
    # Get a page creator.
    my $page = ERDBPDocPage->new(dbObject => $erdb);
    # Create the body HTML.
    my $html = CGI::div({ class => 'doc' }, $page->DocPage(boxHeight => $height));
    # Output it.
    PrintLine($html);
};

if ($@) {
    # Here we have a fatal error. Save the message.
    my $errorText = "SCRIPT ERROR: $@";
    # Issue a feed event.
    Warn($errorText);
    # Output the error message.
    PrintLine CGI::pre($errorText);
}
# Close the page.
PrintLine CGI::end_html();

1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3