diff options
-rw-r--r-- | inc/common.php | 5 | ||||
-rw-r--r-- | inc/html.php | 29 | ||||
-rw-r--r-- | inc/template.php | 4 | ||||
-rw-r--r-- | lang/de/lang.php | 2 | ||||
-rw-r--r-- | lang/en/lang.php | 2 | ||||
-rw-r--r-- | tpl/default/design.css | 26 |
6 files changed, 63 insertions, 5 deletions
diff --git a/inc/common.php b/inc/common.php index 728319e09..775071b7f 100644 --- a/inc/common.php +++ b/inc/common.php @@ -476,6 +476,9 @@ function addLogEntry($date,$id,$summary=""){ /** * returns an array of recently changed files using the * changelog + * num : return 'num' entries + * num = 0: return count of entries set by $conf['recent'] + * num = -1: return all available entries * * @author Andreas Gohr <andi@splitbrain.org> */ @@ -507,7 +510,7 @@ function getRecents($num=0,$incdel=false){ $recent[$info[2]]['sum'] = $info[4]; $recent[$info[2]]['del'] = !@file_exists(wikiFN($info[2])); } - if(count($recent) >= $num){ + if($num != -1 && count($recent) >= $num){ break; //finish if enough items found } } diff --git a/inc/html.php b/inc/html.php index 370754c52..c9b1539f1 100644 --- a/inc/html.php +++ b/inc/html.php @@ -447,14 +447,22 @@ function html_revisions(){ * * @author Andreas Gohr <andi@splitbrain.org> */ -function html_recent(){ +function html_recent($first=0){ global $conf; global $lang; - $recents = getRecents(0,true); + $recents = getRecents(-1,true); + + if($first >= count($recents)) $first = 0; + $last = $first + $conf['recent']; + if ($last > count($recents)) + $last = count($recents); print p_locale_xhtml('recent'); print '<ul>'; - foreach(array_keys($recents) as $id){ + + $keys = array_keys($recents); + for ($n=$first; $n < $last; $n++){ + $id = $keys[$n]; $date = date($conf['dformat'],$recents[$id]['date']); print '<li>'; @@ -482,6 +490,21 @@ function html_recent(){ print '</li>'; } print '</ul>'; + + print '<div class="pagenav">'; + if ($first > 0) { + $first -= $conf['recent']; + if ($first < 0) $first = 0; + print '<div class="pagenav-prev">'; + print html_btn('prevpage','',"p",array('do' => 'recent', 'first' => $first)); + print '</div>'; + } + if ($last < count($recents)) { + print '<div class="pagenav-next">'; + print html_btn('nextpage','',"n",array('do' => 'recent', 'first' => $last)); + print '</div>'; + } + print '</div>'; } /** diff --git a/inc/template.php b/inc/template.php index f76e48108..a5e656443 100644 --- a/inc/template.php +++ b/inc/template.php @@ -75,7 +75,9 @@ function tpl_content(){ html_diff(); break; case 'recent': - html_recent(); + $first = $_REQUEST['first']; + if(empty($first)) $first=0; + html_recent($first); break; case 'index': html_index($IDX); #FIXME can this be pulled from globals? is it sanitized correctly? diff --git a/lang/de/lang.php b/lang/de/lang.php index 9a4e95c43..eaf4286e8 100644 --- a/lang/de/lang.php +++ b/lang/de/lang.php @@ -18,6 +18,8 @@ $lang['btn_search'] = 'Suche'; $lang['btn_save'] = 'Speichern'; $lang['btn_preview']= 'Vorschau'; $lang['btn_top'] = 'Nach oben'; +$lang['btn_prevpage']= '<< zurück'; +$lang['btn_nextpage']= 'weiter >>'; $lang['btn_revs'] = 'Ältere Versionen'; $lang['btn_recent'] = 'Letzte Änderungen'; $lang['btn_upload'] = 'Hochladen'; diff --git a/lang/en/lang.php b/lang/en/lang.php index b56e489c4..d98256736 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -17,6 +17,8 @@ $lang['btn_search'] = 'Search'; $lang['btn_save'] = 'Save'; $lang['btn_preview']= 'Preview'; $lang['btn_top'] = 'Back to top'; +$lang['btn_prevpage']= '<< previous page'; +$lang['btn_nextpage']= 'next page >>'; $lang['btn_revs'] = 'Old revisions'; $lang['btn_recent'] = 'Recent changes'; $lang['btn_upload'] = 'Upload'; diff --git a/tpl/default/design.css b/tpl/default/design.css index 75210ac18..792f508be 100644 --- a/tpl/default/design.css +++ b/tpl/default/design.css @@ -148,6 +148,32 @@ div.secedit input.button { display: inline; } +/* ----------- page navigator ------------- */ + +div.pagenav { + margin-top:1em; +} + +div.pagenav-prev { + text-align:right; + float:left; + width:50% +} + +div.pagenav-prev input.button { + margin-right:5px; +} + +div.pagenav-next { + text-align:left; + float:right; + width:50% +} + +div.pagenav-next input.button { + margin-left:5px; +} + /* --------------- Links ------------------ */ a { |