Subversion Repositories Applications.papyrus

Rev

Rev 431 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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