Generic Tables, by Michael.

About

"Generic Tables" allows the possibility of "generic tables". Originally written for HumanRightsTools, it is a single program that does not require change to the logic or code when a person wishes to create new tables, no matter the complexity of the table.

It provides as much functionality and flexibility as I can think, merely by editing the settings file. (And allows multiple settings files to use the same copy of the program, enabling you to always have an up to date copy for each table.)

It requires PHP and MySQL, with (in the future) certain (non-essential) functionality requiring Apache.

Setup

Filling in the settings file by hand, making sure all the arrays are correct (there is nothing to check that for you), and then running the setup.php script. If it displays no errors, then everything went fine. Otherwise ...

If you want to have two or more settings files, just make sure they are all in the settings folder, and then use ?version= in your get request (as part of the URL) to select which settings folder you want to use.

Make sure to fix up the authentication.

External programs

This program makes use of two other files.

authent.php
The Quick and Dirty Authentication program is a useful and usable single user authentication program. It is included in each file that has the potential to be damaging. See that file for more details.
castle.php
A captcha like thingy, Castle allows you to make it more difficult for automated spammers or similar to add entries (if you allow records to be added without authentication). See that file for more details.

Both of these programs are available under the same license as this program, and both are designed to be upgraded independently of the main program. This is particularly important when it comes to authent.php as you can replace it with your own authentication program easily. (Though, Generic Tables still won't support multiple users.)

Types of fields available

At present, the following 'types' are available:

Into the future the following types will be introduced: For select, radio buttons maybe an option in the future. For Multichoice, tick boxes maybe an option in the future.

Features that might not work just now

Things TODO

Have to fix up authentication and validation on the relevant pages. Fix up setup to make it nicer. Make it possible to edit the settings via a web interface, and automagically modify the tables if that happens.

URGENT TODO Fix authentication, make it possible to have multiple users with multiple access levels. Make it possible to modify the tables via the web interface. Make it possible to have multiple ...

Templates! Select radio box.

Changelog and future versions

(Current version .6)

.1 First version, add and display are at equivalent functionality to the "courses" scripts which preceded this generic tables program. That is, you can have dates, URLs, etc.

.2 Add, display, edit, delete, verify all work correctly (as far as I can tell) and don't have any specific bugs or problems. The only major problem is security is not verified to work correctly (it may, it just hasn't been reviewed). There is a rudimentary import function, which will be improved in future versions.
Added a lot of internal documentation, including documenting the dbaccess API.

.3 Lots of changes happened and there was no "set" version released.

.4 Skipped to indicate the large amount of changes that occured.

.5 We now have export, more data types, view single item, view items after adding and editing, the possibility to have more than one table (all the files are in another folder).

.5.1 Work started on 4 July. Email type, no validation. Can send an email when a new record is added.

.6 Started 21 July 2010. The type of field and length of field can be set as help, the same as the SHOW_TEXTAREA_HELP. Various changes, through the system. Nicer error messages, particularly if a form has a validation error. Removed formordering. Created form2.php one less redundant place.
Added heaps of project documentation, converted README into HTML.

.7 Started 01 December 2010. This version is basically the same as .6, except that it is going to be packaged and deployed. Features not essential for HumanRightsTools (including image uploads, email type, email on new record, import and export etc.) are not being extensively tested, if tested at all.

Future Options

To flag items for review. More date types, hidden field flag, all to be added (see bug tracker for more details). A proper setup is in the works as well.

It would be really nice if setup used a lot of JavaScript to enable people to create the settings file. It would grab the shortname, heading, size and type, and then once that is "submitted" (it would not go to the server, just to more JS), the JS would display forms for each select, multiple etc. If more input fields are required, you click a button, and it creates another one... It would have a nice help feature, that you just click the ? icon and it would pop up what each field meant...

It would be really flashy and nice.

Thoughts for the future

Would be nice if you could 'delete' things, and require validation to actually delete them. So that, if someone deletes an item, it wouldn't actually be removed from the table, it would just not be displayed. Tinyint can be used for all these validation tasks.

Having a summary for the table would be nice http://www.w3.org/TR/html401/struct/tables.html#adef-summary

Allow nice URL's, rather then add.php?version=settings, add.php/settings.

It would be grand if display.php and singled.php both were functions that returned their content, rather than echoing it.

When's 1.0?

From installation, with it's flash setup, through to everyday use, including exporting and importing records, and pagination, Generic Tables offers a program to suit virtually any "table on the web" scenario. A single record can be exported to a template of your choosing, easily and consistently. The program integrates into your website with ease (including into WordPress blogs with the externally developed plugin), whether it be HTML or XHTML.

Generic Tables allows quick, easy and accessible management of records, including mass verification and deletion. It supports a variety of datatypes (including uploaded images, PDF's and other files), the number of which can be added to with little difficulty*.

Generic Tables, by Michael. A simple, but powerful tool.

Files

Apart from the various program files, the following files are important:

readme.html
What you are reading now.
devnotes.txt.html
Lots of information about the internals of the system. Some of it out of date.
help.php
Specific help information for end users. Because it is .php it can read the settings file and stuff.
*.css
Various CSS files that are used to provide styles in certain situations. See devnotes.txt.html#cssclasses for some information about CSS classes that are available.

Licence and copyright

Apart from the two files noted below (Sorttable.js and filterTable.js) all the other files in the archive (including .php, .js and .css) are copyright by Michael Harris, and are licenced under the following licence:

Copyright 2008, 2009 & 2010 by Michael Harris, http://next-nexus.info/harrismw

This program is free software. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

sorttable.js is by Stuart Langridge and is under "The MIT Licence" (or "X11 Licence"?); below is a copy of the licence from Stuart Langridge's site.

Copyright (c) 1997-date Stuart Langridge

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

filterTable.js is from http://leparlement.org/filterTable there is no licence attached, it is implied that it is free to use however (the author gives help to people on how to use it).

"I'm so happy with myself, I want to share some nice and easy code that can search and filter in a table. Simple, nothing to add in your html but for the javascript file and a simple filterable class to set onto tables and to define with a color (or any other style you want)."

Parts of it are originally from http://www.vonloesch.de/node/23