X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Futils_cgi.c;h=97dfc7c60b9a9bdd6e8b588d7645fcd9a8ea63c4;hb=022298601cad5a59aba37fa205f6f5ae6a364956;hp=fb9a1fb17079562f125be874ef27bad8b33f3aef;hpb=b13fce25f7de6f9319fd609bb0fa262c974c1c98;p=collection4.git diff --git a/src/utils_cgi.c b/src/utils_cgi.c index fb9a1fb..97dfc7c 100644 --- a/src/utils_cgi.c +++ b/src/utils_cgi.c @@ -7,6 +7,9 @@ #include "utils_cgi.h" +#include +#include + struct parameter_s { char *key; @@ -355,4 +358,100 @@ char *html_escape (const char *string) /* {{{ */ return (strdup (buffer)); } /* }}} char *html_escape */ +int html_print_page (const char *title, /* {{{ */ + const page_callbacks_t *cb, void *user_data) +{ + char *title_html; + + printf ("Content-Type: text/html\n\n"); + + if (title == NULL) + title = "c4: collection4 graph interface"; + + title_html = html_escape (title); + + printf ("\n" + " \n" + " %s\n" + " \n" + " \n" + " \n" + " \n", + title_html); + + printf (" \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
"); + if (cb->top_left != NULL) + (*cb->top_left) (user_data); + printf (""); + if (cb->top_center != NULL) + (*cb->top_center) (user_data); + else + printf ("

%s

", title_html); + printf ("
"); + if (cb->top_right != NULL) + (*cb->top_right) (user_data); + printf ("
"); + if (cb->middle_left != NULL) + (*cb->middle_left) (user_data); + printf (""); + if (cb->middle_center != NULL) + (*cb->middle_center) (user_data); + printf (""); + if (cb->middle_right != NULL) + (*cb->middle_right) (user_data); + printf ("
"); + if (cb->bottom_left != NULL) + (*cb->bottom_left) (user_data); + printf (""); + if (cb->bottom_center != NULL) + (*cb->bottom_center) (user_data); + printf (""); + if (cb->bottom_right != NULL) + (*cb->bottom_right) (user_data); + printf ("
\n" + " \n" + "\n"); + + free (title_html); + return (0); +} /* }}} int html_print_page */ + +int html_print_search_box (__attribute__((unused)) void *user_data) /* {{{ */ +{ + char *term_html; + + term_html = html_escape (param ("q")); + + printf ("
\n" + " \n" + " \n" + " \n" + "
\n", + script_name (), + (term_html != NULL) ? term_html : ""); + + free (term_html); + + return (0); +} /* }}} int html_print_search_box */ + /* vim: set sw=2 sts=2 et fdm=marker : */