X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=cgi.c;h=d605525154ba854d350db9b01b73d16f344b1838;hb=2af6f0359aa4252bd1dfefe69091d8ce69161854;hp=df20340be94e193a27a45058fca4ecf8524f368d;hpb=949d36c345d6be2e6860cfec3e8d88c10b192481;p=privoxy.git diff --git a/cgi.c b/cgi.c index df20340b..d6055251 100644 --- a/cgi.c +++ b/cgi.c @@ -1,4 +1,4 @@ -const char cgi_rcs[] = "$Id: cgi.c,v 1.63 2002/04/15 19:06:43 jongfoster Exp $"; +const char cgi_rcs[] = "$Id: cgi.c,v 1.65 2002/04/26 12:53:51 oes Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgi.c,v $ @@ -38,6 +38,17 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.63 2002/04/15 19:06:43 jongfoster Exp $"; * * Revisions : * $Log: cgi.c,v $ + * Revision 1.65 2002/04/26 12:53:51 oes + * - New function add_help_link + * - default_exports now exports links to the user manual + * and a prefix for links into the config chapter + * + * Revision 1.64 2002/04/24 02:17:21 oes + * - Better descriptions for CGIs + * - Hide edit-actions, more shortcuts + * - Moved get_char_param, get_string_param and get_number_param here + * from cgiedit.c + * * Revision 1.63 2002/04/15 19:06:43 jongfoster * Typos * @@ -1222,6 +1233,43 @@ jb_err cgi_error_bad_param(struct client_state *csp, } +/********************************************************************* + * + * Function : add_help_link + * + * Description : Produce a copy of the string given as item, + * embedded in an HTML link to its corresponding + * section (item name in uppercase) in the configuration + * chapter of the user manual, (whose URL is given in + * the config and defaults to our web site). + * + * Parameters : + * 1 : item = item (will NOT be free()d.) + * It is assumed to be HTML-safe. + * + * Returns : String with item embedded in link, or NULL on + * out-of-memory + * + *********************************************************************/ +char *add_help_link(const char *item, + struct configuration_spec *config) +{ + char *result; + + if (!item) return NULL; + + result = strdup("usermanual); + string_append(&result, HELP_LINK_PREFIX); + string_join (&result, string_toupper(item)); + string_append(&result, "\">"); + string_append(&result, item); + string_append(&result, " "); + + return result; +} + + /********************************************************************* * * Function : get_http_time @@ -1772,6 +1820,8 @@ struct map *default_exports(const struct client_state *csp, const char *caller) if (!err) err = map(exports, "default-cgi", 1, html_encode(CGI_PREFIX), 0); if (!err) err = map(exports, "menu", 1, make_menu(caller), 0); if (!err) err = map(exports, "code-status", 1, CODE_STATUS, 1); + if (!err) err = map(exports, "user-manual", 1, csp->config->usermanual ,1); + if (!err) err = map(exports, "helplink", 1, HELP_LINK_PREFIX ,1); if (!err) err = map_conditional(exports, "enabled-display", g_bToggleIJB); snprintf(buf, 20, "%d", csp->config->hport); @@ -1941,9 +1991,10 @@ jb_err map_conditional(struct map *exports, const char *name, int choose_first) * Function : make_menu * * Description : Returns an HTML-formatted menu of the available - * unhidden CGIs, excluding the one given in . + * unhidden CGIs, excluding the one given in * - * Parameters : self = name of CGI to leave out, can be NULL + * Parameters : self = name of CGI to leave out, can be NULL for + * complete listing. * * Returns : menu string, or NULL on out-of-memory error. * @@ -1979,7 +2030,7 @@ char *make_menu(const char *self) * * Function : dump_map * - * Description : HTML-dump a map for debugging + * Description : HTML-dump a map for debugging (as table) * * Parameters : * 1 : the_map = map to dump