Index: /trunk/bin/module_maker/form_template.cli.php
===================================================================
--- /trunk/bin/module_maker/form_template.cli.php	(revision 294)
+++ /trunk/bin/module_maker/form_template.cli.php	(revision 295)
@@ -62,11 +62,13 @@
         if (preg_match('/.*_id$/i', $field)) {
             $output[$field] = <<<E_O_F
-
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<select name="$field" id="$field" class="sc-small"><\x3fphp printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', __///__)", '$field', \$frm['$field'], true, 'ORDER BY $field ASC'); \x3f></select>
-    <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=add&boomerang=true'); \x3f>" onclick"javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo _("Add __///__") \x3f></a></span>
+            
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <select name="$field" id="$field" class="sc-small"><\x3fphp printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', __///__)", '$field', \$frm['$field'], true, 'ORDER BY $field ASC'); \x3f></select>
+    <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=add&boomerang=true'); \x3f>" onclick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>');"><\x3fphp echo _("Add __///__") \x3f></a></span>
     <\x3fphp if ('' != \$frm['__///___id']) { \x3f>
-    <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=edit&boomerang=true&__///___id=' . \$frm['__///___id']); \x3f>" onclick"javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo sprintf(_("Edit __///__ <em>%s</em>"), \$frm['__///__']) \x3f></a></span>
+        <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=edit&boomerang=true&__///___id=' . \$frm['__///___id']); \x3f>" onclick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>');"><\x3fphp echo sprintf(_("Edit __///__ <em>%s</em>"), \$frm['__///__']) \x3f></a></span>
     <\x3fphp } \x3f>
+</div>
 E_O_F;
             continue;
@@ -77,10 +79,12 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<input type="file" name="$field" id="$field" />
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <input type="file" name="$field" id="$field" />
     <\x3fphp if ('' != \$upload->getFilenameGlob(getFormData('$primary_key') . '_*') && getFormData('op') == 'edit' || getFormData('op') == 'update') { \x3f>
-    <div class="sc-help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\\$s\"><strong>%2\\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/__///__', \$upload->getFilenameGlob(getFormData('$primary_key') . '_*')) \x3f></div>
+        <div class="sc-help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\\$s\"><strong>%2\\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/__///__', \$upload->getFilenameGlob(getFormData('$primary_key') . '_*')) \x3f></div>
     <\x3fphp } \x3f>
     <div class="sc-help"><\x3fphp printf(_("File to upload must have one of the following file-name extensions: %s."), join(', ', \$upload->getParam('valid_file_extensions'))) \x3f></div>
+</div>
 E_O_F;
             continue;
@@ -91,6 +95,8 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<input type="password" class="sc-medium" size="50" name="$field" id="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <input type="password" name="$field" id="$field" class="sc-medium" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
+</div>
 E_O_F;
             continue;
@@ -103,6 +109,8 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<select name="$field" id="$field"><\x3fphp printSetSelectForm('$db_tbl', '$field', \$frm['$field'], true); \x3f></select>
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <select name="$field" id="$field"><\x3fphp printSetSelectForm('$db_tbl', '$field', \$frm['$field'], true); \x3f></select>
+</div>
 E_O_F;
             break;
@@ -112,6 +120,8 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<\x3fphp printSetCheckboxes('$db_tbl', '$field', \$frm['$field'], 1) \x3f>
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <\x3fphp printSetCheckboxes('$db_tbl', '$field', \$frm['$field'], 1) \x3f>
+</div>
 E_O_F;
             break;
@@ -121,6 +131,8 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<input type="checkbox" name="$field" id="$field" <\x3fphp frmChecked(!empty(\$frm['$field'])) \x3f> /><label class="left"><\x3fphp echo _("Check this box to $title"); \x3f></label>
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <label><input type="checkbox" name="$field" id="$field" <\x3fphp frmChecked(!empty(\$frm['$field'])) \x3f> /><\x3fphp echo _("Check this box to $title"); \x3f></label>
+</div>
 E_O_F;
             break;
@@ -132,6 +144,8 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<textarea class="sc-large sc-short" cols="75" rows="4" name="$field" id="$field"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <textarea name="$field" id="$field" rows="8" cols="40" class="sc-short sc-medium"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
+</div>
 E_O_F;
             break;
@@ -144,6 +158,8 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<textarea class="sc-large sc-tall" cols="75" rows="4" name="$field" id="$field"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <textarea name="$field" id="$field" rows="8" cols="40" class="sc-short sc-medium"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
+</div>
 E_O_F;
             break;
@@ -170,6 +186,8 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<input type="text" class="sc-tiny" size="12" name="$field" id="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <input type="text" name="$field" id="$field" class="sc-tiny" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
+</div>
 E_O_F;
             break;
@@ -184,6 +202,8 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<input type="text" class="sc-medium" size="25" name="$field" id="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <input type="text" name="$field" id="$field" class="sc-small" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
+</div>
 E_O_F;
             break;
@@ -197,6 +217,8 @@
             $output[$field] = <<<E_O_F
 
-<label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
-<input type="text" class="sc-medium" size="50" name="$field" id="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
+<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
+    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
+    <input type="text" name="$field" id="$field" class="sc-medium" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
+</div>
 E_O_F;
             break;
Index: /trunk/bin/module_maker/list_template.cli.php
===================================================================
--- /trunk/bin/module_maker/list_template.cli.php	(revision 294)
+++ /trunk/bin/module_maker/list_template.cli.php	(revision 295)
@@ -90,7 +90,7 @@
             $listrows[] = "<\x3fphp printf('$%01.2f', \$list[\$i]['$field']); \x3f>";
         } else if (preg_match('/(added_by_user_id)/i', $field)) {
-            $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['added_admin_username']); \x3f>";
+            $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['added_by_username']); \x3f>";
         } else if (preg_match('/(modified_by_user_id)/i', $field)) {
-            $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['modified_admin_username']); \x3f>";
+            $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['modified_by_username']); \x3f>";
         } else if ('rank' == $field) {
             $listrows[] = "<input type=\"text\" name=\"rank[<\x3fphp echo \$list[\$i]['$primary_key']; \x3f>]\" value=\"<\x3fphp echo \$list[\$i]['rank']; \x3f>\" size=\"5\" />";
@@ -164,5 +164,5 @@
 
 echo isset($op) ? '' : <<<E_O_F
-        <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onclick"javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['__///__'])) \x3f>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
+        <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onclick"javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['__///__'])) \x3f>');"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
     </tr>
     <\x3fphp } \x3f>
