X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Fdownloads.c;h=6e6c9b981b5ebf0acf8bc46dc664fc9630956acd;hp=6571591cc15c835dcce5cea15d4293fa686c6959;hb=HEAD;hpb=8a86f7520848e71eb7105210102a6a53633d0f20
diff --git a/webcit/downloads.c b/webcit/downloads.c
index 6571591cc..9b7dde993 100644
--- a/webcit/downloads.c
+++ b/webcit/downloads.c
@@ -1,224 +1,343 @@
/*
- * $Id$
+ * Copyright (c) 1996-2012 by the citadel.org team
+ *
+ * This program is open source software. You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*/
+
#include "webcit.h"
-#include "webserver.h"
-void display_room_directory(void)
+
+CtxType CTX_FILELIST = CTX_NONE;
+
+extern void output_static(const char* What);
+
+extern char* static_dirs[];
+
+typedef struct _FileListStruct {
+ StrBuf *Filename;
+ long FileSize;
+ StrBuf *MimeType;
+ StrBuf *Comment;
+ int IsPic;
+ int Sequence;
+} FileListStruct;
+
+void FreeFiles(void *vFile)
{
- char buf[1024];
- char filename[256];
- char filesize[256];
- char mimetype[64];
- char comment[512];
- int bg = 0;
- char title[256];
- int havepics = 0;
-
- output_headers(1, 1, 2, 0, 0, 0);
- wprintf("
\n");
-
- wprintf("
\n");
- if (havepics)
- wprintf("
", _("Slideshow"));
- wDumpContent(1);
+int Conditional_FILE_ISPIC(StrBuf *Target, WCTemplputParams *TP)
+{
+ FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST);
+ return F->IsPic;
}
+/* -------------------------------------------------------------------------------- */
+int CompareFilelistByMime(const void *vFile1, const void *vFile2)
+{
+ FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
+ FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
-void display_pictureview(void)
+ if (File1->IsPic != File2->IsPic)
+ return File1->IsPic > File2->IsPic;
+ return strcasecmp(ChrPtr(File1->MimeType), ChrPtr(File2->MimeType));
+}
+int CompareFilelistByMimeRev(const void *vFile1, const void *vFile2)
{
- char buf[1024];
- char filename[256];
- char filesize[256];
- char mimetype[64];
- char comment[512];
- char title[256];
- int n = 0;
-
+ FileListStruct *File1 = (FileListStruct*) GetSearchPayload(vFile1);
+ FileListStruct *File2 = (FileListStruct*) GetSearchPayload(vFile2);
+ if (File1->IsPic != File2->IsPic)
+ return File1->IsPic < File2->IsPic;
+ return strcasecmp(ChrPtr(File2->MimeType), ChrPtr(File1->MimeType));
+}
+int GroupchangeFilelistByMime(const void *vFile1, const void *vFile2)
+{
+ FileListStruct *File1 = (FileListStruct*) vFile1;
+ FileListStruct *File2 = (FileListStruct*) vFile2;
+
+ if (File1->IsPic != File2->IsPic)
+ return File1->IsPic > File2->IsPic;
+ return strcasecmp(ChrPtr(File1->MimeType), ChrPtr(File2->MimeType)) != 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("