]> git.donarmstrong.com Git - biopieces.git/blobdiff - www/index.cgi
fixed URI::Escape on q_id in BGB
[biopieces.git] / www / index.cgi
index 4d833cc8005b76570bf35b3089f02983f0aa60b6..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,6 +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' ) || $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' );
@@ -225,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
     }
 }
@@ -442,13 +445,13 @@ sub cookie_href
         last;
     }
 
-    if ( defined $cookie->{ 'NAV_START' } and defined $cookie->{ 'NAV_END' } ) {
+    if ( defined $cookie->{ 'NAV_START' } and defined $cookie->{ 'NAV_END' } and $page !~ /clade|genome|assembly|contig|browse/ ) {
         $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' };
 
@@ -515,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;
@@ -792,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;
 }
@@ -906,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;
 }