* Added $wgArticleRobotPolicies
* (bug 10076) Additional parameter $7 added to MediaWiki:Blockedtext
containing, the ip, ip range, or username whose block is affecting the
-* (bug 7691) Deletion log now shown when creating a new article, following
- MediaWiki:Noarticletext(anon) or MediaWiki:Newarticletext(anon).
- current user.
+* (bug 7691) Show relevant lines from the deletion log when viewing
+ a non-existent article or re-creating a previously-deleted article
* Added variables 'wgRestrictionEdit' and 'wgRestrictionMove' for JS to header
== Bugfixes since 1.10 ==
);
}
- /**
- * If it's a non-existant page, stick the deletion log after the "noarticle" message.
- * This won't appear when editing a new page, but will when viewing a nonexistant one.
+ /**
+ * Show the deletion log when viewing a non-existent page
*/
- if ( 0 == $this->getID() ) {
- $this->showLogExtract( $wgOut, 'view' );
- }
+ if( $this->getId() == 0 )
+ $this->showLogExtract( $wgOut );
# Trackbacks
if ($wgUseTrackbacks)
$wgOut->returnToMain( false );
- $this->showLogExtract( $wgOut, 'delete' );
+ $this->showLogExtract( $wgOut );
}
/**
- * Fetch deletion log
+ * Show relevant lines from the deletion log
*/
- function showLogExtract( &$out, $type = '' ) {
- # Show relevant lines from the deletion log:
- $out->addHTML( "<div id='mw-article-$type-deletionlog'><h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
+ function showLogExtract( $out ) {
+ $out->addHtml( '<h2>' . htmlspecialchars( LogPage::logName( 'delete' ) ) . '</h2>' );
$logViewer = new LogViewer(
new LogReader(
new FauxRequest(
array( 'page' => $this->mTitle->getPrefixedText(),
'type' => 'delete' ) ) ) );
$logViewer->showList( $out );
- $out->addHTML( "</div>" );
}
* to ensure that client-side caches don't keep obsolete copies of global
* styles.
*/
-$wgStyleVersion = '73';
+$wgStyleVersion = '74';
# Server-side caching:
$wgOut->addWikiText( wfMsg( 'newarticletext' ) );
else
$wgOut->addWikiText( wfMsg( 'newarticletextanon' ) );
- // Show deletion log when editing new article.
- $this->mArticle->showLogExtract( $wgOut, 'create' );
+ # Let the user know about previous deletions if applicable
+ $this->showDeletionLog( $wgOut );
}
}
$wgOut->setPageTitle( wfMsg( 'nocreatetitle' ) );
$wgOut->addWikiText( wfMsg( 'nocreatetext' ) );
}
+
+ /**
+ * If there are rows in the deletion log for this page, show them,
+ * along with a nice little note for the user
+ *
+ * @param OutputPage $out
+ */
+ private function showDeletionLog( $out ) {
+ $title = $this->mArticle->getTitle();
+ $reader = new LogReader(
+ new FauxRequest(
+ array(
+ 'page' => $title->getPrefixedText(),
+ 'type' => 'delete',
+ )
+ )
+ );
+ if( $reader->hasRows() ) {
+ $out->addHtml( '<div id="mw-recreate-deleted-warn">' );
+ $out->addHtml( $this->buildWarningDismisser() );
+ $out->addWikiText( wfMsg( 'recreate-deleted-warn' ) );
+ $viewer = new LogViewer( $reader );
+ $viewer->showList( $out );
+ $out->addHtml( '</div>' );
+ }
+ }
+
+ /**
+ * Builds a JavaScript fragment that injects a link to dismiss the
+ * "recreating deleted" warning
+ *
+ * @return string
+ */
+ private function buildWarningDismisser() {
+ return '<script type="text/javascript">'
+ . 'document.write( \'<div class="mw-recreate-deleted-control">'
+ . '<a href="javascript:dismissRecreateWarning();">'
+ . wfMsgHtml( 'recreate-deleted-dismiss' ) . '</a></div>\' );'
+ . '</script>';
+ }
}
// XXX This all needs to use Pager, ugly hack for now.
global $wgMiserMode;
- if ($wgMiserMode && ($this->offset >10000)) $this->offset=10000;
+ if( $wgMiserMode )
+ $this->offset = min( $this->offset, 10000 );
}
/**
return $this->title->getPrefixedText();
}
}
+
+ /**
+ * Is there at least one row?
+ *
+ * @return bool
+ */
+ public function hasRows() {
+ # Little hack...
+ $limit = $this->limit;
+ $this->limit = 1;
+ $res = $this->db->query( $this->getQuery() );
+ $this->limit = $limit;
+ $ret = $this->db->numRows( $res ) > 0;
+ $this->db->freeResult( $res );
+ return $ret;
+ }
+
}
/**
'nocreatetitle' => 'Page creation limited',
'nocreatetext' => 'This site has restricted the ability to create new pages.
You can go back and edit an existing page, or [[Special:Userlogin|log in or create an account]].',
+'recreate-deleted-warn' => "'''Warning: You are recreating a page that was previously deleted.'''
+
+You should consider whether it is appropriate to continue editing this page.
+The deletion log for this page is provided here for convenience:",
+'recreate-deleted-dismiss' => '(dismiss)',
# "Undo" feature
'undo-success' => 'The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.',
/*
* End of table sorting code
*/
+
+/**
+ * Allows the "recreating-deleted-page" warning to be expanded
+ * and collapsed
+ */
+function dismissRecreateWarning() {
+ var warning = document.getElementById( "mw-recreate-deleted-warn" );
+ if( warning != undefined ) {
+ warning.parentNode.removeChild( warning );
+ }
+}
function runOnloadHook() {
// don't run anything below this for non-dom browsers
// so the below should be redundant. It's there just in case.
hookEvent("load", runOnloadHook);
-hookEvent("load", mwSetupToolbar);
+hookEvent("load", mwSetupToolbar);
\ No newline at end of file
background-color: #CC9999;
}
+/* Recreating-deleted-page warning and log entries */
+div#mw-recreate-deleted-warn {
+ padding: 3px;
+ margin-bottom: 3px;
+ border: 2px solid #993333;
+}
+div#mw-recreate-deleted-warn ul li {
+ font-size: 95%;
+}
+div.mw-recreate-deleted-control {
+ float: right;
+ font-size: 90%;
+}
/**
* Here is some stuff that's ACTUALLY COMMON TO ALL SKINS.
* When the day comes, it can be moved to a *real* common.css.