Index: typo3/class.db_list.inc
===================================================================
--- typo3/class.db_list.inc (revision 4593)
+++ typo3/class.db_list.inc (working copy)
@@ -107,6 +107,7 @@
var $id; // Page id
var $table=''; // Tablename if single-table mode
var $listOnlyInSingleTableMode=FALSE; // If true, records are listed only if a specific table is selected.
+ var $pagination = TRUE; // If true, displays a page selector for tables with many records.
var $firstElementNumber=0; // Pointer for browsing list
var $searchString=''; // Search string
var $searchLevels=''; // Levels to search down.
@@ -642,6 +643,7 @@
* Creates the URL to this script, including all relevant GPvars
* Fixed GPvars are id, table, imagemode, returlUrl, search_field, search_levels and showLimit
* The GPvars "sortField" and "sortRev" are also included UNLESS they are found in the $exclList variable.
+ * This method overrides listURL() from base class t3lib_recordlist
*
* @param string Alternative id value. Enter blank string for the current id ($this->id)
* @param string Tablename to display. Enter "-1" for the current table.
@@ -786,4 +788,4 @@
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list.inc']);
}
-?>
\ No newline at end of file
+?>
Index: typo3/stylesheet.css
===================================================================
--- typo3/stylesheet.css (revision 4593)
+++ typo3/stylesheet.css (working copy)
@@ -1918,6 +1918,18 @@
width: 93%;
}
+div#typo3-dblist-pagination {
+ padding: 5px 0;
+}
+div#typo3-dblist-pagination span, div#typo3-dblist-pagination a, div#typo3-dblist-pagination input {
+ margin-right: 5px;
+}
+div#typo3-dblist-pagination span.inactive {
+ color: #666;
+}
+div#typo3-dblist-pagination span.active {
+ font-weight: bold;
+}
/* - - - - - - - - - - - - - - - - - - - - -
Index: typo3/sysext/lang/locallang_mod_web_list.xml
===================================================================
--- typo3/sysext/lang/locallang_mod_web_list.xml (revision 4593)
+++ typo3/sysext/lang/locallang_mod_web_list.xml (working copy)
@@ -50,7 +50,14 @@
+
+
+
+
+
+
+
-
\ No newline at end of file
+
Index: typo3/class.db_list_extra.inc
===================================================================
--- typo3/class.db_list_extra.inc (revision 4593)
+++ typo3/class.db_list_extra.inc (working copy)
@@ -498,7 +498,9 @@
// Forward/Backwards navigation links:
list($flag,$code) = $this->fwd_rwd_nav($table);
- $iOut.=$code;
+ if (!$this->pagination) {
+ $iOut .= $code;
+ }
// If render item, increment counter and call function
if ($flag) {
@@ -538,6 +540,11 @@
$this->eCounter++;
}
+ // Record navigation is added to the end of the table
+ if ($this->pagination) {
+ $iOut .= $this->renderListNavigation($table);
+ }
+
// The header row for the table is now created:
$out.=$this->renderListHeader($table,$currentIdList);
}
@@ -863,11 +870,105 @@
return $this->addelement(1, $icon, $theData, ' class="c-headLine"', '');
}
+ /**
+ * Creates a page selector for tables with many records
+ *
+ * @param string Current table name
+ * @return string Navigation HTML
+ *
+ * @author Dmitry Pikhno
+ * @coauthor Christian Kuhn
+ */
+ protected function renderListNavigation($table) {
+ $totalPages = ceil($this->totalItems / $this->iLimit);
+ $content = '';
+ // Show navigation only if not all records are currently displayed
+ if ($totalPages > 1) {
+ $listURL = $this->listURL('', $table);
+ // Display a link to single table view, else render navigation if in single table view
+ if (!$this->table) {
+ $content = '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:manageAllRecords') . '';
+ } else {
+ // 1 = first page
+ $currentPage = floor(($this->firstElementNumber + 1) / $this->iLimit) + 1;
+ // Number of links to show next to current page
+ $directPageLinks = $GLOBALS['SOBE']->modTSconfig['properties']['pagination.']['directPageLinks'];
+ $directPageLinks = $directPageLinks ? $directPageLinks : 5;
+ // Calculate page links left and right of current page
+ $aroundPages = floor($directPageLinks / 2);
+ if ( $currentPage <= $aroundPages) {
+ $lowerPage = (($aroundPages - $currentPage) > 0) ? ($aroundPages - $currentPage) : 1;
+ $upperPage = ($lowerPage + $directPageLinks) - 1;
+ } elseif (($currentPage + $aroundPages) > $totalPages) {
+ $lowerPage = ($totalPages - $directPageLinks) + 1;
+ $upperPage = $totalPages;
+ } else {
+ $lowerPage = ($currentPage - $aroundPages);
+ $upperPage = ($currentPage + $aroundPages);
+ }
+
+ // Compile previous, next, first and last links
+ $prev = (($currentPage - 1) > 0) ? '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:previous') . ']' : '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:previous') . ']';
+ $next = (($currentPage + 1) <= $totalPages) ? '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:next') . '] ' : '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:next') . ']';
+ $first = ($currentPage > 1) ? '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:first') . ']' : '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:first') . ']';
+ $last = $currentPage <> $totalPages ? '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:last') . ']' : '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:last') . ']';
+
+ // Add a js func to traverse a page select input to a pointer value
+ $content = '
+ ';
+
+ // Compile first row with previous link, direct page links and next link
+ $content .= $prev;
+ foreach (range($lowerPage, $upperPage) as $i) {
+ if (($i > 0) && ($i <= $totalPages)) {
+ $href = $listURL . '&pointer=' . (($i - 1) * $this->iLimit);
+ $from = ($i - 1) * $this->iLimit;
+ $to = ($this->totalItems > ($from + $this->iLimit)) ? ($from + $this->iLimit) : $this->totalItems;
+ $txt = '[' . ($from + 1) . '-' . $to . ']';
+ $content .= ($i == $currentPage) ? '' . $txt . '' : '' . $txt . '';
+ }
+ }
+ $content .= $next . '
';
+
+ // Compile second row with first link, current page indicator, last link and direct page jump input
+ $showingPageOf = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:pageIndicator'), $currentPage, $totalPages);
+ $content .= $first . '|' . $showingPageOf . '|' . $last . '|' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xml:page') . ' #' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:goTo') . '';
+ } //end of if single table view
+
+ $content = '';
+ } // end of if pages > 1
+
+ $data = Array();
+ $titleColumn = $this->fieldArray[0];
+ $data[$titleColumn] = $content;
+
+ return ($this->addElement(1, '', $data));
+ }
+
+
+
+
+
+
/*********************************
*
* Rendering of various elements
@@ -1574,4 +1675,4 @@
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']);
}
-?>
\ No newline at end of file
+?>
Index: typo3/db_list.php
===================================================================
--- typo3/db_list.php (revision 4593)
+++ typo3/db_list.php (working copy)
@@ -216,19 +216,20 @@
$dblist->backPath = $BACK_PATH;
$dblist->calcPerms = $BE_USER->calcPerms($this->pageinfo);
$dblist->thumbs = $BE_USER->uc['thumbnailsByDefault'];
- $dblist->returnUrl=$this->returnUrl;
+ $dblist->returnUrl = $this->returnUrl;
$dblist->allFields = ($this->MOD_SETTINGS['bigControlPanel'] || $this->table) ? 1 : 0;
$dblist->localizationView = $this->MOD_SETTINGS['localization'];
$dblist->showClipboard = 1;
$dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView'];
$dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView'];
+ $dblist->pagination = (isset($this->modTSconfig['properties']['pagination']) && $this->modTSconfig['properties']['pagination'] == 0) ? 0 : 1;
$dblist->hideTables = $this->modTSconfig['properties']['hideTables'];
$dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.'];
$dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode'];
- $dblist->alternateBgColors=$this->modTSconfig['properties']['alternateBgColors']?1:0;
+ $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0;
$dblist->allowedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], 1);
$dblist->deniedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], 1);
- $dblist->newWizards=$this->modTSconfig['properties']['newWizards']?1:0;
+ $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0;
$dblist->pageRow = $this->pageinfo;
$dblist->counter++;
$dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => '');
@@ -441,4 +442,4 @@
$SOBE->main();
$SOBE->printContent();
-?>
\ No newline at end of file
+?>