From 9a2a3aa12c8138e25c096b71b08232079a562b02 Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 13 Aug 2017 15:54:18 +1200 Subject: [PATCH] view individual page of logs --- Router.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Router.go b/Router.go index ff67938..7ed9a9e 100644 --- a/Router.go +++ b/Router.go @@ -105,8 +105,18 @@ func (this *ArchiveServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { arc.renderError(w, fmt.Sprintf("Unknown source '%s'", matches[1])) } - } else if this.rxViewPage.MatchString(r.URL.Path) { - arc.renderError(w, "Not implemented.") // FIXME + } else if matches := this.rxViewPage.FindStringSubmatch(r.URL.Path); len(matches) > 0 { + if ls := this.lookupSource(matches[1]); ls != nil { + arc.selectSource(ls, matches[1]) + y, _ := strconv.Atoi(matches[2]) + m, _ := strconv.Atoi(matches[3]) + arc.ym = YearMonth{Year: y, Month: time.Month(m)} // 1-based months + arc.page, _ = strconv.Atoi(matches[4]) + arc.renderView(w) + + } else { + arc.renderError(w, fmt.Sprintf("Unknown source '%s'", matches[1])) + } } else if this.rxSearch.MatchString(r.URL.Path) { arc.renderError(w, "Not implemented.") // FIXME