Index: /trunk/bin/module_maker/module.cli.php
===================================================================
--- /trunk/bin/module_maker/module.cli.php	(revision 294)
+++ /trunk/bin/module_maker/module.cli.php	(revision 295)
@@ -137,4 +137,7 @@
 
 // Make sure requested table is in database.
+if (!isset($tables)) {
+    die(sprintf("%s Warning: %s does not exist in database %s. No DB tables found!", basename($_SERVER['argv'][0]), $db_tbl, $app->getParam('db_name')));
+}
 if (!in_array($db_tbl, $tables)) {
     die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, $app->getParam('db_name'), join("\n", $tables)));
@@ -207,5 +210,5 @@
 
 $search['admin_form_tag_init'] = '/%ADMIN_FORM_TAG_INIT%/';
-$replace['admin_form_tag_init'] = '<form method="post" action="<\x3fphp echo \$_SERVER[\'PHP_SELF\']; \x3f>" class="sc-form">';
+$replace['admin_form_tag_init'] = "<form method=\"post\" action=\"<\x3fphp echo oTxt(\$_SERVER['PHP_SELF']); \x3f>\" class=\"sc-form\">";
 $search['admin_upload_include'] = '/%ADMIN_UPLOAD_INCLUDE%/';
 $replace['admin_upload_include'] = '';
Index: /trunk/bin/module_maker/skel/adm_form.ihtml
===================================================================
--- /trunk/bin/module_maker/skel/adm_form.ihtml	(revision 294)
+++ /trunk/bin/module_maker/skel/adm_form.ihtml	(revision 295)
@@ -6,8 +6,12 @@
 <input type="hidden" name="%PRIMARY_KEY%" value="<?php echo $frm['%PRIMARY_KEY%']; ?>" />
 
-<?php printSubmitButtons($frm['submit_buttons']); ?>
+<div class="sc-form-row sc-submit-buttons">
+    <?php printSubmitButtons($frm['submit_buttons']); ?>
+</div>
 
 %ADM_FORM_TABLE_ROWS%
 
-<?php printSubmitButtons($frm['submit_buttons']); ?>
+<div class="sc-form-row sc-submit-buttons">
+    <?php printSubmitButtons($frm['submit_buttons']); ?>
+</div>
 </form>
Index: /trunk/bin/module_maker/skel/adm_list.ihtml
===================================================================
--- /trunk/bin/module_maker/skel/adm_list.ihtml	(revision 294)
+++ /trunk/bin/module_maker/skel/adm_list.ihtml	(revision 295)
@@ -3,15 +3,13 @@
 
 <div id="commandbox">
-<form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get">
-<?php $app->printHiddenSession(false); ?>
     <span class="sc-nowrap commandtext"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add %ITEM_TITLE%"); ?></a></span>
-    <br />
-
-    <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: __///__ %SEARCH_FIELDS%.")); ?>" />
-    <select name="filter___///__">
-        <?php // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); ?>
-    </select>
-    <input type="submit" value="<?php echo _("Search"); ?>" />
-</form>
+    <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
+        <?php $app->printHiddenSession(false); ?>
+        <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: __///__ %SEARCH_FIELDS%.")); ?>" />
+        <select name="filter___///__" class="sc-small">
+            <?php // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); ?>
+        </select>
+        <input type="submit" value="<?php echo _("Filter"); ?>" />
+    </form>
 </div>
 
@@ -31,5 +29,5 @@
         <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF('/admin/versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
 %ADM_LIST_ROWS%
-        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&%PRIMARY_KEY%=" . $list[$i]['%PRIMARY_KEY%']); ?>" onclick"javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['__///__'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&%PRIMARY_KEY%=" . $list[$i]['%PRIMARY_KEY%']); ?>" onclick"javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['__///__'])) ?>');"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
     </tr>
     <?php } ?>
Index: /trunk/bin/module_maker/skel/admin.php
===================================================================
--- /trunk/bin/module_maker/skel/admin.php	(revision 294)
+++ /trunk/bin/module_maker/skel/admin.php	(revision 295)
@@ -203,7 +203,7 @@
         'new_op' => 'insert',
         'submit_buttons' => array(
-            'submit' => _("Add %ITEM_TITLE%"),
-            'repeat' => _("Add &amp; repeat"),
-            'cancel' => _("Cancel"),
+            array('name' => 'submit', 'value' => _("Add %ITEM_TITLE%"), 'accesskey' => 's'),
+            array('name' => 'repeat', 'value' => _("Add &amp; repeat"), 'accesskey' => 'r'),
+            array('name' => 'cancel', 'value' => _("Cancel"), 'accesskey' => 'c'),
         ),
     );
@@ -216,4 +216,5 @@
     global $lock;
 	$db =& DB::getInstance();
+	$app =& App::getInstance();
 	
     $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
@@ -242,8 +243,8 @@
         'new_op' => 'update',
         'submit_buttons' => array(
-            'submit' => _("Save changes"),
-            'repeat' => _("Save &amp; edit next"),
-            'reset' => _("Reset"),
-            'cancel' => _("Cancel"),
+            array('name' => 'submit', 'value' => _("Save changes"), 'accesskey' => 's'),
+            array('name' => 'repeat', 'value' => _("Save & edit next"), 'accesskey' => 'e'),
+            array('name' => 'reset', 'value' => _("Reset"), 'accesskey' => 'r'),
+            array('name' => 'cancel', 'value' => _("Cancel"), 'accesskey' => 'c'),
         ),
     ), $frm);
@@ -257,4 +258,5 @@
     global $cache;
 	$db =& DB::getInstance();
+	$app =& App::getInstance();
 	
     $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
@@ -292,4 +294,5 @@
     global $cache;
 	$db =& DB::getInstance();
+	$app =& App::getInstance();
 	
     // Remove any stale cached list data.
@@ -313,4 +316,5 @@
 	global $lock;
     global $cache;
+	$db =& DB::getInstance();
 	$app =& App::getInstance();
     
@@ -342,4 +346,5 @@
     global $cache;
 	$db =& DB::getInstance();	
+	$app =& App::getInstance();
     
     $where_clause = '';
@@ -374,9 +379,9 @@
         SELECT
             %DB_TBL%.*,
-            a1.username AS added_admin_username,
-            a2.username AS modified_admin_username
+            a1.username AS added_by_username,
+            a2.username AS modified_by_username
         FROM %DB_TBL%
