commit 88dbd3a3ff4dd6b39109bbb5ef49394fb995a0d9
parent 074e9c6c7b8abab17a0c9178b4031c31210183ed
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Mon, 11 Mar 2024 01:20:48 -0700
Add export function to main page
Add a form for utilizing the export page.
Diffstat:
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/pages/main.c b/pages/main.c
@@ -292,7 +292,22 @@ pagemain(struct pagedata *pd)
free(times);
return status;
}
-
free(times);
+
+ if ((status = htmlwithin(pd, KELEM_H2, "Export")) != KCGI_OK ||
+ (status = khtml_attr(&pd->html, KELEM_FORM,
+ KATTR_ACTION, pd->pages[PageExport], KATTR__MAX)) != KCGI_OK ||
+ (status = khtml_attr(&pd->html, KELEM_INPUT,
+ KATTR_TYPE, "checkbox",
+ KATTR_NAME, keys[KeyFormat].name,
+ KATTR_VALUE, ".epoch", KATTR__MAX)) != KCGI_OK ||
+ (status = khtml_puts(&pd->html, " Use UNIX epoch times")) != KCGI_OK ||
+ (status = khtml_elem(&pd->html, KELEM_BR)) != KCGI_OK ||
+ (status = khtml_attr(&pd->html, KELEM_INPUT,
+ KATTR_TYPE, "submit",
+ KATTR_VALUE, "Export", KATTR__MAX)) != KCGI_OK ||
+ (status = khtml_closeelem(&pd->html, 1)) != KCGI_OK)
+ return status;
+
return khtml_close(&pd->html);
}