Index: branches/1.1dev/bin/module_maker/_config.inc.php
===================================================================
--- branches/1.1dev/bin/module_maker/_config.inc.php	(revision 105)
+++ branches/1.1dev/bin/module_maker/_config.inc.php	(revision 109)
@@ -9,4 +9,5 @@
 if ($_SERVER['argc'] > 1 && '' != $site_base && is_dir($site_base)) {
     // First arg is path to current site. Realpath removes trailing /s
+    define('COMMON_BASE', $_SERVER['argv'][1]);
     define('SITE_BASE', $site_base);
 } else {
Index: branches/1.1dev/bin/module_maker/list_template.cli.php
===================================================================
--- branches/1.1dev/bin/module_maker/list_template.cli.php	(revision 105)
+++ branches/1.1dev/bin/module_maker/list_template.cli.php	(revision 109)
@@ -77,11 +77,11 @@
             $listrows[] = "<\x3fphp echo strlen(\$list[\$i]['$field'])<50 \x3f oTxt(\$list[\$i]['$field'], true) : oTxt(trim(substr(\$list[\$i]['$field'], 0, 50)) . '...'); \x3f>";
         } else if (preg_match('/.*(begin|start).*date.*/i', $field)) {
-            $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date($CFG->date_format, strtotime(\$list[\$i]['$field'])); \x3f>";
+            $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date(\$CFG->date_format, strtotime(\$list[\$i]['$field'])); \x3f>";
         } else if (preg_match('/.*(end|expire).*date.*/i', $field)) {
-            $listrows[] = "<\x3fphp echo '9999-12-31' == \$list[\$i]['$field'] ? '' : date($CFG->date_format, strtotime(\$list[\$i]['$field'])); \x3f>";
+            $listrows[] = "<\x3fphp echo '9999-12-31' == \$list[\$i]['$field'] ? '' : date(\$CFG->date_format, strtotime(\$list[\$i]['$field'])); \x3f>";
         } else if (preg_match('/datetime/i', $type)) {
-            $listrows[] = "<\x3fphp echo '0000-00-00 00:00:00' == \$list[\$i]['$field'] ? '' : date($CFG->date_format, strtotime(\$list[\$i]['$field'])); \x3f>";
+            $listrows[] = "<\x3fphp echo '0000-00-00 00:00:00' == \$list[\$i]['$field'] ? '' : date(\$CFG->date_format, strtotime(\$list[\$i]['$field'])); \x3f>";
         } else if (preg_match('/date/i', $type)) {
-            $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date($CFG->date_format, strtotime(\$list[\$i]['$field'])); \x3f>";
+            $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date(\$CFG->date_format, strtotime(\$list[\$i]['$field'])); \x3f>";
         } else if (preg_match('/(amount|_rate)/i', $field)) {
             $listrows[] = "<\x3fphp printf('$%01.2f', \$list[\$i]['$field']); \x3f>";
Index: branches/1.1dev/bin/module_maker/module.cli.php
===================================================================
--- branches/1.1dev/bin/module_maker/module.cli.php	(revision 105)
+++ branches/1.1dev/bin/module_maker/module.cli.php	(revision 109)
@@ -258,5 +258,5 @@
 echo "Generating admin form table rows...\n";
 $output = array();
-exec(dirname($_SERVER['argv'][0]) . "/form_template.cli.php $db_tbl", $output, $return_val);
+exec(dirname($_SERVER['argv'][0]) . "/form_template.cli.php " . COMMON_BASE . " $db_tbl", $output, $return_val);
 if ($return_val == 0) {
     $search['adm_form_table_rows'] = '/%ADM_FORM_TABLE_ROWS%/';
@@ -268,5 +268,5 @@
 echo "Generating admin list table header rows...\n";
 $output = array();
-exec(dirname($_SERVER['argv'][0]) . "/list_template.cli.php $db_tbl headerrows", $output, $return_val);
+exec(dirname($_SERVER['argv'][0]) . "/list_template.cli.php " . COMMON_BASE . "  $db_tbl headerrows", $output, $return_val);
 if ($return_val == 0) {
     $search['adm_list_header_rows'] = '/%ADM_LIST_HEADER_ROWS%/';
@@ -278,5 +278,5 @@
 echo "Generating admin list table rows...\n";
 $output = array();
-exec(dirname($_SERVER['argv'][0]) . "/list_template.cli.php $db_tbl listrows", $output, $return_val);
+exec(dirname($_SERVER['argv'][0]) . "/list_template.cli.php " . COMMON_BASE . "  $db_tbl listrows", $output, $return_val);
 if ($return_val == 0) {
     $search['adm_list_rows'] = '/%ADM_LIST_ROWS%/';
@@ -288,5 +288,5 @@
 echo "Generating sortorder...\n";
 $output = array();
-exec(dirname($_SERVER['argv'][0]) . "/sql.cli.php $db_tbl sortorder", $output, $return_val);
+exec(dirname($_SERVER['argv'][0]) . "/sql.cli.php " . COMMON_BASE . "  $db_tbl sortorder", $output, $return_val);
 if ($return_val == 0) {
     $search['sort_order'] = '/%SORT_ORDER%/';
@@ -298,5 +298,5 @@
 echo "Generating insert data...\n";
 $output = array();
-exec(dirname($_SERVER['argv'][0]) . "/sql.cli.php $db_tbl insert", $output, $return_val);
+exec(dirname($_SERVER['argv'][0]) . "/sql.cli.php " . COMMON_BASE . "  $db_tbl insert", $output, $return_val);
 if ($return_val == 0) {
     $search['insert'] = '/%INSERT%/';
@@ -308,5 +308,5 @@
 echo "Generating update data...\n";
 $output = array();
-exec(dirname($_SERVER['argv'][0]) . "/sql.cli.php $db_tbl update", $output, $return_val);
+exec(dirname($_SERVER['argv'][0]) . "/sql.cli.php " . COMMON_BASE . "  $db_tbl update", $output, $return_val);
 if ($return_val == 0) {
     $search['update'] = '/%UPDATE%/';
@@ -318,5 +318,5 @@
 echo "Generating search data...\n";
 $output = array();
-exec(dirname($_SERVER['argv'][0]) . "/sql.cli.php $db_tbl search", $output, $return_val);
+exec(dirname($_SERVER['argv'][0]) . "/sql.cli.php " . COMMON_BASE . "  $db_tbl search", $output, $return_val);
 if ($return_val == 0) {
     $search['search'] = '/%SEARCH%/';
@@ -328,5 +328,5 @@
 echo "Generating form validation data...\n";
 $output = array();
-exec(dirname($_SERVER['argv'][0]) . "/validation.cli.php $db_tbl", $output, $return_val);
+exec(dirname($_SERVER['argv'][0]) . "/validation.cli.php " . COMMON_BASE . " $db_tbl", $output, $return_val);
 if ($return_val == 0) {
     $search['form_validation'] = '/%FORM_VALIDATION%/';
Index: branches/1.1dev/bin/module_maker/skel/adm_list.ihtml
===================================================================
--- branches/1.1dev/bin/module_maker/skel/adm_list.ihtml	(revision 105)
+++ branches/1.1dev/bin/module_maker/skel/adm_list.ihtml	(revision 109)
@@ -1,42 +1,45 @@
 
 <?php include 'form_error_header.ihtml'; ?>
-<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
-<?php printHiddenSession(false); ?>
 
 <div id="commandbox">
-    <span class="nowrap commandtext"><a href="<?php echo ohref($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add %ITEM_TITLE%"); ?></a></span>
-    <br />
+    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
+        <?php printHiddenSession(false); ?>
+        <span class="nowrap commandtext"><a href="<?php echo ohref($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add %ITEM_TITLE%"); ?></a></span>
+        <br />
     
-    <input type="text" class="forminputtext" 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" name="list" value="<?php echo _("Search"); ?>" />
+        <input type="text" class="forminputtext" 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" name="list" value="<?php echo _("Search"); ?>" />
+    </form>
 </div>
 
 <?php include 'adm_list_info.ihtml'; ?>
 
-<table class="list">
-    <tr>
-        <th>&nbsp;</th>
-        <th>&nbsp;</th>
-%ADM_LIST_HEADER_ROWS%
-        <th>&nbsp;</th>
-    </tr>
-    <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
-    <tr>
-        <td class="padleft nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo ohref($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="<?php echo $CFG->admin_url; ?>/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
-        <td class="padleft nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo ohref("$CFG->admin_url/record_versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=" . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="<?php echo $CFG->admin_url; ?>/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
-%ADM_LIST_ROWS%
-        <td class="padleft nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo 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]['______RECORD_NAME______'])) ?>')"><img src="<?php echo $CFG->admin_url; ?>/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
-    </tr>
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+    <?php printHiddenSession(false); ?>
+    <table class="list">
+        <tr>
+            <th>&nbsp;</th>
+            <th>&nbsp;</th>
+    %ADM_LIST_HEADER_ROWS%
+            <th>&nbsp;</th>
+        </tr>
+        <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
+        <tr>
+            <td class="padleft nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo ohref($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="<?php echo $CFG->admin_url; ?>/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
+            <td class="padleft nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo ohref("$CFG->admin_url/record_versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=" . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="<?php echo $CFG->admin_url; ?>/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
+    %ADM_LIST_ROWS%
+            <td class="padleft nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo 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]['______RECORD_NAME______'])) ?>')"><img src="<?php echo $CFG->admin_url; ?>/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
+        </tr>
+        <?php } ?>
+    </table>
+
+    <?php if ($page->total_pages > 1) { ?>
+    <div class="nowrap commandtext" style="float: right;"><?php echo _("Pages:"); ?>&nbsp;<?php $page->printPageNumbers() ?></div>
     <?php } ?>
-</table>
-
-<?php if ($page->total_pages > 1) { ?>
-<div class="nowrap commandtext" style="float: right;"><?php echo _("Pages:"); ?>&nbsp;<?php $page->printPageNumbers() ?></div>
-<?php } ?>
-<?php if ($page->total_items > 0) { ?>
-<div class="commanditem"><input type="submit" name="op" value="<?php echo _("Save rank"); ?>" /></div>
-<?php } ?>
+    <?php if ($page->total_items > 0) { ?>
+    <div class="commanditem"><input type="submit" name="op" value="<?php echo _("Save rank"); ?>" /></div>
+    <?php } ?>
 </form>
Index: branches/1.1dev/lib/Hierarchy.inc.php
===================================================================
--- branches/1.1dev/lib/Hierarchy.inc.php	(revision 105)
+++ branches/1.1dev/lib/Hierarchy.inc.php	(revision 109)
@@ -712,5 +712,5 @@
             for ($i=0; $i<$num_children; $i++) {
 
-                // Preventing circular references (Except when including current  item in list).
+                // Preventing circular references (Except when including current item in list).
                 if ($my_children[$i]['child_type'] == $child_type && $my_children[$i]['child_id'] == $child_id && !($_return_flag && $include_curr)) {
                     logMsg(sprintf(_("Circular reference detected: %s has itself as a parent."), $this->toStringID($my_children[$i]['child_type'], $my_children[$i]['child_id'])), LOG_ERR, __FILE__, __LINE__);
@@ -748,4 +748,16 @@
     }
     
+    /*
+    * Returns an array converted from a stack to a multidimentional hierarchy based on the parent types and ids.
+    *
+    * @access   public
+    * @param    array   $curr           The starting array to convert from.
+    * @param    string  $child_type     Optional root node type to start from.
+    * @param    int     $child_id       Optional root node id to start from.
+    * @return   array                   Multidimentional array.
+    * @author   Quinn Comendant <quinn@strangecode.com>
+    * @version  1.0
+    * @since    26 Apr 2006 15:40:30
+    */
     function convertListToTree($curr, $child_type=null, $child_id=null, $_indent=0)
     {
@@ -814,4 +826,13 @@
     }
 
+    /*
+    * Prints a nested HTML list from input array generated by convertListToTree().
+    *
+    * @access   public
+    * @param    array   $in     Input array.
+    * @author   Quinn Comendant <quinn@strangecode.com>
+    * @version  1.0
+    * @since    26 Apr 2006 15:50:00
+    */
     function printTree($in)
     {
