diff options
-rw-r--r-- | inc/html.php | 414 | ||||
-rw-r--r-- | inc/template.php | 40 | ||||
-rw-r--r-- | tpl/default/footer.html (renamed from includes/footer.html) | 31 | ||||
-rw-r--r-- | tpl/default/main.php | 12 |
4 files changed, 74 insertions, 423 deletions
diff --git a/inc/html.php b/inc/html.php index 3b31c96ff..2e8432b3c 100644 --- a/inc/html.php +++ b/inc/html.php @@ -158,94 +158,6 @@ function html_secedit($text,$show=true){ } /** - * displays the breadcrumbs trace - * - * @deprecated - * @author Andreas Gohr <andi@splitbrain.org> - */ -function html_breadcrumbs(){ - global $lang; - global $conf; - - //check if enabled - if(!$conf['breadcrumbs']) return; - - $crumbs = breadcrumbs(); //setup crumb trace - print '<div class="breadcrumbs">'; - print $lang['breadcrumb'].':'; - foreach ($crumbs as $crumb){ - print ' » '; - print '<a href="'.wl($crumb).'" class="breadcrumbs" onclick="return svchk()" onkeypress="return svchk()" title="'.$crumb.'">'.noNS($crumb).'</a>'; - } - print '</div>'; -} - -/** - * display the HTML head and metadata - * - * @deprecated -> tpl_metaheaders() - * @author Andreas Gohr <andi@splitbrain.org> - */ -function html_head(){ - global $ID; - global $ACT; - global $INFO; - global $REV; - global $conf; - global $lang; - - //print '<'.'?xml version="1.0"?'.">\n"; - print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'; - print ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; - print "\n"; -?> - <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?=$conf['lang']?>" lang="<?=$conf['lang']?>" dir="ltr"> - <head> - <title><?=$ID?> [<?=$conf['title']?>]</title> - <meta http-equiv="Content-Type" content="text/html; charset=<?=$lang['encoding']?>" /> - <meta name="generator" content="DokuWiki <?=getVersion()?>" /> - <link rel="stylesheet" media="screen" type="text/css" href="<?=DOKU_BASE?>style.css" /> - <link rel="stylesheet" media="print" type="text/css" href="<?=DOKU_BASE?>print.css" /> - <link rel="shortcut icon" href="<?=DOKU_BASE?>images/favicon.ico" /> - <link rel="start" href="<?=wl()?>" /> - <link rel="contents" href="<?=wl($ID,'do=index')?>" title="<?=$lang['index']?>" /> - <link rel="alternate" type="application/rss+xml" title="Recent Changes" href="<?=DOKU_BASE?>feed.php" /> - <link rel="alternate" type="application/rss+xml" title="Current Namespace" href="<?=DOKU_BASE?>feed.php?mode=list&ns=<?=$INFO['namespace']?>" /> - <link rel="alternate" type="text/html" title="Plain HTML" href="<?=wl($ID,'do=export_html')?>" /> - <link rel="alternate" type="text/plain" title="Wiki Markup" href="<?=wl($ID, 'do=export_raw')?>" /> -<? - if( ($ACT=='show' || $ACT=='export_html') && !$REV){ - if($INFO['exists']){ - print ' <meta name="robots" content="index,follow" />'."\n"; - print ' <meta name="date" content="'.date('Y-m-d\TH:i:sO',$INFO['lastmod']).'" />'."\n"; - }else{ - print ' <meta name="robots" content="noindex,follow" />'."\n"; - } - }else{ - print ' <meta name="robots" content="noindex,nofollow" />'."\n"; - } -?> - - <script language="JavaScript" type="text/javascript"> - var alertText = '<?=$lang['qb_alert']?>'; - var notSavedYet = '<?=$lang['notsavedyet']?>'; - var DOKU_BASE = '<?=DOKU_BASE?>'; - </script> - <script language="JavaScript" type="text/javascript" src="<?=DOKU_BASE?>script.js"></script> - - <!--[if gte IE 5]> - <style type="text/css"> - /* that IE 5+ conditional comment makes this only visible in IE 5+ */ - img { behavior: url("<?=DOKU_BASE?>pngbehavior.htc"); } /* IE bugfix for transparent PNGs */ - </style> - <![endif]--> - - <?@include("includes/meta.html")?> - </head> -<? -} - -/** * Just the back to top button (in it's own form) * * @author Andreas Gohr <andi@splitbrain.org> @@ -304,180 +216,6 @@ function html_btn($name,$id,$akey,$params,$method='get'){ } /** - * Check for the given permission or prints an error - * - * @deprecated - * @author Andreas Gohr <andi@splitbrain.org> - */ -function html_acl($perm){ - global $INFO; - if($INFO['perm'] >= $perm) return true; - - print parsedLocale('denied'); - return false; -} - -/** - * Displays the overall page header and calls html_head() - * - * @author Andreas Gohr <andi@splitbrain.org> - */ -function html_header(){ - global $ID; - global $REV; - global $lang; - global $conf; - html_head(); -?> -<body> - <div class="all"> - <? - @include("includes/topheader.html"); - html_msgarea(); - ?> - <div class="stylehead"> - <div class="header"> - <div class="pagename"> - [[<a href="<?=wl($ID,'do=backlink')?>" onclick="return svchk()" onkeypress="return svchk()"><?=$ID?></a>]] - </div> - <div class="logo"> - <a href="<?=wl()?>" name="top" accesskey="h" title="[ALT+H]" onclick="return svchk()" onkeypress="return svchk()"><?=$conf['title']?></a> - </div> - </div> - <?@include("includes/header.html")?> - - <div class="bar" id="bar_top"> - <div class="bar-left" id="bar_topleft"> - <?=html_editbutton()?> - <?=html_btn(revs,$ID,'o',array('do' => 'revisions'))?> - </div> - - <div class="bar-right" id="bar_topright"> - <?=html_btn(recent,'','r',array('do' => 'recent'))?> - <form action="<?=wl()?>" accept-charset="<?=$lang['encoding']?>"> - <input type="hidden" name="do" value="search" /> - <input type="text" accesskey="f" name="id" class="edit" /> - <input type="submit" value="<?=$lang['btn_search']?>" class="button" /> - </form> - </div> - </div> - - <? - flush(); - html_breadcrumbs(); - @include("includes/pageheader.html"); - ?> - </div> - <div class="page"> - <!-- wikipage start --> -<? -} - -/** - * display document and user info - * - * Displays some Metadata like who's logged in and the last modified - * date - do not confuse this with the HTML meta header. - * - * @author Andreas Gohr <andi@splitbrain.org> - */ -function html_metainfo(){ - global $conf; - global $lang; - global $INFO; - global $REV; - - $fn = $INFO['filepath']; - if(!$conf['fullpath']){ - if($REV){ - $fn = str_replace(realpath($conf['olddir']).DIRECTORY_SEPARATOR,'',$fn); - }else{ - $fn = str_replace(realpath($conf['datadir']).DIRECTORY_SEPARATOR,'',$fn); - } - } - $date = date($conf['dformat'],$INFO['lastmod']); - - print '<div class="meta">'; - if($_SERVER['REMOTE_USER']){ - print '<div class="user">'; - print $lang['loggedinas'].': '.$_SERVER['REMOTE_USER']; - print '</div>'; - } - print ' '; - if($INFO['exists']){ - print $fn; - print ' · '; - print $lang['lastmod']; - print ': '; - print $date; - if($INFO['editor']){ - print ' '.$lang['by'].' '; - print $INFO['editor']; - } - if($INFO['locked']){ - print ' · '; - print $lang['lockedby']; - print ': '; - print $INFO['locked']; - } - } - print '</div>'; -} - -/** - * Diplay the overall footer - * - * @author Andreas Gohr <andi@splitbrain.org> - */ -function html_footer(){ - global $ID; - global $REV; - global $INFO; - global $lang; - global $conf; -?> - <!-- wikipage stop --> - </div> - <div class="clearer"> </div> - <div class="stylefoot"> - <? - flush(); - @include("includes/pagefooter.html"); - html_metainfo(); - ?> - <div class="bar" id="bar_bottom"> - <div class="bar-left" id="bar_bottomleft"> - <?=html_editbutton()?> - <?=html_btn(revs,$ID,'o',array('do' => 'revisions'))?> - </div> - - <div class="bar-right" id="bar_bottomright"> - <? - if($conf['useacl']){ - if($_SERVER['REMOTE_USER']){ - print html_btn('logout',$ID,'',array('do' => 'logout',)); - }else{ - print html_btn('login',$ID,'',array('do' => 'login')); - } - #//acl-admin button - #if($INFO['perm'] == AUTH_GRANT){ - # print html_btn('acl_admin',$ID,'',array('do' => 'acl_admin')); - #} - } - ?> - <?=html_btn(index,$ID,'x',array('do' => 'index'))?> - <a href="#top"><input type="button" class="button" value="<?=$lang['btn_top']?>" /></a> - </div> - </div> - </div> - <?@include("includes/footer.html")?> - </div> - </body> - </html> -<? -} - -/** * Print the table of contents * * @author Andreas Gohr <andi@splitbrain.org> @@ -1208,158 +946,6 @@ function html_debug(){ } /** - * prints the acl-admin form(s) - * - * @author Frank Schubert <frank@schokilade.de> - */ -function html_acl_admin(){ - global $lang; - global $ID; - global $INFO; - - print parsedLocale('acl_admin'); -?> - <fieldset style="float:left; text-align:left; white-space:nowrap; width:320px;"> - <legend><?=$lang['acl_admin']?></legend> - - -<!-- XXXXXXXXXXXXX --> - - <form name="acl_admin_add" method="post" action="<?=wl($ID)?>" accept-charset="<?=$lang['encoding']?>"> - <input type="hidden" name="do" value="acl_admin_add" /> - <input type="hidden" name="save" value="1" /> - <table> - <tr> - <td><?=$lang['acl_user']?></td> - <td><input type="text" name="acl_user" class="edit" size="20" value="" /></td> - </tr><tr> - <td><?=$lang['acl_scope']?></td> - <td><select name="acl_scope" id="acl_scope" class="edit" size="1" onChange="checkAclLevel();"> - <option value="">(<?=$lang['acl_input_request']?>)</option> - <option><?=$ID?></option> - <?php if( ($ns=getNS($ID)) != NULL) {?> - <option><?=$ns?>:*</option> - <?php }else{ ?> - <option>*</option> - <?php } ?> - </select></td> - </tr><tr> - <td style="vertical-align:top"><?=$lang['acl_level']?></td> - <td> - <input type="checkbox" name="acl_checkbox[1]" value="on" checked="checked" /><?=$lang['acl_read']?><br /> - <input type="checkbox" name="acl_checkbox[2]" value="on" /><?=$lang['acl_edit']?><br /> - <input type="checkbox" name="acl_checkbox[4]" value="on" /><?=$lang['acl_create']?><br /> - <input type="checkbox" name="acl_checkbox[8]" value="on" /><?=$lang['acl_upload']?> - </td> - </tr><tr> - <td></td> - <td><input type="submit" class="button" value="<?=$lang['acl_commit']?>" /></td> - </tr> - </table> - </form> -<!-- XXXXXXXXXXXXX --> - </fieldset> - - <div style="float:right;"> - <fieldset> - <legend><?=$lang['acl_current']?></legend> - <div style="text-align:left"> - -<!-- XXXXXXXXXXXXX --> - <?php - $acl_config=get_acl_config($ID); - foreach($acl_config as $pagename => $value){ - if($pagename != '*') { - $ID_cur=$pagename; - while(($piece=getNS($ID_cur)) !== false){ - $url="<a href='".wl($piece,'do=acl_admin')."'>".noNS($piece)."</a>:".$url;; - $ID_cur=$piece; - } - $url.="<a href='".wl($pagename,'do=acl_admin')."'>".noNS($pagename)."</a>"; - print $url; - $url=''; - }else{ - print $pagename; - } ?> - - <!-- XXXXXXXXXXXXX --> - <table class="inline"> - <tr> - <th class="inline"></th> - <th class="inline">name</th> - <th class="inline">R</th> - <th class="inline">W</th> - <th class="inline">C</th> - <th class="inline">U</th> - <th class="inline">UPDATE</th> - <th class="inline">DELETE</th> - </tr> - <?php - foreach($value as $conf){ - ?> - <tr> - <!-- user/group --> - <td class="inline"> - <?php - $group = false; - if(substr($conf[0],0,1)=="@"){ - print $lang['acl_group']; - $group = true; - }else{ - print $lang['acl_user']; - } - ?> - </td> - <td class="inline"> - <!-- name --> - <?php - if($group) { print substr($conf[0],1); } else { print $conf[0]; } - ?> - </td> - <form name="acl_admin_change" method="post" action="<?=wl($ID)?>" accept-charset="<?=$lang['encoding']?>"> - <?php - // read,write,create,upload - $acl_nums=array(1,2,4,8); - foreach($acl_nums as $num){ - ?><td class="inline"> - <input type="hidden" name="do" value="acl_admin_change" /> - <input type="hidden" name="save" value="1" /> - <input type="hidden" name="acl_scope" value='<?=urlencode($pagename)?>' /> - <input type="hidden" name="acl_user" value='<?=urlencode($conf[0])?>' /> - <input type="hidden" name="acl_level" value='<?=$conf[1]?>' /> - <input type="checkbox" name="acl_checkbox[<?=$num?>]" value="on"<?php - if($conf[1]>=$num) { - ?> checked="checked"<?php - } - ?> /></td><?php - } - ?> - <td class="inline"><input type="submit" class="button" value="update"></td> - </form> - <td class="inline"> - <!-- delete form --> - <form name="acl_admin_del" method="post" action="<?=wl($ID)?>" accept-charset="<?=$lang['encoding']?>"> - <input type="hidden" name="do" value="acl_admin_del" /> - <input type="hidden" name="save" value="1" /> - <input type="hidden" name="acl_scope" value='<?=urlencode($pagename);?>' /> - <input type="hidden" name="acl_user" value='<?=urlencode($conf[0])?>' /> - <input type="hidden" name="acl_level" value='<?=$conf[1]?>' /> - <input type="submit" class="button" value='DEL' onClick="return window.confirm('<?=$lang['acl_confirm_delete']?>');" /> - </form> - </td> - </tr> - <?php - } - ?></table><?php - } - ?> - </div> - </fieldset> - </div> -<? -} - -/** * Print the admin overview page * * @author Andreas Gohr <andi@splitbrain.org> diff --git a/inc/template.php b/inc/template.php index 8047a33d0..38af79df7 100644 --- a/inc/template.php +++ b/inc/template.php @@ -262,7 +262,6 @@ function tpl_searchform(){ /** * Print the breadcrumbs trace * - * @todo add a hierachical breadcrumb function * @author Andreas Gohr <andi@splitbrain.org> */ function tpl_breadcrumbs(){ @@ -281,6 +280,45 @@ function tpl_breadcrumbs(){ } /** + * Hierarchical breadcrumbs + * + * This code was suggested as replacement for the usual breadcrumbs + * trail in the Wiki and was modified by me. + * It only makes sense with a deep site structure. + * + * @author Andreas Gohr <andi@splitbrain.org> + * @link http://wiki.splitbrain.org/wiki:tipsandtricks:hierarchicalbreadcrumbs + */ +function tpl_youarehere(){ + global $conf; + global $ID; + global $lang; + + + $parts = explode(':', $ID); + + print $lang['breadcrumb'].': '; + + //always print the startpage + if( $a_part[0] != $conf['start'] ) + tpl_link(wl($conf['start']),$conf['start'],'title="'.$conf['start'].'"'); + + $page = ''; + foreach ($parts as $part){ + print ' » '; + $page .= $part; + + if(file_exists(wikiFN($page))){ + tpl_link(wl($page),$part,'title="'.$page.'"'); + }else{ + print $page; + } + + $page .= ':'; + } +} + +/** * Print info if the user is logged in * * Could be enhanced with a profile link in future? diff --git a/includes/footer.html b/tpl/default/footer.html index 3396315e9..323fdb686 100644 --- a/includes/footer.html +++ b/tpl/default/footer.html @@ -1,17 +1,34 @@ +<?php +/** + * Example footer include + * + * This file shows you how to use the include hooks. However I recommend to + * create your own complete new template instead. + */ +?> + <div align="center" class="footerinc"> - <a target="_blank" href="feed.php" title="Recent changes RSS feed"><img src="<?=getBaseURL()?>images/button-rss.png" width="80" height="15" alt="Recent changes RSS feed" border="0" /></a> + <a target="_blank" href="feed.php" title="Recent changes RSS feed"><img src="<?=DOKU_TPL?>images/button-rss.png" width="80" height="15" alt="Recent changes RSS feed" border="0" /></a> + + <a target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/2.0/" rel="license" title="Creative Commons License"><img src="<?=DOKU_TPL?>images/button-cc.gif" width="80" height="15" alt="Creative Commons License" border="0" /></a> + + <a target="_blank" href="https://www.paypal.com/xclick/business=andi%40splitbrain.org&item_name=DokuWiki+Donation&no_shipping=1&no_note=1&tax=0&currency_code=EUR&lc=US" title="Donate"><img src="<?=DOKU_TPL?>images/button-donate.gif" alt="Donate" border="0" /></a> - <a target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/2.0/" rel="license" title="Creative Commons License"><img src="<?=getBaseURL()?>images/button-cc.gif" width="80" height="15" alt="Creative Commons License" border="0" /></a> + <a target="_blank" href="http://www.php.net" title="Powered by PHP"><img src="<?=DOKU_TPL?>images/button-php.gif" width="80" height="15" alt="Powered by PHP" border="0" /></a> - <a target="_blank" href="https://www.paypal.com/xclick/business=andi%40splitbrain.org&item_name=DokuWiki+Donation&no_shipping=1&no_note=1&tax=0&currency_code=EUR&lc=US" title="Donate"><img src="<?=getBaseURL()?>images/button-donate.gif" alt="Donate" border="0" /></a> + <a target="_blank" href="http://validator.w3.org/check/referer" title="Valid XHTML 1.0"><img src="<?=DOKU_TPL?>images/button-xhtml.png" width="80" height="15" alt="Valid XHTML 1.0" border="0" /></a> - <a target="_blank" href="http://www.php.net" title="Powered by PHP"><img src="<?=getBaseURL()?>images/button-php.gif" width="80" height="15" alt="Powered by PHP" border="0" /></a> + <a target="_blank" href="http://jigsaw.w3.org/css-validator/check/referer" title="Valid CSS"><img src="<?=DOKU_TPL?>images/button-css.png" width="80" height="15" alt="Valid CSS" border="0" /></a> - <a target="_blank" href="http://validator.w3.org/check/referer" title="Valid XHTML 1.0"><img src="<?=getBaseURL()?>images/button-xhtml.png" width="80" height="15" alt="Valid XHTML 1.0" border="0" /></a> + <a target="_blank" href="http://wiki.splitbrain.org/wiki:dokuwiki" title="Driven by DokuWiki"><img src="<?=DOKU_TPL?>images/button-dw.png" width="80" height="15" alt="Driven by DokuWiki" border="0" /></a> - <a target="_blank" href="http://jigsaw.w3.org/css-validator/check/referer" title="Valid CSS"><img src="<?=getBaseURL()?>images/button-css.png" width="80" height="15" alt="Valid CSS" border="0" /></a> - <a target="_blank" href="http://wiki.splitbrain.org/wiki:dokuwiki" title="Driven by DokuWiki"><img src="<?=getBaseURL()?>images/button-dw.png" width="80" height="15" alt="Driven by DokuWiki" border="0" /></a> +<?php +/* + * The following stuff in HTML comments declares a Creative Commons + * License - remove this if you don't want this license for your Wiki + */ +?> <!-- diff --git a/tpl/default/main.php b/tpl/default/main.php index 091717142..1ce58f407 100644 --- a/tpl/default/main.php +++ b/tpl/default/main.php @@ -9,7 +9,6 @@ * You should leave the doctype at the very top - It should * always be the very first line of a document. * - * @todo read the include hooks, add the CSS! * @link http://wiki.splitbrain.org/wiki:tpl:templates * @author Andreas Gohr <andi@splitbrain.org> */ @@ -33,9 +32,12 @@ img { behavior: url("<?=DOKU_BASE?>/pngbehavior.htc"); } </style> <![endif]--> + + <?/*old includehook*/ @include(dirname(__FILE__).'/meta.html')?> </head> <body> +<?/*old includehook*/ @include(dirname(__FILE__).'/topheader.html')?> <div class="dokuwiki"> <?html_msgarea()?> @@ -49,6 +51,8 @@ <?tpl_link(wl(),$conf['title'],'name="top" accesskey="h" title="[ALT+H]"')?> </div> </div> + + <?/*old includehook*/ @include(dirname(__FILE__).'/header.html')?> <div class="bar" id="bar_top"> <div class="bar-left" id="bar_topleft"> @@ -65,12 +69,15 @@ <?if($conf['breadcrumbs']){?> <div class="breadcrumbs"> <?tpl_breadcrumbs()?> + <?//tpl_youarehere() //(some people prefer this)?> </div> <?}?> </div> <?flush()?> + <?/*old includehook*/ @include(dirname(__FILE__).'/pageheader.html')?> + <div class="page"> <!-- wikipage start --> <?tpl_content()?> @@ -92,6 +99,8 @@ </div> </div> + <?/*old includehook*/ @include(dirname(__FILE__).'/pagefooter.html')?> + <div class="bar" id="bar_bottom"> <div class="bar-left" id="bar_bottomleft"> <?tpl_button('edit')?> @@ -108,4 +117,5 @@ </div> </div> +<?/*old includehook*/ @include(dirname(__FILE__).'/footer.html')?> </body> |