Changeset 408 for trunk/bin


Ignore:
Timestamp:
Aug 30, 2012 5:52:29 PM (12 years ago)
Author:
anonymous
Message:

Improved admin list filter query retention

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/skel/admin.php

    r405 r408  
    6767$page->setPageNumber(getFormData('page_number'));
    6868
    69 // Search limiters retain their values between page requests.
    70 $app->carryQuery('search_query');
    71 $app->carryQuery('filter___///__');
     69// Query parameters to retain always.
     70$app->carryQuery(array(
     71    'filter___///__',
     72));
     73
     74// Query parameters to retain only locally.
     75$locally_carried_queries = array(
     76    'search_query',
     77);
    7278%ADMIN_UPLOAD_CONFIG%
    7379/********************************************************************
     
    107113    if ($app->validBoomerangURL('%NAME_PLURAL%')) {
    108114        // Display boomerang page.
    109         $app->dieBoomerangURL('%NAME_PLURAL%');
     115        $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
    110116    }
    111117    // Display default page.
    112     $app->dieURL($_SERVER['PHP_SELF']);
     118    $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
    113119    break;
    114120
     
    117123        if ($app->validBoomerangURL('%NAME_PLURAL%')) {
    118124            // Display boomerang page.
    119             $app->dieBoomerangURL('%NAME_PLURAL%');
     125            $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
    120126        }
    121127        // Display default page.
    122         $app->dieURL($_SERVER['PHP_SELF']);
     128        $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
    123129    }
    124130    validateInput();
     
    132138        if (getFormdata('repeat', false)) {
    133139            // Display function again.
    134             $app->dieURL($_SERVER['PHP_SELF'] . '?op=add');
     140            $app->dieURL($_SERVER['PHP_SELF'] . '?op=add', $locally_carried_queries);
    135141        } else if ($app->validBoomerangURL('%NAME_PLURAL%')) {
    136142            // Display boomerang page.
    137             $app->dieBoomerangURL('%NAME_PLURAL%');
     143            $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
    138144        }
    139145        // Display default page.
    140         $app->dieURL($_SERVER['PHP_SELF']);
     146        $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
    141147    }
    142148    break;
     
    145151    if (getFormdata('reset', false)) {
    146152        $app->raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__);
    147         $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%'));
     153        $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%'), $locally_carried_queries);
    148154    }
    149155    if (getFormdata('cancel', false)) {
     
    153159        if ($app->validBoomerangURL('%NAME_PLURAL%')) {
    154160            // Display boomerang page.
    155             $app->dieBoomerangURL('%NAME_PLURAL%');
     161            $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
    156162        }
    157163        // Display default page.
    158         $app->dieURL($_SERVER['PHP_SELF']);
     164        $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
    159165    }
    160166    validateInput();
     
    170176            $qid = $db->query("SELECT %PRIMARY_KEY% FROM %DB_TBL% WHERE %PRIMARY_KEY% > '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' ORDER BY %PRIMARY_KEY% ASC LIMIT 1");
    171177            if (list($next_id) = mysql_fetch_row($qid)) {
    172                 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id);
     178                $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id, $locally_carried_queries);
    173179            } else {
    174180                $app->raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__);
     
    176182        } else if ($app->validBoomerangURL('%NAME_PLURAL%')) {
    177183            // Display boomerang page.
    178             $app->dieBoomerangURL('%NAME_PLURAL%');
     184            $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
    179185        }
    180186        // Display default page.
    181         $app->dieURL($_SERVER['PHP_SELF']);
     187        $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
    182188    }
    183189    break;
     
    185191case _("Save rank") :
    186192    updateRank(getFormData('rank'));
    187     $app->dieURL($_SERVER['PHP_SELF']);
     193    $app->dieURL($_SERVER['PHP_SELF'], $locally_carried_queries);
    188194    break;
    189195
     
    199205
    200206include 'header.ihtml';
     207$app->carryQuery($locally_carried_queries);
    201208include $main_template;
    202209include 'footer.ihtml';
     
    244251        $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);
    245252        $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
    246         $app->dieBoomerangURL();
     253        $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
    247254    }
    248255
     
    289296        $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);
    290297        $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
    291         $app->dieBoomerangURL();
     298        $app->dieBoomerangURL('%NAME_PLURAL%', $locally_carried_queries);
    292299    }
    293300
Note: See TracChangeset for help on using the changeset viewer.