From cb9fc6d901c59999f3ebd369449e4a845680665d Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Wed, 17 Aug 2011 00:24:50 +0200 Subject: [PATCH] make the help section working and pretty. knowledge base entries are fetched via OCS from a different server. cool stuff --- core/templates/part.pagenavi.php | 8 ++++---- lib/ocsclient.php | 11 ++++++++--- settings/css/settings.css | 15 ++++++++++++++- settings/help.php | 12 ++++++------ settings/templates/help.php | 11 ++++++----- 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/core/templates/part.pagenavi.php b/core/templates/part.pagenavi.php index 0602b79388..2300805875 100644 --- a/core/templates/part.pagenavi.php +++ b/core/templates/part.pagenavi.php @@ -1,12 +1,12 @@
- + - - +
0):?> t( 'prev' ); ?>   + 0):?> ... @@ -26,6 +26,6 @@ t( 'next' ); ?>
-
\ No newline at end of file + diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 1df9e21e60..4b71f4550e 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -134,8 +134,10 @@ class OC_OCSClient{ * * This function returns a list of all the knowledgebase entries from the OCS server */ - public static function getKnownledgebaseEntries(){ - $url='http://api.apps.owncloud.com/v1/knowledgebase/data?type=150&page=0&pagesize=10'; + public static function getKnownledgebaseEntries($page,$pagesize){ + $p= (int) $page; + $s= (int) $pagesize; + $url='http://api.apps.owncloud.com/v1/knowledgebase/data?type=150&page='.$p.'&pagesize='.$s; $kbe=array(); $xml=@file_get_contents($url); @@ -152,9 +154,12 @@ class OC_OCSClient{ $kb['description']=$tmp[$i]->description; $kb['answer']=$tmp[$i]->answer; $kb['preview1']=$tmp[$i]->smallpreviewpic1; + $kb['detailpage']=$tmp[$i]->detailpage; $kbe[]=$kb; } - return $kbe; + $total=$data->meta->totalitems; + $kbe['totalitems']=$total; + return $kbe; } diff --git a/settings/css/settings.css b/settings/css/settings.css index c8163ff2f8..2068389909 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -29,4 +29,17 @@ span.version{margin-left:3em;color:#ddd} /* HELP */ -table#help tr td { white-space:normal; } + +table.help { border-spacing:1em; } +table.help tr td { white-space:normal; } + + +a.newquestion { font-size:1em; width:10em; margin:1.5em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } +a.newquestion:hover { background:#ddd; } + + +td.entry { padding:1em; margin:2em; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } +td.entry:hover { background:#eee; } +tr.entryrow:hover { background:#fff; } +tr.pager:hover { background:#fff; } + diff --git a/settings/help.php b/settings/help.php index b6466d282b..731ae09a0a 100644 --- a/settings/help.php +++ b/settings/help.php @@ -6,17 +6,17 @@ if( !OC_User::isLoggedIn()){ exit(); } -//hardcode for testing -$pagecount=8; -$page=2; - // Load the files we need OC_Util::addStyle( "settings", "settings" ); OC_App::setActiveNavigationEntry( "help" ); -$kbe=OC_OCSClient::getKnownledgebaseEntries(); - +$pagesize=5; +if(isset($_GET['page'])) $page=$_GET['page']; else $page=0; +$kbe=OC_OCSClient::getKnownledgebaseEntries($page,$pagesize); +$totalitems=$kbe['totalitems']; +unset($kbe['totalitems']); +$pagecount=ceil($totalitems/$pagesize); $tmpl = new OC_Template( "settings", "help", "user" ); $tmpl->assign( "kbe", $kbe ); diff --git a/settings/templates/help.php b/settings/templates/help.php index 4cd748c3df..3a7edfa9b2 100644 --- a/settings/templates/help.php +++ b/settings/templates/help.php @@ -1,14 +1,15 @@ Can't connect to Q&A database - +
- + - + '') echo('
read more')?> +
@@ -18,7 +19,7 @@ $pageNavi=OC_Util::getPageNavi($_['pagecount'],$_['page'],$url); $pageNavi->printPage(); ?> - t( 'Ask a question' ); ?> +
t( 'Ask a question' ); ?>
"") { echo(''); } ?>

'.$kb['description'].''); ?> +

'.$kb['description'].''); ?> '') echo('
Answer:
'.$kb['answer'].'');?> -