]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/blog/themeinfo.php
livesearch.js support, fix calendar init
[SourceForge/phpwiki.git] / themes / blog / themeinfo.php
1 <?php
2 rcs_id('$Id: themeinfo.php,v 1.4 2005-02-03 05:11:40 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  * For the livesearch feature (autodropdown of the results while you tip) 
28  * you'll have to copy livesearch.js from http://blog.bitflux.ch/wiki/LiveSearch
29  * to themes/default/ and define ENABLE_LIVESEARCH in config.ini to true.
30  * Better autodropdown's are in consideration:
31  *   http://momche.net/publish/article.php?page=acdropdown)
32  *
33  * Happy blogging.
34  */
35
36 require_once('lib/Theme.php');
37 require_once('themes/Sidebar/themeinfo.php');
38
39 class Theme_blog extends Theme_Sidebar {
40     function _findFile ($file, $missing_okay=false) {
41         if (file_exists($this->_path . "themes/".$this->_name."/$file"))
42             return "themes/".$this->_name."/$file";
43         if (file_exists($this->_path . "themes/Sidebar/$file"))
44             return "themes/Sidebar/$file";
45         return parent::_findFile($file, $missing_okay);
46     }
47
48     function _labelForAction ($action) {
49         switch ($action) {
50             case 'edit':   return _("Edit");
51             case 'diff':   return _("Diff");
52             case 'logout': return _("SignOut");
53             case 'login':  return _("SignIn");
54             case 'lock':   return _("Lock");
55             case 'unlock': return _("Unlock");
56             case 'remove': return _("Remove");
57             default:
58                 return gettext(ucfirst($action));
59         }
60     }
61
62     function getRecentChangesFormatter ($format) {
63         include_once($this->file('lib/RecentChanges.php'));
64         if (preg_match('/^rss|^sidebar/', $format))
65             return false;       // use default
66         if ($format == 'box')
67             return '_blog_RecentChanges_BoxFormatter';
68         return '_blog_RecentChanges_Formatter';
69     }
70     
71     /* TODO: use the blog summary as label instead of the pagename */
72     function linkExistingWikiWord($wikiword, $linktext = '', $version = false) {
73         global $request;
74         if ($version !== false and !$this->HTML_DUMP_SUFFIX)
75             $url = WikiURL($wikiword, array('version' => $version));
76         else
77             $url = WikiURL($wikiword);
78
79         // Extra steps for dumping page to an html file.
80         if ($this->HTML_DUMP_SUFFIX) {
81             $url = preg_replace('/^\./', '%2e', $url); // dot pages
82         }
83
84         $link = HTML::a(array('href' => $url));
85
86         if (isa($wikiword, 'WikiPageName'))
87              $default_text = $wikiword->shortName;
88          else
89              $default_text = $wikiword;
90          
91         if (!empty($linktext)) {
92             $link->pushContent($linktext);
93             $link->setAttr('class', 'named-wiki');
94             $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
95         }
96         else {
97             //TODO: check if wikiblog
98             $link->pushContent($this->maybeSplitWikiWord($default_text));
99             $link->setAttr('class', 'wiki');
100         }
101         if ($request->getArg('frame'))
102             $link->setAttr('target', '_top');
103         return $link;
104     }
105 }
106
107 $WikiTheme = new Theme_blog('blog');
108 define("PAGETRAIL_ARROW", " ยป ");
109
110 // CSS file defines fonts, colors and background images for this
111 // style.
112
113 // override sidebar definitions:
114 $WikiTheme->setDefaultCSS(_("blog"), 'Kubrick.css');
115
116 $WikiTheme->addButtonAlias(_("(diff)"), "[diff]" );
117 $WikiTheme->addButtonAlias("...", "alltime");
118
119 $WikiTheme->setButtonSeparator("");
120
121 /**
122  * WikiWords can automatically be split by inserting spaces between
123  * the words. The default is to leave WordsSmashedTogetherLikeSo.
124  */
125 $WikiTheme->setAutosplitWikiWords(false);
126
127 /**
128  * If true (default) show create '?' buttons on not existing pages, even if the 
129  * user is not signed in.
130  * If false, anon users get no links and it looks cleaner, but then they 
131  * cannot easily fix missing pages.
132  */
133 $WikiTheme->setAnonEditUnknownLinks(false);
134
135 /*
136  * You may adjust the formats used for formatting dates and times
137  * below.  (These examples give the default formats.)
138  * Formats are given as format strings to PHP strftime() function See
139  * http://www.php.net/manual/en/function.strftime.php for details.
140  * Do not include the server's zone (%Z), times are converted to the
141  * user's time zone.
142  */
143 //$WikiTheme->setDateFormat("%B %d, %Y");
144 $WikiTheme->setDateFormat("%A, %B %e, %Y"); // must not contain time
145 $WikiTheme->setTimeFormat("%H:%M:%S");
146
147 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
148 // (c-file-style: "gnu")
149 // Local Variables:
150 // mode: php
151 // tab-width: 8
152 // c-basic-offset: 4
153 // c-hanging-comment-ender-p: nil
154 // indent-tabs-mode: nil
155 // End:   
156 ?>