From dbedcb66113ae5150bfb8b738fa45acbba73169f Mon Sep 17 00:00:00 2001 From: Jonathan Byrne Date: Tue, 13 May 2008 12:39:17 +0000 Subject: [PATCH] KTS-3299 "CLONE -Feature Request - Break Up List of "Documents with Indexing Problems" Into Seperate Pages(SUP-756)" Fixed. Added pagination to index errors report page. --- plugins/search2/reporting/IndexErrors.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- plugins/search2/reporting/templates/indexerrors.smarty | 31 ++++++++++++++++++++++++++----- 2 files changed, 73 insertions(+), 7 deletions(-) diff --git a/plugins/search2/reporting/IndexErrors.php b/plugins/search2/reporting/IndexErrors.php index c88affa..bbd9faa 100644 --- a/plugins/search2/reporting/IndexErrors.php +++ b/plugins/search2/reporting/IndexErrors.php @@ -51,6 +51,9 @@ class IndexErrorsDispatcher extends KTAdminDispatcher { } function do_main() { + + //Number of items on a page + $itemsPerPage = 50; //registerTypes registers the mime types and populates the needed tables. $indexer = Indexer::get(); @@ -93,12 +96,54 @@ class IndexErrorsDispatcher extends KTAdminDispatcher { $doc['extractor'] = $extractor->getDisplayName(); $aIndexerValues[$key] = $doc; } + + $aIndexList = array(); + + //creating page variables and loading the items for the current page + if(!empty($aIndexerValues)){ + $items = count($aIndexerValues); + + if(fmod($items, $itemsPerPage) > 0){ + $pages = floor($items/$itemsPerPage)+1; + }else{ + $pages = ($items/$itemsPerPage); + } + for($i=1; $i<=$pages; $i++){ + $aPages[] = $i; + } + if($items < $itemsPerPage){ + $limit = $items-1; + }else{ + $limit = $itemsPerPage-1; + } - + if(isset($_REQUEST['pageValue'])) + { + $pageNum = (int)$_REQUEST['pageValue']; + $start = (($pageNum-1)*$itemsPerPage)-1; + $limit = $start+$itemsPerPage; + for($i = $start; $i <= $limit; $i++){ + if(isset($aIndexerValues[$i])) + { + $aIndexList[] = $aIndexerValues[$i]; + } + } + } + else + { + for($i = 0; $i <= $limit; $i++){ + $aIndexList[] = $aIndexerValues[$i]; + } + } + } $oTemplate->setData(array( 'context' => $this, - 'index_errors' => $aIndexerValues + 'pageList' => $aPages, + 'pageCount' => $pages, + 'itemCount' => $items, + 'itemsPerPage' => $itemsPerPage, + 'indexErrors' => $aIndexList )); return $oTemplate; diff --git a/plugins/search2/reporting/templates/indexerrors.smarty b/plugins/search2/reporting/templates/indexerrors.smarty index bf1694b..d30fd02 100644 --- a/plugins/search2/reporting/templates/indexerrors.smarty +++ b/plugins/search2/reporting/templates/indexerrors.smarty @@ -6,7 +6,12 @@ hiddenVal.value = rescheduleAction; document.scheduleForm.submit(); } - + function nextSearchPage(value) + { + var hiddenPageVal = document.getElementById("pageValue"); + hiddenPageVal.value = value; + document.scheduleForm.submit(); + } {/literal} @@ -14,10 +19,11 @@

{i18n}This report will help to diagnose problems with document indexing.{/i18n}


-{if $index_errors} +{if $indexErrors}
+ @@ -31,7 +37,7 @@ -{foreach key=key from=$index_errors item=indexError} +{foreach key=key from=$indexErrors item=indexError} @@ -41,14 +47,29 @@ - + {/foreach} - + + + + + + + +
{$indexError.filename|truncate:40:'...'}
 
{$indexError.status_msg}
{$indexError.status_msg}
+
+{foreach item=page from=$pageList} +{$page} +{/foreach} +
+
+
{$itemCount} items, {$itemsPerPage} items per page.
+

-- libgit2 0.21.4