-        LEFT JOIN admin_tbl a1 ON (%DB_TBL%.added_by_user_id = a1.admin_id)
-        LEFT JOIN admin_tbl a2 ON (%DB_TBL%.modified_by_user_id = a2.admin_id)
+        LEFT JOIN user_tbl a1 ON (%DB_TBL%.added_by_user_id = a1.user_id)
+        LEFT JOIN user_tbl a2 ON (%DB_TBL%.modified_by_user_id = a2.user_id)
         $where_clause
         " . $so->getSortOrderSQL() . "
@@ -398,5 +403,6 @@
     // First try to return from the cache.
     if ($cache->exists('list')) {
-        return $cache->get('list');
+        $list = $cache->get('list');
+        return $list;
     }
     
@@ -419,4 +425,5 @@
     global $cache;
 	$db =& DB::getInstance();
+	$app =& App::getInstance();
 	
     if (!is_array($ranks)) {
Index: /trunk/css/admin.inc.css
===================================================================
--- /trunk/css/admin.inc.css	(revision 294)
+++ /trunk/css/admin.inc.css	(revision 295)
@@ -138,5 +138,5 @@
     margin-left: 9em;
     border-left: 1px solid gray;
-    padding: 0.75em 0.5em 15px 0.5em;
+    padding: 0.75em 0.5em 2em 0.5em;
     background-color: #FFF;
 }
Index: /trunk/css/admin2.inc.css
===================================================================
--- /trunk/css/admin2.inc.css	(revision 295)
+++ /trunk/css/admin2.inc.css	(revision 295)
@@ -0,0 +1,372 @@
+/**
+ * admin.css 
+ * code by strangecode :: www.strangecode.com :: this document contains copyrighted information
+ *
+ * CSS for the Strangecode administration sites.
+ */
+
+/*_____________________ GLOBAL ____________________*/
+body {
+    background: #fff;
+    margin: 0;
+    padding: 0;
+    font-family: verdana,geneva,arial,sans-serif;
+    color: #000;
+}
+
+a:link,
+a:visited { color: #336; text-decoration: underline; }
+a:hover   { color: #C30; text-decoration: none; }
+a:active  { color: #336; }
+
+/*_____________________ MISC ____________________*/
+
+/* The following are here in addition to in utilities.inc.css only because I want the font size 70%. Is there a more general way to do this? There currently are NO font-size specifications in utilities.inc.css or codebase.inc.css. That seems safest, but requires that they are redefined anyways (like here for eg). Have you figured out how to do font sizes correctly? */
+
+/* Why does having a form change the presentation of the page? Don't do that. */
+/* form { margin: 0; }
+
+form label {
+    font-size: 70%;
+    max-width: 25em;
+    font-weight: bold;
+}
+ */
+.help,
+.sc-help,
+.commandtext,
+.commanditem { font-size: 70%; }
+
+/* For fv err applied to tds. */
+td.sc-msg-warning,
+td.sc-msg-error,
+td.sc-msg-success,
+td.sc-msg-notice {
+	background: #fff;
+	color: #f00;
+	border: none;
+}
+
+
+/*_____________________ HEADER ____________________*/
+#userinfo {
+    width: 98%;
+    margin: 4px auto 2px;
+    background-color: #fff;
+    color: #333;
+    text-align: right;
+}
+
+#userinfo p {
+    margin: 0;
+    padding: 0;
+}
+
+#container {
+    width: 98%;
+    margin: 0 auto 10px;
+    background-color: #EEE;
+    border: 1px solid gray;
+}
+
+#top {
+    border-bottom: 1px solid gray;
+    background-color: #CCC;
+    padding: .5em;
+}
+
+#top h1 {
+    margin: 0;
+    padding: 0;
+    font-size: 150%;
+    color: #000;
+}
+
+/*_____________________ NAVIGATION ____________________*/
+#leftnav {
+    float: left;
+    width: 9em;
+    margin: 0 0 10px 0;
+/*     border-right: 1px solid gray; */
+    padding: 0;
+    background-color: #EEE;
+}
+
+#leftnav ul {
+    padding: 0;
+    margin: 0;
+    width: 9em;
+}
+
+#leftnav #navlist li {
+    list-style: none;
+    margin: 0;
+    border-bottom: 1px solid #ccc;
+    margin-left: 0em;
+    padding: 1px 0 2px 6px;
+    font-size: 70%;
+    font-weight: bold;
+}
+
+#leftnav #navlist li a {
+    text-decoration: none;
+    padding: 1px;
+}
+
+#leftnav #navlist li.label {
+    color: #999;
+	padding-top: 15px;
+	font-size: 90%;
+    font-weight: bold;
+}
+
+#leftnav a.addlink {
+    margin-left: 0.5em;
+    font-weight: normal;
+}
+
+#leftnav #navlist li a:link, #navlist li a:visited {
+    color: #336;
+}
+
+#leftnav #navlist li a:hover, #navlist li a:active {
+    color: #C00;
+}
+
+/*_____________________ CONTENT ____________________*/
+#content {
+    width: 100%;
+/*     margin-left: 1em; */
+    border-left: 1px solid gray;
+    padding: 0.75em 0.5em 15px 0.75em;
+    background-color: #FFF;
+}
+
+#content h1, #content h2, #content h3, #content h4, #content h5 {
+    margin: 0 0 .5em 0;
+}
+#content h1 { font-size: 130%; }
+#content h2 { font-size: 110%; }
+#content h3 { font-size: 90%; }
+#content h4 { font-size: 75%; }
+
+#content p {
+    margin: 0 0 .5em 0;
+    font-size: 70%;
+    line-height: 130%;
+}
+
+#content li {
+    margin: 0 0 0 0;
+    font-size: 70%;
+    line-height: 100%;
+}
+
+/*_____________________ TABLES ____________________*/
+/* BEAU: I copied this from NEXT. Please help! */
+table {
+	border-size: 1px;
+	border-collapse: collapse;
+	border-spacing: 0;
+}
+
+th {
+	padding: 2px;
+	text-align: left;
+	vertical-align: middle;
+	white-space: nowrap;
+}
+
+td {
+	vertical-align: top;
+    padding: 8px 6px 0 0;
+}
+
+table.list {
+	border-size: 1px;
+	width: 100%;
+	margin: 4px 0;
+}
+
+table.list th {
+	padding: 0 6px 1px 2px;
+	font-size: 70%;
+    border-top: 2px solid #eee;
+    border-bottom: 2px solid #eee;
+    background-color: #ddd;
+/*  border-bottom: 1px solid #000; */
+}
+
+table.list td, #commandbox table td {
+	font-size: 70%;
+	padding: 2px 6px 2px 2px;
+	border-bottom: 1px dotted #ccc;
+	vertical-align: top;
+}
+
+table.list tr:hover, #commandbox table tr:hover {
+    background: #FAF8C7;
+}
+
+/*_____________________ COMMANDS ____________________*/
+
+/* Should this be an ID??? */
+#commandbox
+{
+	padding: 3px 5px 5px 5px;
+	margin: 0 0 10px 0;
+    border: 2px solid #eee;
+    background-color: #ddd;
+	color: inherit;
+}
+
+.commanditem
+{
+	padding: 0 10px 5px 0;
+	white-space: nowrap;
+}
+
+#commandbox form {
+    margin: 8px 0 0 0;
+}
+
+/* I replaced all instances of commandtext with commanditem on the SC admin, but leave it here for sites I didn't. */
+.commandtext
+{
+	padding-right: 1em;
+}
+
+.command_left
+{
+	float: left;
+	white-space: nowrap;
+}
+
+.command_right
+{
+	position: relative;
+	visibility: visible;
+	white-space: nowrap;
+	float: right;
+}
+
+
+/*_____________________ FOOTER ____________________*/
+#footer {
+    clear: both;
+    margin: 0;
+    padding: 6px;
+    color: #333;
+    background-color: #DDD;
+    border-top: 1px solid gray;
+    font-size: 70%;
+    line-height: 100%;
+}
+
+#footer a:link, 
+#footer a:visited {
+    color: #333;
+    text-decoration: none;
+}
+
+#footer a:active, 
+#footer a:hover {
+    color: #333;
+    text-decoration: underline;
+}
+
+/* Form Defaults ---------------------------------------------------- */
+
+.sc-form {
+    width: 100%;
+    margin: 1em 0;
+}
+
+.sc-form-row {
+    margin: .35em 0;
+}
+.sc-form-row:after { content: " "; display: block; visibility: hidden; clear: both; height: 0.1px; font-size: 0.1em; line-height: 0; } /* clear floats - Ydnar Hack */
+
+fieldset {
+    margin: 1em 0 0 0;
+    padding: 0;
+	border: 0; 
+}
+
+legend {
+    font-size: 90%;
+    font-weight: bold; 
+    padding: 0;
+	margin: 0;
+}
+
+.sc-form textarea,
+.sc-tiny,
+.sc-small,
+.sc-medium,
+.sc-large, 
+.sc-full,
+#sc-captcha-input,
+input[type="text"],
+input[type="password"],
+textarea,
+select {
+    border: 1px solid #ccc;
+    padding: 2px;
+}
+label.sc-full {
+    border: none;
+}
+
+textarea {
+    padding: 0 2px;
+}
+
+.sc-form-row label {
+    font-size: 70%;
+    padding-top: 0.5em;
+}
+
+.sc-form-row>label:first-child {
+    display: block;
+    width: 120px;
+    float: left;
+    text-align: right;
+    padding-right: 10px;
+    font-style: italic;
+}
+
+.sc-form label span {
+    visibility: hidden;
+}
+
+.sc-form input {
+    padding: 2px;
+}
+
+input[type="submit"],
+input[type="button"] {
+    margin-right: 5px;
+    border: 1px solid #ccc;
+}
+
+.sc-submit-buttons {
+    margin-top: 20px;
+}
+.sc-form-row .sc-help {
+    margin-left: 130px;
+}
+
+input.sc-medium,
+textarea.sc-medium,
+select.sc-medium,
+label.sc-medium {
+    width: 21.25em;
+}
+
+label.sc-radio-label {
+    width: auto;
+/*     padding-right: 0;
+    padding-top: 0;
+    font-style: normal;
+ */}
Index: /trunk/css/codebase.inc.css
===================================================================
--- /trunk/css/codebase.inc.css	(revision 294)
+++ /trunk/css/codebase.inc.css	(revision 295)
@@ -11,8 +11,8 @@
 /* App.inc.php ------------------------------------------------------ */
 .sc-msg { z-index: 2000000000; } /* Close to the maximum of a 32-bit integer. */
