From 58fcffcc0813233a1f3ed798bf8a4ff83cfb89fb Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Sat, 28 Jul 2018 17:02:07 +0100 Subject: log added (still incomplete) --- cgit_70.mk | 3 ++- ui_70-log.c | 55 +++++++++++++++++++++++++------------------------------ ui_70-refs.c | 3 --- ui_70-shared.c | 28 +++++++++++++++++----------- 4 files changed, 44 insertions(+), 45 deletions(-) diff --git a/cgit_70.mk b/cgit_70.mk index ab4a3ae..551ae7f 100644 --- a/cgit_70.mk +++ b/cgit_70.mk @@ -85,7 +85,8 @@ CGIT_OBJ_NAMES += ui-blob.o CGIT_OBJ_NAMES += ui-clone.o CGIT_OBJ_NAMES += ui-commit.o CGIT_OBJ_NAMES += ui-diff.o -CGIT_OBJ_NAMES += ui-log.o +##CGIT_OBJ_NAMES += ui-log.o +CGIT_OBJ_NAMES += ui_70-log.o CGIT_OBJ_NAMES += ui-patch.o CGIT_OBJ_NAMES += ui-plain.o ##CGIT_OBJ_NAMES += ui-refs.o diff --git a/ui_70-log.c b/ui_70-log.c index d696e20..598634d 100644 --- a/ui_70-log.c +++ b/ui_70-log.c @@ -9,7 +9,7 @@ #include "cgit.h" #include "ui-log.h" #include "html.h" -#include "ui-shared.h" +#include "ui_70-shared.h" #include "argv-array.h" static int files, add_lines, rem_lines, lines_counted; @@ -196,22 +196,18 @@ static void print_commit(struct commit *commit, struct rev_info *revs) } info = cgit_parse_commit(commit); - htmlf("", ctx.qry.showmsg ? " class='logheader'" : ""); + + cgit_gopher_start_selector(GOPHER_MENU); if (revs->graph) { /* Print graph segment for current commit */ - html(""); - html(graphbuf.buf); - html(""); + cgit_gopher_text(graphbuf.buf); strbuf_setlen(&graphbuf, 0); } else { - html(""); cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); - html(""); } - htmlf("", ctx.qry.showmsg ? " class='logsubject'" : ""); if (ctx.qry.showmsg) { /* line-wrap long commit subjects instead of truncating them */ size_t subject_len = strlen(info->subject); @@ -237,13 +233,13 @@ static void print_commit(struct commit *commit, struct rev_info *revs) strcpy(info->subject + i, wrap_symbol); } } + cgit_gopher_text_pad(info->subject, GOPHER_SUMMARY_DESC_LEN + 1); + cgit_gopher_text_pad(info->author, GOPHER_SUMMARY_NAME_LEN); + cgit_gopher_tab(); cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); - show_commit_decorations(commit); - html(""); - cgit_open_filter(ctx.repo->email_filter, info->author_email, "log"); - html_txt(info->author); - cgit_close_filter(ctx.repo->email_filter); + + cgit_gopher_end_selector(); if (revs->graph) { html(""); @@ -258,13 +254,12 @@ static void print_commit(struct commit *commit, struct rev_info *revs) cgit_diff_commit(commit, inspect_files, ctx.qry.vpath); } - if (ctx.repo->enable_log_filecount) +/* if (ctx.repo->enable_log_filecount) htmlf("%d", files); if (ctx.repo->enable_log_linecount) htmlf("-%d/" "+%d", rem_lines, add_lines); - - html("\n"); +*/ if ((revs->graph && !graph_is_commit_finished(revs->graph)) || ctx.qry.showmsg) { /* Print a second table row */ @@ -451,16 +446,16 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern if (pager) { cgit_print_layout_start(); - html(""); + /*html("
");*/ } - html(""); + cgit_gopher_start_selector(GOPHER_INFO); if (commit_graph) - html(""); + cgit_gopher_text_pad("", GOPHER_SUMMARY_DATE_LEN); else - html(""); - html(""); + }*/ + cgit_gopher_text_pad("Author", GOPHER_SUMMARY_NAME_LEN); if (rev.graph) - html(""); + cgit_gopher_text_pad("Age", GOPHER_SUMMARY_AGE_LEN); if (ctx.repo->enable_log_filecount) { - html(""); + cgit_gopher_text_pad("Files", GOPHER_SUMMARY_MODE_LEN); columns++; } if (ctx.repo->enable_log_linecount) { - html(""); + cgit_gopher_text_pad("Lines", GOPHER_SUMMARY_MODE_LEN); columns++; } - html("\n"); + cgit_gopher_tab(); + cgit_gopher_selector_link("Err"); + cgit_gopher_end_selector(); if (ofs<0) ofs = 0; @@ -515,7 +512,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern commit->parents = NULL; } if (pager) { - html("
AgeCommit message"); - if (pager) { + cgit_gopher_text_pad("Age", GOPHER_SUMMARY_DATE_LEN); + cgit_gopher_text_pad("Commit message", GOPHER_SUMMARY_DESC_LEN); + /*if (pager) { html(" ("); cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL, NULL, ctx.qry.head, ctx.qry.sha1, @@ -468,19 +463,21 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern ctx.qry.search, ctx.qry.showmsg ? 0 : 1, ctx.qry.follow); html(")"); - } - html("AuthorAgeFilesLines
    "); if (ofs > 0) { html("
  • "); cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, @@ -534,7 +530,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern ctx.qry.follow); html("
  • "); } - html("
