summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 19a8721)
raw | patch | inline | side by side (parent: 19a8721)
author | Martin Waitz <tali@admingilde.org> | |
Tue, 15 Aug 2006 22:23:50 +0000 (00:23 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 16 Aug 2006 04:55:17 +0000 (21:55 -0700) |
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 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>
gitweb/gitweb.perl | patch | blob | history |
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 0e1de297e926cf03564de75a81f80187ad594a8f..1471d4dadb23e27e4db0d97a4f1edc3f3b4949fc 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
$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