diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2012-03-30 05:59:14 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2012-03-30 05:59:14 +0000 |
commit | 82cc1f9ac32564e92bfbbe7a1de416f4ebcc8584 (patch) | |
tree | af43377451e06dac91d6639e35b1b5bf41d14d4e /cgi-bin | |
parent | 3e7fe0ca760ad0054cf5c9ec7c90ca415cf6eb06 (diff) | |
download | cups-82cc1f9ac32564e92bfbbe7a1de416f4ebcc8584.tar.gz |
Merge changes from CUPS 1.6svn-r10390.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3755 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cgi-bin')
-rw-r--r-- | cgi-bin/admin.c | 56 | ||||
-rw-r--r-- | cgi-bin/help.c | 25 | ||||
-rw-r--r-- | cgi-bin/var.c | 6 |
3 files changed, 62 insertions, 25 deletions
diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index 64a29bffd..dcfc2dc47 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -1557,6 +1557,8 @@ do_config_server(http_t *http) /* I - HTTP connection */ int advanced, /* Advanced settings shown? */ changed; /* Have settings changed? */ const char *debug_logging, /* DEBUG_LOGGING value */ + *preserve_jobs = NULL, + /* PRESERVE_JOBS value */ *remote_admin, /* REMOTE_ADMIN value */ *remote_any, /* REMOTE_ANY value */ *share_printers,/* SHARE_PRINTERS value */ @@ -1611,19 +1613,36 @@ do_config_server(http_t *http) /* I - HTTP connection */ */ browse_web_if = cgiGetVariable("BROWSE_WEB_IF") ? "Yes" : "No"; - preserve_job_history = cgiGetVariable("PRESERVE_JOB_HISTORY") ? "Yes" : "No"; - preserve_job_files = cgiGetVariable("PRESERVE_JOB_FILES") ? "Yes" : "No"; max_clients = cgiGetVariable("MAX_CLIENTS"); - max_jobs = cgiGetVariable("MAX_JOBS"); max_log_size = cgiGetVariable("MAX_LOG_SIZE"); + preserve_jobs = cgiGetVariable("PRESERVE_JOBS"); + + if (preserve_jobs) + { + max_jobs = cgiGetVariable("MAX_JOBS"); + preserve_job_history = cgiGetVariable("PRESERVE_JOB_HISTORY"); + preserve_job_files = cgiGetVariable("PRESERVE_JOB_FILES"); + + if (!max_jobs || atoi(max_jobs) < 0) + max_jobs = "500"; + + if (!preserve_job_history) + preserve_job_history = "On"; + + if (!preserve_job_files) + preserve_job_files = "1d"; + } + else + { + max_jobs = "0"; + preserve_job_history = "No"; + preserve_job_files = "No"; + } if (!max_clients || atoi(max_clients) <= 0) max_clients = "100"; - if (!max_jobs || atoi(max_jobs) <= 0) - max_jobs = "500"; - - if (!max_log_size || atof(max_log_size) <= 0.0) + if (!max_log_size || atoi(max_log_size) <= 0.0) max_log_size = "1m"; } @@ -1674,7 +1693,7 @@ do_config_server(http_t *http) /* I - HTTP connection */ if ((current_preserve_job_files = cupsGetOption("PreserveJobFiles", num_settings, settings)) == NULL) - current_preserve_job_files = "No"; + current_preserve_job_files = "1d"; if ((current_max_clients = cupsGetOption("MaxClients", num_settings, settings)) == NULL) @@ -2636,18 +2655,25 @@ do_menu(http_t *http) /* I - HTTP connection */ settings)) == NULL) val = "Yes"; - if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") || - !_cups_strcasecmp(val, "true")) + if (val && + (!_cups_strcasecmp(val, "0") || !_cups_strcasecmp(val, "no") || + !_cups_strcasecmp(val, "off") || !_cups_strcasecmp(val, "false") || + !_cups_strcasecmp(val, "disabled"))) { - cgiSetVariable("PRESERVE_JOB_HISTORY", "CHECKED"); + cgiSetVariable("PRESERVE_JOB_HISTORY", "0"); + cgiSetVariable("PRESERVE_JOB_FILES", "0"); + } + else + { + cgiSetVariable("PRESERVE_JOBS", "CHECKED"); + cgiSetVariable("PRESERVE_JOB_HISTORY", val); if ((val = cupsGetOption("PreserveJobFiles", num_settings, settings)) == NULL) - val = "No"; + val = "1d"; + + cgiSetVariable("PRESERVE_JOB_FILES", val); - if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") || - !_cups_strcasecmp(val, "true")) - cgiSetVariable("PRESERVE_JOB_FILES", "CHECKED"); } if ((val = cupsGetOption("MaxClients", num_settings, settings)) == NULL) diff --git a/cgi-bin/help.c b/cgi-bin/help.c index 32b6db693..215c98bc4 100644 --- a/cgi-bin/help.c +++ b/cgi-bin/help.c @@ -39,7 +39,8 @@ main(int argc, /* I - Number of command-line arguments */ const char *query; /* Search query */ const char *cache_dir; /* CUPS_CACHEDIR environment variable */ const char *docroot; /* CUPS_DOCROOT environment variable */ - const char *helpfile; /* Current help file */ + const char *helpfile, /* Current help file */ + *helptitle = NULL; /* Current help title */ const char *topic; /* Current topic */ char topic_data[1024]; /* Topic form data */ const char *section; /* Current section */ @@ -88,7 +89,7 @@ main(int argc, /* I - Number of command-line arguments */ perror(filename); cgiStartHTML(cgiText(_("Online Help"))); - cgiSetVariable("ERROR", "Unable to load help index!"); + cgiSetVariable("ERROR", cgiText(_("Unable to load help index."))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -129,7 +130,7 @@ main(int argc, /* I - Number of command-line arguments */ perror(filename); cgiStartHTML(cgiText(_("Online Help"))); - cgiSetVariable("ERROR", "Unable to access help file!"); + cgiSetVariable("ERROR", cgiText(_("Unable to access help file."))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -139,7 +140,7 @@ main(int argc, /* I - Number of command-line arguments */ if ((n = helpFindNode(hi, helpfile, NULL)) == NULL) { cgiStartHTML(cgiText(_("Online Help"))); - cgiSetVariable("ERROR", "Help file not in index!"); + cgiSetVariable("ERROR", cgiText(_("Help file not in index."))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -147,12 +148,11 @@ main(int argc, /* I - Number of command-line arguments */ } /* - * Set the page title and save the help file... + * Save the page title and help file... */ - cgiSetVariable("HELPFILE", helpfile); - cgiSetVariable("HELPTITLE", n->text); - cgiSetVariable("TOPIC", n->section); + helptitle = n->text; + topic = n->section; /* * Send a standard page header... @@ -170,6 +170,8 @@ main(int argc, /* I - Number of command-line arguments */ */ cgiStartHTML(cgiText(_("Online Help"))); + + topic = cgiGetVariable("TOPIC"); } /* @@ -180,7 +182,6 @@ main(int argc, /* I - Number of command-line arguments */ cgiSetVariable("QUERY", ""); query = cgiGetVariable("QUERY"); - topic = cgiGetVariable("TOPIC"); si = helpSearchIndex(hi, query, topic, helpfile); cgiClearVariables(); @@ -188,6 +189,10 @@ main(int argc, /* I - Number of command-line arguments */ cgiSetVariable("QUERY", query); if (topic) cgiSetVariable("TOPIC", topic); + if (helpfile) + cgiSetVariable("HELPFILE", helpfile); + if (helptitle) + cgiSetVariable("HELPTITLE", helptitle); fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n", query ? query : "(null)", topic ? topic : "(null)"); @@ -356,7 +361,7 @@ main(int argc, /* I - Number of command-line arguments */ else { perror(filename); - cgiSetVariable("ERROR", "Unable to open help file."); + cgiSetVariable("ERROR", cgiText(_("Unable to open help file."))); cgiCopyTemplateLang("error.tmpl"); } } diff --git a/cgi-bin/var.c b/cgi-bin/var.c index d5e58eb1e..8b8c026c4 100644 --- a/cgi-bin/var.c +++ b/cgi-bin/var.c @@ -167,6 +167,8 @@ cgiClearVariables(void) _cgi_var_t *v; /* Current variable */ + fputs("DEBUG: cgiClearVariables called.\n", stderr); + for (v = form_vars, i = form_count; i > 0; v ++, i --) { _cupsStrFree(v->name); @@ -401,6 +403,8 @@ cgiSetArray(const char *name, /* I - Name of variable */ if (name == NULL || value == NULL || element < 0 || element > 100000) return; + fprintf(stderr, "DEBUG: cgiSetArray: %s[%d]=\"%s\"\n", name, element, value); + if ((var = cgi_find_variable(name)) == NULL) { cgi_add_variable(name, element, value); @@ -532,6 +536,8 @@ cgiSetVariable(const char *name, /* I - Name of variable */ if (name == NULL || value == NULL) return; + fprintf(stderr, "cgiSetVariable: %s=\"%s\"\n", name, value); + if ((var = cgi_find_variable(name)) == NULL) { cgi_add_variable(name, 0, value); |