commit 9f07f181ad2f2922cfde2b1e32b246e040c7f0fb
parent 8c46a0669466da45a19e109b1d89b92353aa5ecd
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Sat, 23 Mar 2024 18:48:42 -0700
Replace unrelated forms, etc. with a menu
Diffstat:
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/pages/main.c b/pages/main.c
@@ -17,6 +17,7 @@
#include "common.h"
#include "pages.h"
+#include "../menu.h"
#include "../times.h"
#include "../util.h"
@@ -336,6 +337,12 @@ pagemain(struct pagedata *pd)
int current;
char heading[64];
int h1len;
+ struct menuitem menuitems[] = {
+ { MenuFunc, { .func = breakform } },
+ { MenuFunc, { .func = exportform } },
+ { MenuURL, { .url = pd->pages[PageArchive] } }
+ };
+ int menuoffset;
if (!pd->user)
return errorpage(pd, KHTTP_401);
@@ -381,11 +388,14 @@ pagemain(struct pagedata *pd)
if (h1len < 0 || (unsigned int)h1len >= sizeof(heading))
return KCGI_SYSTEM;
+ /*(status = htmllink(pd, pd->pages[PageArchive], "Archive")) != KCGI_OK ||*/
+ /* (current && (status = breakform(pd))) != KCGI_OK || */
+
+ menuoffset = current ? 0 : 1;
+
if ((status = htmlwithin(pd, KELEM_H1, heading)) != KCGI_OK ||
- (status = htmllink(pd, pd->pages[PageArchive], "Archive")) != KCGI_OK ||
- (status = exportform(pd)) != KCGI_OK ||
- (current && (status = breakform(pd))) != KCGI_OK ||
- (status = printtimes(pd, times)) != KCGI_OK) {
+ (status = printtimes(pd, times)) != KCGI_OK ||
+ (status = htmlmenu(pd, menuitems + menuoffset, Len(menuitems) - menuoffset)) != KCGI_OK) {
freetimesheet(times);
return status;
}