OSDN Git Service

Better late than never. Added simple credits, workdays(years), and license notificati...
[pukiwiki/pukiwiki.git] / skin / tdiary.skin.php
index 8055dce..d0ead91 100644 (file)
@@ -1,11 +1,19 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: tdiary.skin.php,v 1.14 2005/01/19 13:49:19 henoheno Exp $
+// $Id: tdiary.skin.php,v 1.23 2005/05/01 02:43:27 henoheno Exp $
+// Copyright (C)
+//   2002-2005 PukiWiki Developers Team
+//   2001-2002 Originally written by yu-ji
+// License: GPL v2 or (at your option) any later version
 //
 // tDiary-wrapper skin
 
+// ------------------------------------------------------------
+// Settings (define before here, if you want)
+
 // Select theme
-if (! defined('TDIARY_THEME')) define('TDIARY_THEME', 'loose-leaf'); // Default
+if (! defined('TDIARY_THEME'))
+       define('TDIARY_THEME', 'loose-leaf'); // Default
 
 // Show link(s) at your choice, with <div class="calendar"> design
 // NOTE: Some theme become looking worse with this!
@@ -15,15 +23,25 @@ if (! defined('TDIARY_THEME')) define('TDIARY_THEME', 'loose-leaf'); // Default
 if (! defined('TDIARY_CALENDAR_DESIGN'))
        define('TDIARY_CALENDAR_DESIGN', NULL); // NULL, 0, 1
 
+// Show / Hide navigation bar UI at your choice
+// NOTE: This is not stop their functionalities!
+if (! defined('PKWK_SKIN_SHOW_NAVBAR'))
+       define('PKWK_SKIN_SHOW_NAVBAR', 1); // 1, 0
+
 // Show toolbar at your choice, with <div class="footer"> design
 // NOTE: Some theme become looking worse with this!
 if (! defined('PKWK_SKIN_SHOW_TOOLBAR'))
        define('PKWK_SKIN_SHOW_TOOLBAR', 0); // 0, 1
 
-// --------
+// TDIARY_SIDEBAR_POSITION: See below
+
+// ------------------------------------------------------------
+// Code start
+
 // Prohibit direct access
 if (! defined('UI_LANG')) die('UI_LANG is not set');
 if (! isset($_LANG)) die('$_LANG is not set');
+if (! defined('PKWK_READONLY')) die('PKWK_READONLY is not set');
 
 // Check theme
 $theme = TDIARY_THEME;
@@ -34,14 +52,17 @@ if ($theme == '' || $theme == 'TDIARY_THEME') {
        $theme_css = SKIN_DIR . 'theme/' . $theme . '/' . $theme . '.css';
        if (! file_exists($theme_css)) {
                echo 'tDiary theme wrapper: ';
-               echo 'Theme not found: ' . htmlspecialchars($theme_css) . '<br/>';
+               echo 'Theme not found: ' . htmlspecialchars($theme_css) . '<br />';
                echo 'You can get tdiary-theme from: ';
                echo 'http://sourceforge.net/projects/tdiary/';
                exit;
         }
 }
 
-// Adjust DTD (between theme(=CSS) and MSIE bug)
+// ------------------------------------------------------------
+// Exception
+
+// Adjust DTD (bug between these theme(=CSS) and MSIE)
 // NOTE:
 //    PukiWiki default: PKWK_DTD_XHTML_1_1
 //    tDiary's default: PKWK_DTD_HTML_4_01_STRICT
@@ -54,11 +75,56 @@ case 'christmas':
 // Adjust reverse-link default design manually
 $disable_backlink = FALSE;
 switch(TDIARY_THEME){
-case 'hatena': /*FALLTHROUGH*/
-       $disable_backlink = TRUE;
+case 'hatena':
+       $disable_backlink = TRUE; // or very viewable title color
        break;
 }
 
+// ------------------------------------------------------------
+// Select CSS color theme (testing)
+$css_theme = '';
+switch(TDIARY_THEME){
+case 'alfa':
+case 'bill':
+case 'black-lingerie':
+case 'bubble':
+case 'cosmos':
+case 'darkness-pop':
+case 'fine':
+case 'fri':
+case 'giza':
+case 'kaizou':
+case 'lightning':
+case 'lime':
+case 'line':
+case 'midnight':
+case 'moo':
+case 'nachtmusik':
+case 'nebula':
+case 'nippon':
+case 'noel':
+case 'petith-b':
+case 'quiet_black':
+case 'redgrid':
+case 'starlight':
+case 'tinybox_green':
+case 'white-lingerie':
+case 'whiteout':
+case 'wine':
+case 'wood':
+case 'xmastree':
+case 'yukon':
+       $css_theme = 'black';
+
+// Another theme needed?
+case 'bluely':
+case 'brown':
+case 'deepblue':
+case 'scarlet':
+case 'smoking_black':
+       ;
+}
+
 // Select title design (which is fancy, date and text?)
 $title_design_date = 1; // Default: Select the date desin, or 'the same design'
 switch(TDIARY_THEME){
@@ -84,6 +150,7 @@ case 'midnight':
 case 'momonga':
 case 'nande-ya-nen':
 case 'narrow':
+case 'natrium':
 case 'nebula':
 case 'orange':
 case 'parabola':
@@ -97,18 +164,18 @@ case 'sky':
 case 'snow_man':
 case 'spring':
 case 'tag':
+case 'tdiarynet':
 case 'white-lingerie':
 case 'whiteout':
 case 'wood':
        $title_design_date = 0; // Select text design   
        break;
 
-// Show both :)
 case 'arrow':
 case 'fluxbox':
 case 'fluxbox2':
 case 'fluxbox3':
-       $title_design_date = 2;
+       $title_design_date = 2; // Show both :)
        break;
 }
 
