2 # Copyright (C) 2003 Brion Vibber <brion@pobox.com>
3 # http://www.mediawiki.org/
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.
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.
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
20 # And turn on $wgUseSmarty so this file gets included
22 # Set your include_path so Smarty/libs is available
23 include_once( "Smarty.class.php" );
25 class SkinSmarty
extends Skin
{
29 $this->template
= "paddington";
32 function outputPage( &$out ) {
33 global $wgTitle, $wgArticle, $wgUser, $wgLang;
34 global $wgScriptPath, $wgStyleSheetPath, $wgLanguageCode;
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" ) );
44 $smarty->assign( "title", $wgTitle->getPrefixedText() ); // ?
45 $smarty->assign( "thispage", $wgTitle->getPrefixedDbKey() );
46 $smarty->assign( "subtitle", $out->getSubtitle() );
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" );
53 $smarty->assign( "searchaction", $wgScriptPath );
54 $smarty->assign( "stylepath", $wgStyleSheetPath );
55 $smarty->assign( "lang", $wgLanguageCode );
56 $smarty->assign( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
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",
65 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
66 . ":" . $wgUser->getName(),
67 wfMsg("newmessageslink")
73 $smarty->assign( "newtalk", $ntl );
75 $smarty->assign( "logo", $this->logoText() );
76 $smarty->assign( "pagestats", $this->pageStats() );
77 $smarty->assign( "otherlanguages", $this->otherLanguages() );
79 $smarty->assign( "debug", $out->mDebugtext
);
80 $smarty->assign( "reporttime", $out->reportTime() );
82 $smarty->assign( "bodytext", $out->mBodytext
);
84 $smarty->display( $this->template
. ".tpl" );
87 function smarty_function_wikimsg( $params, &$smarty ) {
88 return wfMsg( $params['key'] );
91 function smarty_function_wikilink( $params, &$smarty ) {
97 if($params['action']) $action = "action=" . $params['action'];
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'] );
105 if( $params['keypage'] )
106 $title = Title
::newFromText( wfMsg( $params['keypage'] ) );
108 $title = Title
::newFromText( $params['name'] );
109 if(isset($params["talk"])) {
110 $title = Title
::makeTitle( $title->getNamespace() ^
1, $title->getDbKey() );
112 $text = $popup = $title->getPrefixedText();
115 $url = $title->escapeLocalURL( $action );
117 if($params['text']) $text = $params['text'];
118 if($params['key']) $text = wfMsg( $params['key'] );
119 if($popup) $popup = ' title="' . htmlspecialchars( $popup ) . '"';
121 return "<a href=\"$url\"$popup>$text</a>";
126 function getSkinNames()
127 function getStylesheet()
131 function getHeadScripts() {
132 function getUserStyles()
133 function doGetUserStyles()
134 function getBodyOptions()
135 function getExternalLinkAttributes( $link, $text )
136 function getInternalLinkAttributes( $link, $text, $broken = false )
139 function beforeContent()
140 function doBeforeContent()
141 function getQuickbarCompensator( $rows = 1 )
142 function afterContent()
143 function doAfterContent()
144 function pageTitleLinks()
145 function printableLink()
147 function pageSubtitle()
148 function nameAndLogin()
149 function searchForm()
151 function bottomLinks()
153 function lastModified()
154 function logoText( $align = "" )
156 function specialPagesList()
157 function mainPageLink()
158 function copyrightLink()
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()
174 function transformContent( $text )
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 = "" )
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 )
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 )
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) {
213 class SkinMontparnasse
extends SkinSmarty
{
214 function initPage() {
215 SkinSmarty
::initPage();
216 $this->template
= "montparnasse";