gitweb: Navbar refactoring - use git_page_nav to generate navigation bar
Use git_page_nav subroutine to generate navigation bar. Additional navigation (either formats or pager/pagination) is put into variables. Corrects error in git_search where hash parameter was added to "summary" link instead of to "log" link. Might differ from previous version by additional "<br/>" in navigation bar. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jakub Narebski committed
Jul 30, 2006 at 15:01 UTC
0d83ddc40f356aa0b5618a6571f5146818ec2b41
1 file changed
+66
-169
gitweb/gitweb.cgi
+66
-169
@@ -1081,15 +1081,7 @@ sub git_summary {
1081
1082
my $refs = read_info_ref();
1083
git_header_html();
1084
- print "<div class=\"page_nav\">\n" .
1085
- "summary".
1086
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
1087
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
1088
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$head")}, "commit") .
1089
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1090
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree")}, "tree") .
1091
- "<br/><br/>\n" .
1092
- "</div>\n";
1084
+ git_page_nav('summary','', $head);
1085
print "<div class=\"title\"> </div>\n";
1086
print "<table cellspacing=\"0\">\n" .
1087
"<tr><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" .
@@ -1251,15 +1243,7 @@ sub git_print_page_path {
1243
sub git_tag {
1244
my $head = git_read_head($project);
1245
git_header_html();
1254
- print "<div class=\"page_nav\">\n" .
1255
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
1256
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
1257
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
1258
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$head")}, "commit") .
1259
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1260
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1261
- "<br/>\n" .
1262
- "</div>\n";
1246
+ git_page_nav('','', $head,undef,$head);
1247
my %tag = git_read_tag($hash);
1248
print "<div>\n" .
1249
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($tag{'name'})) . "\n" .
@@ -1307,19 +1291,13 @@ sub git_blame2 {
1291
open ($fd, "-|", $GIT, "blame", '-l', $file_name, $hash_base)
1292
or die_error(undef, "Open git-blame failed.");
1293
git_header_html();
1310
- print "<div class=\"page_nav\">\n" .
1311
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
1312
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
1313
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
1314
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") .
1315
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1316
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") . "<br/>\n";
1317
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
1318
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;f=$file_name")}, "head") . "<br/>\n";
1319
- print "</div>\n".
1320
- "<div>" .
1321
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
1322
- "</div>\n";
1294
+ my $formats_nav =
1295
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
1296
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;f=$file_name")}, "head");
1297
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
1298
+ print "<div>" .
1299
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
1300
+ "</div>\n";
1301
git_print_page_path($file_name, $ftype);
1302
my @rev_color = (qw(light dark));
1303
my $num_colors = scalar(@rev_color);
@@ -1369,19 +1347,13 @@ sub git_blame {
1347
open ($fd, "-|", $GIT, "annotate", '-l', '-t', '-r', $file_name, $hash_base)
1348
or die_error(undef, "Open git-annotate failed.");
1349
git_header_html();
1372
- print "<div class=\"page_nav\">\n" .
1373
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
1374
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
1375
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
1376
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") .
1377
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1378
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") . "<br/>\n";
1379
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
1380
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;f=$file_name")}, "head") . "<br/>\n";
1381
- print "</div>\n".
1382
- "<div>" .
1383
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
1384
- "</div>\n";
1350
+ my $formats_nav =
1351
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
1352
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;f=$file_name")}, "head");
1353
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
1354
+ print "<div>" .
1355
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
1356
+ "</div>\n";
1357
git_print_page_path($file_name);
1358
print "<div class=\"page_body\">\n";
1359
print <<HTML;
@@ -1456,15 +1428,7 @@ HTML
1428
sub git_tags {
1429
my $head = git_read_head($project);
1430
git_header_html();
1459
- print "<div class=\"page_nav\">\n" .
1460
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
1461
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
1462
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
1463
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$head")}, "commit") .
1464
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1465
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1466
- "<br/>\n" .
1467
- "</div>\n";
1431
+ git_page_nav('','', $head,undef,$head);
1432
my $taglist = git_read_refs("refs/tags");
1433
print "<div>\n" .
1434
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary"), -class => "title"}, " ") .
@@ -1515,15 +1479,7 @@ sub git_tags {
1479
sub git_heads {
1480
my $head = git_read_head($project);
1481
git_header_html();
1518
- print "<div class=\"page_nav\">\n" .
1519
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
1520
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
1521
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
1522
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$head")}, "commit") .
1523
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1524
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1525
- "<br/>\n" .
1526
- "</div>\n";
1482
+ git_page_nav('','', $head,undef,$head);
1483
my $taglist = git_read_refs("refs/heads");
1484
print "<div>\n" .
1485
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary"), -class => "title"}, " ") .
@@ -1684,25 +1640,20 @@ sub git_blob {
1640
return git_blob_plain($mimetype);
1641
}
1642
git_header_html();
1643
+ my $formats_nav = '';
1644
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1688
- print "<div class=\"page_nav\">\n" .
1689
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
1690
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
1691
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
1692
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") .
1693
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1694
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") . "<br/>\n";
1645
if (defined $file_name) {
1646
if ($have_blame) {
1697
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$hash;hb=$hash_base;f=$file_name")}, "blame") . " | ";
1647
+ $formats_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$hash;hb=$hash_base;f=$file_name")}, "blame") . " | ";
1648
}
1699
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$hash;f=$file_name")}, "plain") .
1700
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;hb=HEAD;f=$file_name")}, "head") . "<br/>\n";
1649
+ $formats_nav .=
1650
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$hash;f=$file_name")}, "plain") .
1651
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;hb=HEAD;f=$file_name")}, "head");
1652
} else {
1702
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$hash")}, "plain") . "<br/>\n";
1653
+ $formats_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$hash")}, "plain");
1654
}
1704
- print "</div>\n".
1705
- "<div>" .
1655
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
1656
+ print "<div>" .
1657
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
1658
"</div>\n";
1659
} else {
@@ -1757,15 +1708,7 @@ sub git_tree {
1708
my $base = "";
1709
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1710
$base_key = ";hb=$hash_base";
1760
- print "<div class=\"page_nav\">\n" .
1761
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
1762
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash_base")}, "shortlog") .
1763
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash_base")}, "log") .
1764
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") .
1765
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1766
- " | tree" .
1767
- "<br/><br/>\n" .
1768
- "</div>\n";
1711
+ git_page_nav('tree','', $hash_base);
1712
print "<div>\n" .
1713
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" .
1714
"</div>\n";
@@ -1922,14 +1865,6 @@ sub git_log {
1865
$page = 0;
1866
}
1867
my $refs = read_info_ref();
1925
- git_header_html();
1926
- print "<div class=\"page_nav\">\n";
1927
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
1928
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash")}, "shortlog") .
1929
- " | log" .
1930
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash")}, "commit") .
1931
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
1932
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
1868
1869
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
1870
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
@@ -1937,25 +1872,28 @@ sub git_log {
1872
my @revlist = map { chomp; $_ } <$fd>;
1873
close $fd;
1874
1875
+ my $paging_nav = '';
1876
if ($hash ne $head || $page) {
1941
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "HEAD");
1877
+ $paging_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "HEAD");
1878
} else {
1943
- print "HEAD";
1879
+ $paging_nav .= "HEAD";
1880
}
1881
if ($page > 0) {
1946
- print " ⋅ " .
1947
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
1882
+ $paging_nav .= " ⋅ " .
1883
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
1884
} else {
1949
- print " ⋅ prev";
1885
+ $paging_nav .= " ⋅ prev";
1886
}
1887
if ($#revlist >= (100 * ($page+1)-1)) {
1952
- print " ⋅ " .
1953
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
1888
+ $paging_nav .= " ⋅ " .
1889
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
1890
} else {
1955
- print " ⋅ next";
1891
+ $paging_nav .= " ⋅ next";
1892
}
1957
- print "<br/>\n" .
1958
- "</div>\n";
1893
+
1894
+ git_header_html();
1895
+ git_page_nav('log','', $hash,undef,undef, $paging_nav);
1896
+
1897
if (!@revlist) {
1898
print "<div>\n" .
1899
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary"), -class => "title"}, " ") .
@@ -2037,21 +1975,14 @@ sub git_commit {
1975
$ref = " <span class=\"tag\">" . esc_html($refs->{$co{'id'}}) . "</span>";
1976
}
1977
git_header_html(undef, $expires);
2040
- print "<div class=\"page_nav\">\n" .
2041
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
2042
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash")}, "shortlog") .
2043
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash")}, "log") .
2044
- " | commit";
2045
- if (defined $co{'parent'}) {
2046
- print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash")}, "commitdiff");
2047
- }
2048
- print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "\n" .
2049
- "<br/>\n";
1978
+ my $formats_nav = '';
1979
if (defined $file_name && defined $co{'parent'}) {
1980
my $parent = $co{'parent'};
2052
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;hb=$parent;f=$file_name")}, "blame") . "\n";
1981
+ $formats_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;hb=$parent;f=$file_name")}, "blame");
1982
}
2054
- print "<br/></div>\n";
1983
+ git_page_nav('commit', defined $co{'parent'} ? '' : 'commitdiff',
1984
+ $hash, $co{'tree'}, $hash,
1985
+ $formats_nav);
1986
1987
if (defined $co{'parent'}) {
1988
print "<div>\n" .
@@ -2223,16 +2154,9 @@ sub git_blobdiff {
2154
mkdir($git_temp, 0700);
2155
git_header_html();
2156
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
2226
- print "<div class=\"page_nav\">\n" .
2227
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
2228
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
2229
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
2230
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") .
2231
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
2232
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") .
2233
- "<br/>\n";
2234
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent")}, "plain") .
2235
- "</div>\n";
2157
+ my $formats_nav =
2158
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent")}, "plain");
2159
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
2160
print "<div>\n" .
2161
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" .
2162
"</div>\n";
@@ -2284,15 +2208,9 @@ sub git_commitdiff {
2208
$ref = " <span class=\"tag\">" . esc_html($refs->{$co{'id'}}) . "</span>";
2209
}
2210
git_header_html(undef, $expires);
2287
- print "<div class=\"page_nav\">\n" .
2288
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
2289
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash")}, "shortlog") .
2290
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash")}, "log") .
2291
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash")}, "commit") .
2292
- " | commitdiff" .
2293
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "<br/>\n";
2294
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain") . "\n" .
2295
- "</div>\n";
2211
+ my $formats_nav =
2212
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain");
2213
+ git_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);
2214
print "<div>\n" .
2215
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" .
2216
"</div>\n";
@@ -2424,15 +2342,7 @@ sub git_history {
2342
}
2343
my $refs = read_info_ref();
2344
git_header_html();
2427
- print "<div class=\"page_nav\">\n" .
2428
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
2429
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
2430
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
2431
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") .
2432
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
2433
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") .
2434
- "<br/><br/>\n" .
2435
- "</div>\n";
2345
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base);
2346
print "<div>\n" .
2347
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" .
2348
"</div>\n";
@@ -2515,15 +2425,7 @@ sub git_search {
2425
$pickaxe_search = 1;
2426
}
2427
git_header_html();
2518
- print "<div class=\"page_nav\">\n" .
2519
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary;h=$hash")}, "summary") .
2520
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
2521
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash")}, "log") .
2522
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash")}, "commit") .
2523
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2524
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
2525
- "<br/><br/>\n" .
2526
- "</div>\n";
2428
+ git_page_nav('','', $hash,$co{'tree'},$hash);
2429
2430
print "<div>\n" .
2431
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" .
@@ -2643,14 +2545,6 @@ sub git_shortlog {
2545
$page = 0;
2546
}
2547
my $refs = read_info_ref();
2646
- git_header_html();
2647
- print "<div class=\"page_nav\">\n" .
2648
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
2649
- " | shortlog" .
2650
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash")}, "log") .
2651
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash")}, "commit") .
2652
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2653
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
2548
2549
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
2550
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
@@ -2658,25 +2552,28 @@ sub git_shortlog {
2552
my @revlist = map { chomp; $_ } <$fd>;
2553
close $fd;
2554
2555
+ my $paging_nav = '';
2556
if ($hash ne $head || $page) {
2662
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "HEAD");
2557
+ $paging_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "HEAD");
2558
} else {
2664
- print "HEAD";
2559
+ $paging_nav .= "HEAD";
2560
}
2561
if ($page > 0) {
2667
- print " ⋅ " .
2668
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
2562
+ $paging_nav .= " ⋅ " .
2563
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
2564
} else {
2670
- print " ⋅ prev";
2565
+ $paging_nav .= " ⋅ prev";
2566
}
2567
if ($#revlist >= (100 * ($page+1)-1)) {
2673
- print " ⋅ " .
2674
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
2568
+ $paging_nav .= " ⋅ " .
2569
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
2570
} else {
2676
- print " ⋅ next";
2571
+ $paging_nav .= " ⋅ next";
2572
}
2678
- print "<br/>\n" .
2679
- "</div>\n";
2573
+
2574
+ git_header_html();
2575
+ git_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav);
2576
+
2577
print "<div>\n" .
2578
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary"), -class => "title"}, " ") .
2579
"</div>\n";