@@ -116,12 +183,13 @@ case 'fluxbox3':
 if (defined('TDIARY_SIDEBAR_POSITION')) {
        $sidebar = TDIARY_SIDEBAR_POSITION;
 } else {
-       // Themes including sidebar CSS < (AllTheme / 2)
+       $sidebar = 'another'; // Default: Show as an another page below
+
+       // List of themes having sidebar CSS < (AllTheme / 2)
        // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
        // $ wc -l *.txt
-       //     75 list-sidebar.txt
-       //    193 list-all.txt
-       $sidebar = 'another'; // Default: Show as an another page below
+       //     78 list-sidebar.txt
+       //    196 list-all.txt
        switch(TDIARY_THEME){
        case '3minutes':        /*FALLTHROUGH*/
        case '3pink':
@@ -129,6 +197,7 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'arrow':
        case 'autumn':
        case 'babypink':
+       case 'be_r5';
        case 'bill':
        case 'bistro_menu':
        case 'bluely':
@@ -165,6 +234,7 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'momonga':
        case 'mono':
        case 'moo':
+       case 'natrium':
        case 'nippon':
        case 'note':
        case 'old-pavement':
@@ -191,6 +261,7 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'smoking_white':
        case 'spring':
        case 'sunset':
+       case 'tdiarynet':
        case 'teacup':
        case 'thin':
        case 'tile':
@@ -198,14 +269,14 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'tinybox_green':
        case 'wine':
        case 'yukon':
-               $sidebar = 'bottom';    // This is the default position of tDiary's.
+               $sidebar = 'bottom'; // This is the default position of tDiary's.
                break;
        }
 
-       // Adjust sidebar's default position
+       // Manually adjust sidebar's default position
        switch(TDIARY_THEME){
 
-       // Assuming sidebar is above of the body
+       // 'top': Assuming sidebar is above of the body
        case 'autumn':  /*FALLTHROUGH*/
        case 'cosmos':
        case 'dice':    // Sidebar text (white) seems unreadable
@@ -219,7 +290,7 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
                $sidebar = 'top';
                break;
 
-       // Strict separation between sidebar and main contents needed
+       // 'strict': Strict separation between sidebar and main contents needed
        case '3minutes':        /*FALLTHROUGH*/
        case '3pink':
        case 'aoikuruma':
@@ -230,6 +301,7 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'cool_ice':
        case 'flower':
        case 'germany':
+       case 'hiki':
        case 'himawari':
        case 'kotatsu':
        case 'light-blue':
@@ -253,7 +325,7 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
                $sidebar = 'strict';
                break;
 
-       // They have sidevar-design, but can not show it at the 'side' of the contents
+       // 'another': They have sidebar-design, but can not show it at the 'side' of the contents
        case 'babypink':        /*FALLTHROUGH*/
        case 'bubble':
        case 'cherry':
@@ -268,18 +340,27 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
                $sidebar = 'another'; // Show as an another page below
                break;
        }
+
+       // 'none': Show no sidebar
 }
 // Check menu (sidebar) is ready and $menubar is there
-$menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
-       exist_plugin_convert('menu'));
-if ($menu) {
-       $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
-               '<h3 $1><span class="sanchor"></span> $2</h3>',
-               do_plugin_convert('menu'));
+if ($sidebar == 'none') {
+       $menu = FALSE;
+} else {
+       $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
+               exist_plugin_convert('menu'));
+       if ($menu) {
+               $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
+                       '<h3 $1><span class="sanchor"></span> $2</h3>',
+                       do_plugin_convert('menu'));
+       }
 }
 
+// ------------------------------------------------------------
+
 $lang  = & $_LANG['skin'];
 $link  = & $_LINK;
+$rw    = ! PKWK_READONLY;
 
 // Decide charset for CSS
 $css_charset = 'iso-8859-1';
@@ -287,6 +368,8 @@ switch(UI_LANG){
        case 'ja': $css_charset = 'Shift_JIS'; break;
 }
 
+// ------------------------------------------------------------
+
 // Output HTTP headers
 pkwk_common_headers();
 header('Cache-control: no-cache');
