Friday, May 21, 2010

CSS skins on RdbAdmin

Those of you who consider our default Rdbadmin 'look' to be unattractive, can now provide your own css 'skins' for your own accounts.

The admin program now checks for a query in the lookup.queries table called 'css'. If found, that query is requested and the contents used as a css style-sheet for the page. If none is found, the default stylesheet is used.

Two demonstrations:

The Stackoverflow account now has a look suggestive of the stackoverflow site.
A baseball data account has a distinctive green theme.

The baseball account has a logo image as part of its theme, and the theme is self-contained within the account. To accomplish this, I created a table in the lookup schema to hold the css stylesheet and the image file. I called this table 'pseudofiles', as it serves individual fields as though they were files. The css data and the image file went into separate records in the table, and the lookup.queries table gained an entry to retrieve the css, and another entry to retrieve the image file. The entries resembled:
tag: css
query: SELECT "body" FROM "lookup"."pseudofiles" WHERE "name" = 'css'
format: binary:text/css
nopermit: {} (empty set)
So the browser loads the rdadmin/main.html page, and embedded javascript loads the css stylesheet. The stylesheet contains a background image url, and that url includes a query for the background image. The result looks like this.

The stackoverflow account uses a slightly different approach. The 'stylesheet' was a one-liner, completely embedded in the lookup.queries query.

SELECT "@import url(http://www.freshfaves.com/css/stackoverflow.css);"
The real css style information is then stored in a regular file on the freshfaves.com server, and loaded by @import. This approach has the merit of keeping the true styles in a relatively easily edited format, but also the penalty of having to involve another server.




minor grammatical and line-break editing 10 June

No comments:

Post a Comment