From cfc8ee482223c9310f360242c8db24c3b73ffd73 Mon Sep 17 00:00:00 2001 From: David Schmidt Date: Thu, 18 Oct 2001 22:22:09 +0000 Subject: [PATCH] Only show "Local support" on templates conditionally: - if either 'admin-address' or 'proxy-info-url' are uncommented in config - if not, no Local support section appears are removed automatically --- cgi.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/cgi.c b/cgi.c index f0e8b405..d5f87703 100644 --- a/cgi.c +++ b/cgi.c @@ -1,4 +1,4 @@ -const char cgi_rcs[] = "$Id: cgi.c,v 1.32 2001/10/14 22:20:18 jongfoster Exp $"; +const char cgi_rcs[] = "$Id: cgi.c,v 1.33 2001/10/14 22:28:41 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgi.c,v $ @@ -38,6 +38,9 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.32 2001/10/14 22:20:18 jongfoster Exp $"; * * Revisions : * $Log: cgi.c,v $ + * Revision 1.33 2001/10/14 22:28:41 jongfoster + * Fixing stupid typo. + * * Revision 1.32 2001/10/14 22:20:18 jongfoster * - Changes to CGI dispatching method to match CGI names exactly, * rather than doing a prefix match. @@ -930,12 +933,12 @@ void template_fill(char **template_ptr, struct map *exports) struct map *default_exports(const struct client_state *csp, const char *caller) { char buf[20]; + int local_help_exists = 0; struct map * exports = new_map(); map(exports, "version", 1, VERSION, 1); map(exports, "my-ip-address", 1, csp->my_ip_addr_str ? csp->my_ip_addr_str : "unknown", 1); map(exports, "my-hostname", 1, csp->my_hostname ? csp->my_hostname : "unknown", 1); - map(exports, "admin-address", 1, csp->config->admin_address ? csp->config->admin_address : "fill@me.in.please", 1); map(exports, "homepage", 1, HOME_PAGE_URL, 1); map(exports, "default-cgi", 1, HOME_PAGE_URL "/config", 1); map(exports, "menu", 1, make_menu(caller), 0); @@ -949,14 +952,28 @@ struct map *default_exports(const struct client_state *csp, const char *caller) map_block_killer(exports, "unstable"); } + if(csp->config->admin_address != NULL) + { + map(exports, "admin-address", 1, csp->config->admin_address, 1); + local_help_exists = 1; + } + else + { + map_block_killer(exports, "have-adminaddr-info"); + } + if(csp->config->proxy_info_url != NULL) { map(exports, "proxy-info-url", 1, csp->config->proxy_info_url, 1); + local_help_exists = 1; } else { map_block_killer(exports, "have-proxy-info"); - } + } + + if (local_help_exists == 0) + map_block_killer(exports, "have-help-info"); return (exports); -- 2.39.2