Forgot to add this file.
[lhc/web/wiklou.git] / includes / SkinSmarty.php
1 <?php
2 # Copyright (C) 2003 Brion Vibber <brion@pobox.com>
3 # http://www.mediawiki.org/
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # http://www.gnu.org/copyleft/gpl.html
19
20 # And turn on $wgUseSmarty so this file gets included
21
22 # Set your include_path so Smarty/libs is available
23 include_once( "Smarty.class.php" );
24
25 class SkinSmarty extends Skin {
26 var $template;
27
28 function initPage() {
29 $this->template = "paddington";
30 }
31
32 function outputPage( &$out ) {
33 global $wgTitle, $wgArticle, $wgUser, $wgLang;
34 global $wgScriptPath, $wgStyleSheetPath, $wgLanguageCode;
35
36 $this->initPage();
37
38 $smarty = new Smarty();
39 $smarty->register_function( "wikimsg",
40 array( &$this,"smarty_function_wikimsg" ), true );
41 $smarty->register_function( "wikilink",
42 array( &$this, "smarty_function_wikilink" ) );
43
44 $smarty->assign( "title", $wgTitle->getPrefixedText() ); // ?
45 $smarty->assign( "thispage", $wgTitle->getPrefixedDbKey() );
46 $smarty->assign( "subtitle", $out->getSubtitle() );
47
48 $smarty->assign( "editable", ($wgTitle->getNamespace != Namespace::getSpecial() ) );
49 $smarty->assign( "exists", $wgTitle->getArticleID() != 0 );
50 $smarty->assign( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
51 $smarty->assign( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
52
53 $smarty->assign( "searchaction", $wgScriptPath );
54 $smarty->assign( "stylepath", $wgStyleSheetPath );
55 $smarty->assign( "lang", $wgLanguageCode );
56 $smarty->assign( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
57
58 $smarty->assign( "username", $wgUser->getName() );
59 $smarty->assign( "userpage", $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName() );
60 $smarty->assign( "loggedin", $wgUser->getID() != 0 );
61 $smarty->assign( "sysop", $wgUser->isSysop() );
62 if( $wgUser->getNewtalk() ) {
63 $ntl = wfMsg( "newmessages",
64 $this->makeKnownLink(
65 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
66 . ":" . $wgUser->getName(),
67 wfMsg("newmessageslink")
68 )
69 );
70 } else {
71 $ntl = "";
72 }
73 $smarty->assign( "newtalk", $ntl );
74
75 $smarty->assign( "logo", $this->logoText() );
76 $smarty->assign( "pagestats", $this->pageStats() );
77 $smarty->assign( "otherlanguages", $this->otherLanguages() );
78
79 $smarty->assign( "debug", $out->mDebugtext );
80 $smarty->assign( "reporttime", $out->reportTime() );
81
82 $smarty->assign( "bodytext", $out->mBodytext );
83
84 $smarty->display( $this->template . ".tpl" );
85 }
86
87 function smarty_function_wikimsg( $params, &$smarty ) {
88 return wfMsg( $params['key'] );
89 }
90
91 function smarty_function_wikilink( $params, &$smarty ) {
92 global $wgLang;
93 $action = "";
94 $popup = "";
95 $title = NULL;
96
97 if($params['action']) $action = "action=" . $params['action'];
98
99 if($params['special']) {
100 $title = Title::makeTitle( NS_SPECIAL, $params['special'] );
101 #$text = $wgLang->getSpecialPageName( $params['special'] );
102 $text = $popup = $params['special'];
103 if($params['target']) $action .= "target=" . urlencode( $params['target'] );
104 } else {
105 if( $params['keypage'] )
106 $title = Title::newFromText( wfMsg( $params['keypage'] ) );
107 else
108 $title = Title::newFromText( $params['name'] );
109 if(isset($params["talk"])) {
110 $title = Title::makeTitle( $title->getNamespace() ^ 1, $title->getDbKey() );
111 }
112 $text = $popup = $title->getPrefixedText();
113 }
114
115 $url = $title->escapeLocalURL( $action );
116
117 if($params['text']) $text = $params['text'];
118 if($params['key']) $text = wfMsg( $params['key'] );
119 if($popup) $popup = ' title="' . htmlspecialchars( $popup ) . '"';
120
121 return "<a href=\"$url\"$popup>$text</a>";
122 }
123
124 /*
125 function Skin()
126 function getSkinNames()
127 function getStylesheet()
128
129 function qbSetting()
130 function initPage()
131 function getHeadScripts() {
132 function getUserStyles()
133 function doGetUserStyles()
134 function getBodyOptions()
135 function getExternalLinkAttributes( $link, $text )
136 function getInternalLinkAttributes( $link, $text, $broken = false )
137
138 function getLogo()
139 function beforeContent()
140 function doBeforeContent()
141 function getQuickbarCompensator( $rows = 1 )
142 function afterContent()
143 function doAfterContent()
144 function pageTitleLinks()
145 function printableLink()
146 function pageTitle()
147 function pageSubtitle()
148 function nameAndLogin()
149 function searchForm()
150 function topLinks()
151 function bottomLinks()
152 function pageStats()
153 function lastModified()
154 function logoText( $align = "" )
155 function quickBar()
156 function specialPagesList()
157 function mainPageLink()
158 function copyrightLink()
159 function aboutLink()
160 function editThisPage()
161 function deleteThisPage()
162 function protectThisPage()
163 function watchThisPage()
164 function moveThisPage()
165 function historyLink()
166 function whatLinksHere()
167 function userContribsLink()
168 function emailUserLink()
169 function watchPageLinksLink()
170 function otherLanguages()
171 function bugReportsLink()
172 function dateLink()
173 function talkLink()
174 function transformContent( $text )
175
176 function makeLink( $title, $text= "", $query = "", $trail = "" )
177 function makeKnownLink( $title, $text = "", $query = "", $trail = "" )
178 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" )
179 function makeStubLink( $title, $text = "", $query = "", $trail = "" )
180 function fnamePart( $url )
181 function makeImage( $url, $alt = "" )
182 function makeImageLink( $name, $url, $alt = "" )
183 function makeMediaLink( $name, $url, $alt = "" )
184 function specialLink( $name, $key = "" )
185
186 function beginHistoryList()
187 function beginImageHistoryList()
188 function endRecentChangesList()
189 function endHistoryList()
190 function endImageHistoryList()
191 function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor )
192 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
193
194
195 function beginRecentChangesList()
196 function recentChangesBlockLine ( $y ) {
197 function recentChangesBlockGroup ( $y ) {
198 function recentChangesBlock ()
199 function recentChangesLine( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
200 function recentChangesLineOld( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0, $diffid = 0 )
201 function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
202
203 function tocIndent($level) {
204 function tocUnindent($level) {
205 function tocLine($anchor,$tocline,$level) {
206 function tocTable($toc) {
207 function editSectionScript($section,$head) {
208 function editSectionLink($section) {
209 */
210
211 }
212
213 class SkinMontparnasse extends SkinSmarty {
214 function initPage() {
215 SkinSmarty::initPage();
216 $this->template = "montparnasse";
217 }
218 }
219
220 ?>