+.sc-msg-success,
+.sc-msg-notice,
 .sc-msg-warning,
-.sc-msg-error,
-.sc-msg-success,
-.sc-msg-notice {
+.sc-msg-error {
 	margin: 0 0 6px 0;
 	padding: 5px;
@@ -23,4 +23,12 @@
 .sc-msg-success { color: #090; border-color: #090; }
 .sc-msg-notice { color: #C60; border-color: #C60; }
+
+form .sc-msg-success,
+form .sc-msg-notice,
+form .sc-msg-warning,
+form .sc-msg-error {
+    border-style: none;
+    padding: 0;
+}
 
 /* PEdit.inc.php ---------------------------------------------------- */
Index: /trunk/docs/examples/_config.inc.php
===================================================================
--- /trunk/docs/examples/_config.inc.php	(revision 294)
+++ /trunk/docs/examples/_config.inc.php	(revision 295)
@@ -1,12 +1,11 @@
 <?php
-/**
- * _config.inc.php lives in the document root of the site/application. It is the beginning of everything.
+/** * _config.inc.php lives in the document root of the site/application. It is the beginning of everything.
  *
  * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information.
  * @author  Quinn Comendant <quinn@strangecode.com>
- * @version 1.2
+ * @version 1.3
  * @since   03 Dec 2005 19:09:32
  */
-
+ 
 // The constant __FILE__ must be an absolute directory path, starting with / on unix or C: on windows.
 // To work around a PHP bug always include this config file with: require_once dirname(__FILE__) . '/_config.inc.php';
@@ -19,9 +18,9 @@
 define('COMMON_BASE', realpath(dirname(__FILE__) . '/../'));
 
-// The DocRoot for this application. SITE_BASE is ifferent from $_SERVER['DOCUMENT_ROOT'] because the
+// The DocRoot for this application. SITE_BASE is different from $_SERVER['DOCUMENT_ROOT'] because the 
 // latter does not change when using the apache Alias directive or URL Rewriting to define a site.
 define('SITE_BASE', dirname(__FILE__));
 
-// Set include path for all tempates.
+// Set include path for all templates.
 ini_set('include_path', join(PATH_SEPARATOR, array(
     COMMON_BASE,
@@ -32,11 +31,10 @@
 // Include core libraries.
 require_once 'codebase/lib/Utilities.inc.php';
-require_once 'codebase/lib/Auth_SQL.inc.php';
 require_once 'codebase/lib/App.inc.php';
 
 // Primary application class.
-$app =& App::getInstance('example.org');
+$app =& App::getInstance('public');
 $app->setParam(array(
-    'site_name' => 'My example site',
+    'site_name' => 'WWW Public Site',
     'site_email' => 'hello@example.com',
     'redirect_home_url' => '/',
@@ -47,13 +45,17 @@
     'character_set' => 'utf-8',
 
-    'enable_session' => false,
+    'enable_session' => true,
     'enable_db_session_handler' => false,
     'session_use_cookies' => true,
+    'session_use_trans_sid' => true, // Disable this for high-security sites where session-ID theft is a risk.
 
-    'enable_db' => false,
+    // 'ssl_domain' => 'www.example.com',
+    // 'ssl_enabled' => ($_SERVER['SERVER_NAME'] == 'www.example.com'),
+
+    'enable_db' => true,
     'db_always_debug' => false,
     'db_debug' => true,
     'db_die_on_failure' => true,
-    'db_create_tables' => true, /// Disable after site launch.
+    'db_create_tables' => true, // Disable after site launch.
 
     'display_errors' => true,
@@ -65,11 +67,14 @@
     'log_sms_priority' => false,
     'log_screen_priority' => false,
-    'log_to_email_address' => 'log@example.com',
-    'log_to_sms_address' => 'sms@example.com',
+    'log_to_email_address' => 'log@strangecode.com',
+    'log_to_sms_address' => 'sms-quinn@strangecode.com',
 ));
-// DB credentials for command line scripts stored in a file with read rights
-// given only to the user who will be executing the scripts: -rw-------
-// This file includes $app-> method calls so must be included after App.
-// require_once 'global/db_auth.inc.php';
+
+if (defined('_CLI')) {
+    // DB credentials for command line scripts stored in a file with read rights
+    // given only to the user who will be executing the scripts: -rw-------
+    // This file includes $app-> method calls so this must be included after App::getInstance().
+    require_once 'global/db_auth.inc.php';
+}
 
 // Start application-based functionality: database, session, environment, ini setup, etc.
@@ -77,24 +82,57 @@
 $app->start();
 
-// Global DB object. Automatically preconfigured by $app->start().
+// Global DB object. Automatically pre-configured by $app->start().
 $db =& DB::getInstance();
 
-// User authentication.
-$auth = new Auth_SQL('user');
+// Global Auth object.
+require_once 'codebase/lib/Auth_SQL.inc.php';
+$auth = new Auth_SQL('public');
 $auth->setParam(array(
     'db_table'          => 'user_tbl',
     'db_primary_key'    => 'user_id',
-    'login_url'         => '/login.php'
+    'login_url'         => '/login.php',
+    'login_timeout' => 260000, // 72 hours
+    'idle_timeout' => 86400, // 24 hours
 ));
 
-// Set CSS files.
+// Load preferences for the user.
+require_once 'codebase/lib/Prefs.inc.php';
+$prefs = new Prefs('permanent');
+$prefs->setParam(array(
+    'persistent' => $auth->isLoggedIn(),
+    'user_id' => $auth->get('user_id'),
+));
+$prefs->setDefaults(array(
+));
+$prefs->load();
+// Temporary prefs.
+$tmp_prefs = new Prefs('temporary');
+$tmp_prefs->setDefaults(array(
+));
+
+// Global record-locking object.
+require_once 'codebase/lib/Lock.inc.php';
+$lock =& Lock::getInstance($auth);
+$lock->setParam(array(
+    'timeout' => 0,
+    'auto_timeout' => 1800,
+    'error_url' => '/lock.php',
+));
+
+// Global cache object.
+require_once 'codebase/lib/Cache.inc.php';
+$cache = new Cache('global');
+$cache->setParam(array('enabled' => true));
+
+// Setup CSS files to include. These will always be available.
 require_once 'codebase/lib/CSS.inc.php';
 $css = new CSS();
-$css->setParam(array('cache_css' => true));
+$css->setParam(array('cache_css' => false)); /// Enable caching after site launch.
 $css->setFile('codebase/css/codebase.inc.css');
 $css->setFile('codebase/css/utilities.inc.css');
-$css->setFile('html/css/screen.inc.css');
+// $css->setFile('html/css/screen.inc.css');
 
-// Global navigation elements object.
+// Nav class for titles, breadcrumbs, and page features.
+// Global navigation titles, breadcrumbs, and page features.
 require_once 'codebase/lib/Navigation.inc.php';
 $nav = new Navigation(array(
@@ -103,3 +141,7 @@
 ));
 
+// Global site-specific configuration.
+// $cfg = array();
+// require_once 'global/config.inc.php';
+
 ?>
Index: /trunk/lib/TemplateGlue.inc.php
===================================================================
--- /trunk/lib/TemplateGlue.inc.php	(revision 294)
+++ /trunk/lib/TemplateGlue.inc.php	(revision 295)
@@ -62,7 +62,8 @@
  * @param  string $db_table   database table to lookup
  * @param  string $db_col     database column to lookup
+ * @param  bool   $sort          Sort the output.
  * @return array    Array of the set/enum values on success, false on failure.
  */
-function getSetEnumFieldValues($db_table, $db_col)
+function getSetEnumFieldValues($db_table, $db_col, $sort=false)
 {
 	$app =& App::getInstance();
@@ -73,5 +74,7 @@
     $row = mysql_fetch_row($qid);
     if (preg_match('/^enum|^set/i', $row[1]) && preg_match_all("/'([^']*)'/", $row[1], $enum)) {
-        natsort($enum[1]);
+        if ($sort) {
+            natsort($enum[1]);            
+        }
         return $enum[1];
     } else {
@@ -87,8 +90,9 @@
  * @param  string $db_table   database table to lookup
  * @param  string $db_col     database column to lookup
- */
-function printSetSelectForm($db_table, $db_col, $preselected, $blank=false)
-{
-    $values = getSetEnumFieldValues($db_table, $db_col);
+ * @param  bool   $sort          Sort the output.
+ */
+function printSetSelectForm($db_table, $db_col, $preselected, $blank=false, $sort=false)
+{
+    $values = getSetEnumFieldValues($db_table, $db_col, $sort);
     if ($values === false) {
         ?><option value="">&nbsp;</option>
@@ -121,8 +125,9 @@
  * @param  string $db_table   database table to lookup
  * @param  string $db_col     database column to lookup
- */
-function printEnumRadios($name, $db_table, $db_col, $preselected, $blank=false)
-{
-    $values = getSetEnumFieldValues($db_table, $db_col);
+ * @param  bool   $sort          Sort the output.
+ */
+function printEnumRadios($name, $db_table, $db_col, $preselected, $blank=false, $sort=false)
+{
+    $values = getSetEnumFieldValues($db_table, $db_col, $sort);
     if ($values === false) {
         return false;
@@ -145,6 +150,7 @@
  * @param  int    $columns       number of table columns to print
  * @param  int    $flag          set to 'allone' for name of input fields to all be the same of a multidimentional array.
- */
-function printSetCheckboxes($db_table, $db_col, $preselected, $columns=1, $flag=null)
+ * @param  bool   $sort          Sort the output.
+ */
+function printSetCheckboxes($db_table, $db_col, $preselected, $columns=1, $flag=null, $sort)
 {
     ?>
@@ -166,5 +172,5 @@
 
     // Retreive values of a Set or ENUM database column.
-    $values = getSetEnumFieldValues($db_table, $db_col);
+    $values = getSetEnumFieldValues($db_table, $db_col, $sort);
 
     // Initialize the HTML table generation vars.
@@ -222,7 +228,7 @@
  * @param  array  $preselected   array of preselected values (matching the values in $db_col)
  * @param  int    $columns       number of table columns to print
- * @param  int    $flag          set to 'allone' for name of input fields to all be the same of a multidimentional array.
- */
-function printSetRadios($db_table, $db_col, $preselected, $columns=1, $flag=null)
+ * @param  bool   $sort          Sort the output.
+ */
+function printSetRadios($db_table, $db_col, $preselected, $columns=1, $sort=false)
 {
     ?>
@@ -244,5 +250,5 @@
 
     // Retreive values of a Set or ENUM database column.
-    $values = getSetEnumFieldValues($db_table, $db_col);
+    $values = getSetEnumFieldValues($db_table, $db_col, $sort);
 
     // Initialize the HTML table generation vars.
Index: /trunk/services/admins.php
===================================================================
--- /trunk/services/admins.php	(revision 294)
+++ /trunk/services/admins.php	(revision 295)
@@ -39,20 +39,20 @@
 
 // Instantiate a sorting object with the default sort and order. Add SQL for each column.
-$so = new SortOrder('admin_tbl.admin_id', 'DESC');
-$so->setColumn('admin_tbl.admin_id', 'admin_tbl.admin_id ASC', 'admin_tbl.admin_id DESC');
-$so->setColumn('admin_tbl.username', 'admin_tbl.username ASC', 'admin_tbl.username DESC');
-$so->setColumn('admin_tbl.userpass', 'admin_tbl.userpass ASC', 'admin_tbl.userpass DESC');
-$so->setColumn('admin_tbl.first_name', 'admin_tbl.first_name ASC', 'admin_tbl.first_name DESC');
-$so->setColumn('admin_tbl.last_name', 'admin_tbl.last_name ASC', 'admin_tbl.last_name DESC');
-$so->setColumn('admin_tbl.email', 'admin_tbl.email ASC', 'admin_tbl.email DESC');
-$so->setColumn('admin_tbl.user_type', 'admin_tbl.user_type ASC', 'admin_tbl.user_type DESC');
-$so->setColumn('admin_tbl.seconds_online', 'admin_tbl.seconds_online ASC', 'admin_tbl.seconds_online DESC');
-$so->setColumn('admin_tbl.last_login_datetime', 'admin_tbl.last_login_datetime ASC', 'admin_tbl.last_login_datetime DESC');
-$so->setColumn('admin_tbl.last_access_datetime', 'admin_tbl.last_access_datetime ASC', 'admin_tbl.last_access_datetime DESC');
-$so->setColumn('admin_tbl.last_login_ip', 'admin_tbl.last_login_ip ASC', 'admin_tbl.last_login_ip DESC');
-$so->setColumn('admin_tbl.added_by_user_id', 'admin_tbl.added_by_user_id ASC', 'admin_tbl.added_by_user_id DESC');
-$so->setColumn('admin_tbl.modified_by_user_id', 'admin_tbl.modified_by_user_id ASC', 'admin_tbl.modified_by_user_id DESC');
-$so->setColumn('admin_tbl.added_datetime', 'admin_tbl.added_datetime ASC', 'admin_tbl.added_datetime DESC');
-$so->setColumn('admin_tbl.modified_datetime', 'admin_tbl.modified_datetime ASC', 'admin_tbl.modified_datetime DESC');
+$so = new SortOrder('admin_id', 'DESC');
+$so->setColumn('admin_id', $auth->getParam('db_primary_key') . ' ASC', $auth->getParam('db_primary_key') . ' DESC');
+$so->setColumn('username', $auth->getParam('db_username_column') . ' ASC', $auth->getParam('db_username_column') . ' DESC');
+$so->setColumn('userpass', $auth->getParam('db_table') . '.userpass ASC', $auth->getParam('db_table') . '.userpass DESC');
+$so->setColumn('first_name', $auth->getParam('db_table') . '.first_name ASC', $auth->getParam('db_table') . '.first_name DESC');
+$so->setColumn('last_name', $auth->getParam('db_table') . '.last_name ASC', $auth->getParam('db_table') . '.last_name DESC');
+$so->setColumn('email', $auth->getParam('db_table') . '.email ASC', $auth->getParam('db_table') . '.email DESC');
+$so->setColumn('user_type', $auth->getParam('db_table') . '.user_type ASC', $auth->getParam('db_table') . '.user_type DESC');
+$so->setColumn('seconds_online', $auth->getParam('db_table') . '.seconds_online ASC', $auth->getParam('db_table') . '.seconds_online DESC');
+$so->setColumn('last_login_datetime', $auth->getParam('db_table') . '.last_login_datetime ASC', $auth->getParam('db_table') . '.last_login_datetime DESC');
+$so->setColumn('last_access_datetime', $auth->getParam('db_table') . '.last_access_datetime ASC', $auth->getParam('db_table') . '.last_access_datetime DESC');
+$so->setColumn('last_login_ip', $auth->getParam('db_table') . '.last_login_ip ASC', $auth->getParam('db_table') . '.last_login_ip DESC');
+$so->setColumn('added_by_user_id', $auth->getParam('db_table') . '.added_by_user_id ASC', $auth->getParam('db_table') . '.added_by_user_id DESC');
+$so->setColumn('modified_by_user_id', $auth->getParam('db_table') . '.modified_by_user_id ASC', $auth->getParam('db_table') . '.modified_by_user_id DESC');
+$so->setColumn('added_datetime', $auth->getParam('db_table') . '.added_datetime ASC', $auth->getParam('db_table') . '.added_datetime DESC');
+$so->setColumn('modified_datetime', $auth->getParam('db_table') . '.modified_datetime ASC', $auth->getParam('db_table') . '.modified_datetime DESC');
 
 // Instantiate page numbers. Total items are set and calculation is done in the getRecordList function.
@@ -143,5 +143,5 @@
     if (getFormdata('cancel', false)) {
         // Remove lock
-        $lock->select('admin_tbl', 'admin_id', getFormData('admin_id'));
+        $lock->select($auth->getParam('db_table'), $auth->getParam('db_primary_key'), getFormData('admin_id'));
         $lock->remove();
         if ($app->validBoomerangURL('admins')) {
@@ -162,5 +162,5 @@
         if (getFormdata('repeat', false)) {
             // Display edit function with next available ID.
-            $qid = $db->query("SELECT admin_id FROM admin_tbl WHERE admin_id > '" . $db->escapeString(getFormData('admin_id')) . "' ORDER BY admin_id ASC LIMIT 1");
+            $qid = $db->query("SELECT " . $auth->getParam('db_primary_key') . " FROM " . $auth->getParam('db_table') . " WHERE " . $auth->getParam('db_primary_key') . " > '" . $db->escapeString(getFormData('admin_id')) . "' ORDER BY " . $auth->getParam('db_primary_key') . " ASC LIMIT 1");
             if (list($next_id) = mysql_fetch_row($qid)) {
                 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $next_id);
@@ -265,9 +265,10 @@
 function &editRecordForm($id)
 {
+    global $auth;
     global $lock;
 	$app =& App::getInstance();
 	$db =& DB::getInstance();
 	
-    $lock->select('admin_tbl', 'admin_id', $id);
+    $lock->select($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $id);
     if ($lock->isLocked() && !$lock->isMine()) {
         $lock->dieErrorPage();
@@ -276,7 +277,8 @@
     // Get the information for the form.
     $qid = $db->query("
-        SELECT *
-        FROM admin_tbl
-        WHERE admin_id = '" . $db->escapeString($id) . "'
+        SELECT *,
+        " . $auth->getParam('db_primary_key') . " AS admin_id
+        FROM " . $auth->getParam('db_table') . "
+        WHERE " . $auth->getParam('db_primary_key') . " = '" . $db->escapeString($id) . "'
     ");
     if (!$frm = mysql_fetch_assoc($qid)) {
@@ -287,5 +289,5 @@
 
     // Lock this record.
-    $lock->set('admin_tbl', 'admin_id', $id, $frm['username']);
+    $lock->set($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $id, $frm['username']);
 
     // Set misc values for the form.
@@ -328,5 +330,5 @@
 	$db =& DB::getInstance();
 	
-    $lock->select('admin_tbl', 'admin_id', $id);
+    $lock->select($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $id);
     if ($lock->isLocked() && !$lock->isMine()) {
         $lock->dieErrorPage();
@@ -338,6 +340,6 @@
     // Get the information for this object.
     $qid = $db->query("
-        SELECT username, user_type from admin_tbl
-        WHERE admin_id = '" . $db->escapeString($id) . "'
+        SELECT " . $auth->getParam('db_username_column') . ", user_type from " . $auth->getParam('db_table') . "
+        WHERE " . $auth->getParam('db_primary_key') . " = '" . $db->escapeString($id) . "'
     ");
     if (! list($name, $user_type) = mysql_fetch_row($qid)) {
@@ -348,5 +350,5 @@
 
     // Get the information for this object.
-    $qid = $db->query("SELECT COUNT(*) from admin_tbl");
+    $qid = $db->query("SELECT COUNT(*) from " . $auth->getParam('db_table') . "");
     list($num_admins) = mysql_fetch_row($qid);
     if ('root' == $user_type && 'root' != $auth->get('user_type')) {
@@ -361,5 +363,5 @@
     } else {
         // Delete the record.
-        $db->query("DELETE FROM admin_tbl WHERE admin_id = '" . $db->escapeString($id) . "'");
+        $db->query("DELETE FROM " . $auth->getParam('db_table') . " WHERE " . $auth->getParam('db_primary_key') . " = '" . $db->escapeString($id) . "'");
         $app->raiseMsg(sprintf(_("The admin <em>%s</em> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);
     }
@@ -381,6 +383,6 @@
     // Insert record data.
     $db->query("
-        INSERT INTO admin_tbl (
-            username,
+        INSERT INTO " . $auth->getParam('db_table') . " (
+            " . $auth->getParam('db_username_column') . ",
             first_name,
             last_name,
@@ -406,5 +408,5 @@
     // Create version.
     $version = Version::getInstance($auth);
-    $version->create('admin_tbl', 'admin_id', $last_insert_id, $frm['username']);
+    $version->create($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $last_insert_id, $frm['username']);
 
     $app->raiseMsg(sprintf(_("The Administrator <em>%s</em> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
@@ -421,5 +423,5 @@
 	$db =& DB::getInstance();
 	
-    $lock->select('admin_tbl', 'admin_id', $frm['admin_id']);
+    $lock->select($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $frm['admin_id']);
     if ($lock->isLocked() && !$lock->isMine()) {
         $lock->dieErrorPage();
@@ -437,6 +439,6 @@
     // Update record data.
     $db->query("
-        UPDATE admin_tbl SET
-            username = '" . $db->escapeString($frm['username']) . "',
+        UPDATE " . $auth->getParam('db_table') . " SET
+            " . $auth->getParam('db_username_column') . " = '" . $db->escapeString($frm['username']) . "',
             first_name = '" . $db->escapeString($frm['first_name']) . "',
             last_name = '" . $db->escapeString($frm['last_name']) . "',
@@ -445,10 +447,10 @@
             modified_by_user_id = '" . $db->escapeString($auth->get('user_id')) . "',
             modified_datetime = NOW()
-        WHERE admin_id = '" . $db->escapeString($frm['admin_id']) . "'
+        WHERE " . $auth->getParam('db_primary_key') . " = '" . $db->escapeString($frm['admin_id']) . "'
     ");
 
     // Create version.
     $version = Version::getInstance($auth);
-    $version->create('admin_tbl', 'admin_id', $frm['admin_id'], $frm['username']);
+    $version->create($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $frm['admin_id'], $frm['username']);
 
     $app->raiseMsg(sprintf(_("The Administrator <em>%s</em> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
@@ -464,4 +466,5 @@
     global $tmp_prefs;
     global $cache;
+    global $auth;
 	$db =& DB::getInstance();
 	
@@ -474,8 +477,8 @@
             $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . "
                 (
-                    admin_tbl.username LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
-                    OR admin_tbl.first_name LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
-                    OR admin_tbl.last_name LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
-                    OR admin_tbl.email LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
+                    " . $auth->getParam('db_table') . "." . $auth->getParam('db_username_column') . " LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
+                    OR " . $auth->getParam('db_table') . ".first_name LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
+                    OR " . $auth->getParam('db_table') . ".last_name LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
+                    OR " . $auth->getParam('db_table') . ".email LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
                 )
             ";
@@ -486,5 +489,5 @@
     $qid = $db->query("
         SELECT COUNT(*)
-        FROM admin_tbl
+        FROM " . $auth->getParam('db_table') . "
         $where_clause
     ");
@@ -498,10 +501,11 @@
     $sql = "
         SELECT
-            admin_tbl.*,
-            a1.username AS added_admin_username,
-            a2.username AS modified_admin_username
-        FROM admin_tbl
-        LEFT JOIN admin_tbl a1 ON (admin_tbl.added_by_user_id = a1.admin_id)
-        LEFT JOIN admin_tbl a2 ON (admin_tbl.modified_by_user_id = a2.admin_id)
+            " . $auth->getParam('db_table') . ".*,
+            " . $auth->getParam('db_table') . "." . $auth->getParam('db_primary_key') . " AS admin_id,            
+            a1." . $auth->getParam('db_username_column') . " AS added_admin_username,
+            a2." . $auth->getParam('db_username_column') . " AS modified_admin_username
+        FROM " . $auth->getParam('db_table') . "
+        LEFT JOIN " . $auth->getParam('db_table') . " a1 ON (" . $auth->getParam('db_table') . ".added_by_user_id = a1." . $auth->getParam('db_primary_key') . ")
+        LEFT JOIN " . $auth->getParam('db_table') . " a2 ON (" . $auth->getParam('db_table') . ".modified_by_user_id = a2." . $auth->getParam('db_primary_key') . ")
         $where_clause
         " . $so->getSortOrderSQL() . "
Index: /trunk/services/templates/admin_form.ihtml
===================================================================
--- /trunk/services/templates/admin_form.ihtml	(revision 294)
+++ /trunk/services/templates/admin_form.ihtml	(revision 295)
@@ -1,5 +1,5 @@
 <?php $fv->printErrorMessages(); ?>
 
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>">
+<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
 <?php $app->printHiddenSession(); ?>
 <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" />
@@ -46,5 +46,5 @@
         <td>
             <select name="user_type" class="sc-small">
-            <?php printSetSelectForm('admin_tbl', 'user_type', $frm['user_type'], true); ?>
+                <?php printSetSelectForm($auth->getParam('db_table'), 'user_type', $frm['user_type'], true); ?>
             </select>
         </td>
Index: /trunk/services/templates/admin_list.ihtml
===================================================================
--- /trunk/services/templates/admin_list.ihtml	(revision 294)
+++ /trunk/services/templates/admin_list.ihtml	(revision 295)
@@ -1,17 +1,17 @@
 
 <?php $fv->printErrorMessages(); ?>
-<form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get">
-<?php $app->printHiddenSession(false); ?>
+
 <div id="commandbox">
-    <span class="sc-nowrap commanditem"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add administrator"); ?></a></span>
-
-    <div class="form">
+    <span class="sc-nowrap commanditem"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add Administrator"); ?></a></span>
+    <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
+        <?php $app->printHiddenSession(false); ?>
         <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: Admin id, Username, Userpass, First name, Last name, Email.")); ?>" />
         <input type="submit" value="<?php echo _("Search"); ?>" />
-    </div>
+    </form>
 </div>
 
 <?php include 'list_info.ihtml'; ?>
 
+<form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
 <table class="list">
     <tr>
@@ -33,5 +33,5 @@
     <tr>
         <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0" /></a> &nbsp;</td>
-        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF('/admin/versions.php?record_table=admin_tbl&record_key=admin_id&boomerang=true&record_val=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF(sprintf('/admin/versions.php?record_table=%s&record_key=%s&record_val=%s&boomerang=true', $auth->getParam('db_table'), $auth->getParam('db_primary_key'), $list[$i]['admin_id'])); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
         <td class="sc-nowrap"><?php echo oTxt($list[$i]['admin_id'], true); ?> &nbsp;</td>
         <td class="sc-nowrap"><?php echo oTxt($list[$i]['username'], true); ?> &nbsp;</td>
Index: /trunk/services/templates/lock.ihtml
===================================================================
--- /trunk/services/templates/lock.ihtml	(revision 294)
+++ /trunk/services/templates/lock.ihtml	(revision 295)
@@ -4,5 +4,5 @@
 }
 ?>
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>">
+<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
     <?php $app->printHiddenSession() ?>
     <input type="hidden" name="lock_id" value="<?php echo $lock->getID(); ?>" />
Index: /trunk/services/templates/log_list.ihtml
===================================================================
--- /trunk/services/templates/log_list.ihtml	(revision 294)
+++ /trunk/services/templates/log_list.ihtml	(revision 295)
@@ -1,3 +1,3 @@
-<form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get">
+<form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
 <?php $app->printHiddenSession(false); ?>
 <div id="commandbox">
Index: /trunk/services/templates/login_form.ihtml
===================================================================
--- /trunk/services/templates/login_form.ihtml	(revision 294)
+++ /trunk/services/templates/login_form.ihtml	(revision 295)
@@ -1,3 +1,3 @@
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>">
+<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
 <?php $app->printHiddenSession() ?>
 <table>
Index: /trunk/services/templates/password.ihtml
===================================================================
--- /trunk/services/templates/password.ihtml	(revision 294)
+++ /trunk/services/templates/password.ihtml	(revision 295)
@@ -1,5 +1,5 @@
 <?php $fv->printErrorMessages(); ?>
 
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>">
+<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
 <?php $app->printHiddenSession() ?>
 <input type="hidden" name="op" value="update_password" />
Index: /trunk/services/templates/versions_list.ihtml
===================================================================
--- /trunk/services/templates/versions_list.ihtml	(revision 294)
+++ /trunk/services/templates/versions_list.ihtml	(revision 295)
@@ -1,3 +1,3 @@
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>">
+<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
 <?php $app->printHiddenSession() ?>
 <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" />
