1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
8
* Licensed under the terms of any of the following licenses at your
11
* - GNU General Public License Version 2 or later (the "GPL")
12
* http://www.gnu.org/licenses/gpl.html
14
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15
* http://www.gnu.org/licenses/lgpl.html
17
* - Mozilla Public License Version 1.1 or later (the "MPL")
18
* http://www.mozilla.org/MPL/MPL-1.1.html
22
* Template selection dialog window.
24
<html xmlns="http://www.w3.org/1999/xhtml">
27
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
28
<meta name="robots" content="noindex, nofollow" />
29
<style type="text/css">
32
border: #dcdcdc 2px solid;
33
background-color: #ffffff;
42
border: #eeeeee 1px solid;
55
<script src="common/fck_dialog_common.js" type="text/javascript"></script>
56
<script type="text/javascript">
58
var oEditor = window.parent.InnerDialogLoaded() ;
59
var FCK = oEditor.FCK ;
60
var FCKLang = oEditor.FCKLang ;
61
var FCKConfig = oEditor.FCKConfig ;
63
window.onload = function()
65
// Set the right box height (browser dependent).
66
GetE('eList').style.height = document.all ? '100%' : '295px' ;
68
// Translate the dialog box texts.
69
oEditor.FCKLanguageManager.TranslatePage(document) ;
71
GetE('xChkReplaceAll').checked = ( FCKConfig.TemplateReplaceAll !== false ) ;
73
if ( FCKConfig.TemplateReplaceCheckbox !== false )
74
GetE('xReplaceBlock').style.display = '' ;
76
window.parent.SetAutoSize( true ) ;
81
function LoadTemplatesXml()
85
if ( !FCK._Templates )
87
GetE('eLoading').style.display = '' ;
89
// Create the Templates array.
90
FCK._Templates = new Array() ;
93
var oXml = new oEditor.FCKXml() ;
94
oXml.LoadUrl( FCKConfig.TemplatesXmlPath ) ;
96
// Get the Images Base Path.
97
var oAtt = oXml.SelectSingleNode( 'Templates/@imagesBasePath' ) ;
98
var sImagesBasePath = oAtt ? oAtt.value : '' ;
100
// Get the "Template" nodes defined in the XML file.
101
var aTplNodes = oXml.SelectNodes( 'Templates/Template' ) ;
103
for ( var i = 0 ; i < aTplNodes.length ; i++ )
105
var oNode = aTplNodes[i] ;
107
oTemplate = new Object() ;
111
// Get the Template Title.
112
if ( (oPart = oNode.attributes.getNamedItem('title')) )
113
oTemplate.Title = oPart.value ;
115
oTemplate.Title = 'Template ' + ( i + 1 ) ;
117
// Get the Template Description.
118
if ( (oPart = oXml.SelectSingleNode( 'Description', oNode )) )
119
oTemplate.Description = oPart.text ? oPart.text : oPart.textContent ;
121
// Get the Template Image.
122
if ( (oPart = oNode.attributes.getNamedItem('image')) )
123
oTemplate.Image = sImagesBasePath + oPart.value ;
125
// Get the Template HTML.
126
if ( (oPart = oXml.SelectSingleNode( 'Html', oNode )) )
127
oTemplate.Html = oPart.text ? oPart.text : oPart.textContent ;
130
alert( 'No HTML defined for template index ' + i + '. Please review the "' + FCKConfig.TemplatesXmlPath + '" file.' ) ;
134
FCK._Templates[ FCK._Templates.length ] = oTemplate ;
137
GetE('eLoading').style.display = 'none' ;
140
if ( FCK._Templates.length == 0 )
141
GetE('eEmpty').style.display = '' ;
144
for ( var j = 0 ; j < FCK._Templates.length ; j++ )
146
oTemplate = FCK._Templates[j] ;
148
var oItemDiv = GetE('eList').appendChild( document.createElement( 'DIV' ) ) ;
149
oItemDiv.TplIndex = j ;
150
oItemDiv.className = 'TplItem' ;
152
// Build the inner HTML of our new item DIV.
153
var sInner = '<table><tr>' ;
155
if ( oTemplate.Image )
156
sInner += '<td valign="top"><img src="' + oTemplate.Image + '"><\/td>' ;
158
sInner += '<td valign="top"><div class="TplTitle">' + oTemplate.Title + '<\/div>' ;
160
if ( oTemplate.Description )
161
sInner += '<div>' + oTemplate.Description + '<\/div>' ;
163
sInner += '<\/td><\/tr><\/table>' ;
165
oItemDiv.innerHTML = sInner ;
167
oItemDiv.onmouseover = ItemDiv_OnMouseOver ;
168
oItemDiv.onmouseout = ItemDiv_OnMouseOut ;
169
oItemDiv.onclick = ItemDiv_OnClick ;
174
function ItemDiv_OnMouseOver()
176
this.className += ' PopupSelectionBox' ;
179
function ItemDiv_OnMouseOut()
181
this.className = this.className.replace( /\s*PopupSelectionBox\s*/, '' ) ;
184
function ItemDiv_OnClick()
186
SelectTemplate( this.TplIndex ) ;
189
function SelectTemplate( index )
191
oEditor.FCKUndo.SaveUndoStep() ;
193
if ( GetE('xChkReplaceAll').checked )
194
FCK.SetHTML( FCK._Templates[index].Html ) ;
196
FCK.InsertHtml( FCK._Templates[index].Html ) ;
198
window.parent.Cancel( true ) ;
203
<body style="overflow: hidden">
204
<table width="100%" style="height: 100%">
207
<span fcklang="DlgTemplatesSelMsg">Please select the template to open in the editor<br />
208
(the actual contents will be lost):</span>
212
<td height="100%" align="center">
213
<div id="eList" align="left" class="TplList">
214
<div id="eLoading" align="center" style="display: none">
216
<span fcklang="DlgTemplatesLoading">Loading templates list. Please wait...</span>
218
<div id="eEmpty" align="center" style="display: none">
220
<span fcklang="DlgTemplatesNoTpl">(No templates defined)</span>
225
<tr id="xReplaceBlock" style="display: none">
227
<table cellpadding="0" cellspacing="0">
230
<input id="xChkReplaceAll" type="checkbox" /></td>
234
<label for="xChkReplaceAll" fcklang="DlgTemplatesReplace">
235
Replace actual contents</label></td>