{"thread":{"id":"5292","subject":"[PATCH] gitweb: provide function to format the URL for an action link.","startedAt":"2006-08-15T22:23:50Z","lastAt":"2006-08-15T22:23:50Z","messageCount":1,"participants":["Martin Waitz"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"25389","messageId":"20060815222350.GC14459@admingilde.org","threadId":"5292","inReplyTo":null,"subject":"[PATCH] gitweb: provide function to format the URL for an action link.","fromName":"Martin Waitz","fromEmail":"tali@admingilde.org","sentAt":"2006-08-15T22:23:50Z","receivedAt":"2006-08-15T22:23:50Z","isPatch":true,"sender":{"key":"tali@admingilde.org","avatar":"https://gravatar.com/avatar/3f89b03eee362187effabe257898735b475673a12265c398ea9161259ae91553?d=mp&s=160"},"body":"Provide a new function which can be used to generate an URL for the CGI.\nThis makes it possible to consolidate the URL generation in order to make\nit easier to change the encoding of actions into URLs.\n\nSigned-off-by: Martin Waitz <tali@admingilde.org>\n---\n gitweb/gitweb.perl |   27 +++++++++++++++++++++++++++\n 1 files changed, 27 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex b5b89de..726dd66 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -181,6 +181,33 @@ if (!defined($actions{$action})) {\n exit;\n \n ## ======================================================================\n+## action links\n+\n+sub href(%) {\n+\tmy %mapping = (\n+\t\taction => \"a\",\n+\t\tproject => \"p\",\n+\t\tfile_name => \"f\",\n+\t\thash => \"h\",\n+\t\thash_parent => \"hp\",\n+\t\thash_base => \"hb\",\n+\t\tpage => \"pg\",\n+\t\tsearchtext => \"s\",\n+\t);\n+\n+\tmy %params = @_;\n+\t$params{\"project\"} ||= $project;\n+\n+\tmy $href = \"$my_uri?\";\n+\t$href .= esc_param( join(\";\",\n+\t\tmap { \"$mapping{$_}=$params{$_}\" } keys %params\n+\t) );\n+\n+\treturn $href;\n+}\n+\n+\n+## ======================================================================\n ## validation, quoting/unquoting and escaping\n \n sub validate_input {\n-- \n1.4.2.rc2.gf055\n\n-- \nMartin Waitz\n"}]}