author | Lars Hjemli <hjemli@gmail.com> | 2007-11-03 09:42:37 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-11-03 09:42:37 (UTC) |
commit | 51140311bb3b0d4d0e859d5045ffe4c74478f5fe (patch) (unidiff) | |
tree | 6575f174e32abd5f5d1f481e5f7f5978525ae416 /ui-shared.c | |
parent | df203a293e3ac19245f8761cf7c5808f8735f917 (diff) | |
download | cgit-51140311bb3b0d4d0e859d5045ffe4c74478f5fe.zip cgit-51140311bb3b0d4d0e859d5045ffe4c74478f5fe.tar.gz cgit-51140311bb3b0d4d0e859d5045ffe4c74478f5fe.tar.bz2 |
Add search parameters to cgit_log_link
This makes the [prev] and [next] links work correctly on search results.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-shared.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c index 1d66940..a03661a 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -185,35 +185,44 @@ static void reporevlink(char *page, char *name, char *title, char *class, | |||
185 | html("'>"); | 185 | html("'>"); |
186 | html_txt(name); | 186 | html_txt(name); |
187 | html("</a>"); | 187 | html("</a>"); |
188 | } | 188 | } |
189 | 189 | ||
190 | void cgit_tree_link(char *name, char *title, char *class, char *head, | 190 | void cgit_tree_link(char *name, char *title, char *class, char *head, |
191 | char *rev, char *path) | 191 | char *rev, char *path) |
192 | { | 192 | { |
193 | reporevlink("tree", name, title, class, head, rev, path); | 193 | reporevlink("tree", name, title, class, head, rev, path); |
194 | } | 194 | } |
195 | 195 | ||
196 | void cgit_log_link(char *name, char *title, char *class, char *head, | 196 | void cgit_log_link(char *name, char *title, char *class, char *head, |
197 | char *rev, char *path, int ofs) | 197 | char *rev, char *path, int ofs, char *grep, char *pattern) |
198 | { | 198 | { |
199 | char *delim; | 199 | char *delim; |
200 | 200 | ||
201 | delim = repolink(title, class, "log", head, path); | 201 | delim = repolink(title, class, "log", head, path); |
202 | if (rev && strcmp(rev, cgit_query_head)) { | 202 | if (rev && strcmp(rev, cgit_query_head)) { |
203 | html(delim); | 203 | html(delim); |
204 | html("id="); | 204 | html("id="); |
205 | html_attr(rev); | 205 | html_attr(rev); |
206 | delim = "&"; | 206 | delim = "&"; |
207 | } | 207 | } |
208 | if (grep && pattern) { | ||
209 | html(delim); | ||
210 | html("qt="); | ||
211 | html_attr(grep); | ||
212 | delim = "&"; | ||
213 | html(delim); | ||
214 | html("q="); | ||
215 | html_attr(pattern); | ||
216 | } | ||
208 | if (ofs > 0) { | 217 | if (ofs > 0) { |
209 | html(delim); | 218 | html(delim); |
210 | html("ofs="); | 219 | html("ofs="); |
211 | htmlf("%d", ofs); | 220 | htmlf("%d", ofs); |
212 | } | 221 | } |
213 | html("'>"); | 222 | html("'>"); |
214 | html_txt(name); | 223 | html_txt(name); |
215 | html("</a>"); | 224 | html("</a>"); |
216 | } | 225 | } |
217 | 226 | ||
218 | void cgit_commit_link(char *name, char *title, char *class, char *head, | 227 | void cgit_commit_link(char *name, char *title, char *class, char *head, |
219 | char *rev) | 228 | char *rev) |
@@ -452,25 +461,25 @@ void cgit_print_pageheader(char *title, int show_search) | |||
452 | html("<h1>"); | 461 | html("<h1>"); |
453 | html_txt(strrpart(cgit_repo->name, 20)); | 462 | html_txt(strrpart(cgit_repo->name, 20)); |
454 | html("</h1>\n"); | 463 | html("</h1>\n"); |
455 | html_txt(cgit_repo->desc); | 464 | html_txt(cgit_repo->desc); |
456 | if (cgit_repo->owner) { | 465 | if (cgit_repo->owner) { |
457 | html("<p>\n<h1>owner</h1>\n"); | 466 | html("<p>\n<h1>owner</h1>\n"); |
458 | html_txt(cgit_repo->owner); | 467 | html_txt(cgit_repo->owner); |
459 | } | 468 | } |
460 | html("<p>\n<h1>navigate</h1>\n"); | 469 | html("<p>\n<h1>navigate</h1>\n"); |
461 | reporevlink(NULL, "summary", NULL, "menu", cgit_query_head, | 470 | reporevlink(NULL, "summary", NULL, "menu", cgit_query_head, |
462 | NULL, NULL); | 471 | NULL, NULL); |
463 | cgit_log_link("log", NULL, "menu", cgit_query_head, | 472 | cgit_log_link("log", NULL, "menu", cgit_query_head, |
464 | cgit_query_sha1, cgit_query_path, 0); | 473 | cgit_query_sha1, cgit_query_path, 0, NULL, NULL); |
465 | cgit_tree_link("tree", NULL, "menu", cgit_query_head, | 474 | cgit_tree_link("tree", NULL, "menu", cgit_query_head, |
466 | cgit_query_sha1, NULL); | 475 | cgit_query_sha1, NULL); |
467 | cgit_commit_link("commit", NULL, "menu", cgit_query_head, | 476 | cgit_commit_link("commit", NULL, "menu", cgit_query_head, |
468 | cgit_query_sha1); | 477 | cgit_query_sha1); |
469 | cgit_diff_link("diff", NULL, "menu", cgit_query_head, | 478 | cgit_diff_link("diff", NULL, "menu", cgit_query_head, |
470 | cgit_query_sha1, cgit_query_sha2, | 479 | cgit_query_sha1, cgit_query_sha2, |
471 | cgit_query_path); | 480 | cgit_query_path); |
472 | 481 | ||
473 | for_each_ref(print_archive_ref, &header); | 482 | for_each_ref(print_archive_ref, &header); |
474 | 483 | ||
475 | html("<p>\n<h1>branch</h1>\n"); | 484 | html("<p>\n<h1>branch</h1>\n"); |
476 | html("<form method='get' action=''>\n"); | 485 | html("<form method='get' action=''>\n"); |