1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-26 08:16:12 +02:00

gitweb: provide function to format the URL for an action link.

Provide a new function which can be used to generate an URL for the CGI.
This makes it possible to consolidate the URL generation in order to make
it easier to change the encoding of actions into URLs.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Martin Waitz 2006-08-16 00:23:50 +02:00 committed by Junio C Hamano
parent 19a8721ef8
commit 06a9d86b49

View File

@ -184,6 +184,33 @@
$actions{$action}->();
exit;
## ======================================================================
## action links
sub href(%) {
my %mapping = (
action => "a",
project => "p",
file_name => "f",
hash => "h",
hash_parent => "hp",
hash_base => "hb",
page => "pg",
searchtext => "s",
);
my %params = @_;
$params{"project"} ||= $project;
my $href = "$my_uri?";
$href .= esc_param( join(";",
map { "$mapping{$_}=$params{$_}" } keys %params
) );
return $href;
}
## ======================================================================
## validation, quoting/unquoting and escaping