Index: trunk/bin/module_maker/skel/admin.php
===================================================================
--- trunk/bin/module_maker/skel/admin.php	(revision 405)
+++ trunk/bin/module_maker/skel/admin.php	(revision 408)
@@ -67,7 +67,13 @@
 $page->setPageNumber(getFormData('page_number'));
 
-// Search limiters retain their values between page requests.
-$app->carryQuery('search_query');
-$app->carryQuery('filter___///__');
+// Query parameters to retain always.
+$app->carryQuery(array(
+    'filter___///__',
+));
+
+// Query parameters to retain only locally.
+$locally_carried_queries = array(
+    'search_query',
+);
 %ADMIN_UPLOAD_CONFIG%
 /********************************************************************
@@ -107,8 +113,8 @@
     if ($app->validBoomerangURL('%NAME_PLURAL%')) {
         // Display boomerang page.
-        $app->dieBoomerangURL('%NAME_PLURAL%');
+        $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
     }
     // Display default page.
-    $app->dieURL($_SERVER['PHP_SELF']);
+    $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
     break;
 
@@ -117,8 +123,8 @@
         if ($app->validBoomerangURL('%NAME_PLURAL%')) {
             // Display boomerang page.
-            $app->dieBoomerangURL('%NAME_PLURAL%');
+            $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
         }
         // Display default page.
-        $app->dieURL($_SERVER['PHP_SELF']);
+        $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
     }
     validateInput();
@@ -132,11 +138,11 @@
         if (getFormdata('repeat', false)) {
             // Display function again.
-            $app->dieURL($_SERVER['PHP_SELF'] . '?op=add');
+            $app->dieURL($_SERVER['PHP_SELF'] . '?op=add', $locally_carried_queries);
         } else if ($app->validBoomerangURL('%NAME_PLURAL%')) {
             // Display boomerang page.
-            $app->dieBoomerangURL('%NAME_PLURAL%');
+            $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
         }
         // Display default page.
-        $app->dieURL($_SERVER['PHP_SELF']);
+        $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
     }
     break;
@@ -145,5 +151,5 @@
     if (getFormdata('reset', false)) {
         $app->raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__);
-        $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%'));
+        $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%'), $locally_carried_queries);
     }
     if (getFormdata('cancel', false)) {
@@ -153,8 +159,8 @@
         if ($app->validBoomerangURL('%NAME_PLURAL%')) {
             // Display boomerang page.
-            $app->dieBoomerangURL('%NAME_PLURAL%');
+            $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
         }
         // Display default page.
-        $app->dieURL($_SERVER['PHP_SELF']);
+        $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
     }
     validateInput();
@@ -170,5 +176,5 @@
             $qid = $db->query("SELECT %PRIMARY_KEY% FROM %DB_TBL% WHERE %PRIMARY_KEY% > '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' ORDER BY %PRIMARY_KEY% ASC LIMIT 1");
             if (list($next_id) = mysql_fetch_row($qid)) {
-                $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id);
+                $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id, $locally_carried_queries);
             } else {
                 $app->raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__);
@@ -176,8 +182,8 @@
         } else if ($app->validBoomerangURL('%NAME_PLURAL%')) {
             // Display boomerang page.
-            $app->dieBoomerangURL('%NAME_PLURAL%');
+            $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
         }
         // Display default page.
-        $app->dieURL($_SERVER['PHP_SELF']);
+        $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
     }
     break;
@@ -185,5 +191,5 @@
 case _("Save rank") :
     updateRank(getFormData('rank'));
-    $app->dieURL($_SERVER['PHP_SELF']);
+    $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
     break;
 
@@ -199,4 +205,5 @@
 
 include 'header.ihtml';
+$app->carryQuery($locally_carried_queries);
 include $main_template;
 include 'footer.ihtml';
@@ -244,5 +251,5 @@
         $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);
         $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
-        $app->dieBoomerangURL();
+        $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
     }
 
@@ -289,5 +296,5 @@
         $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);
         $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
-        $app->dieBoomerangURL();
+        $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
     }
 
