summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
Unidiff
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 8a804c2..83758f7 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -465,97 +465,100 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
465 html_hidden("q", ctx.qry.search); 465 html_hidden("q", ctx.qry.search);
466 } 466 }
467} 467}
468 468
469char *hc(struct cgit_cmd *cmd, const char *page) 469char *hc(struct cgit_cmd *cmd, const char *page)
470{ 470{
471 return (strcmp(cmd->name, page) ? NULL : "active"); 471 return (strcmp(cmd->name, page) ? NULL : "active");
472} 472}
473 473
474void cgit_print_pageheader(struct cgit_context *ctx) 474void cgit_print_pageheader(struct cgit_context *ctx)
475{ 475{
476 struct cgit_cmd *cmd = cgit_get_cmd(ctx); 476 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
477 477
478 html("<table id='header'>\n"); 478 html("<table id='header'>\n");
479 html("<tr>\n"); 479 html("<tr>\n");
480 html("<td class='logo' rowspan='2'><a href='"); 480 html("<td class='logo' rowspan='2'><a href='");
481 if (ctx->cfg.logo_link) 481 if (ctx->cfg.logo_link)
482 html_attr(ctx->cfg.logo_link); 482 html_attr(ctx->cfg.logo_link);
483 else 483 else
484 html_attr(cgit_rooturl()); 484 html_attr(cgit_rooturl());
485 html("'><img src='"); 485 html("'><img src='");
486 html_attr(ctx->cfg.logo); 486 html_attr(ctx->cfg.logo);
487 html("' alt='cgit logo'/></a></td>\n"); 487 html("' alt='cgit logo'/></a></td>\n");
488 488
489 html("<td class='main'>"); 489 html("<td class='main'>");
490 if (ctx->repo) { 490 if (ctx->repo) {
491 reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"), 491 reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"),
492 ctx->qry.head, NULL, NULL); 492 ctx->qry.head, NULL, NULL);
493 html(" : "); 493 html(" : ");
494 html_txt(ctx->qry.page); 494 html_txt(ctx->qry.page);
495 html("</td><td class='form'>"); 495 html("</td><td class='form'>");
496 html("<form method='get' action=''>\n"); 496 html("<form method='get' action=''>\n");
497 add_hidden_formfields(0, 1, ctx->qry.page); 497 add_hidden_formfields(0, 1, ctx->qry.page);
498 html("<select name='h' onchange='this.form.submit();'>\n"); 498 html("<select name='h' onchange='this.form.submit();'>\n");
499 for_each_branch_ref(print_branch_option, ctx->qry.head); 499 for_each_branch_ref(print_branch_option, ctx->qry.head);
500 html("</select> "); 500 html("</select> ");
501 html("<input type='submit' name='' value='switch'/>"); 501 html("<input type='submit' name='' value='switch'/>");
502 html("</form>"); 502 html("</form>");
503 } else 503 } else
504 html_txt(ctx->cfg.root_title); 504 html_txt(ctx->cfg.root_title);
505 html("</td></tr>\n"); 505 html("</td></tr>\n");
506 506
507 html("<tr><td class='sub'"); 507 html("<tr><td class='sub'");
508 if (ctx->repo) { 508 if (ctx->repo) {
509 html(" colspan='2'>"); 509 html(" colspan='2'>");
510 html_txt(ctx->repo->desc); 510 html_txt(ctx->repo->desc);
511 } else { 511 } else {
512 html(">"); 512 html(">");
513 html_txt("a fast webinterface for the git dscm"); 513 if (ctx->cfg.root_desc)
514 html_txt(ctx->cfg.root_desc);
515 else if (ctx->cfg.index_info)
516 html_include(ctx->cfg.index_info);
514 } 517 }
515 html("</td></tr></table>\n"); 518 html("</td></tr></table>\n");
516 519
517 html("<table class='tabs'><tr><td>\n"); 520 html("<table class='tabs'><tr><td>\n");
518 if (ctx->repo) { 521 if (ctx->repo) {
519 reporevlink(NULL, "summary", NULL, hc(cmd, "summary"), 522 reporevlink(NULL, "summary", NULL, hc(cmd, "summary"),
520 ctx->qry.head, NULL, NULL); 523 ctx->qry.head, NULL, NULL);
521 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 524 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
522 ctx->qry.sha1, NULL); 525 ctx->qry.sha1, NULL);
523 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 526 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
524 NULL, NULL, 0, NULL, NULL); 527 NULL, NULL, 0, NULL, NULL);
525 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 528 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
526 ctx->qry.sha1, NULL); 529 ctx->qry.sha1, NULL);
527 cgit_commit_link("commit", NULL, hc(cmd, "commit"), 530 cgit_commit_link("commit", NULL, hc(cmd, "commit"),
528 ctx->qry.head, ctx->qry.sha1); 531 ctx->qry.head, ctx->qry.sha1);
529 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, 532 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
530 ctx->qry.sha1, ctx->qry.sha2, NULL); 533 ctx->qry.sha1, ctx->qry.sha2, NULL);
531 html("</td><td class='form'>"); 534 html("</td><td class='form'>");
532 html("<form class='right' method='get' action='"); 535 html("<form class='right' method='get' action='");
533 if (ctx->cfg.virtual_root) 536 if (ctx->cfg.virtual_root)
534 html_attr(cgit_fileurl(ctx->qry.repo, "log", 537 html_attr(cgit_fileurl(ctx->qry.repo, "log",
535 ctx->qry.path, NULL)); 538 ctx->qry.path, NULL));
536 html("'>\n"); 539 html("'>\n");
537 add_hidden_formfields(1, 0, "log"); 540 add_hidden_formfields(1, 0, "log");
538 html("<select name='qt'>\n"); 541 html("<select name='qt'>\n");
539 html_option("grep", "log msg", ctx->qry.grep); 542 html_option("grep", "log msg", ctx->qry.grep);
540 html_option("author", "author", ctx->qry.grep); 543 html_option("author", "author", ctx->qry.grep);
541 html_option("committer", "committer", ctx->qry.grep); 544 html_option("committer", "committer", ctx->qry.grep);
542 html("</select>\n"); 545 html("</select>\n");
543 html("<input class='txt' type='text' size='10' name='q' value='"); 546 html("<input class='txt' type='text' size='10' name='q' value='");
544 html_attr(ctx->qry.search); 547 html_attr(ctx->qry.search);
545 html("'/>\n"); 548 html("'/>\n");
546 html("<input type='submit' value='search'/>\n"); 549 html("<input type='submit' value='search'/>\n");
547 html("</form>\n"); 550 html("</form>\n");
548 } else { 551 } else {
549 html("<a class='active' href='"); 552 html("<a class='active' href='");
550 html_attr(cgit_rooturl()); 553 html_attr(cgit_rooturl());
551 html("'>index</a>\n"); 554 html("'>index</a>\n");
552 html("</td><td class='form'>"); 555 html("</td><td class='form'>");
553 html("<form method='get' action='"); 556 html("<form method='get' action='");
554 html_attr(cgit_rooturl()); 557 html_attr(cgit_rooturl());
555 html("'>\n"); 558 html("'>\n");
556 html("<input type='text' name='q' size='10' value='"); 559 html("<input type='text' name='q' size='10' value='");
557 html_attr(ctx->qry.search); 560 html_attr(ctx->qry.search);
558 html("'/>\n"); 561 html("'/>\n");
559 html("<input type='submit' value='search'/>\n"); 562 html("<input type='submit' value='search'/>\n");
560 html("</form>"); 563 html("</form>");
561 } 564 }