Fix Bug #838070: Refactor the page browser in list view

This commit is contained in:
Sebastian Meyer 2011-11-10 17:23:13 +01:00
commit ca18769766
2 changed files with 47 additions and 9 deletions

View File

@ -82,23 +82,59 @@ class tx_dlf_listview extends tx_dlf_plugin {
}
$output = ($this->piVars['pointer'] > 0 ? $this->pi_linkTP_keepPIvars($this->pi_getLL('firstPage', '<'), array ('pointer' => $this->piVars['pointer'] - 1), TRUE) : $this->pi_getLL('firstPage', '<'));
// Get separator.
$separator = $this->pi_getLL('separator', ' - ');
$output .= $this->pi_getLL('separator', ' - ');
// Add link to previous page.
if ($this->piVars['pointer'] > 0) {
$output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '<'), array ('pointer' => $this->piVars['pointer'] - 1), TRUE).$separator;
} else {
$output = $this->pi_getLL('prevPage', '<').$separator;
}
$i = 0;
while ($i < $maxPages) {
$output .= ($this->piVars['pointer'] != $i ? $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d'), $i + 1), array ('pointer' => $i), TRUE) : sprintf($this->pi_getLL('page', '%d'), $i + 1));
if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) {
$output .= $this->pi_getLL('separator', ' - ');
if ($this->piVars['pointer'] != $i) {
$output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d'), $i + 1), array ('pointer' => $i), TRUE).$separator;
} else {
$output .= sprintf($this->pi_getLL('page', '%d'), $i + 1).$separator;
}
$skip = TRUE;
} elseif ($skip == TRUE) {
$output .= $this->pi_getLL('skip', '...').$separator;
$skip = FALSE;
}
$i++;
}
$output .= ($this->piVars['pointer'] < $maxPages - 1 ? $this->pi_linkTP_keepPIvars($this->pi_getLL('lastPage', '&gt;'), array ('pointer' => $this->piVars['pointer'] + 1), TRUE) : $this->pi_getLL('lastPage', '&gt;'));
if ($this->piVars['pointer'] < $maxPages - 1) {
$output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '&gt;'), array ('pointer' => $this->piVars['pointer'] + 1), TRUE);
} else {
$output .= $this->pi_getLL('nextPage', '&gt;');
}
return $output;

View File

@ -13,10 +13,11 @@
<label index="tt_content.pi_flexform.templateFile">Template file</label>
<label index="nohits">Nothing found.</label>
<label index="count">Entries %d to %d of %d.</label>
<label index="firstPage">&lt;</label>
<label index="lastPage">&gt;</label>
<label index="prevPage">&lt;</label>
<label index="nextPage">&gt;</label>
<label index="page">%d</label>
<label index="separator"> - </label>
<label index="skip">...</label>
<label index="orderBy">Order by: </label>
<label index="noTitle">[no title]</label>
</languageKey>
@ -28,10 +29,11 @@
<label index="tt_content.pi_flexform.templateFile">HTML-Template</label>
<label index="nohits">Keine Treffer.</label>
<label index="count">Einträge %d bis %d von %d.</label>
<label index="firstPage">&lt;</label>
<label index="lastPage">&gt;</label>
<label index="prevPage">&lt;</label>
<label index="nextPage">&gt;</label>
<label index="page">%d</label>
<label index="separator"> - </label>
<label index="skip">...</label>
<label index="orderBy">Sortieren nach: </label>
<label index="noTitle">[kein Titel]</label>
</languageKey>