Ticket #1567: template.html

File template.html, 3.3 KB (added by B_aniaczek, 16 years ago)

Dialog

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!--
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
5 *
6 * == BEGIN LICENSE ==
7 *
8 * Licensed under the terms of any of the following licenses at your
9 * choice:
10 *
11 *  - GNU General Public License Version 2 or later (the "GPL")
12 *    http://www.gnu.org/licenses/gpl.html
13 *
14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 *    http://www.gnu.org/licenses/lgpl.html
16 *
17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
18 *    http://www.mozilla.org/MPL/MPL-1.1.html
19 *
20 * == END LICENSE ==
21 *
22 * Link dialog window.
23-->
24<html>
25<head>
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">
30
31var oEditor             = window.parent.InnerDialogLoaded() ;
32var FCK                 = oEditor.FCK ;
33var FCKLang             = oEditor.FCKLang ;
34var FCKConfig   = oEditor.FCKConfig ;
35var FCKRegexLib = oEditor.FCKRegexLib ;
36var FCKTools    = oEditor.FCKTools ;
37
38document.write( '<script src="' + FCKConfig.BasePath + 'dialog/common/fck_dialog_common.js" type="text/javascript"><\/script>' ) ;
39
40        </script>
41        <script type="text/javascript">
42
43// Get the selected flash embed (if available).
44var oFakeImage = FCK.Selection.GetSelectedElement() ;
45var oTemplateSpan ;
46
47if ( oFakeImage )
48{
49        if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fck_mw_template') )
50                oTemplateSpan = FCK.GetRealElement( oFakeImage ) ;
51        else
52                oFakeImage = null ;
53}
54
55window.onload = function()
56{
57        // Translate the dialog box texts.
58        oEditor.FCKLanguageManager.TranslatePage(document) ;
59
60        // Load the selected link information (if any).
61        LoadSelection() ;
62
63        // Activate the "OK" button.
64        window.parent.SetOkButton( true ) ;
65        window.parent.SetAutoSize( true ) ;
66}
67
68function LoadSelection()
69{
70        if ( !oTemplateSpan ) return ;
71
72        GetE('xTemplateRaw').value = FCKTools.HTMLDecode( oTemplateSpan.innerHTML ).replace( /&quot;/g, '"' ) ;
73}
74
75//#### The OK button was hit.
76function Ok()
77{
78        if ( !oTemplateSpan )
79        {
80                oTemplateSpan = FCK.EditorDocument.createElement( 'SPAN' ) ;
81                oTemplateSpan.className = 'fck_mw_template' ;
82        }
83
84        var templateData = FCKTools.HTMLEncode( GetE('xTemplateRaw').value ).Trim().replace( /"/g, '&quot;' ) ;
85
86        if ( !( /^{{[\s\S]+}}$/.test( templateData ) ) )
87        {
88                alert( FCKLang.wikiTmplEmpty ) ;
89                return false ;
90        }
91
92        oTemplateSpan.innerHTML = templateData ;
93
94        if ( !oFakeImage )
95        {
96                oFakeImage      = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__MWTemplate', oTemplateSpan ) ;
97                oFakeImage.setAttribute( '_fck_mw_template', 'true', 0 ) ;
98                oFakeImage      = FCK.InsertElement( oFakeImage ) ;
99        }
100
101        return true ;
102}
103
104        </script>
105</head>
106<body style="overflow: hidden">
107        <div id="divInfo">
108                <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
109                        <tr>
110                                <td>
111                                        <span fcklang="wikiTmpl"></span><br />
112                                </td>
113                        </tr>
114                        <tr>
115                                <td height="100%">
116                                        <textarea id="xTemplateRaw" style="width: 100%; height: 100%; font-family: Monospace"
117                                                cols="50" rows="10" wrap="off"></textarea>
118                                </td>
119                        </tr>
120                </table>
121        </div>
122</body>
123</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy