Commit dbedcb66113ae5150bfb8b738fa45acbba73169f
1 parent
765f6b00
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. Committed By: Jonathan Byrne Reviewed By: Jalaloedien Abrahams git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8457 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
73 additions
and
7 deletions
plugins/search2/reporting/IndexErrors.php
| @@ -51,6 +51,9 @@ class IndexErrorsDispatcher extends KTAdminDispatcher { | @@ -51,6 +51,9 @@ class IndexErrorsDispatcher extends KTAdminDispatcher { | ||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | function do_main() { | 53 | function do_main() { |
| 54 | + | ||
| 55 | + //Number of items on a page | ||
| 56 | + $itemsPerPage = 50; | ||
| 54 | 57 | ||
| 55 | //registerTypes registers the mime types and populates the needed tables. | 58 | //registerTypes registers the mime types and populates the needed tables. |
| 56 | $indexer = Indexer::get(); | 59 | $indexer = Indexer::get(); |
| @@ -93,12 +96,54 @@ class IndexErrorsDispatcher extends KTAdminDispatcher { | @@ -93,12 +96,54 @@ class IndexErrorsDispatcher extends KTAdminDispatcher { | ||
| 93 | $doc['extractor'] = $extractor->getDisplayName(); | 96 | $doc['extractor'] = $extractor->getDisplayName(); |
| 94 | $aIndexerValues[$key] = $doc; | 97 | $aIndexerValues[$key] = $doc; |
| 95 | } | 98 | } |
| 99 | + | ||
| 100 | + $aIndexList = array(); | ||
| 101 | + | ||
| 102 | + //creating page variables and loading the items for the current page | ||
| 103 | + if(!empty($aIndexerValues)){ | ||
| 104 | + $items = count($aIndexerValues); | ||
| 105 | + | ||
| 106 | + if(fmod($items, $itemsPerPage) > 0){ | ||
| 107 | + $pages = floor($items/$itemsPerPage)+1; | ||
| 108 | + }else{ | ||
| 109 | + $pages = ($items/$itemsPerPage); | ||
| 110 | + } | ||
| 111 | + for($i=1; $i<=$pages; $i++){ | ||
| 112 | + $aPages[] = $i; | ||
| 113 | + } | ||
| 114 | + if($items < $itemsPerPage){ | ||
| 115 | + $limit = $items-1; | ||
| 116 | + }else{ | ||
| 117 | + $limit = $itemsPerPage-1; | ||
| 118 | + } | ||
| 96 | 119 | ||
| 97 | - | 120 | + if(isset($_REQUEST['pageValue'])) |
| 121 | + { | ||
| 122 | + $pageNum = (int)$_REQUEST['pageValue']; | ||
| 123 | + $start = (($pageNum-1)*$itemsPerPage)-1; | ||
| 124 | + $limit = $start+$itemsPerPage; | ||
| 125 | + for($i = $start; $i <= $limit; $i++){ | ||
| 126 | + if(isset($aIndexerValues[$i])) | ||
| 127 | + { | ||
| 128 | + $aIndexList[] = $aIndexerValues[$i]; | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + else | ||
| 133 | + { | ||
| 134 | + for($i = 0; $i <= $limit; $i++){ | ||
| 135 | + $aIndexList[] = $aIndexerValues[$i]; | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + } | ||
| 98 | 139 | ||
| 99 | $oTemplate->setData(array( | 140 | $oTemplate->setData(array( |
| 100 | 'context' => $this, | 141 | 'context' => $this, |
| 101 | - 'index_errors' => $aIndexerValues | 142 | + 'pageList' => $aPages, |
| 143 | + 'pageCount' => $pages, | ||
| 144 | + 'itemCount' => $items, | ||
| 145 | + 'itemsPerPage' => $itemsPerPage, | ||
| 146 | + 'indexErrors' => $aIndexList | ||
| 102 | 147 | ||
| 103 | )); | 148 | )); |
| 104 | return $oTemplate; | 149 | return $oTemplate; |
plugins/search2/reporting/templates/indexerrors.smarty
| @@ -6,7 +6,12 @@ | @@ -6,7 +6,12 @@ | ||
| 6 | hiddenVal.value = rescheduleAction; | 6 | hiddenVal.value = rescheduleAction; |
| 7 | document.scheduleForm.submit(); | 7 | document.scheduleForm.submit(); |
| 8 | } | 8 | } |
| 9 | - | 9 | + function nextSearchPage(value) |
| 10 | + { | ||
| 11 | + var hiddenPageVal = document.getElementById("pageValue"); | ||
| 12 | + hiddenPageVal.value = value; | ||
| 13 | + document.scheduleForm.submit(); | ||
| 14 | + } | ||
| 10 | </script> | 15 | </script> |
| 11 | {/literal} | 16 | {/literal} |
| 12 | 17 | ||
| @@ -14,10 +19,11 @@ | @@ -14,10 +19,11 @@ | ||
| 14 | <p class="descriptiveText">{i18n}This report will help to diagnose problems with document indexing.{/i18n}</p> | 19 | <p class="descriptiveText">{i18n}This report will help to diagnose problems with document indexing.{/i18n}</p> |
| 15 | 20 | ||
| 16 | <br> | 21 | <br> |
| 17 | -{if $index_errors} | 22 | +{if $indexErrors} |
| 18 | 23 | ||
| 19 | <form name="scheduleForm" action="{$smarty.server.PHP_SELF}" method="POST"> | 24 | <form name="scheduleForm" action="{$smarty.server.PHP_SELF}" method="POST"> |
| 20 | <input type="hidden" name="rescheduleValue" id="rescheduleValue" value="" /> | 25 | <input type="hidden" name="rescheduleValue" id="rescheduleValue" value="" /> |
| 26 | +<input type="hidden" name="pageValue" id="pageValue" value="" /> | ||
| 21 | 27 | ||
| 22 | <table class=kt_collection> | 28 | <table class=kt_collection> |
| 23 | <thead> | 29 | <thead> |
| @@ -31,7 +37,7 @@ | @@ -31,7 +37,7 @@ | ||
| 31 | </thead> | 37 | </thead> |
| 32 | 38 | ||
| 33 | <tbody> | 39 | <tbody> |
| 34 | -{foreach key=key from=$index_errors item=indexError} | 40 | +{foreach key=key from=$indexErrors item=indexError} |
| 35 | <tr> | 41 | <tr> |
| 36 | <td class="centered"><input type="checkbox" name="index_error[{$indexError.document_id}]" value="1"/></td> | 42 | <td class="centered"><input type="checkbox" name="index_error[{$indexError.document_id}]" value="1"/></td> |
| 37 | <td><a href="/view.php?fDocumentId={$indexError.document_id}">{$indexError.filename|truncate:40:'...'}</a></td> | 43 | <td><a href="/view.php?fDocumentId={$indexError.document_id}">{$indexError.filename|truncate:40:'...'}</a></td> |
| @@ -41,14 +47,29 @@ | @@ -41,14 +47,29 @@ | ||
| 41 | </tr> | 47 | </tr> |
| 42 | <tr> | 48 | <tr> |
| 43 | <td> </td> | 49 | <td> </td> |
| 44 | - <td colspan=4><pre>{$indexError.status_msg}</pre></td> | 50 | + <td colspan="4"><pre>{$indexError.status_msg}</pre></td> |
| 45 | </tr> | 51 | </tr> |
| 46 | 52 | ||
| 47 | 53 | ||
| 48 | {/foreach} | 54 | {/foreach} |
| 49 | 55 | ||
| 50 | </tbody> | 56 | </tbody> |
| 51 | - | 57 | +<tfoot> |
| 58 | +<tr> | ||
| 59 | +<td colspan="4"> | ||
| 60 | +<div align="center"> | ||
| 61 | +{foreach item=page from=$pageList} | ||
| 62 | +<a id="pageButton{$page}" href="#" onclick="nextSearchPage({$page});">{$page}</a> | ||
| 63 | +{/foreach} | ||
| 64 | +</div> | ||
| 65 | +</td> | ||
| 66 | +</tr> | ||
| 67 | +<tr> | ||
| 68 | +<td colspan="4"> | ||
| 69 | +<div> {$itemCount} items, {$itemsPerPage} items per page.</div> | ||
| 70 | +</td> | ||
| 71 | +</tr> | ||
| 72 | +</tfoot> | ||
| 52 | </table> | 73 | </table> |
| 53 | 74 | ||
| 54 | <br> | 75 | <br> |