.TplList
{
border: #dcdcdc 2px solid;
background-color: #ffffff;
overflow: auto;
width: 90%;
}
.TplItem
{
margin: 5px;
padding: 7px;
border: #eeeeee 1px solid;
}
.TplItem TABLE
{
display: inline;
}
.TplTitle
{
font-weight: bold;
}
var oEditor = window.parent.InnerDialogLoaded() ;
var FCK = oEditor.FCK ;
var FCKLang = oEditor.FCKLang ;
var FCKConfig = oEditor.FCKConfig ;
window.onload = function()
{
// Set the right box height (browser dependent).
GetE('eList').style.height = document.all ? '100%' : '295px' ;
// Translate the dialog box texts.
oEditor.FCKLanguageManager.TranslatePage(document) ;
window.parent.SetAutoSize( true ) ;
LoadTemplatesXml() ;
}
function LoadTemplatesXml()
{
if ( !FCK._Templates )
{
GetE('eLoading').style.display = '' ;
// Create the Templates array.
FCK._Templates = new Array() ;
// Load the XML file.
var oXml = new oEditor.FCKXml() ;
oXml.LoadUrl( FCKConfig.TemplatesXmlPath ) ;
// Get the Images Base Path.
var oAtt = oXml.SelectSingleNode( 'Templates/@imagesBasePath' ) ;
var sImagesBasePath = oAtt ? oAtt.value : '' ;
// Get the "Template" nodes defined in the XML file.
var aTplNodes = oXml.SelectNodes( 'Templates/Template' ) ;
for ( var i = 0 ; i < aTplNodes.length ; i++ )
{
var oNode = aTplNodes[i]
var oTemplate = new Object() ;
var oPart ;
// Get the Template Title.
if ( oPart = oNode.attributes.getNamedItem('title') )
oTemplate.Title = oPart.value ;
else
oTemplate.Title = 'Template ' + ( i + 1 ) ;
// Get the Template Description.
if ( oPart = oXml.SelectSingleNode( 'Description', oNode ) )
oTemplate.Description = oPart.text ? oPart.text : oPart.textContent ;
// Get the Template Image.
if ( oPart = oNode.attributes.getNamedItem('image') )
oTemplate.Image = sImagesBasePath + oPart.value ;
// Get the Template HTML.
if ( oPart = oXml.SelectSingleNode( 'Html', oNode ) )
oTemplate.Html = oPart.text ? oPart.text : oPart.textContent ;
else
{
alert( 'No HTML defined for template index ' + i + '. Please review the "' + FCKConfig.TemplatesXmlPath + '" file.' ) ;
continue ;
}
FCK._Templates[ FCK._Templates.length ] = oTemplate ;
}
GetE('eLoading').style.display = 'none' ;
}
if ( FCK._Templates.length == 0 )
GetE('eEmpty').style.display = '' ;
else
{
for ( var i = 0 ; i < FCK._Templates.length ; i++ )
{
var oTemplate = FCK._Templates[i] ;
var oItemDiv = GetE('eList').appendChild( document.createElement( 'DIV' ) ) ;
oItemDiv.TplIndex = i ;
oItemDiv.className = 'TplItem' ;
// Build the inner HTML of our new item DIV.
var sInner = '' ;
if ( oTemplate.Image )
sInner += '' ;
sInner += '' + oTemplate.Title + '' ;
if ( oTemplate.Description )
sInner += '' + oTemplate.Description + '' ;
sInner += '' ;
oItemDiv.innerHTML = sInner ;
oItemDiv.onmouseover = ItemDiv_OnMouseOver ;
oItemDiv.onmouseout = ItemDiv_OnMouseOut ;
oItemDiv.onclick = ItemDiv_OnClick ;
}
}
}
function ItemDiv_OnMouseOver()
{
this.className += ' PopupSelectionBox' ;
}
function ItemDiv_OnMouseOut()
{
this.className = this.className.replace( /\s*PopupSelectionBox\s*/, '' ) ;
}
function ItemDiv_OnClick()
{
SelectTemplate( this.TplIndex ) ;
}
function SelectTemplate( index )
{
oEditor.FCKUndo.SaveUndoStep() ;
FCK.SetHTML( FCK._Templates[index].Html ) ;
window.parent.Cancel() ;
}
Please select the template to open in the editor
(the actual contents will be lost):
Loading templates list. Please wait...
(No templates defined)
Wyszukiwarka
Podobne podstrony:
fck templatefck templateTemplatePart6templateeditDworak Iwona Templariusze (5)fck anchorFREECHART template indd 1DIY Mortis Dreadmought Plans & Templatesemail template product notificationtemplate?mintemplatewięcej podobnych podstron