[imp] filterprefs.php and the template system

Chuck Hagenbuch chuck at horde.org
Fri Jan 25 20:01:07 UTC 2008


Quoting Liam Hoekenga <liamr at deathstar.org>:

> We'd created a couple of locally used preferences to toggle the display
> of the blacklist / whitelist links (show_bw_lists), and the spam
> reporting links (show_spam_links), and traditionally they've been
> located in on the filter's preference screen.
>
> I figured out what I need to do to to add them to imp/filterprefs.php,
> and they show up.. but since they begin with show_ instead of filter_,
> templates/filter/prefs.html won't save them...
>
> <loop:opts>
> <input type="checkbox" id="filter_<tag:opts.key />"
> name="filter_<tag:opts.key />" <if:opts.checked>checked="checked"
> </if:opts.checked>/> &nbsp;<tag:opts.label/> &nbsp;<tag:opts.help/><br />
> </loop:opts>
>
> I could put in a second "input type" line, with show_, but then it
> displays everything twice.  Not really what I want.
>
> What would I add to get it to process both filter_ and show_ ?  Short of
> renaming my prefs

I think what you want is to change filterprefs.php so that it sets  
$opts to the original prefs, and assigns the custom options to another  
variable - $show_opts? Then add a second loop just on that.

Or, you could just change the $options_array variable in  
filterprefs.php to include the filter_ prefix, and remove the prefix  
from the template. That might be good to do in the main codebase  
anyway, for better flexibility and to avoid any hair pulling if we add  
another non filter_* option to that page.

-chuck


More information about the imp mailing list