Eidetic Usage
Eidetic is a CGI program and as such takes parameters as inputs and emits its output to stdout. Inputs can be specified in several ways: an URL, as part of an HTML form, or even from the commandline. This document describes how to use Eidetic with each of these approaches, and how to retrieve data from it in several different ways.
Eidetic Parameters
Here is a summary of the most common parameters that Eidetic accepts as inputs:
- modulename: This is the name of a module, such as "projects", "colors", or "users". Eidetic uses this information to figure out which table(s) to operate on, what commands are available, and so forth.
- command: This determines what code should be activated to handle the request. Common commands include "display", "edit", and "store". Some modules have additional commands available to them.
- on: This parameter determines the set of records to be operated on. It corresponds to the 'ID#s' of the records in the module's primary table. You can specify a particular entity ('on=42') or a range ('on=10-20' or 'on=2,4,6' or even 'on=2,4,6,10-20,42'). Eidetic will also support an "open" range, such as 'on=42-', which takes all records after 42, and 'on=0-', which matches all records in the database.
- maxitems: This controls the number of records returned in a listing. By default, 'maxitems=25'. Also by default, the first 'maxitem' items are returned. You can request to get the last maxitems in a set by appending an exclamation mark to the on parameter. For example: 'on=-42!&maxitems=5'
- sort: By default, Eidetic sorts by 'ID#', but you can specify any column to sort on. For example, 'sort=descriptor' will sort the set alphabetically by the descriptor field.
- filter: This allows narrowing the selection via filtering for desired parameter values.
- query: This is a module-specific parameter; use this to call up special "canned" filter/sort sets.
Eidetic URL Usage
Eidetic can be called like any other CGI program using a set of parameters specified as part of an URL. Here is an example URL:
'http://www.site.org/eidetic.cgi?modulename=colors&command=display'
In the above, the question mark shows where the parameter list begins. Each 'key=value' pair is separated by an ampersand.
If you wish to submit data into the database, this can be done by specifying the table fields distinguished by having 'd_' prepended to them. For example:
'http://www.site.org/eidetic.cgi?modulename=colors&command=store&d_descriptor="lavender"'
If you need to get the results of a particular query in a programmatic means, here is how to do it via wget:
'$ wget -nd -O file.html http://www.mysite.org/eidetic.cgi?command=display&modulename=colors'
Eidetic Form Usage
In an HTML form, commands can be specified through the 'hidden' input widget, thusly:
'<INPUT TYPE="hidden" NAME="modulename" VALUE="colors">'
'<INPUT TYPE="hidden" NAME="command" VALUE="display">'
For table-specific parameters, prepend the field names with 'd_'.
Eidetic Commandline Usage
Since Eidetic uses 'CGI.pm', it is also possible to run Eidetic as a commandline utility. In this case, parameters are specified as space-separated instead of ampersand separated. For example:
'$ cd /usr/lib/cgi-bin/' '$ ./eidetic.cgi command=display modulename=colors > colors.html'
This will cause the table to be output as HTML to the file 'colors.html'. This is an extremely handy way to generate static pages (such as for caching).
| Current Issue: February 2003, Recent Issues: January 2003, November 2002, October 2002 |