Enhanced Pager performance, especially when using larger databases as logsource or when filtering

This commit is contained in:
Andre Lorbach 2009-01-26 16:18:54 +01:00
parent b03f39862d
commit 297ca06d36
2 changed files with 75 additions and 7 deletions

View File

@ -99,7 +99,7 @@ else
$content['EXPORT_ENABLED'] = true;
// Init Pager variables
// $content['uid_previous'] = UID_UNKNOWN;
$content['uid_previous'] = UID_UNKNOWN;
$content['uid_next'] = UID_UNKNOWN;
$content['uid_first'] = UID_UNKNOWN;
$content['uid_last'] = UID_UNKNOWN;
@ -651,8 +651,8 @@ if ( isset($content['Sources'][$currentSourceID]) )
//print_r ( $content['syslogmessages'] );
// Move below processing - Read First and LAST UID's before start reading the stream!
$content['uid_last'] = $stream->GetLastPageUID();
$content['uid_first'] = $stream->GetFirstPageUID();
// $content['uid_last'] = $stream->GetLastPageUID();
/// $content['uid_first'] = $stream->GetFirstPageUID();
if ( $content['main_recordcount'] == -1 || $content['main_recordcount'] > $content['CurrentViewEntriesPerPage'] )
{
@ -676,6 +676,7 @@ if ( isset($content['Sources'][$currentSourceID]) )
}
// ---
/*
// --- Handle uid_previous page button
if ( $content['uid_current'] != UID_UNKNOWN )
{
@ -700,9 +701,60 @@ if ( isset($content['Sources'][$currentSourceID]) )
$content['main_pager_previous_found'] = false;
//echo $content['uid_previous'];
// ---
*/
// --- Handle uid_previous page button
if ( $content['read_direction'] == EnumReadDirection::Forward )
{
if ( $ret == SUCCESS )
{
// Try to read the next one!
$ret = $stream->ReadNext($uID, $tmp);
if ( $ret == SUCCESS )
$content['main_pager_previous_found'] = true;
else
$content['main_pager_previous_found'] = false;
}
else
$content['main_pager_previous_found'] = false;
}
else
{
if ( $content['uid_current'] == $content['uid_previous'] )
$content['main_pager_previous_found'] = false;
else
$content['main_pager_previous_found'] = true;
}
// ---
// --- Handle uid_last and uid_next page button
if ( $content['read_direction'] == EnumReadDirection::Forward )
{
if ( $content['uid_current'] == $content['uid_last'] )
{
$content['main_pager_last_found'] = false;
$content['main_pager_next_found'] = false;
}
else
{
$content['main_pager_last_found'] = true;
$content['main_pager_next_found'] = true;
}
// Restore uid_current if necessary
$content['uid_current'] = $lastUid;
}
else
{
$content['main_pager_last_found'] = true;
$content['main_pager_next_found'] = true;
}
// ---
// --- Handle uid_last page button
//!!!!!!!!
/*
// if we found a last uid, and if it is not the current one (which means we already are on the last page ;)!
if ( $content['uid_last'] != -1 && $content['uid_last'] != $content['uid_current'])
$content['main_pager_last_found'] = true;
@ -723,8 +775,23 @@ if ( isset($content['Sources'][$currentSourceID]) )
// As we went back, we need to change the currend uid to the latest read one
$content['uid_current'] = $lastUid;
}
*/
// ---
// --- Handle uid_first page button
if ( $content['uid_current'] == $content['uid_first'] )
{
$content['main_pager_first_found'] = false;
$content['main_pager_previous_found'] = false; // If there is no FIRST, there is no going back!
}
else if ( !$content['main_pager_previous_found'] )
$content['main_pager_first_found'] = false;
else
$content['main_pager_first_found'] = true;
// ---
// $content['uid_first']
/*
// --- Handle uid_first page button
if ( $content['main_pager_previous_found'] == false ||
$content['uid_current'] == UID_UNKNOWN ||
@ -736,6 +803,7 @@ if ( isset($content['Sources'][$currentSourceID]) )
else
$content['main_pager_first_found'] = true;
// ---
*/
}
else // Disable pager in this case!
$content['main_pagerenabled'] = false;

View File

@ -217,7 +217,7 @@
<td class="line1" width="20" nowrap>
<!-- IF main_pager_last_found="true" -->
<a href="?{additional_url_sortingonly}&uid={uid_last}&direction=desc{additional_url}" target="_top"><img src="{MENU_PAGER_END}" width="16" title="{LN_GEN_LASTPAGE}"></a>
<a href="?{additional_url_sortingonly}&uid=-1&direction=desc{additional_url}" target="_top"><img src="{MENU_PAGER_END}" width="16" title="{LN_GEN_LASTPAGE}"></a>
<!-- ENDIF main_pager_last_found="true" -->
<!-- IF main_pager_last_found!="true" -->
<img src="{MENU_PAGER_END_GREY}" width="16" height="16">
@ -374,7 +374,7 @@
<td class="line1" width="20" nowrap>
<!-- IF main_pager_last_found="true" -->
<a href="?{additional_url_sortingonly}&uid={uid_last}&direction=desc{additional_url}" target="_top"><img src="{MENU_PAGER_END}" width="16" title="{LN_GEN_LASTPAGE}"></a>
<a href="?{additional_url_sortingonly}&uid=-1&direction=desc{additional_url}" target="_top"><img src="{MENU_PAGER_END}" width="16" title="{LN_GEN_LASTPAGE}"></a>
<!-- ENDIF main_pager_last_found="true" -->
<!-- IF main_pager_last_found!="true" -->
<img src="{MENU_PAGER_END_GREY}" width="16" height="16">