]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-shared.c
Add support for cloning over http
[ps-cgit] / ui-shared.c
index 6f83d2a772208c794eee360da531ae73d9913acb..197ee37409b7497d27c1ea766ebd6d4405d843bc 100644 (file)
@@ -353,14 +353,17 @@ void cgit_object_link(struct object *obj)
        html_link_close();
 }
 
        html_link_close();
 }
 
-void cgit_print_date(time_t secs, char *format)
+void cgit_print_date(time_t secs, char *format, int local_time)
 {
        char buf[64];
        struct tm *time;
 
        if (!secs)
                return;
 {
        char buf[64];
        struct tm *time;
 
        if (!secs)
                return;
-       time = gmtime(&secs);
+       if(local_time)
+               time = localtime(&secs);
+       else
+               time = gmtime(&secs);
        strftime(buf, sizeof(buf)-1, format, time);
        html_txt(buf);
 }
        strftime(buf, sizeof(buf)-1, format, time);
        html_txt(buf);
 }
@@ -375,7 +378,7 @@ void cgit_print_age(time_t t, time_t max_relative, char *format)
        secs = now - t;
 
        if (secs > max_relative && max_relative >= 0) {
        secs = now - t;
 
        if (secs > max_relative && max_relative >= 0) {
-               cgit_print_date(t, format);
+               cgit_print_date(t, format, ctx.cfg.local_time);
                return;
        }
 
                return;
        }
 
@@ -453,7 +456,7 @@ void cgit_print_docend()
                html_include(ctx.cfg.footer);
        else {
                html("<div class='footer'>generated ");
                html_include(ctx.cfg.footer);
        else {
                html("<div class='footer'>generated ");
-               cgit_print_date(time(NULL), FMT_LONGDATE);
+               cgit_print_date(time(NULL), FMT_LONGDATE, ctx.cfg.local_time);
                htmlf(" by cgit %s", cgit_version);
                html("</div>\n");
        }
                htmlf(" by cgit %s", cgit_version);
                html("</div>\n");
        }
@@ -518,7 +521,8 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
                html_hidden("url", url);
        }
 
                html_hidden("url", url);
        }
 
-       if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch))
+       if (incl_head && ctx.qry.head && ctx.repo->defbranch &&
+           strcmp(ctx.qry.head, ctx.repo->defbranch))
                html_hidden("h", ctx.qry.head);
 
        if (ctx.qry.sha1)
                html_hidden("h", ctx.qry.head);
 
        if (ctx.qry.sha1)
@@ -572,12 +576,12 @@ void cgit_print_pageheader(struct cgit_context *ctx)
                html_txt(ctx->cfg.root_title);
        html("</td></tr>\n");
 
                html_txt(ctx->cfg.root_title);
        html("</td></tr>\n");
 
-       html("<tr><td class='sub'");
+       html("<tr><td class='sub'>");
        if (ctx->repo) {
        if (ctx->repo) {
-               html(" colspan='2'>");
                html_txt(ctx->repo->desc);
                html_txt(ctx->repo->desc);
+               html("</td><td class='sub right'>");
+               html_txt(ctx->repo->owner);
        } else {
        } else {
-               html(">");
                if (ctx->cfg.root_desc)
                        html_txt(ctx->cfg.root_desc);
                else if (ctx->cfg.index_info)
                if (ctx->cfg.root_desc)
                        html_txt(ctx->cfg.root_desc);
                else if (ctx->cfg.index_info)