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