]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/blog/themeinfo.php
more blog hacks
[SourceForge/phpwiki.git] / themes / blog / themeinfo.php
1 <?php
2 rcs_id('$Id: themeinfo.php,v 1.3 2005-02-02 19:14:13 rurban Exp $');
3
4 /**
5  * This file defines a blog theme for PhpWiki, 
6  * based on Rui Carmo's excellent http://the.taoofmac.com/space/ 
7  * which is based on the Kubrick theme: http://binarybonsai.com/kubrick/
8  * The layout was designed and built by Michael Heilemann,
9  * whose blog you will find at http://binarybonsai.com/
10  *
11  * [Stanley Kubrick]"Good afternoon, gentlemen. I am a HAL 9000
12  * computer. I became operational at the H.A.L. plant in Urbana,
13  * Illinois on the 12th of January 1992. My instructor was
14  * Mr. Langley, and he taught me to sing a song. If you'd like to hear
15  * it I can sing it for you."
16  *
17  * The CSS, XHTML and design is released under GPL:
18  * http://www.opensource.org/licenses/gpl-license.php 
19  *
20  * Default is a one-person (ADMIN_USER) blog (at the BlogHomePage), but 
21  * other blogs are also enabled for every authenticated user.
22  *
23  * Actionbar: Edit, Home, About, Archives, News, ..., Info  [ Search ]
24  * PageTrail: > .. > ..
25  * Right sidebar boxes: Archives, Syndication, Links, GoogleAds
26  *
27  * Happy blogging.
28  */
29
30 require_once('lib/Theme.php');
31 require_once('themes/Sidebar/themeinfo.php');
32
33 class Theme_blog extends Theme_Sidebar {
34    function _findFile ($file, $missing_okay=false) {
35         if (file_exists($this->_path . "themes/".$this->_name."/$file"))
36             return "themes/".$this->_name."/$file";
37         if (file_exists($this->_path . "themes/Sidebar/$file"))
38             return "themes/Sidebar/$file";
39         return parent::_findFile($file, $missing_okay);
40     }
41
42     function _labelForAction ($action) {
43         switch ($action) {
44             case 'edit':   return _("Edit");
45             case 'diff':   return _("Diff");
46             case 'logout': return _("SignOut");
47             case 'login':  return _("SignIn");
48             case 'lock':   return _("Lock");
49             case 'unlock': return _("Unlock");
50             case 'remove': return _("Remove");
51             default:
52                 return gettext(ucfirst($action));
53         }
54     }
55
56     function getRecentChangesFormatter ($format) {
57         include_once($this->file('lib/RecentChanges.php'));
58         if (preg_match('/^rss|^sidebar/', $format))
59             return false;       // use default
60         if ($format == 'box')
61             return '_blog_RecentChanges_BoxFormatter';
62         return '_blog_RecentChanges_Formatter';
63     }
64     
65     /* TODO: use the blog summary as label instead of the pagename */
66     function linkExistingWikiWord($wikiword, $linktext = '', $version = false) {
67         global $request;
68         if ($version !== false and !$this->HTML_DUMP_SUFFIX)
69             $url = WikiURL($wikiword, array('version' => $version));
70         else
71             $url = WikiURL($wikiword);
72
73         // Extra steps for dumping page to an html file.
74         if ($this->HTML_DUMP_SUFFIX) {
75             $url = preg_replace('/^\./', '%2e', $url); // dot pages
76         }
77
78         $link = HTML::a(array('href' => $url));
79
80         if (isa($wikiword, 'WikiPageName'))
81              $default_text = $wikiword->shortName;
82          else
83              $default_text = $wikiword;
84          
85         if (!empty($linktext)) {
86             $link->pushContent($linktext);
87             $link->setAttr('class', 'named-wiki');
88             $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
89         }
90         else {
91             //TODO: check if wikiblog
92             $link->pushContent($this->maybeSplitWikiWord($default_text));
93             $link->setAttr('class', 'wiki');
94         }
95         if ($request->getArg('frame'))
96             $link->setAttr('target', '_top');
97         return $link;
98     }
99 }
100
101 $WikiTheme = new Theme_blog('blog');
102
103 // CSS file defines fonts, colors and background images for this
104 // style.
105
106 // override sidebar definitions:
107 $WikiTheme->setDefaultCSS(_("blog"), 'Kubrick.css');
108
109 $WikiTheme->addButtonAlias(_("(diff)"), "[diff]" );
110 $WikiTheme->addButtonAlias("...", "alltime");
111
112 $WikiTheme->setButtonSeparator("");
113
114 /**
115  * WikiWords can automatically be split by inserting spaces between
116  * the words. The default is to leave WordsSmashedTogetherLikeSo.
117  */
118 $WikiTheme->setAutosplitWikiWords(false);
119
120 /**
121  * If true (default) show create '?' buttons on not existing pages, even if the 
122  * user is not signed in.
123  * If false, anon users get no links and it looks cleaner, but then they 
124  * cannot easily fix missing pages.
125  */
126 $WikiTheme->setAnonEditUnknownLinks(false);
127
128 /*
129  * You may adjust the formats used for formatting dates and times
130  * below.  (These examples give the default formats.)
131  * Formats are given as format strings to PHP strftime() function See
132  * http://www.php.net/manual/en/function.strftime.php for details.
133  * Do not include the server's zone (%Z), times are converted to the
134  * user's time zone.
135  */
136 //$WikiTheme->setDateFormat("%B %d, %Y");
137 $WikiTheme->setDateFormat("%A, %B %e, %Y"); // must not contain time
138 $WikiTheme->setTimeFormat("%H:%M:%S");
139
140 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
141 // (c-file-style: "gnu")
142 // Local Variables:
143 // mode: php
144 // tab-width: 8
145 // c-basic-offset: 4
146 // c-hanging-comment-ender-p: nil
147 // indent-tabs-mode: nil
148 // End:   
149 ?>