summaryrefslogtreecommitdiff
path: root/includes/pager.inc
diff options
context:
space:
mode:
authorGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-04-13 08:25:27 +0000
committerGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-04-13 08:25:27 +0000
commitd6a164c4008395e323ef8888a3c8867188f40d6b (patch)
tree490ba9b27d1241a595edc4ff055d77fdfced2420 /includes/pager.inc
parentbfb407601b73ccd6fbe79481dcc49517fcbdbe67 (diff)
downloadbrdo-d6a164c4008395e323ef8888a3c8867188f40d6b.tar.gz
brdo-d6a164c4008395e323ef8888a3c8867188f40d6b.tar.bz2
#5371, drupal_get_destination, pager and tablesort array handling, patch by Steven
Diffstat (limited to 'includes/pager.inc')
-rw-r--r--includes/pager.inc24
1 files changed, 22 insertions, 2 deletions
diff --git a/includes/pager.inc b/includes/pager.inc
index 80d80dd82..9f36f2ab8 100644
--- a/includes/pager.inc
+++ b/includes/pager.inc
@@ -84,6 +84,21 @@ function pager_query($query, $limit = 10, $element = 0, $count_query = NULL) {
}
/**
+ * Compose a query string to append to pager requests.
+ *
+ * @return
+ * A query string that consists of all components of the current page request
+ * except for those pertaining to paging.
+ */
+function pager_get_querystring() {
+ static $string = NULL;
+ if (!isset($string)) {
+ $string = drupal_query_string_encode($_REQUEST, array_merge(array('q', 'page'), array_keys($_COOKIE)));
+ }
+ return $string;
+}
+
+/**
* Format a query pager.
*
* Menu callbacks that display paged query results should call theme('pager') to
@@ -179,6 +194,7 @@ function theme_pager_previous($text, $limit, $element = 0, $interval = 1, $param
// If we are anywhere but the first page
if ($pager_page_array[$element] > 0) {
$page_new = pager_load_array($pager_page_array[$element] - $interval, $element, $pager_page_array);
+
// If the previous page is the first page, mark the link as such.
if ($page_new[$element] == 0) {
$output = theme('pager_first', $text, $limit, $element, $parameters);
@@ -357,8 +373,12 @@ function theme_pager_link($text, $page_new, $element, $parameters = array(), $at
}
$query = array();
- foreach ($parameters as $key => $value) {
- $query[] = $key .'='. $value;
+ if (count($parameters)) {
+ $query[] = drupal_query_string_encode($parameters, array());
+ }
+ $querystring = pager_get_querystring();
+ if ($querystring != '') {
+ $query[] = $querystring;
}
// Set each pager link title