]> git.donarmstrong.com Git - biopieces.git/blobdiff - www/index.cgi
fixed URI::Escape on q_id in BGB
[biopieces.git] / www / index.cgi
index 57982acc34779854793bc5869fd29f5a837ee8e0..2009fbf25dc455e356425e7caabdebd16c7210e1 100755 (executable)
@@ -26,6 +26,7 @@ use warnings;
 use lib $ENV{ 'BP_PERL' };
 
 use CGI;
+use URI::Escape;
 use Data::Dumper;
 use Digest::MD5;
 use Maasha::Common;
@@ -122,8 +123,8 @@ sub cookie_default
     $cookie->{ 'ASSEMBLY' }        = $cgi->param( 'assembly' ) || '';
     $cookie->{ 'CONTIG' }          = $cgi->param( 'contig' )   || '';
     $cookie->{ 'Q_ID' }            = $cgi->param( 'q_id' );
-    $cookie->{ 'NAV_START' }     ||= $cgi->param( 'nav_start' );
-    $cookie->{ 'NAV_END' }       ||= $cgi->param( 'nav_end' );
+    $cookie->{ 'NAV_START' }     ||= $cgi->param( 'nav_start' ) || $cgi->param( 's_beg' );  # FIXME this is ugly!
+    $cookie->{ 'NAV_END' }       ||= $cgi->param( 'nav_end' )   || $cgi->param( 's_end' );
     $cookie->{ 'S_BEG' }           = $cgi->param( 's_beg' );
     $cookie->{ 'S_END' }           = $cgi->param( 's_end' );
     $cookie->{ 'STRAND' }          = $cgi->param( 'strand' );
@@ -227,7 +228,7 @@ sub cookie_session
         $cookie->{ 'PAGE' } = 'login';
         print STDERR "HER4"; # DEBUG
         print STDERR "NO COOKIE SESSION ID\n" if not $cookie->{ 'SESSION_ID' }; # DEBUG
-        print STDERR "NO COOKIE SESSION ID\n" if not $cookie->{ 'USER' }; # DEBUG
+        print STDERR "NO COOKIE USER\n" if not $cookie->{ 'USER' }; # DEBUG
         print STDERR "NO SESSION USER\n"      if not exists $session->{ $cookie->{ 'USER' } }; # DEBUG
     }
 }
@@ -448,9 +449,9 @@ sub cookie_href
         $href_hash{ "nav_search" } = "$cookie->{ 'NAV_START' }-$cookie->{ 'NAV_END' }";
     }
 
+    $href_hash{ "q_id" }       = URI::Escape::uri_escape( $cookie->{ 'Q_ID' } ) if defined $cookie->{ 'Q_ID' };
     $href_hash{ "s_beg" }      = $cookie->{ 'S_BEG' }      if defined $cookie->{ 'S_BEG' };
     $href_hash{ "s_end" }      = $cookie->{ 'S_END' }      if defined $cookie->{ 'S_END' };
-    $href_hash{ "q_id" }       = $cookie->{ 'Q_ID' }       if defined $cookie->{ 'Q_ID' };
     $href_hash{ "strand" }     = $cookie->{ 'STRAND' }     if defined $cookie->{ 'STRAND' };
     $href_hash{ "session_id" } = $cookie->{ 'SESSION_ID' } if defined $cookie->{ 'SESSION_ID' };
 
@@ -517,7 +518,7 @@ sub page
     }
 
     if ( $cookie->{ 'SESSION_ID' } ) {
-        push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "session_id", value => "$cookie->{ 'SESSION_ID' }" ) );
+        push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "session_id", value => $cookie->{ 'SESSION_ID' } ) );
     }
 
     return wantarray ? @html : \@html;
@@ -579,7 +580,6 @@ sub page_browse
     push @html, section_taxonomy_table( $cookie );
     push @html, section_navigate( $cookie );
     push @html, section_browse( $cookie );
-    push @html, section_permalink( $cookie );
 
     return wantarray ? @html : \@html;
 }
@@ -795,11 +795,11 @@ sub section_navigate
     push @html, Maasha::XHTML::table_end;
 
     push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "page",     value => "browse" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "user",     value => "$cookie->{ 'USER' }" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "clade",    value => "$cookie->{ 'CLADE' }" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "genome",   value => "$cookie->{ 'GENOME' }" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "assembly", value => "$cookie->{ 'ASSEMBLY' }" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "contig",   value => "$cookie->{ 'CONTIG' }" ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "user",     value => $cookie->{ 'USER' } ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "clade",    value => $cookie->{ 'CLADE' } ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "genome",   value => $cookie->{ 'GENOME' } ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "assembly", value => $cookie->{ 'ASSEMBLY' } ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "contig",   value => $cookie->{ 'CONTIG' } ) );
 
     return wantarray ? @html : \@html;
 }
@@ -882,37 +882,6 @@ sub section_browse
 }
 
 
-sub section_permalink
-{
-    # Martin A. Hansen, December 2009.
-
-    # Return HTML with a permanent link to current browser view.
-
-    my ( $cookie,   # cookie hash
-       ) = @_;
-
-    # Returns a list.
-
-    my ( $href, @html );
-
-    $href = join( "&",
-        "$cookie->{ 'SCRIPT' }?page=browse",
-        "user=$cookie->{ 'USER' }",
-        "clade=$cookie->{ 'CLADE' }",
-        "genome=$cookie->{ 'GENOME' }",
-        "assembly=$cookie->{ 'ASSEMBLY' }",
-        "contig=$cookie->{ 'CONTIG' }",
-        "nav_start=$cookie->{ 'NAV_START' }",
-        "nav_end=$cookie->{ 'NAV_END' }",
-        "session_id=$cookie->{ 'SESSION_ID' }",
-    );
-
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::ln( txt => "Permalink", href => $href ), class => 'center' );
-
-    return wantarray ? @html : \@html;
-}
-
-
 sub section_export
 {
     # Martin A. Hansen, November 2009.
@@ -940,12 +909,12 @@ sub section_export
     push @html, Maasha::XHTML::table_row_simple( tr => \@row_dna_contig );
     push @html, Maasha::XHTML::table_end;
 
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "page", value => "dna" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "user",     value => "$cookie->{ 'USER' }" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "clade",    value => "$cookie->{ 'CLADE' }" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "genome",   value => "$cookie->{ 'GENOME' }" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "assembly", value => "$cookie->{ 'ASSEMBLY' }" ) );
-    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "contig",   value => "$cookie->{ 'CONTIG' }" ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "page",     value => "dna" ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "user",     value => $cookie->{ 'USER' } ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "clade",    value => $cookie->{ 'CLADE' } ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "genome",   value => $cookie->{ 'GENOME' } ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "assembly", value => $cookie->{ 'ASSEMBLY' } ) );
+    push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "contig",   value => $cookie->{ 'CONTIG' } ) );
 
     return wantarray ? @html : \@html;
 }