@@ -311,8 +394,8 @@ if (isset($pkwk_dtd)) {
 
  <link rel="stylesheet" href="skin/theme/base.css" type="text/css" media="all" />
  <link rel="stylesheet" href="skin/theme/<?php echo $theme ?>/<?php echo $theme ?>.css" type="text/css" media="all" />
- <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>" type="text/css" media="screen" charset="<?php echo $css_charset ?>" />
- <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>&amp;media=print" type="text/css" media="print" charset="<?php echo $css_charset ?>" />
+ <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>&amp;color=<?php echo $css_theme ?>" type="text/css" media="screen" charset="<?php echo $css_charset ?>" />
+ <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>&amp;color=<?php echo $css_theme ?>&amp;media=print" type="text/css" media="print" charset="<?php echo $css_charset ?>" />
 
  <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
 
@@ -335,8 +418,8 @@ if (isset($pkwk_dtd)) {
 <?php } // if ($menu && $sidebar == 'strict') ?>
 
 <!-- Navigation buttuns -->
-<div id="navigator"></div>
-<div class="adminmenu">
+<?php if (PKWK_SKIN_SHOW_NAVBAR) { ?>
+<div class="adminmenu"><div id="navigator">
 <?php
 function _navigator($key, $value = '', $javascript = ''){
        $lang = $GLOBALS['_LANG']['skin'];
@@ -355,22 +438,26 @@ function _navigator($key, $value = '', $javascript = ''){
  <?php _navigator('top') ?> &nbsp;
 
 <?php if ($is_page) { ?>
-   <?php _navigator('edit')   ?>
- <?php if ($is_read && $function_freeze) { ?>
-    <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
+  <?php if ($rw) { ?>
+       <?php _navigator('edit') ?>
+       <?php if ($is_read && $function_freeze) { ?>
+               <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
+       <?php } ?>
  <?php } ?>
    <?php _navigator('diff') ?>
  <?php if ($do_backup) { ?>
-   <?php _navigator('backup') ?>
+       <?php _navigator('backup') ?>
  <?php } ?>
- <?php if ((bool)ini_get('file_uploads')) { ?>
-   <?php _navigator('upload') ?>
+ <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
+       <?php _navigator('upload') ?>
  <?php } ?>
-   <?php _navigator('reload')    ?>
+   <?php _navigator('reload') ?>
    &nbsp;
 <?php } ?>
 
-   <?php _navigator('new')  ?>
+ <?php if ($rw) { ?>
+       <?php _navigator('new') ?>
+ <?php } ?>
    <?php _navigator('list') ?>
  <?php if (arg_check('list')) { ?>
    <?php _navigator('filelist') ?>
@@ -381,12 +468,15 @@ function _navigator($key, $value = '', $javascript = ''){
 
 <?php if ($trackback) { ?> &nbsp;
    <?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
-       ($trackback_javascript == 1) ? 'onClick="OpenTrackback(this.href); return false"' : '') ?>
+       ($trackback_javascript == 1) ? 'onclick="OpenTrackback(this.href); return false"' : '') ?>
 <?php } ?>
 <?php if ($referer)   { ?> &nbsp;
    <?php _navigator('refer') ?>
 <?php } ?>
-</div>
+</div></div>
+<?php } else { ?>
+<div id="navigator"></div>
+<?php } // PKWK_SKIN_SHOW_NAVBAR ?>
 
 <h1><?php echo $page_title ?></h1>
 
@@ -476,7 +566,7 @@ default:
 <?php if ($notes != '') { ?>
 <div class="comment"><!-- Design for tDiary "Comments" -->
        <div class="caption">&nbsp;</div>
-       <div class="commentbody"><br/>
+       <div class="commentbody"><br />
                <?php
                $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
                echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
@@ -601,29 +691,35 @@ function _toolbar($key, $x = 20, $y = 20){
 
 <?php if ($is_page) { ?>
  &nbsp;
- <?php _toolbar('edit') ?>
- <?php if ($is_read && $function_freeze) { ?>
-  <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
+ <?php if ($rw) { ?>
+       <?php _toolbar('edit') ?>
+       <?php if ($is_read && $function_freeze) { ?>
+               <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
+       <?php } ?>
  <?php } ?>
  <?php _toolbar('diff') ?>
 <?php if ($do_backup) { ?>
-  <?php _toolbar('backup') ?>
+       <?php _toolbar('backup') ?>
 <?php } ?>
- <?php if ((bool)ini_get('file_uploads')) { ?>
-  <?php _toolbar('upload') ?>
+ <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
+       <?php _toolbar('upload') ?>
+ <?php } ?>
+ <?php if ($rw) { ?>
+       <?php _toolbar('copy') ?>
+       <?php _toolbar('rename') ?>
  <?php } ?>
- <?php _toolbar('copy') ?>
- <?php _toolbar('rename') ?>
  <?php _toolbar('reload') ?>
 <?php } ?>
  &nbsp;
- <?php _toolbar('new')    ?>
+ <?php if ($rw) { ?>
+       <?php _toolbar('new') ?>
+ <?php } ?>
  <?php _toolbar('list')   ?>
  <?php _toolbar('search') ?>
  <?php _toolbar('recent') ?>
  &nbsp; <?php _toolbar('help') ?>
  &nbsp; <?php _toolbar('rss10', 36, 14) ?>
- <br/>
+ <br />
 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
 
 <!-- Copyright etc -->