From 8a86f7520848e71eb7105210102a6a53633d0f20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Mon, 18 Feb 2008 20:58:43 +0000 Subject: [PATCH] * add picture view to the files app --- webcit/downloads.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ webcit/webcit.c | 2 ++ webcit/webcit.h | 1 + 3 files changed, 75 insertions(+) diff --git a/webcit/downloads.c b/webcit/downloads.c index f97b1b4fd..6571591cc 100644 --- a/webcit/downloads.c +++ b/webcit/downloads.c @@ -2,6 +2,7 @@ * $Id$ */ #include "webcit.h" +#include "webserver.h" void display_room_directory(void) { @@ -12,6 +13,7 @@ void display_room_directory(void) char comment[512]; int bg = 0; char title[256]; + int havepics = 0; output_headers(1, 1, 2, 0, 0, 0); wprintf("
\n"); @@ -51,6 +53,8 @@ void display_room_directory(void) wprintf(""); escputs(mimetype); wprintf(""); wprintf(""); escputs(comment); wprintf(""); wprintf("\n"); + if (!havepics && (strstr(mimetype, "image") != NULL)) + havepics = 1; } wprintf("\n"); @@ -78,9 +82,77 @@ void display_room_directory(void) } wprintf("
\n"); + if (havepics) + wprintf("
%s
", _("Slideshow")); wDumpContent(1); } + +void display_pictureview(void) +{ + char buf[1024]; + char filename[256]; + char filesize[256]; + char mimetype[64]; + char comment[512]; + char title[256]; + int n = 0; + + + if (atol(bstr("frame")) == 1) { + + output_headers(1, 1, 2, 0, 0, 0); + wprintf("
\n"); + wprintf("

"); + snprintf(title, sizeof title, _("Pictures in %s"), WC->wc_roomname); + escputs(title); + wprintf("

"); + wprintf("
\n"); + + wprintf("
\n"); + + wprintf("
" + "
\n"); + + + + wprintf("\n"); + wprintf("
\n"); + wprintf("\n"); + wprintf("\n"); + } + wDumpContent(1); + + +} + extern char* static_dirs[]; void display_mime_icon(void) { diff --git a/webcit/webcit.c b/webcit/webcit.c index 29463d6c9..4c5fb8940 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1864,6 +1864,8 @@ void session_loop(struct httprequest *req) updatenote(); } else if (!strcasecmp(action, "display_room_directory")) { display_room_directory(); + } else if (!strcasecmp(action, "display_pictureview")) { + display_pictureview(); } else if (!strcasecmp(action, "download_file")) { download_file(index[1]); } else if (!strcasecmp(action, "upload_file")) { diff --git a/webcit/webcit.h b/webcit/webcit.h index 7a430001e..327f76850 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -689,6 +689,7 @@ void initialize_axdefs(void); void burn_folder_cache(time_t age); void list_all_rooms_by_floor(char *viewpref); void display_room_directory(void); +void display_picture(void); void download_file(char *); void upload_file(void); -- 2.30.2