Slight fix for r47781: remove useless if($index) conditional: $index is always set...
[lhc/web/wiklou.git] / includes / EditPage.php
index 50d16a8..840497e 100644 (file)
@@ -324,7 +324,7 @@ class EditPage {
        protected function wasDeletedSinceLastEdit() {
                if ( $this->deletedSinceEdit )
                        return true;
-               if ( $this->mTitle->isDeleted() ) {
+               if ( $this->mTitle->isDeletedQuick() ) {
                        $this->lastDelete = $this->getLastDelete();
                        if ( $this->lastDelete ) {
                                $deleteTime = wfTimestamp( TS_MW, $this->lastDelete->log_timestamp );
@@ -523,7 +523,7 @@ class EditPage {
                } elseif ( $this->section == 'new' ) {
                        // Nothing *to* preview for new sections
                        return false;
-               } elseif ( ( $wgRequest->getVal( 'preload' ) !== '' || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) {
+               } elseif ( ( $wgRequest->getVal( 'preload' ) !== null || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) {
                        // Standard preference behaviour
                        return true;
                } elseif ( !$this->mTitle->exists() && $this->mTitle->getNamespace() == NS_CATEGORY ) {
@@ -678,8 +678,16 @@ class EditPage {
                if ( $this->suppressIntro ) {
                        return;
                }
+
+               $namespace = $this->mTitle->getNamespace();
+
+               if ( $namespace == NS_MEDIAWIKI ) {
+                       # Show a warning if editing an interface message
+                       $wgOut->wrapWikiMsg( "<div class='mw-editinginterface'>\n$1</div>", 'editinginterface' );
+               }
+
                # Show a warning message when someone creates/edits a user (talk) page but the user does not exists
-               if ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) {
+               if ( $namespace == NS_USER || $namespace == NS_USER_TALK ) {
                        $parts = explode( '/', $this->mTitle->getText(), 2 );
                        $username = $parts[0];
                        $id = User::idFromName( $username );
@@ -1161,7 +1169,7 @@ class EditPage {
                        }
 
                        if ( $this->missingComment ) {
-                               $wgOut->wrapWikiMsg( '<div id="mw-missingcommenttext">$1</div>',  'missingcommenttext' );
+                               $wgOut->wrapWikiMsg( '<div id="mw-missingcommenttext">$1</div>', 'missingcommenttext' );
                        }
 
                        if ( $this->missingSummary && $this->section != 'new' ) {
@@ -1183,9 +1191,9 @@ class EditPage {
                        // Let sysop know that this will make private content public if saved
 
                                if ( !$this->mArticle->mRevision->userCan( Revision::DELETED_TEXT ) ) {
-                                       $wgOut->addWikiMsg( 'rev-deleted-text-permission' );
+                                       $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n", 'rev-deleted-text-permission' );
                                } else if ( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
-                                       $wgOut->addWikiMsg( 'rev-deleted-text-view' );
+                                       $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n", 'rev-deleted-text-view' );
                                }
 
                                if ( !$this->mArticle->mRevision->isCurrent() ) {
@@ -1214,8 +1222,6 @@ class EditPage {
 
                $classes = array(); // Textarea CSS
                if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
-                       # Show a warning if editing an interface message
-                       $wgOut->wrapWikiMsg( "<div class='mw-editinginterface'>\n$1</div>", 'editinginterface' );
                } elseif ( $this->mTitle->isProtected( 'edit' ) ) {
                        # Is the title semi-protected?
                        if ( $this->mTitle->isSemiProtected() ) {
@@ -1343,10 +1349,13 @@ class EditPage {
                if ( $this->section == 'new' ) {
                        $commentsubject = '';
                        if ( !$wgRequest->getBool( 'nosummary' ) ) {
+                               # Add an ID if 'missingsummary' is triggered to allow styling of the summary line
+                               $summaryMissedID = $this->missingSummary ? ' mw-summarymissed' : '';
+
                                $commentsubject =
                                        Xml::tags( 'label', array( 'for' => 'wpSummary' ), $subject );
                                $commentsubject =
-                                       Xml::tags( 'span', array( 'id' => 'wpSummaryLabel' ), $commentsubject );
+                                       Xml::tags( 'span', array( 'id' => "wpSummaryLabel$summaryMissedID" ), $commentsubject );
                                $commentsubject .= '&nbsp;';
                                $commentsubject .= Xml::input( 'wpSummary',
                                                                        60,
@@ -1365,10 +1374,12 @@ class EditPage {
                } else {
                        $commentsubject = '';
 
+                       # Add an ID if 'missingsummary' is triggered to allow styling of the summary line
+                       $summaryMissedID = $this->missingSummary ? ' mw-summarymissed' : '';
+
                        $editsummary = Xml::tags( 'label', array( 'for' => 'wpSummary' ), $summary );
-                       $editsummary =
-                               Xml::tags( 'span', array( 'id' => 'wpSummaryLabel' ), $editsummary ) . ' ';
-                               
+                       $editsummary = Xml::tags( 'span', array( 'id' => "wpSummaryLabel$summaryMissedID" ), $editsummary ) . ' ';
+
                        $editsummary .= Xml::input( 'wpSummary',
                                60,
                                $summarytext,
@@ -1377,11 +1388,11 @@ class EditPage {
                                        'maxlength' => '200',
                                        'tabindex' => '1'
                                ) );
-                       
+
                        // No idea where this is closed.
                        $editsummary = Xml::openElement( 'div', array( 'class' => 'editOptions' ) )
                                                        . $editsummary . '<br/>';
-                               
+
                        $summarypreview = '';
                        if ( $summarytext && $this->preview ) {
                                $summarypreview =
@@ -1393,6 +1404,7 @@ class EditPage {
                        }
                        $subjectpreview = '';
                }
+               $commentsubject .= $summaryhiddens;
 
                # Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
                if ( !$this->preview && !$this->diff ) {