Index: trunk/bin/module_maker/form_template.cli.php
===================================================================
--- trunk/bin/module_maker/form_template.cli.php	(revision 270)
+++ 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 270)
+++ 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 270)
+++ 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 270)
+++ 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 270)
+++ 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 270)
+++ 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)) {
