[htdig] small patch to allow_in_form feature

Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Tue, 2 Feb 1999 11:46:15 -0600 (CST)

I've been trying out the new allow_in_form feature, and found it has
a small but annoying quirk to it. The attributes you include in this
list get appended to the query strings for the links to other pages,
at the bottom of the search results, even if they're not given as input
parameters. This is inconsistent with the way other input parameters
are propagated by Display::createURL().

The patch below corrects this problem. Leo, was this feature one that
you added? I was wondering if there was a reason that I'm overlooking
for why you get the parameters from config rather than from input,
in createURL(). It seems unnecessary to put the parameters in the query
string if that's not where they came from to begin with, as the stuff in
the configuration file isn't likely to change from one query to the next.

The reason this change is important to me is that I'm using allow_in_form
for a slightly different purpose - to pass config attributes to the
templates. E.g. I define different values of wrapper_header_tag in each
of 3 different config files, all of which use the same search results
wrapper, which uses $(WRAPPER_HEADER_TAG) to embed the HTML code from
this attribute as the header for the results. This allows all the
customization to be localized to a few config file entries. I don't
really intend these to be overridden by input variables, though they
could be, but I want to avoid having these long HTML strings inserted
unnecessarily into the query strings.

Here's the patch:

--- ./htsearch/Display.cc.allowfix Fri Jan 29 15:16:41 1999
+++ ./htsearch/Display.cc Tue Feb 2 11:18:20 1999
@@ -544,9 +544,9 @@
     StringList form_vars(config["allow_in_form"], " \t\r\n");
     for (i= 0; i < form_vars.Count(); i++)
- if (config[form_vars[i]])
+ if (input->exists(form_vars[i]))
- s << form_vars[i] << '=' << config[form_vars[i]] << '&';
+ s << form_vars[i] << '=' << input->get(form_vars[i]) << '&';
     s << "page=" << pageNumber;

Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930
To unsubscribe from the htdig mailing list, send a message to
htdig@htdig.org containing the single word "unsubscribe" in
the SUBJECT of the message.

This archive was generated by hypermail 2.0b3 on Wed Feb 10 1999 - 17:09:05 PST