-rw-r--r-- | ui-shared.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/ui-shared.c b/ui-shared.c index 2f771da..4c0613a 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -448,30 +448,32 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) | |||
448 | if (cgit_query_grep) | 448 | if (cgit_query_grep) |
449 | html_hidden("qt", cgit_query_grep); | 449 | html_hidden("qt", cgit_query_grep); |
450 | if (cgit_query_search) | 450 | if (cgit_query_search) |
451 | html_hidden("q", cgit_query_search); | 451 | html_hidden("q", cgit_query_search); |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
455 | void cgit_print_pageheader(char *title, int show_search) | 455 | void cgit_print_pageheader(char *title, int show_search) |
456 | { | 456 | { |
457 | static const char *default_info = "This is cgit, a fast webinterface for git repositories"; | 457 | static const char *default_info = "This is cgit, a fast webinterface for git repositories"; |
458 | int header = 0; | 458 | int header = 0; |
459 | 459 | ||
460 | html("<div id='sidebar'>\n"); | 460 | html("<table id='layout' summary=''>\n"); |
461 | html("<div id='logo'><a href='"); | 461 | html("<tr><td id='sidebar'>\n"); |
462 | html("<table class='sidebar' summary=''>\n"); | ||
463 | html("<tr><td class='sidebar'>\n<a href='"); | ||
462 | html_attr(cgit_rooturl()); | 464 | html_attr(cgit_rooturl()); |
463 | htmlf("'><img src='%s' alt='cgit'/></a></div>\n", | 465 | htmlf("'><img src='%s' alt='cgit'/></a>\n", |
464 | cgit_logo); | 466 | cgit_logo); |
465 | html("<div class='infobox'>"); | 467 | html("</td></tr>\n<tr><td class='sidebar'>\n"); |
466 | if (cgit_query_repo) { | 468 | if (cgit_query_repo) { |
467 | html("<h1 class='first'>"); | 469 | html("<h1 class='first'>"); |
468 | html_txt(strrpart(cgit_repo->name, 20)); | 470 | html_txt(strrpart(cgit_repo->name, 20)); |
469 | html("</h1>\n"); | 471 | html("</h1>\n"); |
470 | html_txt(cgit_repo->desc); | 472 | html_txt(cgit_repo->desc); |
471 | if (cgit_repo->owner) { | 473 | if (cgit_repo->owner) { |
472 | html("<h1>owner</h1>\n"); | 474 | html("<h1>owner</h1>\n"); |
473 | html_txt(cgit_repo->owner); | 475 | html_txt(cgit_repo->owner); |
474 | } | 476 | } |
475 | html("<h1>navigate</h1>\n"); | 477 | html("<h1>navigate</h1>\n"); |
476 | reporevlink(NULL, "summary", NULL, "menu", cgit_query_head, | 478 | reporevlink(NULL, "summary", NULL, "menu", cgit_query_head, |
477 | NULL, NULL); | 479 | NULL, NULL); |
@@ -480,57 +482,57 @@ void cgit_print_pageheader(char *title, int show_search) | |||
480 | cgit_tree_link("tree", NULL, "menu", cgit_query_head, | 482 | cgit_tree_link("tree", NULL, "menu", cgit_query_head, |
481 | cgit_query_sha1, NULL); | 483 | cgit_query_sha1, NULL); |
482 | cgit_commit_link("commit", NULL, "menu", cgit_query_head, | 484 | cgit_commit_link("commit", NULL, "menu", cgit_query_head, |
483 | cgit_query_sha1); | 485 | cgit_query_sha1); |
484 | cgit_diff_link("diff", NULL, "menu", cgit_query_head, | 486 | cgit_diff_link("diff", NULL, "menu", cgit_query_head, |
485 | cgit_query_sha1, cgit_query_sha2, NULL); | 487 | cgit_query_sha1, cgit_query_sha2, NULL); |
486 | 488 | ||
487 | for_each_ref(print_archive_ref, &header); | 489 | for_each_ref(print_archive_ref, &header); |
488 | 490 | ||
489 | html("<h1>branch</h1>\n"); | 491 | html("<h1>branch</h1>\n"); |
490 | html("<form method='get' action=''>\n"); | 492 | html("<form method='get' action=''>\n"); |
491 | add_hidden_formfields(0, 1, cgit_query_page); | 493 | add_hidden_formfields(0, 1, cgit_query_page); |
492 | html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>"); | 494 | // html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>"); |
493 | html("<select name='h' onchange='this.form.submit();'>\n"); | 495 | html("<select name='h' onchange='this.form.submit();'>\n"); |
494 | for_each_branch_ref(print_branch_option, cgit_query_head); | 496 | for_each_branch_ref(print_branch_option, cgit_query_head); |
495 | html("</select>\n"); | 497 | html("</select>\n"); |
496 | html("</td><td>"); | 498 | // html("</td><td>"); |
497 | html("<noscript><input type='submit' id='switch-btn' value='..'/></noscript>\n"); | 499 | html("<noscript><input type='submit' id='switch-btn' value='switch'/></noscript>\n"); |
498 | html("</td></tr></table>"); | 500 | // html("</td></tr></table>"); |
499 | html("</form>\n"); | 501 | html("</form>\n"); |
500 | 502 | ||
501 | html("<h1>search</h1>\n"); | 503 | html("<h1>search</h1>\n"); |
502 | html("<form method='get' action='"); | 504 | html("<form method='get' action='"); |
503 | if (cgit_virtual_root) | 505 | if (cgit_virtual_root) |
504 | html_attr(cgit_fileurl(cgit_query_repo, "log", | 506 | html_attr(cgit_fileurl(cgit_query_repo, "log", |
505 | cgit_query_path, NULL)); | 507 | cgit_query_path, NULL)); |
506 | html("'>\n"); | 508 | html("'>\n"); |
507 | add_hidden_formfields(1, 0, "log"); | 509 | add_hidden_formfields(1, 0, "log"); |
508 | html("<select name='qt'>\n"); | 510 | html("<select name='qt'>\n"); |
509 | html_option("grep", "log msg", cgit_query_grep); | 511 | html_option("grep", "log msg", cgit_query_grep); |
510 | html_option("author", "author", cgit_query_grep); | 512 | html_option("author", "author", cgit_query_grep); |
511 | html_option("committer", "committer", cgit_query_grep); | 513 | html_option("committer", "committer", cgit_query_grep); |
512 | html("</select>\n"); | 514 | html("</select>\n"); |
513 | html("<input class='txt' type='text' name='q' value='"); | 515 | html("<input class='txt' type='text' name='q' value='"); |
514 | html_attr(cgit_query_search); | 516 | html_attr(cgit_query_search); |
515 | html("'/>\n"); | 517 | html("'/>\n"); |
516 | html("</form>\n"); | 518 | html("</form>\n"); |
517 | } else { | 519 | } else { |
518 | if (!cgit_index_info || html_include(cgit_index_info)) | 520 | if (!cgit_index_info || html_include(cgit_index_info)) |
519 | html(default_info); | 521 | html(default_info); |
520 | } | 522 | } |
521 | 523 | ||
522 | html("</div>\n"); | 524 | html("</td></tr></table></td>\n"); |
523 | 525 | ||
524 | html("</div>\n<table summary='page content' class='grid'><tr><td id='content'>\n"); | 526 | html("<td id='content'>\n"); |
525 | } | 527 | } |
526 | 528 | ||
527 | 529 | ||
528 | void cgit_print_snapshot_start(const char *mimetype, const char *filename, | 530 | void cgit_print_snapshot_start(const char *mimetype, const char *filename, |
529 | struct cacheitem *item) | 531 | struct cacheitem *item) |
530 | { | 532 | { |
531 | htmlf("Content-Type: %s\n", mimetype); | 533 | htmlf("Content-Type: %s\n", mimetype); |
532 | htmlf("Content-Disposition: inline; filename=\"%s\"\n", filename); | 534 | htmlf("Content-Disposition: inline; filename=\"%s\"\n", filename); |
533 | htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime)); | 535 | htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime)); |
534 | htmlf("Expires: %s\n", http_date(item->st.st_mtime + | 536 | htmlf("Expires: %s\n", http_date(item->st.st_mtime + |
535 | ttl_seconds(item->ttl))); | 537 | ttl_seconds(item->ttl))); |
536 | html("\n"); | 538 | html("\n"); |