Ticket #1437: special.html

File special.html, 4.9 KB (added by barns, 17 years ago)

Dialog for special tags

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>Special Tag 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_special') )
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        LoadDocumentation();
63
64        // Activate the "OK" button.
65        window.parent.SetOkButton( true ) ;
66        window.parent.SetAutoSize( true ) ;
67}
68
69function LoadSearchResults( result )
70{
71        var results = result.responseText.Trim().split( '\n' ) ;
72        var select = GetE( 'xSelectTag' ) ;
73
74        if ( results.length > 0 && !( results.length == 1 && results[0].length == 0 ) )
75        {
76                for ( var i = 0 ; i < results.length ; i++ )
77                        FCKTools.AddSelectOption( select, results[i], results[i] ) ;
78        }
79}
80
81
82function LoadSelection()
83{
84        // Make an Ajax search for the pages.
85        var empty = '';
86        oEditor.window.parent.sajax_request_type = 'GET' ;
87        oEditor.window.parent.sajax_do_call( 'wfSajaxSearchSpecialTagFCKeditor',[empty], LoadSearchResults ) ;
88
89        if ( !oTemplateSpan ) return ;
90
91        GetE('xTemplateRaw').value = FCKTools.HTMLDecode(oTemplateSpan.innerHTML).replace(/fckLR/g,'\r\n' ).replace( /&quot;/g, '"' ) ;
92        var tagName = oTemplateSpan.getAttribute('_fck_mw_tagname').toLowerCase();
93        GetE('xSelectTag').value = tagName;
94}
95
96function LoadDocumentation()
97{
98        var tagName = GetE('xSelectTag').value;
99        if (tagName == 'dpl')
100                GetE('xDefinition').innerHTML = 'DPL stands for Dynamic Page List, and allows to generate a formatted list of pages based on selection criteria. See <a href="#" onclick="javascript:window.open(\'http://semeb.com/dpldemo/index.php?title=Dynamic_Page_List\')">manual</a> for details';
101               
102        if (tagName == 'inputbox')
103                GetE('xDefinition').innerHTML = 'Inputbox allows to create a form for users to create new pages. The new pages edit box can be pre-loaded with any template. See <a href="#" onclick="javascript:window.open(\'http://meta.wikimedia.org/wiki/Help:Inputbox\')">manual</a> for details';
104}
105
106//#### The OK button was hit.
107function Ok()
108{
109        if ( !oTemplateSpan )
110        {
111                oTemplateSpan = FCK.EditorDocument.createElement( 'SPAN' ) ;
112                oTemplateSpan.className = 'fck_mw_special' ;
113                SetAttribute( oTemplateSpan, '_fck_mw_customtag', 'true' ) ;
114        }
115       
116        var templateData = FCKTools.HTMLEncode(GetE('xTemplateRaw').value.Trim().replace(/(\r\n|\n)/g, 'fckLR' )).replace( /"/g, '&quot;' ) ;
117       
118        oTemplateSpan.innerHTML = templateData ;
119        SetAttribute( oTemplateSpan, '_fck_mw_tagname', GetE('xSelectTag').value ) ;   
120
121        if ( !oFakeImage )
122        {
123                oFakeImage      = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__MWSpecial', oTemplateSpan ) ;
124                oFakeImage.setAttribute( '_fck_mw_special', 'true', 0 ) ;
125                oFakeImage      = FCK.InsertElement( oFakeImage ) ;
126        }
127
128        return true ;
129}
130
131        </script>
132</head>
133<body style="overflow: hidden">
134        <div id="divInfo">
135                <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
136                        <tr>
137                                <td>
138                                        <span>Current Special Tag:</span>
139                                        <select id="xSelectTag" onchange="LoadDocumentation()">
140                                        </select><br>
141                                        <i><span id="xDefinition"></span></i>
142                                </td>
143                        </tr>
144                        <tr>
145                                <td>
146                                        <hr>
147                                        Special tag parameters:
148                        </tr>
149                        <tr>
150                                <td height="100%">
151                                        <textarea id="xTemplateRaw" style="width: 100%; height: 100%; font-family: Monospace"
152                                                cols="50" rows="10" wrap="off"></textarea>
153                                </td>
154                        </tr>
155                </table>
156        </div>
157</body>
158</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy