Index: lams_central/web/fckeditor/fckeditor.js
===================================================================
diff -u -r55b56043d9d88eeb96bb4f8680fe9d2b0491dc12 -r877c31055fbefba3e65d509cdee913a6e762a67d
--- lams_central/web/fckeditor/fckeditor.js (.../fckeditor.js) (revision 55b56043d9d88eeb96bb4f8680fe9d2b0491dc12)
+++ lams_central/web/fckeditor/fckeditor.js (.../fckeditor.js) (revision 877c31055fbefba3e65d509cdee913a6e762a67d)
@@ -34,6 +34,7 @@
this.CheckBrowser = true ;
this.DisplayErrors = true ;
this.EnableSafari = false ; // This is a temporary property, while Safari support is under development.
+ this.EnableOpera = false ; // This is a temporary property, while Opera support is under development.
this.Config = new Object() ;
@@ -46,23 +47,23 @@
// Check for errors
if ( !this.InstanceName || this.InstanceName.length == 0 )
{
- this._ThrowError( 701, 'You must specify a instance name.' ) ;
+ this._ThrowError( 701, 'You must specify an instance name.' ) ;
return ;
}
document.write( '
' ) ;
if ( !this.CheckBrowser || this._IsCompatibleBrowser() )
{
- document.write( '' ) ;
+ document.write( '' ) ;
document.write( this._GetConfigHtml() ) ;
document.write( this._GetIFrameHtml() ) ;
}
else
{
var sWidth = this.Width.toString().indexOf('%') > 0 ? this.Width : this.Width + 'px' ;
var sHeight = this.Height.toString().indexOf('%') > 0 ? this.Height : this.Height + 'px' ;
- document.write('
' ) ;
@@ -72,14 +73,20 @@
{
if ( !this.CheckBrowser || this._IsCompatibleBrowser() )
{
+ // We must check the elements firstly using the Id and then the name.
var oTextarea = document.getElementById( this.InstanceName ) ;
+ var colElementsByName = document.getElementsByName( this.InstanceName ) ;
+ var i = 0;
+ while ( oTextarea || i == 0 )
+ {
+ if ( oTextarea && oTextarea.tagName == 'TEXTAREA' )
+ break ;
+ oTextarea = colElementsByName[i++] ;
+ }
if ( !oTextarea )
- oTextarea = document.getElementsByName( this.InstanceName )[0] ;
-
- if ( !oTextarea || oTextarea.tagName != 'TEXTAREA' )
{
- alert( 'Error: The TEXTAREA id "' + this.InstanceName + '" was not found' ) ;
+ alert( 'Error: The TEXTAREA with id or name set to "' + this.InstanceName + '" was not found' ) ;
return ;
}
@@ -111,7 +118,7 @@
sConfig += escape(o) + '=' + escape( this.Config[o] ) ;
}
- return '' ;
+ return '' ;
}
FCKeditor.prototype._GetIFrameHtml = function()
@@ -127,21 +134,31 @@
FCKeditor.prototype._IsCompatibleBrowser = function()
{
var sAgent = navigator.userAgent.toLowerCase() ;
-
+
// Internet Explorer
if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )
{
var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;
return ( sBrowserVersion >= 5.5 ) ;
}
+
// Gecko
- else if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 )
+ if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 )
return true ;
+
+ // Opera
+ if ( this.EnableOpera )
+ {
+ var aMatch = sAgent.match( /^opera\/(\d+\.\d+)/ ) ;
+ if ( aMatch && aMatch[1] >= 9.0 )
+ return true ;
+ }
+
// Safari
- else if ( this.EnableSafari && sAgent.indexOf( 'safari' ) != -1 )
+ if ( this.EnableSafari && sAgent.indexOf( 'safari' ) != -1 )
return ( sAgent.match( /safari\/(\d+)/ )[1] >= 312 ) ; // Build must be at least 312 (1.3)
- else
- return false ;
+
+ return false ;
}
FCKeditor.prototype._ThrowError = function( errorNumber, errorDescription )