diff options
author | Frank Karlitschek <karlitschek@kde.org> | 2011-08-17 00:24:50 +0200 |
---|---|---|
committer | Frank Karlitschek <karlitschek@kde.org> | 2011-08-17 00:24:50 +0200 |
commit | cb9fc6d901c59999f3ebd369449e4a845680665d (patch) | |
tree | d142cc1a9256225498fecdd56386c870777f69e8 | |
parent | 9f28c20660e113c501a951262765ce9c9c4d0e84 (diff) | |
download | nextcloud-server-cb9fc6d901c59999f3ebd369449e4a845680665d.tar.gz nextcloud-server-cb9fc6d901c59999f3ebd369449e4a845680665d.zip |
make the help section working and pretty. knowledge base entries are fetched via OCS from a different server. cool stuff
-rw-r--r-- | core/templates/part.pagenavi.php | 8 | ||||
-rw-r--r-- | lib/ocsclient.php | 11 | ||||
-rw-r--r-- | settings/css/settings.css | 15 | ||||
-rw-r--r-- | settings/help.php | 12 | ||||
-rw-r--r-- | 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 0602b793882..23008058757 100644 --- a/core/templates/part.pagenavi.php +++ b/core/templates/part.pagenavi.php @@ -1,12 +1,12 @@ <center> <table class="pager" cellspacing="0" cellpadding="0" border="0"> - <tr> + <tr><td width="50%"></td> <td width="1"> <?php if($_['page']>0):?> <span class="pagerbutton1"><a href="<?php echo $_['url'].($_['page']-1);?>"><?php echo $l->t( 'prev' ); ?></a> </span> <?php endif; ?> </td> - <td> + <td width="1"> <?php if ($_['pagestart']>0):?> ... <?php endif;?> @@ -26,6 +26,6 @@ <span class="pagerbutton2"><a href="<?php echo $_['url'].($_['page']+1);?>"><?php echo $l->t( 'next' ); ?></a></span> <?php endif; ?> </td> - </tr> + <td width="50%"></td></tr> </table> -</center>
\ No newline at end of file +</center> diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 1df9e21e606..4b71f4550e5 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 c8163ff2f82..2068389909c 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 b6466d282bf..731ae09a0af 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 4cd748c3dff..3a7edfa9b22 100644 --- a/settings/templates/help.php +++ b/settings/templates/help.php @@ -1,14 +1,15 @@ <?php if(is_null($_["kbe"])):?> Can't connect to Q&A database <?php else:?> - <table id="help" cellspacing="20"> + <table class="help"> <tbody> <?php foreach($_["kbe"] as $kb): ?> - <tr> + <tr class="entryrow"> <td width="1"><?php if($kb["preview1"] <> "") { echo('<img class="preview" border="0" src="'.$kb["preview1"].'" />'); } ?> </a></td> - <td class="name"><p><strong><?php echo $kb["name"]; ?></strong></p><?php echo('<span class="type">'.$kb['description'].'</span>'); ?> + <td class="entry"><p><strong><?php echo $kb["name"]; ?></strong></p><?php echo('<span class="type">'.$kb['description'].'</span>'); ?> <?php if($kb['answer']<>'') echo('<br /><span class="type"><b>Answer:</b></span><br /><span class="type">'.$kb['answer'].'</span>');?> - </td> + <?php if($kb['detailpage']<>'') echo('<br /><a target="_blank" href="'.$kb['detailpage'].'"><b>read more</b></a>')?> + <br /></td> </tr> <?php endforeach; ?> </tbody> @@ -18,7 +19,7 @@ $pageNavi=OC_Util::getPageNavi($_['pagecount'],$_['page'],$url); $pageNavi->printPage(); ?> - <a target="_blank" class="prettybutton" href="http://apps.owncloud.com/knowledgebase/editquestion.php?action=new"><?php echo $l->t( 'Ask a question' ); ?></a> + <br /><a target="_blank" class="newquestion" href="http://apps.owncloud.com/knowledgebase/editquestion.php?action=new"><?php echo $l->t( 'Ask a question' ); ?></a> <?php endif;?> |