Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -456,17 +456,30 @@ |
457 | 457 | } |
458 | 458 | |
459 | 459 | /** |
460 | | - * Return true if this page should be previewed when the edit form |
461 | | - * is initially opened. |
| 460 | + * Should we show a preview when the edit form is first shown? |
| 461 | + * |
462 | 462 | * @return bool |
463 | | - * @private |
464 | 463 | */ |
465 | | - function previewOnOpen() { |
466 | | - global $wgUser; |
467 | | - return $this->section != 'new' && |
468 | | - ( ( $wgUser->getOption( 'previewonfirst' ) && $this->mTitle->exists() ) || |
469 | | - ( $this->mTitle->getNamespace() == NS_CATEGORY && |
470 | | - !$this->mTitle->exists() ) ); |
| 464 | + private function previewOnOpen() { |
| 465 | + global $wgRequest, $wgUser; |
| 466 | + if( $wgRequest->getVal( 'preview' ) == 'yes' ) { |
| 467 | + // Explicit override from request |
| 468 | + return true; |
| 469 | + } elseif( $wgRequest->getVal( 'preview' ) == 'no' ) { |
| 470 | + // Explicit override from request |
| 471 | + return false; |
| 472 | + } elseif( $this->section == 'new' ) { |
| 473 | + // Nothing *to* preview for new sections |
| 474 | + return false; |
| 475 | + } elseif( $this->mTitle->exists() && $wgUser->getOption( 'previewonfirst' ) ) { |
| 476 | + // Standard preference behaviour |
| 477 | + return true; |
| 478 | + } elseif( !$this->mTitle->exists() && $this->mTitle->getNamespace() == NS_CATEGORY ) { |
| 479 | + // Categories are special |
| 480 | + return true; |
| 481 | + } else { |
| 482 | + return false; |
| 483 | + } |
471 | 484 | } |
472 | 485 | |
473 | 486 | /** |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -128,6 +128,8 @@ |
129 | 129 | * Improved feedback on "rollback success" page |
130 | 130 | * Show distinct 'namespaceprotected' message to users when namespace protection |
131 | 131 | prevents page editing |
| 132 | +* (bug 9936) Per-edit suppression of preview-on-first edit with "preview=no" |
| 133 | +* Allow showing a one-off preview on first edit with "preview=yes" |
132 | 134 | |
133 | 135 | == Bugfixes since 1.10 == |
134 | 136 | |