summaryrefslogtreecommitdiff
path: root/browse.c
diff options
context:
space:
mode:
Diffstat (limited to 'browse.c')
-rw-r--r--browse.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/browse.c b/browse.c
index be72e34..5bda651 100644
--- a/browse.c
+++ b/browse.c
@@ -197,7 +197,8 @@ header_template_callback(size_t index, void *arg)
return 1;
}
-static const char *const file_template_keys[] = {"icon", "name", "url", "size"};
+static const char *const file_template_keys[] = {"icon", "name", "url", "size",
+"delete_url"};
static int
file_template_callback(size_t index, void *arg)
@@ -253,6 +254,16 @@ file_template_callback(size_t index, void *arg)
size_read[i - 1]), r);
}
break;
+ case 4:
+ /* delete url */
+ if (build_delete_url(r, data->f) == 0) {
+ kutil_warnx(r, NULL,
+ "unable to build delete url for file %s",
+ data->f->path);
+ break;
+ }
+ K_OK(khtml_puts(html, data->f->action_url), r);
+ break;
default:
kutil_warnx(r, NULL,
"Invalid key index for browse file template: %zd",
@@ -352,7 +363,7 @@ browse(struct kreq * r)
/* print file list */
template.key = file_template_keys;
- template.keysz = 4;
+ template.keysz = 5;
template.cb = file_template_callback;
SLIST_FOREACH(file, &list, files) {