Skip to content

Commit

Permalink
Merge pull request #57 from teharrison/master
Browse files Browse the repository at this point in the history
some page reformats
  • Loading branch information
mdsouza committed Jul 6, 2012
2 parents a98769e + 64839d1 commit 67c5ec5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/MGRAST/html/js/Upload.js
Expand Up @@ -444,8 +444,13 @@ function select_metadata_file () {
document.getElementById("icon_step_2").style.display = "";
check_submitable();
} else {
alert(result[2]);
unselect_metadata_file();
if (result[1] eq 'taken') {
alert(result[2]);
unselect_metadata_file();
} else {
document.getElementById("sel_mdfile_div").innerHTML = result[2];
update_inbox();
}
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/MGRAST/lib/JobDB/Project.pm
Expand Up @@ -97,10 +97,10 @@ sub count_public {
}

sub get_private_projects {
my ($self, $user) = @_;
my ($self, $user, $edit) = @_;

unless ($user && ref($user)) { return []; }
my $ids = $user->has_right_to(undef, 'view', 'project');
my $ids = $edit ? $user->has_right_to(undef,'edit','project') : $user->has_right_to(undef,'view','project');
unless ($ids && (@$ids > 0)) { return []; }

my $private = [];
Expand Down
1 change: 1 addition & 0 deletions src/MGRAST/lib/WebPage/MetagenomeOverview.pm
Expand Up @@ -1314,6 +1314,7 @@ sub get_consensus_chart {
# data = [ pos, N, G, C, T, A ]
foreach my $row (@$consensus) {
next if (($row->[0] eq '#') || (! $row->[6]));
next if (($row->[0] > 100) && ($row->[6] < 1000));
my $sum = $row->[6];
my @per = map { floor(100 * 100 * (($_ * 1.0) / $sum)) / 100 } @$row;
push @$data, [ $row->[0] + 1, $per[5], $per[3], $per[2], $per[4], $per[1] ];
Expand Down
20 changes: 17 additions & 3 deletions src/MGRAST/lib/WebPage/PublishGenome.pm
Expand Up @@ -39,6 +39,7 @@ sub init {
$self->title("Make metagenome publicly accessible");

# register components
$self->application->register_component('Table', 'private_projects_table');
$self->application->register_component('Table', 'DisplayMetaData');
$self->application->register_component('Ajax', 'Display_Ajax');

Expand Down Expand Up @@ -148,9 +149,22 @@ sub meta_info {
unshift @tdata, [ "<font color='red'>Project</font>", "<font color='red'>project_name</font>", $project->name ];
} elsif ($no_proj_md) {
my $error = "<p><font color='red'>We are unable to publish your metagenome due to the following errors:</font></p>";
$error .= "<p>Your metagenome does not exist in a project. Please create a new project or add it to an existing project before you can publish.<br>";
$error .= "This can be done through the Browse Page: <a title='Browse Metagenomes' href='?page=MetagenomeSelect'>";
$error .= "<img style='padding-left:15px; height:25px;' src='./Html/mgrast_globe.png'></a></p>";
$error .= "<p>Your metagenome does not exist in a project. Please create a new project or add it to an existing project before you can publish.</p>";

my $projects = $self->app->data_handle('MGRAST')->Project->get_private_projects($user, 1);
if (@$project > 0) {
my $pp_table = $self->app->component('private_projects_table');
$pp_table->columns( [ { name => 'id' }, { name => 'name' }, { name => 'type' } ] );
$pp_table->data([ map { [ $_->{id}, "<a href='?page=MetagenomeProject&project=".$_->{id}."' target=_blank>".($_->{name} ? $_->{name} : "-")."</a>", $_->{type} ] } grep { $_->{id} } @$projects ]);
$pp_table->items_per_page(20);
$pp_table->show_select_items_per_page(1);
$pp_table->show_top_browse(1);
$error .= "<p>Projects you can add metagenomes to:<br>".$pp_table->output()."<br>";
}
else {
$error .= "<p>You have no existing projects, please create one: ";
}
$error .= "<a onclick='pname=prompt(\"Enter new project name\",\"\");if(pname.length){window.top.location=\"?page=MetagenomeProject&action=create&pname=\"+pname;}' style='cursor:pointer;font-size:11px;font-weight:bold;'>create new project</a></p>";
return $error;
}

Expand Down

0 comments on commit 67c5ec5

Please sign in to comment.