Project

General

Profile

Feature #17225 » 5466_1.diff

Administrator Admin, 2008-12-23 03:34

View differences:

typo3/class.db_list.inc (working copy)
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.
......
* 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.
......
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list.inc']);
}
?>
?>
typo3/stylesheet.css (working copy)
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;
}
/* - - - - - - - - - - - - - - - - - - - - -
typo3/sysext/lang/locallang_mod_web_list.xml (working copy)
<label index="defaultLanguage">Default</label>
<label index="multipleLanguages">All languages</label>
<label index="Localize">Localize to:</label>
<label index="manageAllRecords">Manage all records</label>
<label index="viewRecords">Viewing records of</label>
<label index="first">First</label>
<label index="last">Last</label>
<label index="previous">Previous</label>
<label index="next">Next</label>
<label index="goTo">Go to</label>
<label index="pageIndicator">Page %s of %d</label>
</languageKey>
</data>
</T3locallang>
</T3locallang>
typo3/class.db_list_extra.inc (working copy)
// 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) {
......
$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);
}
......
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 <dpi@goldenplanet.com>
* @coauthor Christian Kuhn <lolli@schwarzbu.ch>
*/
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 = '<a href="' . $listURL . '">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:manageAllRecords') . '</a>';
} 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) ? '<a href="' . $listURL . '&pointer=' . (($currentPage - 2) * $this->iLimit) . '">[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:previous') . ']</a>' : '<span class="inactive">[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:previous') . ']</span>';
$next = (($currentPage + 1) <= $totalPages) ? '<a href="' . $listURL . '&pointer=' . (($currentPage) * $this->iLimit) . '">[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:next') . ']</a> ' : '<span class="inactive">[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:next') . ']</span>';
$first = ($currentPage > 1) ? '<a href="' . $listURL . '&pointer=0">[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:first') . ']</a>' : '<span class="inactive">[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:first') . ']</span>';
$last = $currentPage <> $totalPages ? '<a href="' . $listURL . '&pointer=' . (($totalPages - 1)*$this->iLimit) . '">[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:last') . ']</a>' : '<span class="inactive">[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:last') . ']</span>';
// Add a js func to traverse a page select input to a pointer value
$content = '
<script language="JavaScript" type="text/JavaScript">
<!--
function jumpPage(){
page = document.getElementById(\'jumpPage\').value;
if (page > ' . $totalPages . ') {
page = ' . $totalPages . ';
}
if (page < 1) {
page = 1;
}
pointer = (page - 1) * ' . $this->iLimit . ';
eval("self.location=\'' . $listURL . '&pointer="+pointer+"\'");
}
//-->
</script>';
// 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) ? '<span class="active">' . $txt . '</span>' : '<a href="' . htmlspecialchars($href) . '">' . $txt . '</a>';
}
}
$content .= $next . '<br />';
// 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 . '<span>|</span><span>' . $showingPageOf . '</span><span>|</span>' . $last . '<span>|</span>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xml:page') . ' #<input type="text" id="jumpPage" size="3" name="jumpPage" /><a href="javascript:jumpPage();">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:goTo') . '</a>';
} //end of if single table view
$content = '<div id="typo3-dblist-pagination">' . $content . '</div>';
} // end of if pages > 1
$data = Array();
$titleColumn = $this->fieldArray[0];
$data[$titleColumn] = $content;
return ($this->addElement(1, '', $data));
}
/*********************************
*
* Rendering of various elements
......
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']);
}
?>
?>
typo3/db_list.php (working copy)
$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' => '');
......
$SOBE->main();
$SOBE->printContent();
?>
?>
(4-4/9)