function getUserStyles()
{
- $s = "<style type='text/css' media='screen,projection'><!--\n";
+ $s = "<style type='text/css'><!--\n";
$s .= $this->doGetUserStyles();
$s .= "//--></style>\n";
return $s;
function afterContent()
{
global $wgUser, $wgOut, $wgServer, $HTTP_SERVER_VARS;
-
+ global $wgTitle;
+
if ( $wgOut->isPrintable() ) {
$s = "\n</div>\n";
- $u = $wgServer . $HTTP_SERVER_VARS['REQUEST_URI'];
- $u = preg_replace( "/[?&]printable=yes/", "", $u );
- $rf = str_replace( "$1", $u, wfMsg( "retrievedfrom" ) );
+ $u = $wgServer . $wgTitle->getFullURL();
+ $rf = wfMsg( "retrievedfrom", $u );
if ( $wgOut->isArticle() ) {
$lm = "<br>" . $this->lastModified();
} else { $lm = ""; }
- $s .= "<p><em>{$rf}{$lm}</em>\n";
+ $cr = wfMsg( "gnunote" );
+ $s .= "<p><em>{$rf}{$lm} {$cr}</em>\n";
return $s;
}
return $this->doAfterContent();
function pageTitleLinks()
{
- global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang;
+ global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval ;
$s = $this->printableLink();
$style = $this->getInternalLinkAttributes( $link, $name );
$s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
}
- }
+# This will show the "Approve" link if $wgUseApproval=true;
+if ( isset ( $wgUseApproval ) && $wgUseApproval )
+{
+ $t = $wgTitle->getDBkey();
+ $name = "Approve this article" ;
+ $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
+#wfEscapeHTML( wfImageUrl( $name ) );
+ $style = $this->getExternalLinkAttributes( $link, $name );
+ $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
+} }
if ( "history" == $action || isset( $diff ) || isset( $oldid ) ) {
$s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
wfMsg( "currentrev" ) );
$s.=" | <strong>". str_replace( "$1", $tl, wfMsg("newmessages") ) . "</strong>";
}
}
+ if( $wgUser->isSysop() &&
+ (($wgTitle->getArticleId() == 0) || ($action == "history")) &&
+ ($n = $wgTitle->isDeleted() ) ) {
+ $s .= " | " . wfMsg( "thisisdeleted",
+ $this->makeKnownLink(
+ $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
+ wfMsg( "restorelink", $n ) ) );
+ }
return $s;
}
function pageTitle()
{
- global $wgOut, $wgTitle;
+ global $wgOut, $wgTitle, $wgUser;
$s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
+ if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
return $s;
}
if ( $wgOut->isArticle() ) {
$s .= "<strong>" . $this->editThisPage() . "</strong>";
if ( 0 != $wgUser->getID() ) {
- $s .= $sep . $this->watchThisPage() .
- $sep . $this->moveThisPage();
+ $s .= $sep . $this->watchThisPage();
}
$s .= $sep . $this->talkLink()
. $sep . $this->historyLink()
}
if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
$s .= "\n<br>" . $this->deleteThisPage() .
- $sep . $this->protectThisPage();
+ $sep . $this->protectThisPage() .
+ $sep . $this->moveThisPage();
}
$s .= "<br>\n" . $this->otherLanguages();
}
return $this->makeKnownLink( $title, $text, $query, $trail );
}
if ( ( -1 == $nt->getNamespace() ) ||
- ( Namespace::getImage() == $nt->getNamespace() ) ) {
+ ( Namespace::getImage() == $nt->getNamespace() ) ) {
return $this->makeKnownLink( $title, $text, $query, $trail );
}
- $aid = $nt->getArticleID() ;
- if ( 0 == $aid ) {
- return $this->makeBrokenLink( $title, $text, $query, $trail );
- } else {
- $threshold = $wgUser->getOption("stubthreshold") ;
- if ( $threshold > 0 ) {
- $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'" ) ;
-
- if ( wfNumRows( $res ) > 0 ) {
- $s = wfFetchObject( $res );
- $size = $s->x;
- if ( $s->cur_is_redirect OR $s->cur_namespace != 0 )
- $size = $threshold*2 ; # Really big
- wfFreeResult( $res );
- } else $size = $threshold*2 ; # Really big
- } else $size = 1 ;
-
- if ( $size < $threshold )
- return $this->makeStubLink( $title, $text, $query, $trail );
- return $this->makeKnownLink( $title, $text, $query, $trail );
- }
- }
+ $aid = $nt->getArticleID() ;
+ if ( 0 == $aid ) {
+ return $this->makeBrokenLink( $title, $text, $query, $trail );
+ } else {
+ $threshold = $wgUser->getOption("stubthreshold") ;
+ if ( $threshold > 0 ) {
+ $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'" ) ;
+
+ if ( wfNumRows( $res ) > 0 ) {
+ $s = wfFetchObject( $res );
+ $size = $s->x;
+ if ( $s->cur_is_redirect OR $s->cur_namespace != 0 )
+ $size = $threshold*2 ; # Really big
+ wfFreeResult( $res );
+ } else $size = $threshold*2 ; # Really big
+ } else $size = 1 ;
+
+ if ( $size < $threshold )
+ return $this->makeStubLink( $title, $text, $query, $trail );
+ return $this->makeKnownLink( $title, $text, $query, $trail );
+ }
+ }
function makeKnownLink( $title, $text = "", $query = "", $trail = "" )
{
$url = wfImageUrl( $img );
$rlink = $cur;
if ( $wgUser->isSysop() ) {
- $link = wfLocalUrlE( "", "image=" . $wgTitle->getURL() .
+ $link = wfLocalUrlE( $wgTitle->getPrefixedText(), "image=" . $wgTitle->getURL() .
"&action=delete" );
$style = $this->getInternalLinkAttributes( $link, $del );
}
function tocTable($toc) {
- // note to CSS fanatics: putting this in a div does not works -- div won't auto-expand
+ // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
+ global $printable;
+
+ if (!$printable) {
+ $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
+ }
return
"<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
"<b>".wfMsg("toc")."</b>" .
- " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>" .
+ $hideline .
"</td></tr><tr id='tocinside'><td align=\"left\">\n".
$toc."</td></tr></table><P>\n";
}
+ # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
function editSectionScript($section,$head) {
global $wgTitle,$wgUser,$oldid;
- if($wgTitle->isProtected() && !$wgUser->isSysop()) return $head;
if($oldid) return $head;
- $url = wfLocalUrlE($wgTitle->getPrefixedText(),"action=edit§ion=$section");
+ $url = wfLocalUrlE(urlencode($wgTitle->getPrefixedText()),"action=edit§ion=$section");
return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
}
function editSectionLink($section) {
+ global $printable;
global $wgTitle,$wgUser,$oldid;
- if($wgTitle->isProtected() && !$wgUser->isSysop()) return "";
if($oldid) return "";
+ if ($printable) return "";
$editurl="§ion={$section}";
$url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
return "<div style=\"float:right;margin-left:5px;\"><small>[".$url."]</small></div>";