зеркало из https://github.com/nextcloud/server.git
make the help section working and pretty. knowledge base entries are fetched via OCS from a different server. cool stuff
This commit is contained in:
Родитель
9f28c20660
Коммит
cb9fc6d901
|
@ -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>
|
||||
</center>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;?>
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче