Index: /MediaWiki/trunk/extensions/FCKeditor/FCKeditor.php
===================================================================
--- /MediaWiki/trunk/extensions/FCKeditor/FCKeditor.php	(revision 581)
+++ /MediaWiki/trunk/extensions/FCKeditor/FCKeditor.php	(revision 582)
@@ -57,6 +57,6 @@
 $wgExtensionCredits['other'][] = array(
 "name" => "FCKeditor extension",
-"author" => "originally written by Mafs, extended by FCKeditor.net",
-"version" => 'fck/mw-extension $Rev$ 2007',
+"author" => "FCKeditor.net (inspired by the code written by Mafs [Meta])",
+"version" => 'fckeditor/mw-extension $Rev$ 2007',
 "url" => "http://meta.wikimedia.org/wiki/FCKeditor",
 "description" => "FCKeditor extension"
Index: /MediaWiki/trunk/extensions/FCKeditor/FCKeditorSkin.body.php
===================================================================
--- /MediaWiki/trunk/extensions/FCKeditor/FCKeditorSkin.body.php	(revision 581)
+++ /MediaWiki/trunk/extensions/FCKeditor/FCKeditorSkin.body.php	(revision 582)
@@ -40,5 +40,5 @@
         }
         else {
-            $ret .= "_fck_mw_valid=\"false"."\" ";
+			$ret .= "_fck_mw_valid=\"false"."\" ";
         }
         $ret .= "_fck_mw_filename=\"{$orginal}\" ";
@@ -77,4 +77,8 @@
             $class .= ($class?" ":"") . "fck_mw_right";
         }
+		
+		if (!$found) {
+			$class .= ($class?" ":"") . "fck_mw_notfound";
+		}
 
         if (!is_null($alt) && !empty($alt) && false !== strpos(FCKeditorParser::$fkc_mw_makeImage_options, $alt) && $alt != "Image:" . $orginal) {
Index: /MediaWiki/trunk/extensions/FCKeditor/css/fckeditor.css
===================================================================
--- /MediaWiki/trunk/extensions/FCKeditor/css/fckeditor.css	(revision 581)
+++ /MediaWiki/trunk/extensions/FCKeditor/css/fckeditor.css	(revision 582)
@@ -1608,2 +1608,44 @@
 	font-size: 90%;
 }
+
+
+/**
+ * FCKeditor specific styles
+ */
+
+img.fck_mw_frame
+{
+	background-color: #F9F9F9;
+	border: 1px solid #CCCCCC;
+	padding: 3px !important;
+}
+
+img.fck_mw_right
+{
+	margin: 0.5em 5px 0.8em 1.4em ;
+	clear: right;
+	float: right;
+}
+
+img.fck_mw_left
+{
+	margin: 0.5em 1.4em 0.8em 5px;
+	clear: left;
+	float: left;
+}
+
+img.fck_mw_center
+{
+	margin-left: auto;
+	margin-right: auto;
+	margin-bottom: 0.5em;
+	display: block;
+}
+
+img.fck_mw_notfound 
+{
+	font-size: 1px;
+	height: 25px;
+	width: 25px;
+	overflow: hidden ;
+}
Index: /MediaWiki/trunk/extensions/FCKeditor/plugins/mediawiki/dialogs/image.html
===================================================================
--- /MediaWiki/trunk/extensions/FCKeditor/plugins/mediawiki/dialogs/image.html	(revision 582)
+++ /MediaWiki/trunk/extensions/FCKeditor/plugins/mediawiki/dialogs/image.html	(revision 582)
@@ -0,0 +1,324 @@
+﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!--
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net
+ * Copyright (C) 2003-2007 Frederico Caldeira Knabben
+ *
+ * == BEGIN LICENSE ==
+ *
+ * Licensed under the terms of any of the following licenses at your
+ * choice:
+ *
+ *  - GNU General Public License Version 2 or later (the "GPL")
+ *    http://www.gnu.org/licenses/gpl.html
+ *
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ *    http://www.gnu.org/licenses/lgpl.html
+ *
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")
+ *    http://www.mozilla.org/MPL/MPL-1.1.html
+ *
+ * == END LICENSE ==
+ *
+ * Image dialog window.
+-->
+<html>
+<head>
+	<title>Image Properties</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<meta name="robots" content="noindex, nofollow" />
+	<script type="text/javascript">
+
+var oEditor		= window.parent.InnerDialogLoaded() ;
+var FCK			= oEditor.FCK ;
+var FCKLang		= oEditor.FCKLang ;
+var FCKConfig	= oEditor.FCKConfig ;
+var FCKRegexLib	= oEditor.FCKRegexLib ;
+var FCKTools	= oEditor.FCKTools ;
+
+document.write( '<script src="' + FCKConfig.BasePath + 'dialog/common/fck_dialog_common.js" type="text/javascript"><\/script>' ) ;
+
+	</script>
+	<script type="text/javascript">
+
+// Get the selected image (if available).
+var oImage = FCK.Selection.GetSelectedElement() ;
+
+if ( oImage && oImage.tagName != 'IMG' )
+        oImage = null ;
+
+window.onload = function()
+{
+	// Translate the dialog box texts.
+	oEditor.FCKLanguageManager.TranslatePage(document) ;
+
+	// Load the selected element information (if any).
+	LoadSelection() ;
+
+//	UpdateOriginal() ;
+
+	window.parent.SetAutoSize( true ) ;
+	window.parent.SetOkButton( true ) ;
+}
+
+function LoadSelection()
+{
+        if ( ! oImage ) return ;
+
+        var sUrl = GetAttribute( oImage, '_fcksavedurl', '' ) ;
+        if ( sUrl.length == 0 )
+                sUrl = GetAttribute( oImage, 'src', '' ) ;
+
+        GetE('txtUrl').value    = GetAttribute( oImage, '_fck_mw_filename', '' ) ;
+        GetE('txtAlt').value    = GetAttribute( oImage, 'alt', '' ) ;
+        GetE('xType').value		= GetAttribute( oImage, '_fck_mw_type', '' ) ;
+        GetE('cmbAlign').value  = GetAttribute( oImage, '_fck_mw_location', '' ) ;
+
+        GetE('txtWidth').value  = GetAttribute( oImage, '_fck_mw_width', '' ) ;
+        GetE('txtHeight').value = GetAttribute( oImage, '_fck_mw_height', '' ) ;
+}
+
+//#### The OK button was hit.
+function Ok()
+{
+	if ( GetE('txtUrl').value.length == 0 )
+	{
+		GetE('txtUrl').focus() ;
+		return false ;
+	}
+	
+	window.parent.document.getElementById( 'btnOk' ).disabled = true ;
+	window.parent.document.getElementById( 'btnCancel' ).disabled = true ;
+
+	var imgName		= GetE('txtUrl').value ;
+	var imgCaption	= GetE('txtAlt').value ;
+	var imgType		= GetE('xType').value ;
+	var imgLocation	= GetE('cmbAlign').value ;
+	var imgWidth	= GetE('txtWidth').value ;
+	var imgHeight	= GetE('txtHeight').value ;
+
+	var ajaxArg = imgName ;
+
+	if ( imgType.length > 0 )
+		ajaxArg += '|' + imgType ;
+
+	if ( imgLocation.length > 0 )
+		ajaxArg += '|' + imgLocation ;
+
+	if ( imgWidth.length > 0 )
+	{
+		ajaxArg += '|' + imgWidth ;
+
+		if ( imgHeight.length > 0 )
+			ajaxArg += 'x' + imgHeight ;
+
+		ajaxArg += 'px' ;
+	}
+
+	if ( imgCaption.length > 0 )
+		ajaxArg += '|' + imgCaption ;
+
+	oEditor.window.parent.sajax_request_type = 'GET' ;
+	oEditor.window.parent.sajax_do_call( 'wfSajaxGetImageUrl', [ajaxArg], UpdateImageFromAjax ) ;
+
+	return false ;
+}
+
+function UpdateImageFromAjax( response )
+{
+	var bHasImage = ( oImage != null ) ;
+
+	if ( !bHasImage )
+		oImage = FCK.CreateElement( 'IMG' ) ;
+	else
+		oEditor.FCKUndo.SaveUndoStep() ;
+
+	UpdateImage( oImage, response.responseText ) ;
+
+	// Call it using setTimeout to avoid a strange behavior in Firefox.
+	window.setTimeout( window.parent.Cancel, 0 ) ;
+}
+
+function UpdateImage( e, realUrl )
+{
+	var imgType = GetE('xType').value ;
+	var imgLocation = GetE('cmbAlign').value ;
+
+	SetAttribute( e, "_fck_mw_filename", GetE('txtUrl').value ) ;
+	SetAttribute( e, "alt", GetE('txtAlt').value ) ;
+	SetAttribute( e, "_fck_mw_type", imgType ) ;
+	SetAttribute( e, "_fck_mw_location", imgLocation ) ;
+	SetAttribute( e, "_fck_mw_width", GetE('txtWidth').value ) ;
+	SetAttribute( e, "_fck_mw_height", GetE('txtHeight').value ) ;
+
+	SetAttribute( e, "width" , '' ) ;
+	SetAttribute( e, "height", '' ) ;
+
+	if ( imgType == 'thumb' || imgType == 'frame' )
+	{
+		e.className = 'fck_mw_frame' ;
+
+		if ( imgLocation.length == 0 )
+			imgLocation = 'right' ;
+	}
+
+	if ( imgLocation.length > 0 )
+		e.className += ' fck_mw_' + imgLocation ;
+
+	if ( realUrl.length == 0 )
+	{
+		e.className += ' fck_mw_notfound' ;
+		realUrl = 'about:blank' ;
+	}
+	
+	e.src = realUrl ;
+	SetAttribute( e, "_fcksavedurl", realUrl ) ;
+}
+
+var searchTimer ;
+
+//#### Called while the user types the URL.
+function OnUrlChange()
+{
+	var link = GetE('txtUrl').value.Trim() ;
+
+	if ( searchTimer )
+		window.clearTimeout( searchTimer ) ;
+
+	if ( link.length < 3  )
+	{
+		ClearSearch() ;
+
+		if ( link.length == 0 )
+			SetSearchMessage( 'start typing in the above field' ) ;
+		else
+			SetSearchMessage( 'too short... type more' ) ;
+		return ;
+	}
+
+	SetSearchMessage( 'stop typing to search' ) ;
+	searchTimer = window.setTimeout( StartSearch, 500 ) ;
+}
+
+function StartSearch()
+{
+	var link = GetE('txtUrl').value.Trim() ;
+
+	if ( link.length < 3  )
+		return ;
+
+	SetSearchMessage( 'searching...' ) ;
+
+	// Make an Ajax search for the pages.
+	oEditor.window.parent.sajax_request_type = 'GET' ;
+	oEditor.window.parent.sajax_do_call( 'wfSajaxSearchImageFCKeditor', [link], LoadSearchResults ) ;
+}
+
+function LoadSearchResults( result )
+{
+	var results = result.responseText.Trim().split( '\n' ) ;
+	var select = GetE( 'xWikiResults' ) ;
+
+	ClearSearch() ;
+
+	if ( results.length == 0 || ( results.length == 1 && results[0].length == 0 ) )
+	{
+		SetSearchMessage( 'no images found' ) ;
+	}
+	else
+	{
+		if ( results.length == 1 )
+			SetSearchMessage( 'one image found' ) ;
+		else
+			SetSearchMessage( results.length + ' images found' ) ;
+
+		for ( var i = 0 ; i < results.length ; i++ )
+			FCKTools.AddSelectOption( select, results[i], results[i] ) ;
+	}
+}
+
+function ClearSearch()
+{
+	var select = GetE( 'xWikiResults' ) ;
+
+	while ( select.options.length > 0 )
+		select.remove( 0 )
+}
+
+function SetSearchMessage( message )
+{
+	GetE('xWikiSearchStatus').innerHTML = message ;
+}
+
+function SetUrl( url )
+{
+	if ( url.length > 0 )
+		GetE('txtUrl').value = url ;
+}
+
+function UpdatePreview()
+{
+//        if ( !eImgPreview )
+//                return ;
+
+//		UpdateImage( eImgPreview, true ) ;
+}
+
+	</script>
+</head>
+<body scroll="no" style="overflow: hidden">
+	<div id="divInfo">
+		<table cellspacing="1" cellpadding="1" border="0" width="100%">
+			<tr>
+				<td>
+					<span>Image file name</span><br />
+					<input id="txtUrl" style="width: 100%" type="text" onkeyup="OnUrlChange();" onblur="UpdatePreview();" />
+					<br />
+					Automatic search results (<span id="xWikiSearchStatus">start typing in the above field</span>)<br />
+					<select id="xWikiResults" size="5" style="width: 100%; height: 70px" onclick="SetUrl( this.value );">
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td>
+					<span>Caption</span><br />
+					<input id="txtAlt" style="width: 100%" type="text"><br />
+				</td>
+			</tr>
+			<tr>
+				<td valign="top">
+					<table cellspacing="0" cellpadding="0" border="0">
+						<tr>
+							<td nowrap="nowrap">
+								Special Type<br />
+								<select id="xType">
+									<option value="" selected="selected"></option>
+									<option value="thumb">Thumbnail</option>
+									<option value="frame">Frame</option>
+									<option value="border">Border</option>
+								</select>
+							</td>
+							<td style="padding-left:7px;">
+								<span fcklang="DlgImgAlign">Align</span><br />
+								<select id="cmbAlign" onchange="UpdatePreview();">
+									<option value="" selected></option>
+									<option fcklang="DlgImgAlignRight" value="right">Right</option>
+									<option fcklang="DlgImgAlignLeft" value="left">Left</option>
+									<option value="center">Center</option>
+								</select>
+							</td>
+							<td style="padding-left:7px;">
+								<span fcklang="DlgImgWidth">Width</span><br />
+								<input type="text" size="3" id="txtWidth">
+							</td>
+							<td style="padding-left:7px;">
+								<span fcklang="DlgImgHeight">Height</span><br />
+								<input type="text" size="3" id="txtHeight">
+							</td>
+						</tr>
+					</table>
+				</td>
+			</tr>
+		</table>
+	</div>
+</body>
+</html>
Index: /MediaWiki/trunk/extensions/FCKeditor/plugins/mediawiki/fckplugin.js
===================================================================
--- /MediaWiki/trunk/extensions/FCKeditor/plugins/mediawiki/fckplugin.js	(revision 581)
+++ /MediaWiki/trunk/extensions/FCKeditor/plugins/mediawiki/fckplugin.js	(revision 582)
@@ -22,6 +22,9 @@
  *
  * Wikitext syntax reference:
- * http://meta.wikimedia.org/wiki/Help:Wikitext_examples
- * http://meta.wikimedia.org/wiki/Help:Advanced_editing
+ *	http://meta.wikimedia.org/wiki/Help:Wikitext_examples
+ *	http://meta.wikimedia.org/wiki/Help:Advanced_editing
+ *
+ * MediaWiki Sandbox:
+ *	http://meta.wikimedia.org/wiki/Meta:Sandbox
  */
 
@@ -35,7 +38,7 @@
 
 // Override some dialogs.
+FCKCommands.RegisterCommand( 'MW_Template', new FCKDialogCommand( 'MW_Template', 'Template Properties', FCKConfig.PluginsPath + 'mediawiki/dialogs/template.html', 400, 330 ) ) ;
 FCKCommands.RegisterCommand( 'Link', new FCKDialogCommand( 'Link', FCKLang.DlgLnkWindowTitle, FCKConfig.PluginsPath + 'mediawiki/dialogs/link.html', 400, 330 ) ) ;
-FCKCommands.RegisterCommand( 'MW_Template', new FCKDialogCommand( 'MW_Template', 'Template Properties', FCKConfig.PluginsPath + 'mediawiki/dialogs/template.html', 400, 330 ) ) ;
-//FCKCommands.RegisterCommand( 'Image', new FCKDialogCommand( 'Image', FCKLang.DlgImgTitle, FCKConfig.PluginsPath + 'mediawiki/image.html', 450, 400 ) ) ;
+FCKCommands.RegisterCommand( 'Image', new FCKDialogCommand( 'Image', FCKLang.DlgImgTitle, FCKConfig.PluginsPath + 'mediawiki/dialogs/image.html', 450, 300 ) ) ;
 
 // MediaWiki Wikitext Data Processor implementation.
