Merge pull request #868 from owncloud/new_doc_system

New doc system
This commit is contained in:
Frank Karlitschek 2012-12-19 06:40:37 -08:00
commit d7fbe47583
6 changed files with 61 additions and 72 deletions

2
core/doc/admin/index.php Normal file
View File

@ -0,0 +1,2 @@
Here goes the admin documentation.
In the meantime go to <a href="http://owncloud.org/support/" target="_blank">ownCloud.org/support</a>

2
core/doc/user/index.php Normal file
View File

@ -0,0 +1,2 @@
Here goes the user documentation
In the meantime go to <a href="http://owncloud.org/support/" target="_blank">ownCloud.org/support</a>

View File

@ -166,7 +166,7 @@ class OC_Util {
* @param int timestamp $timestamp * @param int timestamp $timestamp
* @param bool dateOnly option to ommit time from the result * @param bool dateOnly option to ommit time from the result
*/ */
public static function formatDate( $timestamp, $dateOnly=false) { public static function formatDate( $timestamp, $dateOnly=false) {
if(isset($_SESSION['timezone'])) {//adjust to clients timezone if we know it if(isset($_SESSION['timezone'])) {//adjust to clients timezone if we know it
$systemTimeZone = intval(date('O')); $systemTimeZone = intval(date('O'));
$systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100); $systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100);
@ -176,37 +176,8 @@ class OC_Util {
} }
$l=OC_L10N::get('lib'); $l=OC_L10N::get('lib');
return $l->l($dateOnly ? 'date' : 'datetime', $timestamp); return $l->l($dateOnly ? 'date' : 'datetime', $timestamp);
}
/**
* Shows a pagenavi widget where you can jump to different pages.
*
* @param int $pagecount
* @param int $page
* @param string $url
* @return OC_Template
*/
public static function getPageNavi($pagecount, $page, $url) {
$pagelinkcount=8;
if ($pagecount>1) {
$pagestart=$page-$pagelinkcount;
if($pagestart<0) $pagestart=0;
$pagestop=$page+$pagelinkcount;
if($pagestop>$pagecount) $pagestop=$pagecount;
$tmpl = new OC_Template( '', 'part.pagenavi', '' );
$tmpl->assign('page', $page);
$tmpl->assign('pagecount', $pagecount);
$tmpl->assign('pagestart', $pagestart);
$tmpl->assign('pagestop', $pagestop);
$tmpl->assign('url', $url);
return $tmpl;
}
} }
/** /**
* check if the current server configuration is suitable for ownCloud * check if the current server configuration is suitable for ownCloud
* @return array arrays with error messages and hints * @return array arrays with error messages and hints

View File

@ -68,3 +68,6 @@ span.securitywarning {color:#C33; font-weight:bold; }
span.connectionwarning {color:#933; font-weight:bold; } span.connectionwarning {color:#933; font-weight:bold; }
input[type=radio] { width:1em; } input[type=radio] { width:1em; }
table.shareAPI td { padding-bottom: 0.8em; } table.shareAPI td { padding-bottom: 0.8em; }
/* HELP */
.pressed {background-color:#DDD;}

View File

@ -12,15 +12,25 @@ OC_App::loadApps();
OC_Util::addStyle( "settings", "settings" ); OC_Util::addStyle( "settings", "settings" );
OC_App::setActiveNavigationEntry( "help" ); OC_App::setActiveNavigationEntry( "help" );
$pagesize=7;
if(isset($_GET['page'])) $page=$_GET['page']; else $page=0; if(isset($_GET['mode']) and $_GET['mode']=='admin') {
$kbe=OC_OCSClient::getKnownledgebaseEntries($page, $pagesize); $url=OC_Helper::linkToAbsolute( 'core', 'doc/admin' );
$totalitems=$kbe['totalitems']; $style1='';
unset($kbe['totalitems']); $style2=' pressed';
$pagecount=ceil($totalitems/$pagesize); }else{
$url=OC_Helper::linkToAbsolute( 'core', 'doc/user' );
$style1=' pressed';
$style2='';
}
$url1=OC_Helper::linkToRoute( "settings_help" ).'?mode=user';
$url2=OC_Helper::linkToRoute( "settings_help" ).'?mode=admin';
$tmpl = new OC_Template( "settings", "help", "user" ); $tmpl = new OC_Template( "settings", "help", "user" );
$tmpl->assign( "kbe", $kbe ); $tmpl->assign( "admin", OC_Group::inGroup(OC_User::getUser(), 'admin') );
$tmpl->assign( "pagecount", $pagecount ); $tmpl->assign( "url", $url );
$tmpl->assign( "page", $page ); $tmpl->assign( "url1", $url1 );
$tmpl->assign( "url2", $url2 );
$tmpl->assign( "style1", $style1 );
$tmpl->assign( "style2", $style2 );
$tmpl->printPage(); $tmpl->printPage();

View File

@ -1,34 +1,35 @@
<?php
/**
* 2012 Frank Karlitschek frank@owncloud.org
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/?>
<div id="controls"> <div id="controls">
<a class="button newquestion" href="http://owncloud.org/support" target="_blank"><?php echo $l->t( 'Documentation' ); ?></a> <?php if($_['admin']) { ?>
<a class="button newquestion" href="http://owncloud.org/support/big-files" target="_blank"><?php echo $l->t( 'Managing Big Files' ); ?></a> <a class="button newquestion <?php echo($_['style1']); ?>" href="<?php echo($_['url1']); ?>"><?php echo $l->t( 'User Documentation' ); ?></a>
<a class="button newquestion" href="http://apps.owncloud.com/knowledgebase/editquestion.php?action=new" target="_blank"><?php echo $l->t( 'Ask a question' ); ?></a> <a class="button newquestion <?php echo($_['style2']); ?>" href="<?php echo($_['url2']); ?>"><?php echo $l->t( 'Administrator Documentation' ); ?></a>
<?php <?php } ?>
$url=OC_Helper::linkTo( "settings", "help.php" ).'?page='; <a class="button newquestion" href="http://owncloud.org/support" target="_blank"><?php echo $l->t( 'Online Documentation' ); ?></a>
$pageNavi=OC_Util::getPageNavi($_['pagecount'], $_['page'], $url); <a class="button newquestion" href="http://forum.owncloud.org" target="_blank"><?php echo $l->t( 'Forum' ); ?></a>
if($pageNavi) { <?php if($_['admin']) { ?>
$pageNavi->printPage(); <a class="button newquestion" href="https://github.com/owncloud/core/issues" target="_blank"><?php echo $l->t( 'Bugtracker' ); ?></a>
} <?php } ?>
?> <a class="button newquestion" href="http://owncloud.com" target="_blank"><?php echo $l->t( 'Commercial Support' ); ?></a>
</diV> </div>
<?php if(!is_array($_["kbe"]) || !count($_["kbe"])):?> <br /><br />
<div class="helpblock"> <iframe src="<?php echo($_['url']); ?>" width="100%" id="ifm" ></iframe>
<p><?php echo $l->t('Problems connecting to help database.');?></p>
<p><a href="http://apps.owncloud.com/kb"><?php echo $l->t('Go there manually.');?></a></p>
</div> <script language="JavaScript">
<?php else:?> <!--
<?php foreach($_["kbe"] as $kb): ?>
<div class="helpblock"> function pageY(elem) {
<?php if($kb["preview1"] <> "") echo('<img class="preview" src="'.$kb["preview1"].'" />'); ?> return elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop;
<?php if($kb['detailpage']<>'') echo('<p><a target="_blank" href="'.$kb['detailpage'].'"><strong>'.$kb["name"].'</strong></a></p>');?> }
<p><?php echo $kb['description'];?></p> var buffer = 5; //scroll bar buffer
<?php if($kb['answer']<>'') echo('<p><strong>'.$l->t('Answer').':</strong><p>'.$kb['answer'].'</p>');?> function resizeIframe() {
</div> var height = document.documentElement.clientHeight;
<?php endforeach; height -= pageY(document.getElementById('ifm'))+ buffer ;
endif?> height = (height < 0) ? 0 : height;
document.getElementById('ifm').style.height = height + 'px';
}
document.getElementById('ifm').onload=resizeIframe;
window.onresize = resizeIframe;
//-->
</script>