-/*
- * print menu box like used in the floor view or admin interface.
- * This function takes pair of strings as va_args,
- * Title Title string of the box
- * Class CSS Class for the box
- * nLines How many string pairs should we print? (URL, UrlText)
- * ... Pairs of URL Strings and their Names
- */
-void print_menu_box(char* Title, char *Class, int nLines, ...)
-{
- va_list arg_list;
- long i;
-
- svput("BOXTITLE", WCS_STRING, Title);
- do_template("beginboxx", NULL);
-
- wprintf("<ul class=\"%s\">", Class);
-
- va_start(arg_list, nLines);
- for (i = 0; i < nLines; ++i)
- {
- wprintf("<li><a href=\"%s\">", va_arg(arg_list, char *));
- wprintf((char *) va_arg(arg_list, char *));
- wprintf("</a></li>\n");
- }
- va_end (arg_list);
-
- wprintf("</a></li>\n");
-
- wprintf("</ul>");
-
- do_template("endbox", NULL);
-}
-
-
-/*
- * dump out static pages from disk
- */
-void output_static(const char *what)
-{
- int fd;
- struct stat statbuf;
- off_t bytes;
- off_t count = 0;
- const char *content_type;
- int len;
- const char *Err;
-
- fd = open(what, O_RDONLY);
- if (fd <= 0) {
- lprintf(9, "output_static('%s') -- NOT FOUND --\n", what);
- hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
- hprintf("Content-Type: text/plain\r\n");
- wprintf("Cannot open %s: %s\r\n", what, strerror(errno));
- end_burst();
- } else {
- len = strlen (what);
- content_type = GuessMimeByFilename(what, len);
-
- if (fstat(fd, &statbuf) == -1) {
- lprintf(9, "output_static('%s') -- FSTAT FAILED --\n", what);
- hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
- hprintf("Content-Type: text/plain\r\n");
- wprintf("Cannot fstat %s: %s\n", what, strerror(errno));
- end_burst();
- return;
- }
-
- count = 0;
- bytes = statbuf.st_size;
-
- if (StrBufReadBLOB(WC->WBuf, &fd, 1, bytes, &Err) < 0)
- {
- if (fd > 0) close(fd);
- lprintf(9, "output_static('%s') -- FREAD FAILED (%s) --\n", what, strerror(errno));
- hprintf("HTTP/1.1 500 internal server error \r\n");
- hprintf("Content-Type: text/plain\r\n");
- end_burst();
- return;
- }
-
-
- close(fd);
-#ifndef TECH_PREVIEW
- lprintf(9, "output_static('%s') %s\n", what, content_type);
-#endif
- http_transmit_thing(content_type, 1);
- }
- if (yesbstr("force_close_session")) {
- end_webcit_session();
- }
-}
-