@@ -283,4 +286,41 @@
 							break ;
 						
+						case 'img' :
+							
+							// <img alt="Blue Flower Image" _fck_mw_type="frame" _fck_mw_width="150" _fck_mw_filename="Blue Flower.jpg" _fcksavedurl="/images/b/b3/Blue_Flower.jpg" src="/images/b/b3/Blue_Flower.jpg"/>
+							
+							var imgName		= htmlNode.getAttribute( '_fck_mw_filename' ) ;
+							var imgCaption	= htmlNode.getAttribute( 'alt' ) || '' ;
+							var imgType		= htmlNode.getAttribute( '_fck_mw_type' ) || '' ;
+							var imgLocation	= htmlNode.getAttribute( '_fck_mw_location' ) || '' ;
+							var imgWidth	= htmlNode.getAttribute( '_fck_mw_width' ) || '' ;
+							var imgHeight	= htmlNode.getAttribute( '_fck_mw_height' ) || '' ;
+							
+							stringBuilder.push( '[[Image:' ) 
+							stringBuilder.push( imgName ) 
+							
+							if ( imgType.length > 0 )
+								stringBuilder.push( '|' + imgType ) ;
+							
+							if ( imgLocation.length > 0 )
+								stringBuilder.push( '|' + imgLocation ) ;
+
+							if ( imgWidth.length > 0 )
+							{
+								stringBuilder.push( '|' + imgWidth ) ;
+								
+								if ( imgHeight.length > 0 )
+									stringBuilder.push( 'x' + imgHeight ) ;
+
+								stringBuilder.push( 'px' ) ;
+							}
+							
+							if ( imgCaption.length > 0 )
+								stringBuilder.push( '|' + imgCaption ) ;
+							
+							stringBuilder.push( ']]' ) 
+							
+							break ;
+						
 						case 'span' :
 							switch ( htmlNode.className )
