Added backlink to ListView in detailpage and added Records per Page selector

The records per page selector makes it possible to change the pagesize on
the fly. By default, the pagesize from the config.php will be used.
This commit is contained in:
Andre Lorbach 2008-04-25 17:43:51 +02:00
parent daa0ef78d0
commit 7a15a17737
7 changed files with 71 additions and 17 deletions

View File

@ -183,6 +183,9 @@ function InitPhpLogCon()
// Init Predefined Searches List
CreatePredefinedSearches();
// Init predefined paging sizes
CreatePagesizesList();
// --- Enable PHP Debug Mode
InitPhpDebugMode();
// ---
@ -241,6 +244,23 @@ function CreateDBTypesList( $selectedDBType )
}
function CreatePagesizesList()
{
global $CFG, $content;
$content['pagesizes'][0] = array( "ID" => 0, "Selected" => "", "DisplayName" => "Preconfigured (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] );
$content['pagesizes'][1] = array( "ID" => 1, "Selected" => "", "DisplayName" => " 25 records per page", "Value" => 25 );
$content['pagesizes'][2] = array( "ID" => 2, "Selected" => "", "DisplayName" => " 50 records per page", "Value" => 50 );
$content['pagesizes'][3] = array( "ID" => 3, "Selected" => "", "DisplayName" => " 75 records per page", "Value" => 75 );
$content['pagesizes'][4] = array( "ID" => 4, "Selected" => "", "DisplayName" => " 100 records per page", "Value" => 100 );
// Set default selected pagesize
$content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected";
// The content variable will now contain the user selected oaging size
$content["ViewEntriesPerPage"] = $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Value"];
}
function CreatePredefinedSearches()
{
global $CFG, $content;
@ -316,17 +336,17 @@ function InitFrontEndVariables()
{
global $content;
$content['MENU_FOLDER_OPEN'] = "image=" . $content['BASEPATH'] . "images/icons/folder_closed.png";
$content['MENU_FOLDER_CLOSED'] = "overimage=" . $content['BASEPATH'] . "images/icons/folder.png";
$content['MENU_HOMEPAGE'] = "image=" . $content['BASEPATH'] . "images/icons/home.png";
$content['MENU_LINK'] = "image=" . $content['BASEPATH'] . "images/icons/link.png";
$content['MENU_PREFERENCES'] = "image=" . $content['BASEPATH'] . "images/icons/preferences.png";
$content['MENU_ADMINENTRY'] = "image=" . $content['BASEPATH'] . "images/icons/star_blue.png";
$content['MENU_ADMINLOGOFF'] = "image=" . $content['BASEPATH'] . "images/icons/exit.png";
$content['MENU_ADMINUSERS'] = "image=" . $content['BASEPATH'] . "images/icons/businessmen.png";
$content['MENU_SEARCH'] = "image=" . $content['BASEPATH'] . "images/icons/view.png";
$content['MENU_SELECTION_DISABLED'] = "image=" . $content['BASEPATH'] . "images/icons/selection.png";
$content['MENU_SELECTION_ENABLED'] = "image=" . $content['BASEPATH'] . "images/icons/selection_delete.png";
$content['MENU_FOLDER_OPEN'] = $content['BASEPATH'] . "images/icons/folder_closed.png";
$content['MENU_FOLDER_CLOSED'] = $content['BASEPATH'] . "images/icons/folder.png";
$content['MENU_HOMEPAGE'] = $content['BASEPATH'] . "images/icons/home.png";
$content['MENU_LINK'] = $content['BASEPATH'] . "images/icons/link.png";
$content['MENU_PREFERENCES'] = $content['BASEPATH'] . "images/icons/preferences.png";
$content['MENU_ADMINENTRY'] = $content['BASEPATH'] . "images/icons/star_blue.png";
$content['MENU_ADMINLOGOFF'] = $content['BASEPATH'] . "images/icons/exit.png";
$content['MENU_ADMINUSERS'] = $content['BASEPATH'] . "images/icons/businessmen.png";
$content['MENU_SEARCH'] = $content['BASEPATH'] . "images/icons/view.png";
$content['MENU_SELECTION_DISABLED'] = $content['BASEPATH'] . "images/icons/selection.png";
$content['MENU_SELECTION_ENABLED'] = $content['BASEPATH'] . "images/icons/selection_delete.png";
$content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png";
$content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png";
@ -412,6 +432,13 @@ function InitConfigurationValues()
}
}
// Paging Size handling!
if ( !isset($_SESSION['PAGESIZE_ID']) )
{
// Default is 0!
$_SESSION['PAGESIZE_ID'] = 0;
}
// Theme Handling
if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; }
if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) )

