summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--css/styles.css19
-rw-r--r--help/index.php7
-rw-r--r--help/templates/index.php6
-rw-r--r--lib/base.php42
4 files changed, 72 insertions, 2 deletions
diff --git a/css/styles.css b/css/styles.css
index a186c173241..f0832d05947 100644
--- a/css/styles.css
+++ b/css/styles.css
@@ -70,7 +70,7 @@ form a { color:#000; text-decoration:none; }
/* CONTENT ------------------------------------------------------------------ */
#content { margin:7em 0 0 16em; }
-table { width:90%; margin:1em 5em 2em 3em; }
+table { margin:1em 5em 2em 3em; }
table tr.mouseOver td { background-color:#eee; }
table th, table td { padding:0; border-bottom:1px solid #ddd; text-align:left; font-style:italic; }
table th { padding:0.5em; }
@@ -118,6 +118,23 @@ p.actions a.delete { background-image:url('../img/delete.png'); }
#quota_indicator { margin:0 4em 1em 0; padding:0; border:1px solid #ddd; border-radius:10px; -webkit-border-radius:10px; -moz-border-radius:10px; }
#quota_indicator div { background-color:#76A9EA; border-radius:10px; -webkit-border-radius:10px; -moz-border-radius:10px; }
+
+/* PAGER ------------------------------------------------------------ */
+.pager tr td
+{
+ border-bottom: 0px;
+}
+
+
+.pager tr td a
+{
+ text-decoration: none;
+ color: #666666;
+ font-size: 0.9em;
+ text-align: center;
+}
+
+
/* LOGS --------------------------------------------------------------------- */
#logs_options { width:auto; margin:0; }
#logs_options p { padding:0.5em; text-align:left; }
diff --git a/help/index.php b/help/index.php
index 426abe39560..f77972f58a7 100644
--- a/help/index.php
+++ b/help/index.php
@@ -7,6 +7,11 @@ if( !OC_USER::isLoggedIn()){
exit();
}
+//hardcode for testing
+$pagecount=8;
+$page=2;
+
+
// Load the files we need
OC_UTIL::addStyle( "help", "help" );
@@ -17,6 +22,8 @@ $kbe=OC_OCSCLIENT::getKnownledgebaseEntries();
$tmpl = new OC_TEMPLATE( "help", "index", "admin" );
$tmpl->assign( "kbe", $kbe );
+$tmpl->assign( "pagecount", $pagecount );
+$tmpl->assign( "page", $page );
$tmpl->printPage();
?>
diff --git a/help/templates/index.php b/help/templates/index.php
index b8444c556e9..262ab3d8cab 100644
--- a/help/templates/index.php
+++ b/help/templates/index.php
@@ -1,7 +1,7 @@
<h1>Questions and Answers</h1>
-<table cellspacing="0">
+<table cellspacing="0" width="100%">
<tbody>
<?php foreach($_["kbe"] as $kb): ?>
<tr>
@@ -13,6 +13,10 @@
<?php endforeach; ?>
</tbody>
</table>
+<?php
+ $url=OC_HELPER::linkTo( "help", "index.php" ).'?page=';
+ OC_UTIL::showPageNavi($_['pagecount'],$_['page'],$url);
+?>
<a target="_blank" class="prettybutton" href="http://apps.owncloud.com/knowledgebase/editquestion.php?action=new">ASK A QUESTION</a>
diff --git a/lib/base.php b/lib/base.php
index fad4007aa19..ec305250809 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -231,6 +231,48 @@ class OC_UTIL {
return date($timeformat,$timestamp);
}
+ /**
+ * Shows a pagenavi widget where you can jump to different pages.
+ *
+ * @param int $pagecount
+ * @param int $page
+ * @param string $url
+ * @return html-string
+ */
+ public static function showPageNavi($pagecount,$page,$url) {
+
+ $pagelinkcount=8;
+ $txt='';
+ if ($pagecount>1) {
+ $txt.='<center><table class="pager" cellspacing="0" cellpadding="0" border="0"><tr><td width="1">';
+
+ if ($page>'0') {
+ $txt.='<span class="pagerbutton1"><a href="'.$url.($page-1).'">prev</a>&nbsp;&nbsp;</span>';
+ }
+ $txt.='</td><td width="1">';
+
+ $pagestart=$page-$pagelinkcount;
+ if($pagestart<0) $pagestart=0;
+ $pagestop=$page+$pagelinkcount;
+ if($pagestop>$pagecount) $pagestop=$pagecount;
+ if ($pagestart<>0) $txt.='...';
+ for ($i=$pagestart; $i < $pagestop;$i++) {
+ if ($i<>$page) {
+ $txt.='<a href="'.$url.$i.'">&nbsp;'.($i+1).'&nbsp;</a>';
+ } else {
+ $txt.='&nbsp;<b>'.($i+1).'</b>&nbsp;';
+ }
+ }
+ if ($pagecount>$pagestop) $txt.='...';
+ $txt.='</td><td width="1">';
+ if (($page+1)<$pagecount) {
+ $txt.='<span class="pagerbutton2"><a href="'.$url.($page+1).'">next</a></span>';
+ }
+ $txt.='</td></tr></table></center>';
+ }
+ echo($txt);
+ }
+
/**