timekeeper

[Abandoned unfinished] CGI web application in C for time tracking. (My first, just a learning project)
Log | Files | Refs | README

commit d07ad36b9d19f21c552bd02c4d0395812242f548
parent d53c210ecbb69f6e6fb6b2a389ada9c2dee3cb88
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Sat, 23 Mar 2024 20:37:58 -0700

Update index page

Add some error handling and a synopsis. Also remove the "Welcome
user" bit which was from earlier on when playing around with the
user system.

Diffstat:
Afrags/synopsis | 2++
Mpages/index.c | 12+++++++-----
2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/frags/synopsis b/frags/synopsis @@ -0,0 +1,2 @@ +<p>The timekeeper system is a tool to keep track of time spent on +the job.</p> diff --git a/pages/index.c b/pages/index.c @@ -1,12 +1,12 @@ #include "common.h" - #include "pages.h" +#include "../frag.h" enum kcgi_err pageindex(struct pagedata *pd) { static char *css[] = { "css/main.css", NULL }; - struct pagetemplate template = { + static struct pagetemplate template = { "Timekeeper", .css = css }; @@ -16,9 +16,11 @@ pageindex(struct pagedata *pd) if ((status = tk_startpage(pd, &template, KHTTP_200)) != KCGI_OK) return status; - khtml_elem(&pd->html, KELEM_H1); - khtml_printf(&pd->html, "Welcome %s!", pd->user ? pd->user->name : "friend"); - khtml_closeelem(&pd->html, 1); + if ((status = htmlwithin(pd, KELEM_H1, "Timekeeper Project")) != KCGI_OK) + return status; + + if (frag(pd, "synopsis")) + return KCGI_SYSTEM; if ((status = htmllink(pd, pd->user ? "/logout" : "/login", pd->user ? "Logout" : "Login")) != KCGI_OK)