<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 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 ==
*
* Link dialog window.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="noindex, nofollow" name="robots" />
<script src="common/fck_dialog_common.js" type="text/javascript"></script>
<script type="text/javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
var FCK = oEditor.FCK ;
var FCKLang = oEditor.FCKLang ;
var FCKConfig = oEditor.FCKConfig ;
//#### Dialog Tabs
// Set the dialog tabs.
window.parent.AddTab( 'General' , FCKLang.DlgDocGeneralTab ) ;
window.parent.AddTab( 'Background' , FCKLang.DlgDocBackTab ) ;
window.parent.AddTab( 'Colors' , FCKLang.DlgDocColorsTab ) ;
window.parent.AddTab( 'Meta' , FCKLang.DlgDocMetaTab ) ;
// Function called when a dialog tag is selected.
function OnDialogTabChange( tabCode )
{
ShowE( 'divGeneral' , ( tabCode == 'General' ) ) ;
ShowE( 'divBackground' , ( tabCode == 'Background' ) ) ;
ShowE( 'divColors' , ( tabCode == 'Colors' ) ) ;
ShowE( 'divMeta' , ( tabCode == 'Meta' ) ) ;
ShowE( 'ePreview' , ( tabCode == 'Background' || tabCode == 'Colors' ) ) ;
}
//#### Get Base elements from the document: BEGIN
// The HTML element of the document.
var oHTML = FCK.EditorDocument.getElementsByTagName('html')[0] ;
// The HEAD element of the document.
var oHead = oHTML.getElementsByTagName('head')[0] ;
var oBody = FCK.EditorDocument.body ;
// This object contains all META tags defined in the document.
var oMetaTags = new Object() ;
// Get all META tags defined in the document.
AppendMetaCollection( oMetaTags, oHead.getElementsByTagName('meta') ) ;
AppendMetaCollection( oMetaTags, oHead.getElementsByTagName('fck:meta') ) ;
function AppendMetaCollection( targetObject, metaCollection )
{
// Loop throw all METAs and put it in the HashTable.
for ( var i = 0 ; i < metaCollection.length ; i++ )
{
// Try to get the "name" attribute.
var sName = GetAttribute( metaCollection[i], 'name', GetAttribute( metaCollection[i], '___fcktoreplace:name', '' ) ) ;
// If no "name", try with the "http-equiv" attribute.
if ( sName.length == 0 )
{
if ( oEditor.FCKBrowserInfo.IsIE )
{
// Get the http-equiv value from the outerHTML.
var oHttpEquivMatch = metaCollection[i].outerHTML.match( oEditor.FCKRegexLib.MetaHttpEquiv ) ;
if ( oHttpEquivMatch )
sName = oHttpEquivMatch[1] ;
}
else
sName = GetAttribute( metaCollection[i], 'http-equiv', '' ) ;
}
if ( sName.length > 0 )
targetObject[ sName.toLowerCase() ] = metaCollection[i] ;
}
}
//#### END
// Set a META tag in the document.
function SetMetadata( name, content, isHttp )
{
if ( content.length == 0 )
{
RemoveMetadata( name ) ;
return ;
}
var oMeta = oMetaTags[ name.toLowerCase() ] ;
if ( !oMeta )
{
oMeta = oHead.appendChild( FCK.EditorDocument.createElement('META') ) ;
if ( isHttp )
SetAttribute( oMeta, 'http-equiv', name ) ;
else
{
// On IE, it is not possible to set the "name" attribute of the META tag.
// So a temporary attribute is used and it is replaced when getting the
// editor's HTML/XHTML value. This is sad, I know :(
if ( oEditor.FCKBrowserInfo.IsIE )
SetAttribute( oMeta, '___fcktoreplace:name', name ) ;
else
SetAttribute( oMeta, 'name', name ) ;
}
oMetaTags[ name.toLowerCase() ] = oMeta ;
}
SetAttribute( oMeta, 'content', content ) ;
// oMeta.content = content ;
}
function RemoveMetadata( name )
{
var oMeta = oMetaTags[ name.toLowerCase() ] ;
if ( oMeta && oMeta != null )
{
oMeta.parentNode.removeChild( oMeta ) ;
oMetaTags[ name.toLowerCase() ] = null ;
}
}
function GetMetadata( name )
{
var oMeta = oMetaTags[ name.toLowerCase() ] ;
if ( oMeta && oMeta != null )
return oMeta.getAttribute( 'content', 2 ) ;
else
return '' ;
}
window.onload = function ()
{
// Show/Hide the "Browse Server" button.
GetE('tdBrowse').style.display = oEditor.FCKConfig.ImageBrowser ? "" : "none";
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage( document ) ;
FillFields() ;
UpdatePreview() ;
// Show the "Ok" button.
window.parent.SetOkButton( true ) ;
window.parent.SetAutoSize( true ) ;
}
function FillFields()
{
// ### General Info
GetE('txtPageTitle').value = FCK.EditorDocument.title ;
GetE('selDirection').value = GetAttribute( oHTML, 'dir', '' ) ;
GetE('txtLang').value = GetAttribute( oHTML, 'xml:lang', GetAttribute( oHTML, 'lang', '' ) ) ; // "xml:lang" takes precedence to "lang".
// Character Set Encoding.
// if ( oEditor.FCKBrowserInfo.IsIE )
// var sCharSet = FCK.EditorDocument.charset ;
// else
var sCharSet = GetMetadata( 'Content-Type' ) ;
if ( sCharSet != null && sCharSet.length > 0 )
{
// if ( !oEditor.FCKBrowserInfo.IsIE )
sCharSet = sCharSet.match( /[^=]*$/ ) ;
GetE('selCharSet').value = sCharSet ;
if ( GetE('selCharSet').selectedIndex == -1 )
{
GetE('selCharSet').value = '...' ;
GetE('txtCustomCharSet').value = sCharSet ;
CheckOther( GetE('selCharSet'), 'txtCustomCharSet' ) ;
}
}
// Document Type.
if ( FCK.DocTypeDeclaration && FCK.DocTypeDeclaration.length > 0 )
{
GetE('selDocType').value = FCK.DocTypeDeclaration ;
if ( GetE('selDocType').selectedIndex == -1 )
{
GetE('selDocType').value = '...' ;
GetE('txtDocType').value = FCK.DocTypeDeclaration ;
CheckOther( GetE('selDocType'), 'txtDocType' ) ;
}
}
// Document Type.
GetE('chkIncXHTMLDecl').checked = ( FCK.XmlDeclaration && FCK.XmlDeclaration.length > 0 ) ;
// ### Background
GetE('txtBackColor').value = GetAttribute( oBody, 'bgColor' , '' ) ;
GetE('txtBackImage').value = GetAttribute( oBody, 'background' , '' ) ;
GetE('chkBackNoScroll').checked = ( GetAttribute( oBody, 'bgProperties', '' ).toLowerCase() == 'fixed' ) ;
// ### Colors
GetE('txtColorText').value = GetAttribute( oBody, 'text' , '' ) ;
GetE('txtColorLink').value = GetAttribute( oBody, 'link' , '' ) ;
GetE('txtColorVisited').value = GetAttribute( oBody, 'vLink' , '' ) ;
GetE('txtColorActive').value = GetAttribute( oBody, 'aLink' , '' ) ;
// ### Margins
GetE('txtMarginTop').value = GetAttribute( oBody, 'topMargin' , '' ) ;
GetE('txtMarginLeft').value = GetAttribute( oBody, 'leftMargin' , '' ) ;
GetE('txtMarginRight').value = GetAttribute( oBody, 'rightMargin' , '' ) ;
GetE('txtMarginBottom').value = GetAttribute( oBody, 'bottomMargin' , '' ) ;
// ### Meta Data
GetE('txtMetaKeywords').value = GetMetadata( 'keywords' ) ;
GetE('txtMetaDescription').value = GetMetadata( 'description' ) ;
GetE('txtMetaAuthor').value = GetMetadata( 'author' ) ;
GetE('txtMetaCopyright').value = GetMetadata( 'copyright' ) ;
}
// Called when the "Ok" button is clicked.
function Ok()
{
// ### General Info
FCK.EditorDocument.title = GetE('txtPageTitle').value ;
var oHTML = FCK.EditorDocument.getElementsByTagName('html')[0] ;
SetAttribute( oHTML, 'dir' , GetE('selDirection').value ) ;
SetAttribute( oHTML, 'lang' , GetE('txtLang').value ) ;
SetAttribute( oHTML, 'xml:lang' , GetE(