View File

@ -396,11 +396,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c
// Increment Counter
$counter++;
} while ($counter < $CFG['ViewEntriesPerPage'] && ($ret = $stream->ReadNext($uID, $logArray)) == SUCCESS);
} while ($counter < $content['ViewEntriesPerPage'] && ($ret = $stream->ReadNext($uID, $logArray)) == SUCCESS);
//print_r ( $content['syslogmessages'] );
if ( $content['main_recordcount'] == -1 || $content['main_recordcount'] > $CFG['ViewEntriesPerPage'] )
if ( $content['main_recordcount'] == -1 || $content['main_recordcount'] > $content['ViewEntriesPerPage'] )
{
// Enable Pager in any case here!
$content['main_pagerenabled'] = true;

View File

@ -118,5 +118,6 @@ $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Erste Syslog Quelle";
// Details page
$content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id";
$content['LN_DETAILS_DETAILSFORMSG'] = "Details for message id";
$content['LN_DETAIL_BACKTOLIST'] = "Back to Listview";
?>

View File

@ -118,5 +118,6 @@ $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "First Syslog Source";
// Details page
$content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id";
$content['LN_DETAILS_DETAILSFORMSG'] = "Details for message id";
$content['LN_DETAIL_BACKTOLIST'] = "Back to Listview";
?>

View File

@ -7,7 +7,8 @@
<table width="100%" align="center" border="0" cellpadding="1" cellspacing="1" class="with_border">
<tr>
<td nowrap width="100%"class="line2" align="left">
<td nowrap width="100%"class="line2" align="left" valign="top">
<a href="index.php?uid={uid_current}" target="_top"><img src="{MENU_HOMEPAGE}" width="16" align="left" title="{LN_DETAIL_BACKTOLIST}">{LN_DETAIL_BACKTOLIST}</a>
<!-- IF main_currentpagenumber_found="true" -->
{LN_GEN_PAGE} {main_currentpagenumber}
<!-- ENDIF main_currentpagenumber_found="true" -->

View File

@ -101,7 +101,24 @@
<!-- ENDIF main_recordcount_found="true" -->
<!-- IF main_pagerenabled="true" -->
<td nowrap width="115" class="cellmenu2">{LN_GEN_PAGERSIZE}:</td>
<td nowrap width="50" class="line2"><B>{ViewEntriesPerPage}</B></td>
<td nowrap width="50" class="line2">
<form action="userchange.php" method="get" name="pageingsize">
<input type="hidden" name="op" value="changepagesize">
<table border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td>
<select name="pagesizeid" size="1" OnChange="document.pageingsize.submit();">
<!-- BEGIN pagesizes -->
<option {Selected} value="{ID}">{DisplayName}</option>
<!-- END pagesizes -->
</select>
</td>
</tr>
</table>
</form>
</td>
<td class="cellmenu2" nowrap><B>Pager: &nbsp; </B></td>
<td class="line0" width="20" nowrap>

View File

@ -50,17 +50,24 @@ else
if ( isset($_GET['op']) )
{
if ( $_GET['op'] == "changestyle" )
if ( $_GET['op'] == "changestyle" && isset($_GET['stylename']) )
{
if ( VerifyTheme($_GET['stylename']) )
$_SESSION['CUSTOM_THEME'] = $_GET['stylename'];
}
if ( $_GET['op'] == "changelang" )
if ( $_GET['op'] == "changelang" && isset($_GET['langcode']) )
{
if ( VerifyLanguage($_GET['langcode']) )
$_SESSION['CUSTOM_LANG'] = $_GET['langcode'];
}
if ( $_GET['op'] == "changepagesize" && isset($_GET['pagesizeid']) )
{
if ( intval($_GET['pagesizeid']) >= 0 && intval($_GET['pagesizeid']) < 5 )
$_SESSION['PAGESIZE_ID'] = intval($_GET['pagesizeid']);
}
}
// Final redirect