aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 4944dfd..3e13c86 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -356,18 +356,20 @@ void cgit_print_age(time_t t, time_t max_relative, char *format)
356 356
357void cgit_print_docstart(char *title, struct cacheitem *item) 357void cgit_print_docstart(char *title, struct cacheitem *item)
358{ 358{
359 html("Content-Type: text/html; charset=utf-8\n"); 359 html("Content-Type: text/html; charset=" PAGE_ENCODING "\n");
360 htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime)); 360 htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime));
361 htmlf("Expires: %s\n", http_date(item->st.st_mtime + 361 htmlf("Expires: %s\n", http_date(item->st.st_mtime +
362 ttl_seconds(item->ttl))); 362 ttl_seconds(item->ttl)));
363 html("\n"); 363 html("\n");
364 html(cgit_doctype); 364 html(cgit_doctype);
365 html("<html>\n"); 365 html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n");
366 html("<head>\n"); 366 html("<head>\n");
367 html("<title>"); 367 html("<title>");
368 html_txt(title); 368 html_txt(title);
369 html("</title>\n"); 369 html("</title>\n");
370 htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); 370 htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version);
371 if (cgit_robots && *cgit_robots)
372 htmlf("<meta name='robots' content='%s'/>\n", cgit_robots);
371 html("<link rel='stylesheet' type='text/css' href='"); 373 html("<link rel='stylesheet' type='text/css' href='");
372 html_attr(cgit_css); 374 html_attr(cgit_css);
373 html("'/>\n"); 375 html("'/>\n");
@@ -377,7 +379,7 @@ void cgit_print_docstart(char *title, struct cacheitem *item)
377 379
378void cgit_print_docend() 380void cgit_print_docend()
379{ 381{
380 html("</td>\n</tr>\n<table>\n</body>\n</html>\n"); 382 html("</td>\n</tr>\n</table>\n</body>\n</html>\n");
381} 383}
382 384
383int print_branch_option(const char *refname, const unsigned char *sha1, 385int print_branch_option(const char *refname, const unsigned char *sha1,
@@ -415,7 +417,7 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
415 hashcpy(fileid, sha1); 417 hashcpy(fileid, sha1);
416 } 418 }
417 if (!*header) { 419 if (!*header) {
418 html("<p><h1>download</h1>"); 420 html("<h1>download</h1>\n");
419 *header = 1; 421 *header = 1;
420 } 422 }
421 url = cgit_pageurl(cgit_query_repo, "blob", 423 url = cgit_pageurl(cgit_query_repo, "blob",
@@ -459,22 +461,24 @@ void cgit_print_pageheader(char *title, int show_search)
459 static const char *default_info = "This is cgit, a fast webinterface for git repositories"; 461 static const char *default_info = "This is cgit, a fast webinterface for git repositories";
460 int header = 0; 462 int header = 0;
461 463
462 html("<div id='sidebar'>\n"); 464 html("<table id='layout' summary=''>\n");
463 html("<a href='"); 465 html("<tr><td id='sidebar'>\n");
466 html("<table class='sidebar' cellspacing='0' summary=''>\n");
467 html("<tr><td class='sidebar'>\n<a href='");
464 html_attr(cgit_rooturl()); 468 html_attr(cgit_rooturl());
465 htmlf("'><div id='logo'><img src='%s' alt='cgit'/></div></a>\n", 469 htmlf("'><img src='%s' alt='cgit'/></a>\n",
466 cgit_logo); 470 cgit_logo);
467 html("<div class='infobox'>"); 471 html("</td></tr>\n<tr><td class='sidebar'>\n");
468 if (cgit_query_repo) { 472 if (cgit_query_repo) {
469 html("<h1>"); 473 html("<h1 class='first'>");
470 html_txt(strrpart(cgit_repo->name, 20)); 474 html_txt(strrpart(cgit_repo->name, 20));
471 html("</h1>\n"); 475 html("</h1>\n");
472 html_txt(cgit_repo->desc); 476 html_txt(cgit_repo->desc);
473 if (cgit_repo->owner) { 477 if (cgit_repo->owner) {
474 html("<p>\n<h1>owner</h1>\n"); 478 html("<h1>owner</h1>\n");
475 html_txt(cgit_repo->owner); 479 html_txt(cgit_repo->owner);
476 } 480 }
477 html("<p>\n<h1>navigate</h1>\n"); 481 html("<h1>navigate</h1>\n");
478 reporevlink(NULL, "summary", NULL, "menu", cgit_query_head, 482 reporevlink(NULL, "summary", NULL, "menu", cgit_query_head,
479 NULL, NULL); 483 NULL, NULL);
480 cgit_log_link("log", NULL, "menu", cgit_query_head, NULL, NULL, 484 cgit_log_link("log", NULL, "menu", cgit_query_head, NULL, NULL,
@@ -488,19 +492,19 @@ void cgit_print_pageheader(char *title, int show_search)
488 492
489 for_each_ref(print_archive_ref, &header); 493 for_each_ref(print_archive_ref, &header);
490 494
491 html("<p>\n<h1>branch</h1>\n"); 495 html("<h1>branch</h1>\n");
492 html("<form method='get' action=''>\n"); 496 html("<form method='get' action=''>\n");
493 add_hidden_formfields(0, 1, cgit_query_page); 497 add_hidden_formfields(0, 1, cgit_query_page);
494 html("<table class='grid'><tr><td id='branch-dropdown-cell'>"); 498// html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>");
495 html("<select name='h' onchange='this.form.submit();'>\n"); 499 html("<select name='h' onchange='this.form.submit();'>\n");
496 for_each_branch_ref(print_branch_option, cgit_query_head); 500 for_each_branch_ref(print_branch_option, cgit_query_head);
497 html("</select>\n"); 501 html("</select>\n");
498 html("</td><td>"); 502// html("</td><td>");
499 html("<noscript><input type='submit' id='switch-btn' value='..'></noscript>\n"); 503 html("<noscript><input type='submit' id='switch-btn' value='switch'/></noscript>\n");
500 html("</td></tr></table>"); 504// html("</td></tr></table>");
501 html("</form>\n"); 505 html("</form>\n");
502 506
503 html("<p>\n<h1>search</h1>\n"); 507 html("<h1>search</h1>\n");
504 html("<form method='get' action='"); 508 html("<form method='get' action='");
505 if (cgit_virtual_root) 509 if (cgit_virtual_root)
506 html_attr(cgit_fileurl(cgit_query_repo, "log", 510 html_attr(cgit_fileurl(cgit_query_repo, "log",
@@ -521,9 +525,9 @@ void cgit_print_pageheader(char *title, int show_search)
521 html(default_info); 525 html(default_info);
522 } 526 }
523 527
524 html("</div>\n"); 528 html("</td></tr></table></td>\n");
525 529
526 html("</div>\n<table class='grid'><tr><td id='content'>\n"); 530 html("<td id='content'>\n");
527} 531}
528 532
529 533