// FCKeditor Class
var FCKeditor = function( instanceName, width, height, toolbarSet, value )
{
// Properties
this.InstanceName = instanceName ;
this.Width = width || '100%' ;
this.Height = height || '200' ;
this.ToolbarSet = toolbarSet || 'Default' ;
this.Value = value || '' ;
this.BasePath = '/fckeditor/' ;
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() ;
// Events
this.OnError = null ; // function( source, errorNumber, errorDescription )
}
FCKeditor.prototype.Version = '2.3.2' ;
FCKeditor.prototype.VersionBuild = '1082' ;
FCKeditor.prototype.Create = function()
{
document.write( this.CreateHtml() ) ;
}
FCKeditor.prototype.CreateHtml = function()
{
// Check for errors
if ( !this.InstanceName || this.InstanceName.length == 0 )
{
this._ThrowError( 701, 'You must specify an instance name.' ) ;
return ;
}
var sHtml = '
' ;
if ( !this.CheckBrowser || FCKeditor_IsCompatibleBrowser() )
{
sHtml += '' ;
sHtml += this._GetConfigHtml() ;
sHtml += 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' ;
sHtml += '
' ;
return sHtml ;
}
FCKeditor.prototype.ReplaceTextarea = function()
{
if ( !this.CheckBrowser || FCKeditor_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.toLowerCase() == 'textarea' )
break ;
oTextarea = colElementsByName[i++] ;
}
if ( !oTextarea )
{
alert( 'Error: The TEXTAREA with id or name set to "' + this.InstanceName + '" was not found' ) ;
return ;
}
oTextarea.style.display = 'none' ;
this._InsertHtmlBefore( this._GetConfigHtml(), oTextarea ) ;
this._InsertHtmlBefore( this._GetIFrameHtml(), oTextarea ) ;
}
}
FCKeditor.prototype._InsertHtmlBefore = function( html, element )
{
if ( element.insertAdjacentHTML ) // IE
element.insertAdjacentHTML( 'beforeBegin', html ) ;
else // Gecko
{
var oRange = document.createRange() ;
oRange.setStartBefore( element ) ;
var oFragment = oRange.createContextualFragment( html );
element.parentNode.insertBefore( oFragment, element ) ;
}
}
FCKeditor.prototype._GetConfigHtml = function()
{
var sConfig = '' ;
for ( var o in this.Config )
{
if ( sConfig.length > 0 ) sConfig += '&' ;
sConfig += escape(o) + '=' + escape( this.Config[o] ) ;
}
return '' ;
}
FCKeditor.prototype._GetIFrameHtml = function()
{
var sFile = 'fckeditor.html' ;
try
{
if ( (/fcksource=true/i).test( window.top.location.search ) )
sFile = 'fckeditor.original.html' ;
}
catch (e) { /* Ignore it. Much probably we are inside a FRAME where the "top" is in another domain (security error). */ }
var sLink = this.BasePath + sFile + '?InstanceName=' + this.InstanceName ;
if (this.ToolbarSet) sLink += '&Toolbar=' + this.ToolbarSet ;
return '' ;
}
// Deprecated (to be removed in the 3.0).
FCKeditor.prototype._IsCompatibleBrowser = function()
{
return FCKeditor_IsCompatibleBrowser() ;
}
FCKeditor.prototype._ThrowError = function( errorNumber, errorDescription )
{
this.ErrorNumber = errorNumber ;
this.ErrorDescription = errorDescription ;
if ( this.DisplayErrors )
{
document.write( '' ) ;
document.write( '[ FCKeditor Error ' + this.ErrorNumber + ': ' + this.ErrorDescription + ' ]' ) ;
document.write( '
' ) ;
}
if ( typeof( this.OnError ) == 'function' )
this.OnError( this, errorNumber, errorDescription ) ;
}
FCKeditor.prototype._HTMLEncode = function( text )
{
if ( typeof( text ) != "string" )
text = text.toString() ;
text = text.replace(
/&/g, "&").replace(
/"/g, """).replace(
//g, ">") ;
return text ;
}
function FCKeditor_IsCompatibleBrowser()
{
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 (Opera 9 tries to behave like Gecko at this point).
if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 && !( typeof(opera) == 'object' && opera.postError ) )
return true ;
// Opera
if ( this.EnableOpera && navigator.appName == 'Opera' && parseInt( navigator.appVersion ) >= 9 )
return true ;
// Safari
if ( this.EnableSafari && sAgent.indexOf( 'safari' ) != -1 )
return ( sAgent.match( /safari\/(\d+)/ )[1] >= 312 ) ; // Build must be at least 312 (1.3)
return false ;
}
function describe(text) {
window.status=text;
return true;
}
function clearstatus() {
window.status='';
}
function display(id) {
var o2 = document.getElementById('div'+id).style;
var o = document.getElementById('form'+id).style;
if(o.display == 'none') {
o.display = 'block';
o2.display = 'none';
}
else {
o.display = 'none';
o2.display = 'block';
}
}
function BlSelChange(id,num,childs,childsnum,childscount,childminright) {
var check = document.getElementById('checkb'+id)
check.checked=true;
document.getElementById('blockname'+id).className='disabledcolor';
var currsel = document.getElementById('blockid'+id).selectedIndex;
var i = 0
do {
i = i +1
var o = document.getElementById('blockappid'+childs[i]+'_'+childsnum[i]);
if (o!=null) {
var flag = 0;
if (childscount[i]==1) {flag = 1}
else {
if (childminright[i]<=currsel) {flag = 1}
}
if (flag == 1) {
o.selectedIndex = currsel;
BlAppSelChange(childs[i],childsnum[i]);
}
}
}
while (i < num)
}
function AppSelChange(id) {
var check = document.getElementById('checkapp'+id)
check.checked=true;
document.getElementById('appname'+id).className='disabledcolor';
}
function ActSelChange(id) {
var check = document.getElementById('checkact'+id)
check.checked=true;
document.getElementById('actname'+id).className='disabledcolor';
}
function SiteSelChange(id) {
var check = document.getElementById('checksite'+id)
check.checked=true;
document.getElementById('sitename'+id).className='disabledcolor';
}
function PageSelChange(id) {
var check = document.getElementById('checkpage'+id)
check.checked=true;
document.getElementById('pagename'+id).className='disabledcolor';
}
function MenuSelChange(id) {
var check = document.getElementById('checkmenu'+id)
check.checked=true;
document.getElementById('menuname'+id).className='disabledcolor';
}
function BlAppSelChange(id,num) {
var i = 0
var check = document.getElementById('check'+id+'_'+num)
check.checked=true;
document.getElementById('appname'+id+'_'+num).className='disabledcolor';
var currsel = document.getElementById('blockappid'+id+'_'+num).selectedIndex;
do {
i = i +1
var o = document.getElementById('blockappid'+id+'_'+i);
if (i!=num) {
if (o!=null) {
o.selectedIndex = currsel;
check = document.getElementById('check'+id+'_'+i)
check.checked=true;
document.getElementById('appname'+id+'_'+i).className='disabledcolor';
} else {i = -1;}}
}
while (i != -1)
}
function SelChange(id) {
var o = document.getElementById('check'+id);
o.checked=true;
}
function linktype1click() {
document.getElementById('ipnb').style.display='block';
document.getElementById('ipinp').style.display='block';
document.getElementById('pagenb').style.display='none';
document.getElementById('pagesel').style.display='none';
if (document.getElementById('pagesel1')) { document.getElementById('pagesel1').style.display='none';}
if (document.getElementById('pagesel2')) { document.getElementById('pagesel2').style.display='none';}
return true ;
}
function linktype2click() {
document.getElementById('ipnb').style.display='none';
document.getElementById('ipinp').style.display='none';
document.getElementById('pagenb').style.display='block';
document.getElementById('pagesel').style.display='block';
if (document.getElementById('pagesel1')) { document.getElementById('pagesel1').style.display='block';}
if (document.getElementById('pagesel2')) { document.getElementById('pagesel2').style.display='block';}
return true ;
}
function sitetype1click() {
document.getElementById('pagelbl1').style.display='block';
document.getElementById('pagelbl2').style.display='none';
document.getElementById('cssnamelbl').style.display='block';
document.getElementById('cssnamebl').style.display='block';
document.getElementById('cssnameblnb').style.display='block';
document.getElementById('pagelblin').style.display='block';
if(document.getElementById('linktype1').checked = 'false')
{
document.getElementById('linktype1').checked = 'true'
}
document.getElementById('createeditorgr').disabled=false;
return true ;
}
function sitetype2click() {
document.getElementById('pagelbl1').style.display='none';
document.getElementById('pagelbl2').style.display='block';
document.getElementById('cssnamelbl').style.display='none';
document.getElementById('cssnamebl').style.display='none';
document.getElementById('cssnameblnb').style.display='none';
document.getElementById('pagelblin').style.display='none';
linktype1click()
document.getElementById('createeditorgr').disabled=true;
document.getElementById('createeditorgr').checked=false;
return true ;
}
function accountgrparentclick() {
ParentGroup = document.getElementById('ParentGroup').value
if (ParentGroup!='')
{
document.getElementById('copyguesttr').style.display='none';
}
else {
document.getElementById('copyguesttr').style.display='block';
}
return true ;
}