"); cgit_print_layout_end(); } else if ((commit = get_revision(&rev)) != NULL) { htmlf("", columns); diff --git a/ui_70-refs.c b/ui_70-refs.c index 6b7c900..8bf65af 100644 --- a/ui_70-refs.c +++ b/ui_70-refs.c @@ -208,7 +208,6 @@ void cgit_print_tags(int maxcount) void cgit_print_refs(void) { cgit_print_layout_start(); - html(""); if (ctx.qry.path && starts_with(ctx.qry.path, "heads")) cgit_print_branches(0); @@ -216,9 +215,7 @@ void cgit_print_refs(void) cgit_print_tags(0); else { cgit_print_branches(0); - html(""); cgit_print_tags(0); } - html("
 
"); cgit_print_layout_end(); } diff --git a/ui_70-shared.c b/ui_70-shared.c index b5a6fa8..a0a9139 100644 --- a/ui_70-shared.c +++ b/ui_70-shared.c @@ -483,10 +483,18 @@ void cgit_summary_link(const char *name, const char *title, const char *class, const char *head) { + reporevlink(NULL, name, title, class, head, NULL, NULL); +} + + +void cgit_gopher_summary_link(const char *name, const char *title, const char *class, + const char *head) +{ + cgit_gopher_start_selector(GOPHER_MENU); cgit_gopher_text(name); cgit_gopher_tab(); - reporevlink(NULL, name, title, class, head, NULL, NULL); + cgit_summary_link(name, title, class, head); cgit_gopher_end_selector(); } @@ -613,11 +621,11 @@ void cgit_commit_link(const char *name, const char *title, const char *class, cgit_gopher_text(delim); cgit_gopher_text("follow=1"); } - if (name[0] != '\0') { +/* if (name[0] != '\0') { cgit_gopher_text(name); } else cgit_gopher_text("(no commit message)"); - cgit_gopher_tab(); +*/ cgit_gopher_tab(); } @@ -886,7 +894,7 @@ void cgit_print_age(time_t t, int tz, time_t max_relative) if (!t) return; - cgit_gopher_text_pad(show_date(t, tz, cgit_date_mode(DATE_ISO8601)), GOPHER_SUMMARY_DATE_LEN); + cgit_gopher_text_pad(show_date(t, tz, cgit_date_mode(DATE_ISO8601)), GOPHER_SUMMARY_DATE_LEN + 1); return; } @@ -1141,7 +1149,7 @@ static void print_header(void) { if (ctx.repo) { cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1); - cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); + cgit_gopher_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); } else cgit_gopher_info(ctx.cfg.root_title); if (ctx.repo) { @@ -1164,7 +1172,7 @@ void cgit_print_pageheader(void) reporevlink("about", "about", NULL, hc("about"), ctx.qry.head, NULL, NULL); - cgit_summary_link("summary", NULL, hc("summary"), + cgit_gopher_summary_link("summary", NULL, hc("summary"), ctx.qry.head); cgit_gopher_refs_link("refs", NULL, hc("refs"), ctx.qry.head, ctx.qry.sha1, NULL); @@ -1185,11 +1193,9 @@ void cgit_print_pageheader(void) cgit_stats_link("stats", NULL, hc("stats"), ctx.qry.head, ctx.qry.vpath); if (ctx.repo->homepage) { - html("homepage"); + /* cgit_gopher_menu("homepage", * ctx.repo->homepage);*/ } - } else { + } /*else { char *currenturl = cgit_currenturl(); site_link(NULL, "index", NULL, hc("repolist"), NULL, NULL, 0, 1); if (ctx.cfg.root_readme) @@ -1219,7 +1225,7 @@ void cgit_print_pageheader(void) html(")"); } html(""); - } + }*/ } void cgit_print_filemode(unsigned short mode) -- cgit v1.2.3