+# PciIds web database
+# Copyright (C) 2008 Michal Vaner (vorner@ucw.cz)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# he Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
package PciIds::Html::Jump;
use strict;
use warnings;
print "</form>\n";
}
-sub redirect( $$$ ) {
- my( $req, $args, $addr ) = @_;
+sub redirect( $$$$ ) {
+ my( $req, $args, $addr, $hasSSL ) = @_;
my $prefix = ( !defined $args->{'action'} || $args->{'action'} eq '' || $args->{'action'} eq 'list' ) ? 'read' : 'mods';
- my $url = "http://".$req->hostname()."/$prefix/$addr".buildArgs( $args );
+ my $url = protoName( $hasSSL )."://".$req->hostname()."/$prefix/$addr".buildArgs( $args );
return HTTPRedirect( $req, $url );
}
return defined $tables->item( $addr );
}
-sub tryDirect( $$$$ ) {
- my( $req, $args, $tables, $search ) = @_;
+sub tryDirect( $$$$$ ) {
+ my( $req, $args, $tables, $search, $hasSSL ) = @_;
my $address = PciIds::Address::new( $req->uri() );
$search =~ s/:/\//g;
$search =~ s/ //g;
$search =~ s/^\//$top\//;
#Is it absolute address?
my $saddr = PciIds::Address::new( $search );
- return redirect( $req, $args, $saddr->get() ) if( defined $saddr && itemExists( $tables, $saddr->get() ) );
+ return redirect( $req, $args, $saddr->get(), $hasSSL ) if( defined $saddr && itemExists( $tables, $saddr->get() ) );
while( defined $address ) {
$saddr = PciIds::Address::new( $address->get()."/$search" );
- return redirect( $req, $args, $saddr->get() ) if( defined $saddr && itemExists( $tables, $saddr->get() ) );
+ return redirect( $req, $args, $saddr->get(), $hasSSL ) if( defined $saddr && itemExists( $tables, $saddr->get() ) );
$address = $address->parent();
}
return undef;
$args->{'action'} = delete $args->{'origin'};
my $search = getFormValue( 'where', '' );
my $idOnly = $search =~ s/^#//;
- my $direct = tryDirect( $req, $args, $tables, $search );
+ my $direct = tryDirect( $req, $args, $tables, $search, $auth->{'ssl'} );
return $direct if defined $direct;
my $address = PciIds::Address::new( $req->uri() );
unless( $idOnly || length $search < 3 ) {#Try extended search
genPath( $req, $address, 1 );
print "<h2>Found items</h2>\n";
genTableHead( 'found', [ 'ID', 'Name', 'Parent' ], [] );
- my $prefix = 'http://'.$req->hostname().'/'.( ( !defined $args->{'action'} || $args->{'action'} eq '' || $args->{'action'} eq 'list' ) ? 'read/' : 'mods/' );
+ my $prefix = $req->hostname().'/'.( ( !defined $args->{'action'} || $args->{'action'} eq '' || $args->{'action'} eq 'list' ) ? 'read/' : 'mods/' );
my $suffix = buildArgs( $args );
htmlFormatTable( $result, 3, [], [ sub {
my $addr = shift;