summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2008-10-05 17:00:32 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-10-05 17:00:32 (UTC)
commit23ffba78b4572f35f0ee52410dde9a16e6d02ce5 (patch) (unidiff)
tree3826ebbae0760fb1d625361de9550e8d737a7bef
parentdf46123b0e55027bc39403df285851d37f25a473 (diff)
downloadcgit-23ffba78b4572f35f0ee52410dde9a16e6d02ce5.zip
cgit-23ffba78b4572f35f0ee52410dde9a16e6d02ce5.tar.gz
cgit-23ffba78b4572f35f0ee52410dde9a16e6d02ce5.tar.bz2
ui-shared: do not print repo name on the "summary" tab
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 1fc5c09..d909f55 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -538,179 +538,178 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
538 } else { 538 } else {
539 hashcpy(fileid, sha1); 539 hashcpy(fileid, sha1);
540 } 540 }
541 if (!*header) { 541 if (!*header) {
542 html("<h1>download</h1>\n"); 542 html("<h1>download</h1>\n");
543 *header = 1; 543 *header = 1;
544 } 544 }
545 url = cgit_pageurl(ctx.qry.repo, "blob", 545 url = cgit_pageurl(ctx.qry.repo, "blob",
546 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid), 546 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid),
547 buf)); 547 buf));
548 html_link_open(url, NULL, "menu"); 548 html_link_open(url, NULL, "menu");
549 html_txt(strlpart(buf, 20)); 549 html_txt(strlpart(buf, 20));
550 html_link_close(); 550 html_link_close();
551 return 0; 551 return 0;
552} 552}
553 553
554void add_hidden_formfields(int incl_head, int incl_search, char *page) 554void add_hidden_formfields(int incl_head, int incl_search, char *page)
555{ 555{
556 char *url; 556 char *url;
557 557
558 if (!ctx.cfg.virtual_root) { 558 if (!ctx.cfg.virtual_root) {
559 url = fmt("%s/%s", ctx.qry.repo, page); 559 url = fmt("%s/%s", ctx.qry.repo, page);
560 if (ctx.qry.path) 560 if (ctx.qry.path)
561 url = fmt("%s/%s", url, ctx.qry.path); 561 url = fmt("%s/%s", url, ctx.qry.path);
562 html_hidden("url", url); 562 html_hidden("url", url);
563 } 563 }
564 564
565 if (incl_head && ctx.qry.head && ctx.repo->defbranch && 565 if (incl_head && ctx.qry.head && ctx.repo->defbranch &&
566 strcmp(ctx.qry.head, ctx.repo->defbranch)) 566 strcmp(ctx.qry.head, ctx.repo->defbranch))
567 html_hidden("h", ctx.qry.head); 567 html_hidden("h", ctx.qry.head);
568 568
569 if (ctx.qry.sha1) 569 if (ctx.qry.sha1)
570 html_hidden("id", ctx.qry.sha1); 570 html_hidden("id", ctx.qry.sha1);
571 if (ctx.qry.sha2) 571 if (ctx.qry.sha2)
572 html_hidden("id2", ctx.qry.sha2); 572 html_hidden("id2", ctx.qry.sha2);
573 573
574 if (incl_search) { 574 if (incl_search) {
575 if (ctx.qry.grep) 575 if (ctx.qry.grep)
576 html_hidden("qt", ctx.qry.grep); 576 html_hidden("qt", ctx.qry.grep);
577 if (ctx.qry.search) 577 if (ctx.qry.search)
578 html_hidden("q", ctx.qry.search); 578 html_hidden("q", ctx.qry.search);
579 } 579 }
580} 580}
581 581
582char *hc(struct cgit_cmd *cmd, const char *page) 582char *hc(struct cgit_cmd *cmd, const char *page)
583{ 583{
584 return (strcmp(cmd->name, page) ? NULL : "active"); 584 return (strcmp(cmd->name, page) ? NULL : "active");
585} 585}
586 586
587void cgit_print_pageheader(struct cgit_context *ctx) 587void cgit_print_pageheader(struct cgit_context *ctx)
588{ 588{
589 struct cgit_cmd *cmd = cgit_get_cmd(ctx); 589 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
590 590
591 html("<table id='header'>\n"); 591 html("<table id='header'>\n");
592 html("<tr>\n"); 592 html("<tr>\n");
593 html("<td class='logo' rowspan='2'><a href='"); 593 html("<td class='logo' rowspan='2'><a href='");
594 if (ctx->cfg.logo_link) 594 if (ctx->cfg.logo_link)
595 html_attr(ctx->cfg.logo_link); 595 html_attr(ctx->cfg.logo_link);
596 else 596 else
597 html_attr(cgit_rooturl()); 597 html_attr(cgit_rooturl());
598 html("'><img src='"); 598 html("'><img src='");
599 html_attr(ctx->cfg.logo); 599 html_attr(ctx->cfg.logo);
600 html("' alt='cgit logo'/></a></td>\n"); 600 html("' alt='cgit logo'/></a></td>\n");
601 601
602 html("<td class='main'>"); 602 html("<td class='main'>");
603 if (ctx->repo) { 603 if (ctx->repo) {
604 cgit_index_link("index", NULL, NULL, NULL, 0); 604 cgit_index_link("index", NULL, NULL, NULL, 0);
605 html(" : "); 605 html(" : ");
606 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL); 606 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL);
607 html("</td><td class='form'>"); 607 html("</td><td class='form'>");
608 html("<form method='get' action=''>\n"); 608 html("<form method='get' action=''>\n");
609 add_hidden_formfields(0, 1, ctx->qry.page); 609 add_hidden_formfields(0, 1, ctx->qry.page);
610 html("<select name='h' onchange='this.form.submit();'>\n"); 610 html("<select name='h' onchange='this.form.submit();'>\n");
611 for_each_branch_ref(print_branch_option, ctx->qry.head); 611 for_each_branch_ref(print_branch_option, ctx->qry.head);
612 html("</select> "); 612 html("</select> ");
613 html("<input type='submit' name='' value='switch'/>"); 613 html("<input type='submit' name='' value='switch'/>");
614 html("</form>"); 614 html("</form>");
615 } else 615 } else
616 html_txt(ctx->cfg.root_title); 616 html_txt(ctx->cfg.root_title);
617 html("</td></tr>\n"); 617 html("</td></tr>\n");
618 618
619 html("<tr><td class='sub'>"); 619 html("<tr><td class='sub'>");
620 if (ctx->repo) { 620 if (ctx->repo) {
621 html_txt(ctx->repo->desc); 621 html_txt(ctx->repo->desc);
622 html("</td><td class='sub right'>"); 622 html("</td><td class='sub right'>");
623 html_txt(ctx->repo->owner); 623 html_txt(ctx->repo->owner);
624 } else { 624 } else {
625 if (ctx->cfg.root_desc) 625 if (ctx->cfg.root_desc)
626 html_txt(ctx->cfg.root_desc); 626 html_txt(ctx->cfg.root_desc);
627 else if (ctx->cfg.index_info) 627 else if (ctx->cfg.index_info)
628 html_include(ctx->cfg.index_info); 628 html_include(ctx->cfg.index_info);
629 } 629 }
630 html("</td></tr></table>\n"); 630 html("</td></tr></table>\n");
631 631
632 html("<table class='tabs'><tr><td>\n"); 632 html("<table class='tabs'><tr><td>\n");
633 if (ctx->repo) { 633 if (ctx->repo) {
634 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, 634 cgit_summary_link("summary", NULL, NULL, ctx->qry.head);
635 ctx->qry.head);
636 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 635 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
637 ctx->qry.sha1, NULL); 636 ctx->qry.sha1, NULL);
638 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 637 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
639 NULL, NULL, 0, NULL, NULL); 638 NULL, NULL, 0, NULL, NULL);
640 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 639 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
641 ctx->qry.sha1, NULL); 640 ctx->qry.sha1, NULL);
642 cgit_commit_link("commit", NULL, hc(cmd, "commit"), 641 cgit_commit_link("commit", NULL, hc(cmd, "commit"),
643 ctx->qry.head, ctx->qry.sha1); 642 ctx->qry.head, ctx->qry.sha1);
644 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, 643 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
645 ctx->qry.sha1, ctx->qry.sha2, NULL); 644 ctx->qry.sha1, ctx->qry.sha2, NULL);
646 if (ctx->repo->readme) 645 if (ctx->repo->readme)
647 reporevlink("about", "about", NULL, 646 reporevlink("about", "about", NULL,
648 hc(cmd, "about"), ctx->qry.head, NULL, 647 hc(cmd, "about"), ctx->qry.head, NULL,
649 NULL); 648 NULL);
650 html("</td><td class='form'>"); 649 html("</td><td class='form'>");
651 html("<form class='right' method='get' action='"); 650 html("<form class='right' method='get' action='");
652 if (ctx->cfg.virtual_root) 651 if (ctx->cfg.virtual_root)
653 html_attr(cgit_fileurl(ctx->qry.repo, "log", 652 html_attr(cgit_fileurl(ctx->qry.repo, "log",
654 ctx->qry.path, NULL)); 653 ctx->qry.path, NULL));
655 html("'>\n"); 654 html("'>\n");
656 add_hidden_formfields(1, 0, "log"); 655 add_hidden_formfields(1, 0, "log");
657 html("<select name='qt'>\n"); 656 html("<select name='qt'>\n");
658 html_option("grep", "log msg", ctx->qry.grep); 657 html_option("grep", "log msg", ctx->qry.grep);
659 html_option("author", "author", ctx->qry.grep); 658 html_option("author", "author", ctx->qry.grep);
660 html_option("committer", "committer", ctx->qry.grep); 659 html_option("committer", "committer", ctx->qry.grep);
661 html("</select>\n"); 660 html("</select>\n");
662 html("<input class='txt' type='text' size='10' name='q' value='"); 661 html("<input class='txt' type='text' size='10' name='q' value='");
663 html_attr(ctx->qry.search); 662 html_attr(ctx->qry.search);
664 html("'/>\n"); 663 html("'/>\n");
665 html("<input type='submit' value='search'/>\n"); 664 html("<input type='submit' value='search'/>\n");
666 html("</form>\n"); 665 html("</form>\n");
667 } else { 666 } else {
668 site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0); 667 site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0);
669 if (ctx->cfg.root_readme) 668 if (ctx->cfg.root_readme)
670 site_link("about", "about", NULL, hc(cmd, "about"), 669 site_link("about", "about", NULL, hc(cmd, "about"),
671 NULL, 0); 670 NULL, 0);
672 html("</td><td class='form'>"); 671 html("</td><td class='form'>");
673 html("<form method='get' action='"); 672 html("<form method='get' action='");
674 html_attr(cgit_rooturl()); 673 html_attr(cgit_rooturl());
675 html("'>\n"); 674 html("'>\n");
676 html("<input type='text' name='q' size='10' value='"); 675 html("<input type='text' name='q' size='10' value='");
677 html_attr(ctx->qry.search); 676 html_attr(ctx->qry.search);
678 html("'/>\n"); 677 html("'/>\n");
679 html("<input type='submit' value='search'/>\n"); 678 html("<input type='submit' value='search'/>\n");
680 html("</form>"); 679 html("</form>");
681 } 680 }
682 html("</td></tr></table>\n"); 681 html("</td></tr></table>\n");
683 html("<div class='content'>"); 682 html("<div class='content'>");
684} 683}
685 684
686void cgit_print_filemode(unsigned short mode) 685void cgit_print_filemode(unsigned short mode)
687{ 686{
688 if (S_ISDIR(mode)) 687 if (S_ISDIR(mode))
689 html("d"); 688 html("d");
690 else if (S_ISLNK(mode)) 689 else if (S_ISLNK(mode))
691 html("l"); 690 html("l");
692 else if (S_ISGITLINK(mode)) 691 else if (S_ISGITLINK(mode))
693 html("m"); 692 html("m");
694 else 693 else
695 html("-"); 694 html("-");
696 html_fileperm(mode >> 6); 695 html_fileperm(mode >> 6);
697 html_fileperm(mode >> 3); 696 html_fileperm(mode >> 3);
698 html_fileperm(mode); 697 html_fileperm(mode);
699} 698}
700 699
701void cgit_print_snapshot_links(const char *repo, const char *head, 700void cgit_print_snapshot_links(const char *repo, const char *head,
702 const char *hex, int snapshots) 701 const char *hex, int snapshots)
703{ 702{
704 const struct cgit_snapshot_format* f; 703 const struct cgit_snapshot_format* f;
705 char *filename; 704 char *filename;
706 705
707 for (f = cgit_snapshot_formats; f->suffix; f++) { 706 for (f = cgit_snapshot_formats; f->suffix; f++) {
708 if (!(snapshots & f->bit)) 707 if (!(snapshots & f->bit))
709 continue; 708 continue;
710 filename = fmt("%s-%s%s", cgit_repobasename(repo), hex, 709 filename = fmt("%s-%s%s", cgit_repobasename(repo), hex,
711 f->suffix); 710 f->suffix);
712 cgit_snapshot_link(filename, NULL, NULL, (char *)head, 711 cgit_snapshot_link(filename, NULL, NULL, (char *)head,
713 (char *)hex, filename); 712 (char *)hex, filename);
714 html("<br/>"); 713 html("<br/>");
715 } 714 }
716} 715}