summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c4
-rw-r--r--cgit.css5
-rw-r--r--cgit.h4
-rw-r--r--html.c10
-rw-r--r--shared.c3
-rw-r--r--ui-repolist.c2
-rw-r--r--ui-shared.c28
7 files changed, 51 insertions, 5 deletions
diff --git a/cgit.c b/cgit.c
index ac43441..277b849 100644
--- a/cgit.c
+++ b/cgit.c
@@ -18,3 +18,3 @@ static void cgit_print_repo_page(struct cacheitem *item)
18 cgit_print_docstart(title, item); 18 cgit_print_docstart(title, item);
19 cgit_print_pageheader(title); 19 cgit_print_pageheader(title, 0);
20 cgit_print_error(fmt("Unable to scan repository: %s", 20 cgit_print_error(fmt("Unable to scan repository: %s",
@@ -27,3 +27,3 @@ static void cgit_print_repo_page(struct cacheitem *item)
27 cgit_print_docstart(title, item); 27 cgit_print_docstart(title, item);
28 cgit_print_pageheader(title); 28 cgit_print_pageheader(title, 0);
29 if (!cgit_query_page) { 29 if (!cgit_query_page) {
diff --git a/cgit.css b/cgit.css
index 459dca7..9112bfe 100644
--- a/cgit.css
+++ b/cgit.css
@@ -63,2 +63,7 @@ div#header img#logo {
63} 63}
64
65div#header input {
66 float: right;
67 margin: 0.25em 1em;
68}
64div#header a { 69div#header a {
diff --git a/cgit.h b/cgit.h
index 362b435..e114a50 100644
--- a/cgit.h
+++ b/cgit.h
@@ -57,2 +57,3 @@ extern char *cgit_query_repo;
57extern char *cgit_query_page; 57extern char *cgit_query_page;
58extern char *cgit_query_search;
58extern char *cgit_query_head; 59extern char *cgit_query_head;
@@ -77,2 +78,3 @@ extern void html_ntxt(int len, char *txt);
77extern void html_attr(char *txt); 78extern void html_attr(char *txt);
79extern void html_hidden(char *name, char *value);
78extern void html_link_open(char *url, char *title, char *class); 80extern void html_link_open(char *url, char *title, char *class);
@@ -100,3 +102,3 @@ extern void cgit_print_docstart(char *title, struct cacheitem *item);
100extern void cgit_print_docend(); 102extern void cgit_print_docend();
101extern void cgit_print_pageheader(char *title); 103extern void cgit_print_pageheader(char *title, int show_search);
102 104
diff --git a/html.c b/html.c
index 3a5d28d..c0b2ed4 100644
--- a/html.c
+++ b/html.c
@@ -119,2 +119,11 @@ void html_attr(char *txt)
119 119
120void html_hidden(char *name, char *value)
121{
122 html("<input type='hidden' name='");
123 html_attr(name);
124 html("' value='");
125 html_attr(value);
126 html("'/>");
127}
128
120void html_link_open(char *url, char *title, char *class) 129void html_link_open(char *url, char *title, char *class)
@@ -157 +166,2 @@ void html_filemode(unsigned short mode)
157} 166}
167
diff --git a/shared.c b/shared.c
index 18b795b..7def51a 100644
--- a/shared.c
+++ b/shared.c
@@ -38,2 +38,3 @@ char *cgit_query_page = NULL;
38char *cgit_query_head = NULL; 38char *cgit_query_head = NULL;
39char *cgit_query_search = NULL;
39char *cgit_query_sha1 = NULL; 40char *cgit_query_sha1 = NULL;
@@ -88,2 +89,4 @@ void cgit_querystring_cb(const char *name, const char *value)
88 cgit_query_page = xstrdup(value); 89 cgit_query_page = xstrdup(value);
90 } else if (!strcmp(name, "q")) {
91 cgit_query_search = xstrdup(value);
89 } else if (!strcmp(name, "h")) { 92 } else if (!strcmp(name, "h")) {
diff --git a/ui-repolist.c b/ui-repolist.c
index 7090c12..9f12b18 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -19,3 +19,3 @@ void cgit_print_repolist(struct cacheitem *item)
19 cgit_print_docstart(cgit_root_title, item); 19 cgit_print_docstart(cgit_root_title, item);
20 cgit_print_pageheader(cgit_root_title); 20 cgit_print_pageheader(cgit_root_title, 0);
21 21
diff --git a/ui-shared.c b/ui-shared.c
index 9ec4be8..b9c1243 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -62,2 +62,14 @@ char *cgit_pageurl(const char *reponame, const char *pagename,
62 62
63char *cgit_currurl()
64{
65 if (!cgit_virtual_root)
66 return "./cgit.cgi";
67 else if (cgit_query_page)
68 return fmt("%s/%s/%s/", cgit_virtual_root, cgit_query_repo, cgit_query_page);
69 else if (cgit_query_repo)
70 return fmt("%s/%s/", cgit_virtual_root, cgit_query_repo);
71 else
72 return fmt("%s/", cgit_virtual_root);
73}
74
63 75
@@ -100,3 +112,3 @@ void cgit_print_docend()
100 112
101void cgit_print_pageheader(char *title) 113void cgit_print_pageheader(char *title, int show_search)
102{ 114{
@@ -106,2 +118,16 @@ void cgit_print_pageheader(char *title)
106 htmlf("</a>"); 118 htmlf("</a>");
119 if (show_search) {
120 html("<form method='get' href='");
121 html_attr(cgit_currurl());
122 html("'>");
123 if (cgit_query_head)
124 html_hidden("h", cgit_query_head);
125 if (cgit_query_sha1)
126 html_hidden("id", cgit_query_sha1);
127 if (cgit_query_sha2)
128 html_hidden("id2", cgit_query_sha2);
129 html("<input type='text' name='q' value='");
130 html_attr(cgit_query_search);
131 html("'/></form>");
132 }
107 if (cgit_query_repo) 133 if (cgit_query_repo)