Index: branches/REL1_4/phase3/includes/EditPage.php |
— | — | @@ -81,37 +81,51 @@ |
82 | 82 | * @todo document |
83 | 83 | */ |
84 | 84 | function importFormData( &$request ) { |
85 | | - # These fields need to be checked for encoding. |
86 | | - # Also remove trailing whitespace, but don't remove _initial_ |
87 | | - # whitespace from the text boxes. This may be significant formatting. |
88 | | - $this->textbox1 = rtrim( $request->getText( 'wpTextbox1' ) ); |
89 | | - $this->textbox2 = rtrim( $request->getText( 'wpTextbox2' ) ); |
90 | | - $this->summary = trim( $request->getText( 'wpSummary' ) ); |
| 85 | + if( $request->wasPosted() ) { |
| 86 | + # These fields need to be checked for encoding. |
| 87 | + # Also remove trailing whitespace, but don't remove _initial_ |
| 88 | + # whitespace from the text boxes. This may be significant formatting. |
| 89 | + $this->textbox1 = rtrim( $request->getText( 'wpTextbox1' ) ); |
| 90 | + $this->textbox2 = rtrim( $request->getText( 'wpTextbox2' ) ); |
| 91 | + $this->summary = trim( $request->getText( 'wpSummary' ) ); |
| 92 | + |
| 93 | + $this->edittime = $request->getVal( 'wpEdittime' ); |
| 94 | + if( is_null( $this->edittime ) ) { |
| 95 | + # If the form is incomplete, force to preview. |
| 96 | + $this->preview = true; |
| 97 | + } else { |
| 98 | + # Some browsers will not report any submit button |
| 99 | + # if the user hits enter in the comment box. |
| 100 | + # The unmarked state will be assumed to be a save, |
| 101 | + # if the form seems otherwise complete. |
| 102 | + $this->preview = $request->getCheck( 'wpPreview' ); |
| 103 | + } |
| 104 | + $this->save = !$this->preview; |
| 105 | + if( !preg_match( '/^\d{14}$/', $this->edittime )) { |
| 106 | + $this->edittime = null; |
| 107 | + } |
| 108 | + |
| 109 | + $this->minoredit = $request->getCheck( 'wpMinoredit' ); |
| 110 | + $this->watchthis = $request->getCheck( 'wpWatchthis' ); |
| 111 | + } else { |
| 112 | + # Not a posted form? Start with nothing. |
| 113 | + $this->textbox1 = ''; |
| 114 | + $this->textbox2 = ''; |
| 115 | + $this->summary = ''; |
| 116 | + $this->edittime = ''; |
| 117 | + $this->preview = false; |
| 118 | + $this->save = false; |
| 119 | + $this->minoredit = false; |
| 120 | + $this->watchthis = false; |
| 121 | + } |
91 | 122 | |
92 | | - $this->edittime = $request->getVal( 'wpEdittime' ); |
93 | | - if( !preg_match( '/^\d{14}$/', $this->edittime )) $this->edittime = ''; |
94 | | - |
95 | | - $this->preview = $request->getCheck( 'wpPreview' ); |
96 | | - $this->save = $request->wasPosted() && !$this->preview; |
97 | | - $this->minoredit = $request->getCheck( 'wpMinoredit' ); |
98 | | - $this->watchthis = $request->getCheck( 'wpWatchthis' ); |
99 | | - |
100 | 123 | $this->oldid = $request->getInt( 'oldid' ); |
101 | 124 | |
102 | 125 | # Section edit can come from either the form or a link |
103 | 126 | $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) ); |
104 | 127 | } |
105 | 128 | |
106 | | - /** |
107 | | - * Since there is only one text field on the edit form, |
108 | | - * pressing <enter> will cause the form to be submitted, but |
109 | | - * the submit button value won't appear in the query, so we |
110 | | - * Fake it here before going back to edit(). This is kind of |
111 | | - * ugly, but it helps some old URLs to still work. |
112 | | - */ |
113 | 129 | function submit() { |
114 | | - if( !$this->preview ) $this->save = true; |
115 | | - |
116 | 130 | $this->edit(); |
117 | 131 | } |
118 | 132 | |
Index: branches/REL1_4/phase3/RELEASE-NOTES |
— | — | @@ -278,6 +278,7 @@ |
279 | 279 | * (bug 1228) Fix double-escaping on & sequences in [enclosed] URLs |
280 | 280 | * (bug 1435) Fixed many CSS errors |
281 | 281 | * (bug 1457) Fix XHTML validation on category column list |
| 282 | +* (bug 1458) Don't save if edit form submission is incomplete |
282 | 283 | |
283 | 284 | === Caveats === |
284 | 285 | |