summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2007-11-03 09:42:37 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-11-03 09:42:37 (UTC)
commit51140311bb3b0d4d0e859d5045ffe4c74478f5fe (patch) (side-by-side diff)
tree6575f174e32abd5f5d1f481e5f7f5978525ae416
parentdf203a293e3ac19245f8761cf7c5808f8735f917 (diff)
downloadcgit-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>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.h3
-rw-r--r--ui-log.c6
-rw-r--r--ui-repolist.c3
-rw-r--r--ui-shared.c13
-rw-r--r--ui-summary.c2
-rw-r--r--ui-tree.c2
6 files changed, 21 insertions, 8 deletions
diff --git a/cgit.h b/cgit.h
index 42036c3..163f355 100644
--- a/cgit.h
+++ b/cgit.h
@@ -229,25 +229,26 @@ extern int cache_expired(struct cacheitem *item);
extern char *cgit_repourl(const char *reponame);
extern char *cgit_fileurl(const char *reponame, const char *pagename,
const char *filename, const char *query);
extern char *cgit_pageurl(const char *reponame, const char *pagename,
const char *query);
extern const char *cgit_repobasename(const char *reponame);
extern void cgit_tree_link(char *name, char *title, char *class, char *head,
char *rev, char *path);
extern void cgit_log_link(char *name, char *title, char *class, char *head,
- char *rev, char *path, int ofs);
+ char *rev, char *path, int ofs, char *grep,
+ char *pattern);
extern void cgit_commit_link(char *name, char *title, char *class, char *head,
char *rev);
extern void cgit_refs_link(char *name, char *title, char *class, char *head,
char *rev, char *path);
extern void cgit_snapshot_link(char *name, char *title, char *class,
char *head, char *rev, char *archivename);
extern void cgit_diff_link(char *name, char *title, char *class, char *head,
char *new_rev, char *old_rev, char *path);
extern void cgit_object_link(struct object *obj);
extern void cgit_print_error(char *msg);
diff --git a/ui-log.c b/ui-log.c
index e7f7d6f..9f5fdf6 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -109,23 +109,25 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
free(commit->buffer);
commit->buffer = NULL;
free_commit_list(commit->parents);
commit->parents = NULL;
}
html("</table>\n");
if (pager) {
html("<div class='pager'>");
if (ofs > 0) {
cgit_log_link("[prev]", NULL, NULL, cgit_query_head,
cgit_query_sha1, cgit_query_path,
- ofs - cnt);
+ ofs - cnt, cgit_query_grep,
+ cgit_query_search);
html("&nbsp;");
}
if ((commit = get_revision(&rev)) != NULL) {
cgit_log_link("[next]", NULL, NULL, cgit_query_head,
cgit_query_sha1, cgit_query_path,
- ofs + cnt);
+ ofs + cnt, cgit_query_grep,
+ cgit_query_search);
}
html("</div>");
}
}
diff --git a/ui-repolist.c b/ui-repolist.c
index 4c86543..9aa5c1e 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -89,21 +89,22 @@ void cgit_print_repolist(struct cacheitem *item)
html("</td><td>");
html_ntxt(cgit_max_repodesc_len, cgit_repo->desc);
html("</td><td>");
html_txt(cgit_repo->owner);
html("</td><td>");
print_modtime(cgit_repo);
html("</td>");
if (cgit_enable_index_links) {
html("<td>");
html_link_open(cgit_repourl(cgit_repo->url),
NULL, "button");
html("summary</a>");
- cgit_log_link("log", NULL, "button", NULL, NULL, NULL, 0);
+ cgit_log_link("log", NULL, "button", NULL, NULL, NULL,
+ 0, NULL, NULL);
cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL);
html("</td>");
}
html("</tr>\n");
}
html("</table>");
cgit_print_docend();
}
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,
html("'>");
html_txt(name);
html("</a>");
}
void cgit_tree_link(char *name, char *title, char *class, char *head,
char *rev, char *path)
{
reporevlink("tree", name, title, class, head, rev, path);
}
void cgit_log_link(char *name, char *title, char *class, char *head,
- char *rev, char *path, int ofs)
+ char *rev, char *path, int ofs, char *grep, char *pattern)
{
char *delim;
delim = repolink(title, class, "log", head, path);
if (rev && strcmp(rev, cgit_query_head)) {
html(delim);
html("id=");
html_attr(rev);
delim = "&";
}
+ if (grep && pattern) {
+ html(delim);
+ html("qt=");
+ html_attr(grep);
+ delim = "&";
+ html(delim);
+ html("q=");
+ html_attr(pattern);
+ }
if (ofs > 0) {
html(delim);
html("ofs=");
htmlf("%d", ofs);
}
html("'>");
html_txt(name);
html("</a>");
}
void cgit_commit_link(char *name, char *title, char *class, char *head,
char *rev)
@@ -452,25 +461,25 @@ void cgit_print_pageheader(char *title, int show_search)
html("<h1>");
html_txt(strrpart(cgit_repo->name, 20));
html("</h1>\n");
html_txt(cgit_repo->desc);
if (cgit_repo->owner) {
html("<p>\n<h1>owner</h1>\n");
html_txt(cgit_repo->owner);
}
html("<p>\n<h1>navigate</h1>\n");
reporevlink(NULL, "summary", NULL, "menu", cgit_query_head,
NULL, NULL);
cgit_log_link("log", NULL, "menu", cgit_query_head,
- cgit_query_sha1, cgit_query_path, 0);
+ cgit_query_sha1, cgit_query_path, 0, NULL, NULL);
cgit_tree_link("tree", NULL, "menu", cgit_query_head,
cgit_query_sha1, NULL);
cgit_commit_link("commit", NULL, "menu", cgit_query_head,
cgit_query_sha1);
cgit_diff_link("diff", NULL, "menu", cgit_query_head,
cgit_query_sha1, cgit_query_sha2,
cgit_query_path);
for_each_ref(print_archive_ref, &header);
html("<p>\n<h1>branch</h1>\n");
html("<form method='get' action=''>\n");
diff --git a/ui-summary.c b/ui-summary.c
index 39fe330..c856793 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -47,25 +47,25 @@ static int cmp_tag_age(const void *a, const void *b)
return cmp_age(r1->tag->tagger_date, r2->tag->tagger_date);
}
static int print_branch(struct refinfo *ref)
{
struct commitinfo *info = ref->commit;
char *name = (char *)ref->refname;
if (!info)
return 1;
html("<tr><td>");
- cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0);
+ cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL);
html("</td><td>");
if (ref->object->type == OBJ_COMMIT) {
cgit_print_age(info->commit->date, -1, NULL);
html("</td><td>");
html_txt(info->author);
html("</td><td>");
cgit_commit_link(info->subject, NULL, NULL, name, NULL);
} else {
html("</td><td></td><td>");
cgit_object_link(ref->object);
}
diff --git a/ui-tree.c b/ui-tree.c
index d6bcec3..c22e30b 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -91,25 +91,25 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
html("</a>");
} else if (S_ISDIR(mode)) {
cgit_tree_link(name, NULL, "ls-dir", cgit_query_head,
curr_rev, fullpath);
} else {
cgit_tree_link(name, NULL, "ls-blob", cgit_query_head,
curr_rev, fullpath);
}
htmlf("</td><td class='ls-size'>%li</td>", size);
html("<td>");
cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev,
- fullpath, 0);
+ fullpath, 0, NULL, NULL);
html("</td></tr>\n");
free(name);
return 0;
}
static void ls_head()
{
html("<table class='list'>\n");
html("<tr class='nohover'>");
html("<th class='left'>Mode</th>");
html("<th class='left'>Name</th>");
html("<th class='right'>Size</th>");