a Python-based script that can build simple HTML tables. A version
of this script has been employed to create the official on-line
bus schedule for a mid-size US city. Using the same password controlled
Python script, the city's transportation department updates all
bus arrival times as well as adds or subtracts bus stops (columns)
and bus runs (rows). The titles of all columns can be edited and
the overall title of the table together with the title's background
color can be specified.
To fully automate
table creation and maintenance, TABLA must have access to an HTML
area that the Web server can read from and write to. In the case
of the city bus department mentioned earlier, the Web server runs
as the owner of the HTML directory containing the public bus schedule.
If write access to a live HTML directory cannot be supported,
TABLA can be configured to write to an open directory such as
/tmp but then some other mechanism (such as the Web administrator)
must be used to place the files created and edited by TABLA in
the proper live HTML directories.
In this version
of TABLA, the working directory is set to /tmp/ the IP address
of the client. This can be edited by the Web administrator. When
invoked as a cgi script (e.g., http://somehost.domain/cgi-bin/tabla.py),
TABLA presents an HTML page which requests the user to identify
a table to open or create. The name of the table may be entered in
the field "Enter file name" or selected from a sorted pop-up list of
titles of the tables the user has already saved on the system.
"Cancel" resets the form. "New" asks the user to enter a new file
name, whereupon a new screen (the TABLA edit screen) appears which
allows the user to edit the content and structure of the new table.
The user must specify a password for the table if "New" is selected.
If the user selects "Open" and a filename or a table title has been
selected, the TABLA edit screen is invoked for editing the specified
table. If the user selects "Open" but has not specified a table
title or filename, then the user is prompted for a filename to
open. In the initial distribution of TABLA, the filename specified
by the user is prefixed with the working directory path ("/tmp/$REMOTE_HOST/")
and suffixed with a file type designator (".tab").
edit screen is an HTML form for editing the content of the selected
table. A new table starts out with three columns and 6 rows. The
TABLA edit screen contains a header identifying the current table
(file) being edited, a password field, and control buttons for
manipulating the current table. The password field must be filled
in when saving any changes made to the table being edited. The
password was specified when the new table was created.
are organized into two groups. The leftmost group is "Open", "Save",
"Save as HTML", "View", "Refresh" and "Reset". The rightmost group
is for navigating tables consisting of more than 4 columns. In
edit mode, TABLA allows no more than 4 columns at a time to be
viewed. The navigation buttons are "<<Prev", "Prev", "Next",
returns the user to the table selection screen (and populates
the "Enter file name" field of that screen with the file name of the
currently selected table). In this version of TABLA, no attempt
is made to ensure that the user has saved any pending changes
to the current table. If the user has mistakenly selected "Open"
from the TABLA edit screen, the user can return to the table being
edited by pressing the back button of the browser (assuming that
the browser is running with cache enabled).
all changes made by the user to the table's content and structure
into the file identified by the "current file:" message at the
top of the TABLA edit screen. The table's content includes the
cell values and the title, the title's background color, the column
header names, and the cell data in each row. The table's editable
structure consists of the number of columns and rows of the table.
The table is saved in a simple type/value format similar to LDIF.
"Save as HTML"
saves all changes made by the user into an HTML file which is
named by prefixing the current file with the working directory
path (e.g., "/tmp/$REMOTE_HOST/") and appending (".html"). The current
TABLA file is also updated.
an HTML "browser view" of the table being edited. As a quick way
to grab the table's HTML, the user can view the table's source
using the browser's view source facility.
rereads the current table from the last saved file. All changes
made by the user since the last "Save" will be lost. "Reset" simply
resets all content (but not structure) of the current table to
what was last read from the file system.
buttons are straightforward. "<<Prev"
scrolls the current table up to 4 columns to the right depending
upon how many columns are hidden on the left. The editing form
will display only 4 or fewer columns at any given time. "Prev"
scrolls the table back 1 column. Similarly, "Next" scrolls the
table to the left by 1 column and "Next>>" scrolls the table
up to 4 columns to the left.
The next line
of the TABLA edit screen contains the table's title and a field
to the left of the title for specifying the background color of
the title row. This color may be specified as an HTML color (such
as red) or as a hexidecimal RGB value in normal HTML notation
(such as #ff0000).
table's title, groups of radio button appear for each column of
the table. The first button of a group deletes the column under
it. The second button adds a new column to the left of this button
group. The third button adds a new column to the right of the
button group. Any combination of adds or deletes may be selected
against multiple columns. However, only one action at a time can
be performed on any one column.
At the beginning
of the next row of the TABLA edit screen, a message identifies
the range of columns currently being viewed (e.g., cols 1-4 of
8). The range of up to 4 columns changes as the navigation buttons
are selected. In the same row, the name, or title, of each visible
column can be specified in the text edit fields.
The next line
of the TABLA edit screen begins the data content of the table.
Each data row of the currently visible range of columns is presented.
The text edit fields allow the user to enter or edit data in each
cell of the table. In addition, button groups to the left of each
row allow the deletion and addition of table rows. The first button
of each group deletes the corresponding row. The second button
adds a row above the current row and the third button adds a row
below the current row.
changes (the deletion or addition of rows or columns) to the current
table are only performed when the user enters in a valid password
and selects "Save". Requests for structural changes are ignored
if the navigation buttons are used. However, content changes are
honored and a password must be entered if the navigation buttons
We hope that
you find TABLA useful in your environment. Please email us, at
email@example.com, if you have any questions or even just to let
us know how you are using this tool.