MediaWiki - Editor WYSIWYG FCKeditor disabled as default

De WikiMar
Dreceres ràpides: navegació, cerca

This is a method to make FCKeditor not being activated by default, and giving the possibility to the editor to activate or deactivate it.

  • 1. Edit the LocalSettings.php and the line to load the FCKeditor should be like:
if ((!(strpos($_SERVER["REQUEST_URI"], "fckeditor=true") === false)) || (!(strpos($_SERVER["REQUEST_URI"], "action=ajax") === false))) 
{
       require_once( "$IP/extensions/FCKeditor/FCKeditor.php" );
}



  • 2. Search in /includes/EditPage.php arround line 1211 the following code:
	// Put these up at the top to ensure they aren't lost on early form submission
	$wgOut->addHTML( "
<input type='hidden' value=\"" . htmlspecialchars( $this->section ) . "\" name=\"wpSection\" />
<input type='hidden' value=\"{$this->starttime}\" name=\"wpStarttime\" />\n
<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n
<input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n" );

	$wgOut->addHTML( <<<END
$recreate
{$commentsubject}
{$subjectpreview}
<textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='{$rows}'
cols='{$cols}'{$ew} $hidden>
END
. htmlspecialchars( $this->safeUnicodeOutput( $this->textbox1 ) ) .
"
</textarea>
	" );
		
	$wgOut->addWikiText( $copywarn );
	$wgOut->addHTML( $this->editFormTextAfterWarn );
	$wgOut->addHTML( "
{$metadata}
{$editsummary}
{$summarypreview}
{$checkboxhtml}
{$safemodehtml}
");


and add right before the line $wgOut->addWikiText( $copywarn );

$wgOut->addHTML( 'FCKEditor: ' );
if (!(strpos($_SERVER["REQUEST_URI"], "&fckeditor=true") === false)) 
 $wgOut->addHTML( '<b>ON</b> - <a href="' . str_replace("&fckeditor=true", "", $_SERVER["REQUEST_URI"]) . '">OFF</a><br>' );
else
 $wgOut->addHTML( '<a href="' . $_SERVER["REQUEST_URI"] . '&fckeditor=true">ON</a> - <b>OFF</b>' );


For newer versions of MediaWiki (>=1.13) the line to search for is

 $wgOut->wrapWikiMsg( "<div id=\"editpage-copywarn\">\n$1\n</div>", $copywarnMsg );