summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
Side-by-side diff
Diffstat (limited to 'ui-shared.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-shared.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/ui-shared.c b/ui-shared.c
index b96237d..b9f487a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -120,72 +120,72 @@ char *cgit_currurl()
return fmt("%s/", ctx.cfg.virtual_root);
}
static char *repolink(char *title, char *class, char *page, char *head,
char *path)
{
char *delim = "?";
html("<a");
if (title) {
html(" title='");
html_attr(title);
html("'");
}
if (class) {
html(" class='");
html_attr(class);
html("'");
}
html(" href='");
if (ctx.cfg.virtual_root) {
html_attr(ctx.cfg.virtual_root);
if (ctx.cfg.virtual_root[strlen(ctx.cfg.virtual_root) - 1] != '/')
html("/");
- html_attr(cgit_repo->url);
- if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/')
+ html_attr(ctx.repo->url);
+ if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
html("/");
if (page) {
html(page);
html("/");
if (path)
html_attr(path);
}
} else {
html(ctx.cfg.script_name);
html("?url=");
- html_attr(cgit_repo->url);
- if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/')
+ html_attr(ctx.repo->url);
+ if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
html("/");
if (page) {
html(page);
html("/");
if (path)
html_attr(path);
}
delim = "&amp;";
}
- if (head && strcmp(head, cgit_repo->defbranch)) {
+ if (head && strcmp(head, ctx.repo->defbranch)) {
html(delim);
html("h=");
html_attr(head);
delim = "&amp;";
}
return fmt("%s", delim);
}
static void reporevlink(char *page, char *name, char *title, char *class,
char *head, char *rev, char *path)
{
char *delim;
delim = repolink(title, class, page, head, path);
if (rev && strcmp(rev, ctx.qry.head)) {
html(delim);
html("id=");
html_attr(rev);
}
html("'>");
html_txt(name);
html("</a>");
}
@@ -425,110 +425,110 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
if (!*header) {
html("<h1>download</h1>\n");
*header = 1;
}
url = cgit_pageurl(ctx.qry.repo, "blob",
fmt("id=%s&amp;path=%s", sha1_to_hex(fileid),
buf));
html_link_open(url, NULL, "menu");
html_txt(strlpart(buf, 20));
html_link_close();
return 0;
}
void add_hidden_formfields(int incl_head, int incl_search, char *page)
{
char *url;
if (!ctx.cfg.virtual_root) {
url = fmt("%s/%s", ctx.qry.repo, page);
if (ctx.qry.path)
url = fmt("%s/%s", url, ctx.qry.path);
html_hidden("url", url);
}
- if (incl_head && strcmp(ctx.qry.head, cgit_repo->defbranch))
+ if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch))
html_hidden("h", ctx.qry.head);
if (ctx.qry.sha1)
html_hidden("id", ctx.qry.sha1);
if (ctx.qry.sha2)
html_hidden("id2", ctx.qry.sha2);
if (incl_search) {
if (ctx.qry.grep)
html_hidden("qt", ctx.qry.grep);
if (ctx.qry.search)
html_hidden("q", ctx.qry.search);
}
}
void cgit_print_pageheader(char *title, int show_search)
{
static const char *default_info = "This is cgit, a fast webinterface for git repositories";
int header = 0;
char *url;
html("<table id='layout' summary=''>\n");
html("<tr><td id='sidebar'>\n");
html("<table class='sidebar' cellspacing='0' summary=''>\n");
html("<tr><td class='sidebar'>\n<a href='");
html_attr(cgit_rooturl());
htmlf("'><img src='%s' alt='cgit'/></a>\n",
ctx.cfg.logo);
html("</td></tr>\n<tr><td class='sidebar'>\n");
if (ctx.qry.repo) {
html("<h1 class='first'>");
- html_txt(strrpart(cgit_repo->name, 20));
+ html_txt(strrpart(ctx.repo->name, 20));
html("</h1>\n");
- html_txt(cgit_repo->desc);
- if (cgit_repo->owner) {
+ html_txt(ctx.repo->desc);
+ if (ctx.repo->owner) {
html("<h1>owner</h1>\n");
- html_txt(cgit_repo->owner);
+ html_txt(ctx.repo->owner);
}
html("<h1>navigate</h1>\n");
reporevlink(NULL, "summary", NULL, "menu", ctx.qry.head,
NULL, NULL);
cgit_log_link("log", NULL, "menu", ctx.qry.head, NULL, NULL,
0, NULL, NULL);
cgit_tree_link("tree", NULL, "menu", ctx.qry.head,
ctx.qry.sha1, NULL);
cgit_commit_link("commit", NULL, "menu", ctx.qry.head,
ctx.qry.sha1);
cgit_diff_link("diff", NULL, "menu", ctx.qry.head,
ctx.qry.sha1, ctx.qry.sha2, NULL);
cgit_patch_link("patch", NULL, "menu", ctx.qry.head,
ctx.qry.sha1);
for_each_ref(print_archive_ref, &header);
- if (cgit_repo->clone_url || ctx.cfg.clone_prefix) {
+ if (ctx.repo->clone_url || ctx.cfg.clone_prefix) {
html("<h1>clone</h1>\n");
- if (cgit_repo->clone_url)
- url = cgit_repo->clone_url;
+ if (ctx.repo->clone_url)
+ url = ctx.repo->clone_url;
else
url = fmt("%s%s", ctx.cfg.clone_prefix,
- cgit_repo->url);
+ ctx.repo->url);
html("<a class='menu' href='");
html_attr(url);
html("' title='");
html_attr(url);
html("'>\n");
html_txt(strrpart(url, 20));
html("</a>\n");
}
html("<h1>branch</h1>\n");
html("<form method='get' action=''>\n");
add_hidden_formfields(0, 1, ctx.qry.page);
// html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>");
html("<select name='h' onchange='this.form.submit();'>\n");
for_each_branch_ref(print_branch_option, ctx.qry.head);
html("</select>\n");
// html("</td><td>");
html("<noscript><input type='submit' id='switch-btn' value='switch'/></noscript>\n");
// html("</td></tr></table>");
html("</form>\n");
html("<h1>search</h1>\n");
html("<form method='get' action='");
if (ctx.cfg.virtual_root)