[Bio] / FortyEight / WebPage / ModifyJob.pm Repository:
ViewVC logotype

Annotation of /FortyEight/WebPage/ModifyJob.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : wilke 1.1 package WebPage::ModifyJob;
2 :    
3 :     use warnings;
4 :     use strict;
5 :    
6 :     use Carp qw( confess );
7 :     use base qw( WebApp::WebPage );
8 :    
9 :     use GenomeMeta;
10 :     use GD;
11 :     use MIME::Base64;
12 :     use Table;
13 :    
14 :     use FIG_Config;
15 :    
16 :     use Job48;
17 :    
18 :     use GenomeBrowser;
19 :    
20 :     1;
21 :    
22 :     =pod
23 :    
24 :     =head1 NAME
25 :    
26 :     Genomes - an instance of WebPage which displays the list of genomes currently in pipeline and their status
27 :    
28 :     =head1 DESCRIPTION
29 :    
30 :     TODO
31 :    
32 :     =head1 METHODS
33 :    
34 :     =over 4
35 :    
36 :     =item * B<output> ()
37 :    
38 :     Returns the html output of the page.
39 :    
40 :     =cut
41 :    
42 :     sub output {
43 :     my ($self) = @_;
44 :    
45 :     $self->title('Annotation Server - Import Jobs into SEED');
46 :    
47 :     my $content = '';
48 :    
49 :     # check if a user is logged in and admin
50 :     if ($self->application->authorized(2)) {
51 :    
52 :     if ($self->application->cgi->param('change_name')) {
53 :     $content = $self->change_name();
54 :     }
55 :     elsif ($self->application->cgi->param('accept_new_name')) {
56 :     $content = $self->new_name();
57 :     }
58 :     else{
59 :     $content = "<h1>JOB ".$self->application->cgi->param('job')."</h1>";
60 :    
61 :     print STDERR " No accept \n";
62 :     }
63 :    
64 :     }
65 :    
66 :     # catch errors
67 :     if ($self->application->error) {
68 :     $content = "<p>An error has occured: ".$self->application->error().
69 :     "<br/>Please return to the <a href='".$self->application->url."?page=Login'>login page</a>.</p>";
70 :     }
71 :    
72 :     return $content;
73 :     }
74 :    
75 :    
76 :     =pod
77 :    
78 :     =item * B<find_related> ()
79 :    
80 :     Find similar genomes and present them in a table.
81 :    
82 :     =cut
83 :    
84 :     sub change_name {
85 :     my $self = shift;
86 :    
87 :     my $job_id = $self->application->cgi->param('change_name');
88 :     my $job = Job48->new($job_id);
89 :     my $fig = FIGV->new($job->dir);
90 :     my $cgi = $self->application->cgi;
91 :    
92 :    
93 :    
94 :     my $id = $job->genome_id;
95 :     my $name = $job->genome_name;
96 :    
97 :     # build search term
98 :     my @terms = split(' ',$name);
99 :     my $search = $terms[0];
100 :    
101 :     my $content = " <h1> Change Genome Name</h1> <p>Change genome name for <b>$name</b> from user ". $job->user . ".</p>";
102 :    
103 :     $content .= '<p>'.$self->start_form("", { job => $job_id });
104 :     #$self->application->cgi->param('job',"$job_id");
105 :     $content .= "New name: ". $cgi->textfield( "new_name" , "") ;
106 :    
107 :     $content .= $cgi->submit(-name => 'accept_new_name', -value => 'Accept new name');
108 :     $content .= $self->end_form.'</p>';
109 :    
110 :     return $content;
111 :     }
112 :    
113 :    
114 :     sub new_name {
115 :     my $self = shift;
116 :    
117 :     my $job_id = $self->application->cgi->param('job');
118 :     my $new_name = $self->application->cgi->param('new_name');
119 :     my $job = Job48->new($job_id);
120 :     my $fig = FIGV->new($job->dir);
121 :     my $cgi = $self->application->cgi;
122 :    
123 :     my $id = $job->genome_id;
124 :     my $old_name = $job->genome_name;
125 :    
126 :     my $changed_name = $job->set_genome_name( $new_name );
127 :    
128 :    
129 :     my $content = " <p>Name changed from $old_name to ". $job->genome_name." for user ". $job->user . " and job $job_id.</p>";
130 :     $content .= "<p>Go back to <a href=\"".$self->application->url."?page=ControlCenter\">V2C2</a>.";
131 :    
132 :    
133 :     return $content;
134 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3