/*
- * "$Id$"
+ * Online help CGI for CUPS.
*
- * Online help CGI for CUPS.
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
*
- * Copyright 2007-2011 by Apple Inc.
- * Copyright 1997-2006 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * Contents:
- *
- * main() - Main entry for CGI.
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * missing or damaged, see the license at "http://www.cups.org/".
*/
/*
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 */
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();
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();
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();
}
/*
- * 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...
*/
cgiStartHTML(cgiText(_("Online Help")));
+
+ topic = cgiGetVariable("TOPIC");
}
/*
cgiSetVariable("QUERY", "");
query = cgiGetVariable("QUERY");
- topic = cgiGetVariable("TOPIC");
si = helpSearchIndex(hi, query, topic, helpfile);
cgiClearVariables();
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)");
section = n->section;
}
- if (!topic || strcmp(n->section, topic))
+ if (!topic || !n->section || strcmp(n->section, topic))
continue;
/*
else
{
perror(filename);
- cgiSetVariable("ERROR", "Unable to open help file.");
+ cgiSetVariable("ERROR", cgiText(_("Unable to open help file.")));
cgiCopyTemplateLang("error.tmpl");
}
}
return (0);
}
-
-
-/*
- * End of "$Id$".
- */