Commit 34daae00 authored by Keith Jolley's avatar Keith Jolley
Browse files

Display installed plugins on version page.

Link this from the index page.
parent 04fee5b6
......@@ -232,7 +232,7 @@ OPTIONS
print "</ul>\n";
print "</div><div style=\"float:left; margin-right:1em\">\n";
print "<img src=\"/images/icons/64x64/information.png\" alt=\"\" />\n";
print "<h2>General statistics</h2>\n<ul class=\"toplevel\">\n";
print "<h2>General information</h2>\n<ul class=\"toplevel\">\n";
my $max_date;
if ( $self->{'system'}->{'dbtype'} eq 'sequences' ) {
my $allele_count = $self->{'datastore'}->run_simple_query("SELECT COUNT (*) FROM sequences");
......@@ -264,6 +264,7 @@ OPTIONS
print "<li>Isolates: $isolate_count</li>";
}
print "<li>Last updated: $max_date</li>" if $max_date;
print "<li><a href=\"$self->{'system'}->{'script_name'}?db=$self->{'instance'}&amp;page=version\">About BIGSdb</a></li>\n";
print "</ul>\n</div>\n</div>\n</div>\n";
my $plugins = $self->{'pluginManager'}->get_appropriate_plugin_names( 'breakdown|export|analysis|miscellaneous', $system->{'dbtype'} );
if (@$plugins) {
......
......@@ -173,4 +173,9 @@ sub is_plugin {
return if !$name;
return any { $_ eq $name } keys %{ $self->{'attributes'} };
}
sub get_installed_plugins {
my ( $self ) = @_;
return $self->{'attributes'};
}
1;
......@@ -116,7 +116,7 @@ my %translate = (
sub get_attributes {
my %att = (
name => 'CodonUsage',
name => 'Codon Usage',
author => 'Keith Jolley',
affiliation => 'University of Oxford, UK',
email => 'keith.jolley@zoo.ox.ac.uk',
......
......@@ -43,6 +43,7 @@ sub get_attributes {
seqdb_type => 'schemes',
help => 'tooltips',
section => 'export,postquery',
url => 'http://pubmlst.org/software/database/bigsdb/userguide/isolates/concatenated.shtml',
input => 'query',
requires => '',
order => 20
......
......@@ -41,6 +41,7 @@ sub get_attributes {
version => '1.1.0',
dbtype => 'isolates',
section => 'export,postquery',
url => 'http://pubmlst.org/software/database/bigsdb/userguide/isolates/export_isolates.shtml',
input => 'query',
requires => 'refdb',
help => 'tooltips',
......
......@@ -39,6 +39,7 @@ sub get_attributes {
version => '1.0.1',
dbtype => 'isolates',
section => 'breakdown,postquery',
url => 'http://pubmlst.org/software/database/bigsdb/userguide/isolates/field_breakdown.shtml',
input => 'query',
requires => 'chartdirector',
order => 10
......
......@@ -30,7 +30,7 @@ use BIGSdb::Page 'SEQ_METHODS';
sub get_attributes {
my %att = (
name => 'GenomeComparator',
name => 'Genome Comparator',
author => 'Keith Jolley',
affiliation => 'University of Oxford, UK',
email => 'keith.jolley@zoo.ox.ac.uk',
......
......@@ -29,7 +29,7 @@ use Bio::SeqIO;
sub get_attributes {
my %att = (
name => 'LocusExplorer',
name => 'Locus Explorer',
author => 'Keith Jolley',
affiliation => 'University of Oxford, UK',
email => 'keith.jolley@zoo.ox.ac.uk',
......
......@@ -40,6 +40,7 @@ sub get_attributes {
version => '1.1.0',
dbtype => 'isolates',
section => 'breakdown,postquery',
url => 'http://pubmlst.org/software/database/bigsdb/userguide/isolates/publications.shtml',
input => 'query',
requires => 'refdb',
order => 30,
......
......@@ -38,6 +38,7 @@ sub get_attributes {
module => 'SchemeBreakdown',
version => '1.0.6',
section => 'breakdown,postquery',
url => 'http://pubmlst.org/software/database/bigsdb/userguide/isolates/scheme_breakdown.shtml',
input => 'query',
requires => '',
order => 20,
......
......@@ -28,7 +28,7 @@ use Apache2::Connection ();
sub get_attributes {
my %att = (
name => 'SequenceComparison',
name => 'Sequence Comparison',
author => 'Keith Jolley',
affiliation => 'University of Oxford, UK',
email => 'keith.jolley@zoo.ox.ac.uk',
......
......@@ -29,7 +29,7 @@ use Apache2::Connection ();
sub get_attributes {
my %att = (
name => 'SequenceSimilarity',
name => 'Sequence Similarity',
author => 'Keith Jolley',
affiliation => 'University of Oxford, UK',
email => 'keith.jolley@zoo.ox.ac.uk',
......
......@@ -30,7 +30,7 @@ use constant IMAGE_WIDTH => 1200;
sub get_attributes {
my %att = (
name => 'TagStatus',
name => 'Tag Status',
author => 'Keith Jolley',
affiliation => 'University of Oxford, UK',
email => 'keith.jolley@zoo.ox.ac.uk',
......
......@@ -40,6 +40,7 @@ sub get_attributes {
version => '1.0.2',
dbtype => 'isolates',
section => 'breakdown,postquery',
url => 'http://pubmlst.org/software/database/bigsdb/userguide/isolates/two_field_breakdown.shtml',
input => 'query',
requires => 'chartdirector',
order => 12
......
......@@ -32,7 +32,7 @@ use BIGSdb::Utils;
sub get_attributes {
my %att = (
name => 'XmfaExport',
name => 'Xmfa Export',
author => 'Keith Jolley',
affiliation => 'University of Oxford, UK',
email => 'keith.jolley@zoo.ox.ac.uk',
......@@ -45,6 +45,7 @@ sub get_attributes {
dbtype => 'isolates,sequences',
seqdb_type => 'schemes',
section => 'export,postquery',
url => 'http://pubmlst.org/software/database/bigsdb/userguide/isolates/xmfa.shtml',
input => 'query',
help => 'tooltips',
requires => 'muscle,offline_jobs',
......
......@@ -23,6 +23,7 @@ use warnings;
use base qw(BIGSdb::Page);
sub print_content {
my ($self) = @_;
print <<"HTML";
<h1>Bacterial Isolate Genome Sequence Database (BIGSdb)</h1>
......@@ -47,12 +48,96 @@ can be found at <a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.or
<p>Details of this software and the latest version can be downloaded from
<a href="http://pubmlst.org/software/database/bigsdb/">
http://pubmlst.org/software/database/bigsdb/</a>.</p>
</div>
HTML
$self->_print_plugins;
print "</div>\n";
return;
}
sub get_title {
return "BIGSdb Version $BIGSdb::main::VERSION";
}
sub _print_plugins {
my ($self) = @_;
print "<h2>Installed plugins</h2>\n";
my $plugins = $self->{'pluginManager'}->get_installed_plugins;
if (!keys %{$plugins}){
print "<p>No plugins installed</p>\n";
return;
}
print "<p>Plugins may be disabled by the system administrator for specific databases where either they're not appropriate"
. " or if they may take up too many resources on a public database.</p>\n";
my ($enabled_buffer, $disabled_buffer, %disabled_reason);
my $dbtype = $self->{'system'}->{'dbtype'};
my $etd = 1;
my $dtd = 1;
foreach (sort {$a cmp $b} keys %{$plugins}){
my $attr = $plugins->{$_};
if ( $attr->{'requires'} ) {
$disabled_reason{$_} = 'Chartdirector not installed.'
if !$self->{'config'}->{'chartdirector'}
&& $attr->{'requires'} =~ /chartdirector/;
$disabled_reason{$_} = 'Reference database not configured.'
if !$self->{'config'}->{'refdb'}
&& $attr->{'requires'} =~ /refdb/;
$disabled_reason{$_} = 'EMBOSS not installed.'
if !$self->{'config'}->{'emboss_path'}
&& $attr->{'requires'} =~ /emboss/;
$disabled_reason{$_} = 'MUSCLE not installed.'
if !$self->{'config'}->{'muscle_path'}
&& $attr->{'requires'} =~ /muscle/;
$disabled_reason{$_} = 'ImageMagick mogrify not installed.'
if !$self->{'config'}->{'mogrify_path'}
&& $attr->{'requires'} =~ /mogrify/;
$disabled_reason{$_} = 'Offline job manager not running.'
if !$self->{'config'}->{'jobs_db'}
&& $attr->{'requires'} =~ /offline_jobs/;
}
$disabled_reason{$_} = 'Not specifically enabled for this database.'
if (
$attr->{'system_flag'}
&& ( !$self->{'system'}->{ $attr->{'system_flag'} }
|| $self->{'system'}->{ $attr->{'system_flag'} } eq 'no' )
);
$disabled_reason{$_} = 'Only for ' . ($dbtype eq 'isolates' ? 'seqdef' : 'isolate') . ' databases.'
if $attr->{'dbtype'} !~ /$dbtype/;
my $comments = '';
if (defined $attr->{'min'} && defined $attr->{'max'}){
$comments .= "Limited to queries with between $attr->{'min'} and $attr->{'max'} results.";
} elsif (defined $attr->{'min'}){
$comments .= "Limited to queries with at least $attr->{'min'} results.";
} elsif (defined $attr->{'max'}){
$comments .= "Limited to queries with fewer than $attr->{'max'} results.";
}
my $author = defined $attr->{'email'} && $attr->{'email'} ne '' ? "<a href=\"mailto:$attr->{'email'}\">$attr->{'author'}</a>" : $attr->{'author'};
$author .= " ($attr->{'affiliation'})" if $attr->{'affiliation'};
my $name = defined $attr->{'url'} ? "<a href=\"$attr->{'url'}\">$attr->{'name'}</a>" : $attr->{'name'};
my $row_buffer = "<td>$name</td><td>$author</td><td>$attr->{'description'}</td><td>$attr->{'version'}</td>";
if ($disabled_reason{$_}){
$disabled_buffer .= "<tr class=\"td$dtd\">$row_buffer<td>$disabled_reason{$_}</td></tr>";
$dtd = $dtd == 1 ? 2 : 1;
} else {
$enabled_buffer .= "<tr class=\"td$etd\">$row_buffer<td>$comments</td></tr>";
$etd = $etd == 1 ? 2 : 1;
}
}
if ($enabled_buffer || $disabled_buffer){
print "<table class=\"resultstable\">";
if ($enabled_buffer){
print "<tr><th colspan=\"5\">Enabled plugins</th></tr>\n";
print "<tr><th>Name</th><th>Author</th><th>Description</th><th>Version</th><th>Comments</th></tr>\n";
print $enabled_buffer;
}
if ($disabled_buffer){
print "<tr><th colspan=\"5\">Disabled plugins</th></tr>\n";
print "<tr><th>Name</th><th>Author</th><th>Description</th><th>Version</th><th>Disabled because</th></tr>\n";
print $disabled_buffer;
}
print "</table>\n";
}
return;
}
1;
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment