[Bio] / SeedViewer / upload.cgi Repository:
ViewVC logotype

Annotation of /SeedViewer/upload.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (view) (download)

1 : paczian 1.1 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 :     use strict;
19 :     use warnings;
20 :     use CGI;
21 :     use WebComponent::Table;
22 :    
23 :     # get a cgi object
24 :     my $cgi = new CGI;
25 :    
26 :     # print the header
27 :     print $cgi->header();
28 :    
29 :     # check if we have all of our variables
30 : paczian 1.3 if (($cgi->param('upload_list') || ($cgi->param('upload_string_list'))) && $cgi->param('upload_table_id')) {
31 : paczian 1.1
32 :     my $tid = $cgi->param('upload_table_id');
33 :    
34 :     # parse the uploaded data
35 : paczian 1.3 my @lines = ();
36 :     if ($cgi->param('upload_string_list')) {
37 :     my $string_content = $cgi->param('upload_string_list');
38 :     my @slines = split(/~/, $string_content);
39 :     foreach my $line (@slines) {
40 :     push(@lines, join("\t", split(/\*/, $line)));
41 :     }
42 :     } else {
43 :     my $file_content = "";
44 :     my $file = $cgi->param('upload_list');
45 :     while (<$file>) {
46 :     $file_content .= $_;
47 :     }
48 :     @lines = split /[\r\n]+/, $file_content;
49 : paczian 1.1 }
50 : paczian 1.3
51 : paczian 1.1 my $data;
52 :     my $rowcount = 0;
53 : paczian 1.3 my $showfirst = '';
54 : paczian 1.1 foreach my $line (@lines) {
55 :     my @row = split /\t/, $line;
56 :     if ($cgi->param('location_list')) {
57 : paczian 1.3 unless ($showfirst) {
58 :     $showfirst = qq~window.parent.focus_upload_feature(\"~.$tid.qq~\", \"~.$cgi->param('data_table_id').qq~\", \"~.$rowcount.qq~\");~;
59 :     }
60 : paczian 1.1 push(@row, qq~<input type="button" onclick="focus_upload_feature('~.$tid.qq~', '~.$cgi->param('data_table_id').qq~', '~.$rowcount.qq~');" value="show">~);
61 :     }
62 :     push(@$data, \@row);
63 :     $rowcount++;
64 :     }
65 :    
66 :     # format the data to table format
67 :     my ($data_source, $onclicks, $highlights) = WebComponent::Table::format_data($data);
68 :    
69 :     # write the data to the page
70 :     print "<input type='hidden' id='data' value='" . $data_source . "'>";
71 :     print "<input type='hidden' id='onclicks' value='" . $onclicks . "'>";
72 :     print "<input type='hidden' id='highlights' value='" . $highlights . "'>";
73 :     print "<input type='hidden' id='table_id' value='".$tid."'>";
74 : paczian 1.3 print "<img src='$FIG_Config::cgi_url/Html/clear.gif' onload='window.parent.document.getElementById(\"table_onclicks_".$tid."\").value=document.getElementById(\"onclicks\").value;window.parent.document.getElementById(\"table_highlights_".$tid."\").value=document.getElementById(\"highlights\").value;window.parent.document.getElementById(\"table_data_".$tid."\").value=document.getElementById(\"data\").value;window.parent.initialize_table(\"".$tid."\");$showfirst'>";
75 : paczian 1.1 }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3