Not really a feature request as I've already written the code:
[url]http://www.npbconsultants.com/openauditupdate.zip[/url]
I originally sent this to Mark while the forum was unavailable, but thought I'd share with anyone else that wanted to use it:
A couple of things have always bugged me with the OpenAudit home page:
1. The page takes a long time to load as each element waits for a query result before being drawn. This can also result in the browser juggling the elements around as new elements are added.
2. Data is downloaded to the browser that may not even be viewed (the table that is displayed in each section when the dropdown arrow is clicked)
Now, depending on configuration options chosen and the performance of the host running OpenAudit these may not be a nuisance, but on my system the page can sometimes take 15 seconds or more to display correctly.
So I have redesigned the index.php page. The major change is that it uses a javascript class called HttpRequestor (which is just a wrapper for a XMLHttpRequest object). A different instance of this class is associated with each section to be displayed on the main page. At the end of index.php each instance makes a call to a different function in index_data.php. The functions in this file perform the relevant SQL query and return HTML code which is then written back to the associated HTML element in the main page.
The effect of this is that the page loads almost instantly and the data for the various sections is populated as soon as the query results are returned, which is much more elegant IMO.
Now originally my intention was to only return the "count" values for each section at first and then use a similar method to download the table data only when the down arrow is clicked (so the data table is only downloaded if the user requests it). However, this would mean performing 2 very similar queries for each section:
- First to get the "count" value only. The query could be optimised (only COUNT(*) needed, no sorting)
- Second to get the table data
In the end I decided that this wasn't worth the extra load on the SQL server, but it's not too hard to implement in future.
I've re-written the index.php in a more modular fashion which should make it easier to add new sections at a later date and to manage future changes.
Finally, I've made a minor change to include.php to change the way that the logo header is displayed - I thought it needed a splash of colour. Just a personal choice
The only other thing I'm working on is to make sure that the "hourglass-busy.gif" is fully loaded before the browser attempts to display it. Sometimes using Firefox if it's not in the browser cache the nasty "picture unavailable" icon is displayed.
See what you think, but I'd like it to be considered for adding to the SVN .
Cheers, Nick.