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
26
<title>Template Properties</title>
27
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
28
<meta name="robots" content="noindex, nofollow" />
29
<script type="text/javascript">
31
var oEditor = window.parent.InnerDialogLoaded() ;
32
var FCK = oEditor.FCK ;
33
var FCKLang = oEditor.FCKLang ;
34
var FCKConfig = oEditor.FCKConfig ;
35
var FCKRegexLib = oEditor.FCKRegexLib ;
36
var FCKTools = oEditor.FCKTools ;
38
document.write( '<script src="' + FCKConfig.BasePath + 'dialog/common/fck_dialog_common.js" type="text/javascript"><\/script>' ) ;
41
<script type="text/javascript">
45
// Set the dialog tabs.
46
window.parent.AddTab( 'Edit', FCKLang.wikiTabEdit || 'Edit' ) ;
47
window.parent.AddTab( 'Manual', FCKLang.wikiTabManual || 'Manual' ) ;
49
function OnDialogTabChange( tabCode )
51
ShowE('divEdit' , ( tabCode == 'Edit' ) ) ;
52
ShowE('divManual' , ( tabCode == 'Manual' ) ) ;
55
// Get the selected flash embed (if available).
56
var oFakeImage = FCK.Selection.GetSelectedElement() ;
61
if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fck_mw_template') )
62
oTemplateSpan = FCK.GetRealElement( oFakeImage ) ;
67
window.onload = function()
69
// Translate the dialog box texts.
70
oEditor.FCKLanguageManager.TranslatePage(document) ;
72
// Load the selected link information (if any).
75
// Activate the "OK" button.
76
window.parent.SetOkButton( true ) ;
77
window.parent.SetAutoSize( true ) ;
78
GetE('xTemplateRaw').focus();
81
function LoadSearchResults( result )
83
var results = result.responseText.Trim().split( '\n' ) ;
84
var select = GetE( 'xWikiResults' ) ;
86
if ( results.length > 0 && !( results.length == 1 && results[0].length == 0 ) )
88
for ( var i = 0 ; i < results.length ; i++ )
89
FCKTools.AddSelectOption( select, 'Template:' + results[i], results[i] ) ;
93
function LoadSelection()
95
// Make an Ajax search for the pages.
97
oEditor.window.parent.sajax_request_type = 'GET' ;
98
oEditor.window.parent.sajax_do_call( 'wfSajaxSearchTemplateFCKeditor',[empty], LoadSearchResults ) ;
100
if ( !oTemplateSpan ) return ;
102
var inputText = FCKTools.HTMLDecode(oTemplateSpan.innerHTML);
103
inputText = FCKConfig.ProtectedSource.Revert(inputText, 0); //#2509
104
if (inputText.length>0 && inputText.indexOf('{{#')<0 && inputText.indexOf('{{:')<0 )
106
var templateName = inputText.substring(2,inputText.indexOf('fckLR'));
107
if (inputText.indexOf('fckLR')<1)
108
templateName = inputText.substring(2,inputText.indexOf('|'));
109
if (inputText.indexOf('|')<1)
110
templateName = inputText.substring(2,inputText.indexOf('}}'));
112
SetUrl(templateName.charAt(0).toUpperCase() + templateName.substr(1));
114
GetE('xTemplateRaw').value = inputText.replace(/fckLR/g,'\r\n').replace( /"/g, '"' );
117
function SetUrl(link)
119
var urlTemplate = oEditor.window.parent.location.pathname + '?title=Template:' + link + '&printable=yes';
120
SetAttribute(GetE('xTemplateManual'),'src',urlTemplate);
121
GetE('xTemplateRaw').value = "{{" + link + "}}";
124
//#### The OK button was hit.
127
if ( !oTemplateSpan )
129
oTemplateSpan = FCK.EditorDocument.createElement( 'SPAN' ) ;
130
oTemplateSpan.className = 'fck_mw_template' ;
133
var protectedValue = FCKConfig.ProtectedSource.Protect(GetE('xTemplateRaw').value);
134
var templateData = FCKTools.HTMLEncode(protectedValue.toString().Trim().replace(/(\r\n|\n)/g, 'fckLR')).replace( /"/g, '"' ) ;
136
if ( !( /^{{[\s\S]+}}$/.test( templateData ) ) )
138
alert( FCKLang.wikiTmplEmpty || 'Templates must start with {{ and end with }}. Please check it.' ) ;
142
oTemplateSpan.innerHTML = templateData ;
146
oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__MWTemplate', oTemplateSpan ) ;
147
oFakeImage.setAttribute( '_fck_mw_template', 'true', 0 ) ;
148
oFakeImage = FCK.InsertElement( oFakeImage ) ;
151
//GetE('xTestSpan').innerHTML = GetE('xTemplateRaw').value.Trim().replace( /"/g, '"' ).replace(/(\r\n|\n)/g, '___') ;
157
<body style="overflow: hidden">
159
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
162
<span fcklang="wikiTmpl">Template raw definition (from {{ to }})</span><br />
167
<textarea id="xTemplateRaw" style="width: 100%; height: 100%; font-family: Monospace"
168
cols="50" rows="10" wrap="off"></textarea>
173
<span id="xTestSpan" class="fck_mw_template"></span>
178
<div id="divManual" style="display: none">
179
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
181
<select id="xWikiResults" style="width: 100%;" onchange="SetUrl( this.value );">
182
<option fcklang="wikiTmpsel" value=""><Pick up a template manual here></option>
187
<iframe id="xTemplateManual" width="100%" scrolling="yes" height="100%" src="" style="margin:5px;padding:0px;"></iframe>