* variable in the constructor is not enough. This can be used when the
* EditPage lives inside of a Special page rather than a custom page action.
*
- * @param Title $title The title for which is being edited (where we go to for &action= links)
+ * @param $title Title object for which is being edited (where we go to for &action= links)
* @return string
*/
protected function getActionURL( Title $title ) {
* this method should be overrided and return the page text that will be used
* for saving, preview parsing and so on...
*
- * @praram WebRequest $request
+ * @param $request WebRequest
*/
protected function importContentFormData( &$request ) {
return; // Don't do anything, EditPage already extracted wpTextbox1
// and fallback to the raw wpTextbox1 since editconflicts can't be
// resolved between page source edits and custom ui edits using the
// custom edit ui.
- $this->showTextbox1();
+ $this->showTextbox1( null, $this->getContent() );
} else {
$this->showContentForm();
}
if ( wfReadOnly() ) {
$wgOut->wrapWikiMsg( "<div id=\"mw-read-only-warning\">\n$1\n</div>", array( 'readonlywarning', wfReadOnlyReason() ) );
- } elseif ( $wgUser->isAnon() && $this->formtype != 'preview' ) {
- $wgOut->wrapWikiMsg( "<div id=\"mw-anon-edit-warning\">\n$1</div>", 'anoneditwarning' );
+ } elseif ( $wgUser->isAnon() ) {
+ if ( $this->formtype != 'preview' ) {
+ $wgOut->wrapWikiMsg( "<div id=\"mw-anon-edit-warning\">\n$1</div>", 'anoneditwarning' );
+ } else {
+ $wgOut->wrapWikiMsg( "<div id=\"mw-anon-preview-warning\">\n$1</div>", 'anonpreviewwarning' );
+ }
} else {
if ( $this->isCssJsSubpage ) {
# Check the skin exists
*
* @param $summary The value of the summary input
* @param $labelText The html to place inside the label
- * @param $userInputAttrs An array of attrs to use on the input
- * @param $userSpanAttrs An array of attrs to use on the span inside the label
+ * @param $inputAttrs An array of attrs to use on the input
+ * @param $spanLabelAttrs An array of attrs to use on the span inside the label
*
* @return array An array in the format array( $label, $input )
*/
}
/**
- * @param bool $isSubjectPreview true if this is the section subject/title
- * up top, or false if this is the comment
- * summary down below the textarea
- * @param string $summary The text of the summary to display
- * @return string
+ * @param $isSubjectPreview Boolean: true if this is the section subject/title
+ * up top, or false if this is the comment summary
+ * down below the textarea
+ * @param $summary String: The text of the summary to display
+ * @return String
*/
protected function showSummaryInput( $isSubjectPreview, $summary = "" ) {
global $wgOut, $wgContLang;
}
/**
- * @param bool $isSubjectPreview true if this is the section subject/title
- * up top, or false if this is the comment
- * summary down below the textarea
- * @param string $summary The text of the summary to display
- * @return string
+ * @param $isSubjectPreview Boolean: true if this is the section subject/title
+ * up top, or false if this is the comment summary
+ * down below the textarea
+ * @param $summary String: the text of the summary to display
+ * @return String
*/
protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) {
if ( !$summary || ( !$this->preview && !$this->diff ) )
* reverse modified when extracted from the post data.
* Note that this is basically the inverse for importContentFormData
*
- * @praram WebRequest $request
+ * @param $request WebRequest
*/
protected function showContentForm() {
$this->showTextbox1();
* The $textoverride method can be used by subclasses overriding showContentForm
* to pass back to this method.
*
- * @param array $customAttribs An array of html attributes to use in the textarea
- * @param string $textoverride Optional text to override $this->textarea1 with
+ * @param $customAttribs An array of html attributes to use in the textarea
+ * @param $textoverride String: optional text to override $this->textarea1 with
*/
protected function showTextbox1($customAttribs = null, $textoverride = null) {
$classes = array(); // Textarea CSS
'id' => $name,
'cols' => $wgUser->getIntOption( 'cols' ),
'rows' => $wgUser->getIntOption( 'rows' ),
- 'style' => '' // avoid php notices when appending for editwidth preference (appending allows customAttribs['style'] to still work
+ 'style' => '' // avoid php notices when appending preferences (appending allows customAttribs['style'] to still work
);
- if ( $wgUser->getOption( 'editwidth' ) )
- $attribs['style'] .= 'width: 100%';
-
$wgOut->addHTML( Html::textarea( $name, $wikitext, $attribs ) );
}
* Append preview output to $wgOut.
* Includes category rendering if this is a category page.
*
- * @param string $text The HTML to be output for the preview.
+ * @param $text String: the HTML to be output for the preview.
*/
protected function showPreview( $text ) {
global $wgOut;
}
}
+ /**
+ * Give a chance for site and per-namespace customizations of
+ * terms of service summary link that might exist separately
+ * from the copyright notice.
+ *
+ * This will display between the save button and the edit tools,
+ * so should remain short!
+ */
protected function showTosSummary() {
$msg = 'editpage-tos-summary';
- // Give a chance for site and per-namespace customizations of
- // terms of service summary link that might exist separately
- // from the copyright notice.
- //
- // This will display between the save button and the edit tools,
- // so should remain short!
wfRunHooks( 'EditPageTosSummary', array( $this->mTitle, &$msg ) );
$text = wfMsg( $msg );
if( !wfEmptyMsg( $msg, $text ) && $text !== '-' ) {
$wgOut->addHTML( " <span class='editHelp'>{$cancel}{$separator}{$edithelp}</span>\n" );
$wgOut->addHTML( "</div><!-- editButtons -->\n</div><!-- editOptions -->\n" );
}
-
+
+ /*
+ * Show an edit conflict. textbox1 is already shown in showEditForm().
+ * If you want to use another entry point to this function, be careful.
+ */
protected function showConflict() {
global $wgOut;
$this->textbox2 = $this->textbox1;
/**
* Format an anchor fragment as it would appear for a given section name
- * @param string $text
- * @return string
+ * @param $text String
+ * @return String
* @private
*/
function sectionAnchor( $text ) {
* Filter an input field through a Unicode de-armoring process if it
* came from an old browser with known broken Unicode editing issues.
*
- * @param WebRequest $request
- * @param string $field
- * @return string
+ * @param $request WebRequest
+ * @param $field String
+ * @return String
* @private
*/
function safeUnicodeInput( $request, $field ) {
* Filter an output field through a Unicode armoring process if it is
* going to an old browser with known broken Unicode editing issues.
*
- * @param string $text
- * @return string
+ * @param $text String
+ * @return String
* @private
*/
function safeUnicodeOutput( $text ) {
* Preexisting such character references will have a 0 added to them
* to ensure that round-trips do not alter the original data.
*
- * @param string $invalue
- * @return string
+ * @param $invalue String
+ * @return String
* @private
*/
function makesafe( $invalue ) {
* back to UTF-8. Used to protect data from corruption by broken web browsers
* as listed in $wgBrowserBlackList.
*
- * @param string $invalue
- * @return string
+ * @param $invalue String
+ * @return String
* @private
*/
function unmakesafe( $invalue ) {