Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
431 ddelon 1
<!--
2
 * FCKeditor - The text editor for internet
3
 * Copyright (C) 2003-2005 Frederico Caldeira Knabben
4
 *
5
 * Licensed under the terms of the GNU Lesser General Public License:
6
 * 		http://www.opensource.org/licenses/lgpl-license.php
7
 *
8
 * For further information visit:
9
 * 		http://www.fckeditor.net/
10
 *
11
 * File Name: fck_template.html
12
 * 	Template selection dialog window.
13
 *
14
 * File Authors:
15
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
16
-->
17
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
18
<html>
19
	<head>
20
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
21
		<meta name="robots" content="noindex, nofollow">
22
		<style>
23
			.TplList
24
			{
25
				border: #dcdcdc 2px solid;
26
				background-color: #ffffff;
27
				overflow: auto;
28
				width: 90%;
29
			}
30
 
31
			.TplItem
32
			{
33
				margin: 5px;
34
				padding: 7px;
35
				border: #eeeeee 1px solid;
36
			}
37
 
38
			.TplItem TABLE
39
			{
40
				display: inline;
41
			}
42
 
43
			.TplTitle
44
			{
45
				font-weight: bold;
46
			}
47
		</style>
48
		<script src="common/fck_dialog_common.js" type="text/javascript"></script>
49
		<script language="javascript">
50
 
51
var oEditor		= window.parent.InnerDialogLoaded() ;
52
var FCK			= oEditor.FCK ;
53
var FCKLang		= oEditor.FCKLang ;
54
var FCKConfig	= oEditor.FCKConfig ;
55
 
56
window.onload = function()
57
{
58
	// Set the right box height (browser dependent).
59
	GetE('eList').style.height = document.all ? '100%' : '295px' ;
60
 
61
	// Translate the dialog box texts.
62
	oEditor.FCKLanguageManager.TranslatePage(document) ;
63
 
64
	window.parent.SetAutoSize( true ) ;
65
 
66
	LoadTemplatesXml() ;
67
}
68
 
69
function LoadTemplatesXml()
70
{
71
	if ( !FCK._Templates )
72
	{
73
		GetE('eLoading').style.display = '' ;
74
 
75
		// Create the Templates array.
76
		FCK._Templates = new Array() ;
77
 
78
		// Load the XML file.
79
		var oXml = new oEditor.FCKXml() ;
80
		oXml.LoadUrl( FCKConfig.TemplatesXmlPath ) ;
81
 
82
		// Get the Images Base Path.
83
		var oAtt = oXml.SelectSingleNode( 'Templates/@imagesBasePath' ) ;
84
		var sImagesBasePath = oAtt ? oAtt.value : '' ;
85
 
86
		// Get the "Template" nodes defined in the XML file.
87
		var aTplNodes = oXml.SelectNodes( 'Templates/Template' ) ;
88
 
89
		for ( var i = 0 ; i < aTplNodes.length ; i++ )
90
		{
91
			var oNode = aTplNodes[i]
92
 
93
			var oTemplate = new Object() ;
94
 
95
			var oPart ;
96
 
97
			// Get the Template Title.
98
			if ( oPart = oNode.attributes.getNamedItem('title') )
99
				oTemplate.Title = oPart.value ;
100
			else
101
				oTemplate.Title = 'Template ' + ( i + 1 ) ;
102
 
103
			// Get the Template Description.
104
			if ( oPart = oXml.SelectSingleNode( 'Description', oNode ) )
105
				oTemplate.Description = oPart.text ? oPart.text : oPart.textContent ;
106
 
107
			// Get the Template Image.
108
			if ( oPart = oNode.attributes.getNamedItem('image') )
109
				oTemplate.Image = sImagesBasePath + oPart.value ;
110
 
111
			// Get the Template HTML.
112
			if ( oPart = oXml.SelectSingleNode( 'Html', oNode ) )
113
				oTemplate.Html = oPart.text ? oPart.text : oPart.textContent ;
114
			else
115
			{
116
				alert( 'No HTML defined for template index ' + i + '. Please review the "' + FCKConfig.TemplatesXmlPath + '" file.' ) ;
117
				continue ;
118
			}
119
 
120
			FCK._Templates[ FCK._Templates.length ] = oTemplate ;
121
		}
122
 
123
		GetE('eLoading').style.display = 'none' ;
124
	}
125
 
126
	if ( FCK._Templates.length == 0 )
127
		GetE('eEmpty').style.display = '' ;
128
	else
129
	{
130
		for ( var i = 0 ; i < FCK._Templates.length ; i++ )
131
		{
132
			var oTemplate = FCK._Templates[i] ;
133
 
134
			var oItemDiv = GetE('eList').appendChild( document.createElement( 'DIV' ) ) ;
135
			oItemDiv.TplIndex = i ;
136
			oItemDiv.className = 'TplItem' ;
137
 
138
			// Build the inner HTML of our new item DIV.
139
			var sInner = '<table><tr>' ;
140
 
141
			if ( oTemplate.Image )
142
				sInner += '<td valign="top"><img src="' + oTemplate.Image + '"></td>' ;
143
 
144
			sInner += '<td valign="top"><div class="TplTitle">' + oTemplate.Title + '</div>' ;
145
 
146
			if ( oTemplate.Description )
147
				sInner += '<div>' + oTemplate.Description + '</div>' ;
148
 
149
			sInner += '</td></tr></table>' ;
150
 
151
			oItemDiv.innerHTML = sInner ;
152
 
153
			oItemDiv.onmouseover = ItemDiv_OnMouseOver ;
154
			oItemDiv.onmouseout = ItemDiv_OnMouseOut ;
155
			oItemDiv.onclick = ItemDiv_OnClick ;
156
		}
157
	}
158
}
159
 
160
function ItemDiv_OnMouseOver()
161
{
162
	this.className += ' PopupSelectionBox' ;
163
}
164
 
165
function ItemDiv_OnMouseOut()
166
{
167
	this.className = this.className.replace( /\s*PopupSelectionBox\s*/, '' ) ;
168
}
169
 
170
function ItemDiv_OnClick()
171
{
172
	SelectTemplate( this.TplIndex ) ;
173
}
174
 
175
function SelectTemplate( index )
176
{
177
	oEditor.FCKUndo.SaveUndoStep() ;
178
	FCK.SetHTML( FCK._Templates[index].Html ) ;
179
	window.parent.Cancel() ;
180
}
181
 
182
		</script>
183
	</head>
184
	<body scroll="no" style="OVERFLOW: hidden">
185
		<table width="100%" height="100%">
186
			<tr>
187
				<td align="center">
188
					<span fckLang="DlgTemplatesSelMsg">Please select the template to open in the editor<br>
189
					(the actual contents will be lost):</span>
190
				</td>
191
			</tr>
192
			<tr>
193
				<td height="100%" align="center">
194
					<div id="eList" align="left" class="TplList">
195
						<div id="eLoading" align="center" style="DISPLAY: none">
196
							<br>
197
							<span fckLang="DlgTemplatesLoading">Loading templates list. Please wait...</span>
198
						</div>
199
						<div id="eEmpty" align="center" style="DISPLAY: none">
200
							<br>
201
							<span fckLang="DlgTemplatesNoTpl">(No templates defined)</span>
202
						</div>
203
					</div>
204
				</td>
205
			</tr>
206
		</table>
207
	</body>
208
</html>