~ubuntu-branches/ubuntu/saucy/mediawiki-extensions/saucy

« back to all changes in this revision

Viewing changes to dist/mediawiki-extensions-fckeditor/usr/share/mediawiki-extensions/fckeditor/plugins/mediawiki/dialogs/template.html

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2010-05-04 15:13:35 UTC
  • mfrom: (0.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100504151335-54qeucg3ec108q28
Tags: 2.2
* Added Replaces:/Conflicts: to allow a proper upgrade.
Closes: #580066
* Fixed package descriptions.
Closes: #579667
* Patched mediawiki-extensions-fckeditor to make it work with
  php 5.3. The fix may not be perfect but at least it work.
  Not closing the bug (#579822) for now..

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
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 ;
 
37
 
 
38
document.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
//#### Dialog Tabs
 
44
 
 
45
// Set the dialog tabs.
 
46
window.parent.AddTab( 'Edit', FCKLang.wikiTabEdit || 'Edit' ) ;
 
47
window.parent.AddTab( 'Manual', FCKLang.wikiTabManual || 'Manual' ) ;
 
48
 
 
49
function OnDialogTabChange( tabCode )
 
50
{
 
51
        ShowE('divEdit'         , ( tabCode == 'Edit' ) ) ;
 
52
        ShowE('divManual'               , ( tabCode == 'Manual' ) ) ;
 
53
}
 
54
 
 
55
// Get the selected flash embed (if available).
 
56
var oFakeImage = FCK.Selection.GetSelectedElement() ;
 
57
var oTemplateSpan ;
 
58
 
 
59
if ( oFakeImage )
 
60
{
 
61
        if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fck_mw_template') )
 
62
                oTemplateSpan = FCK.GetRealElement( oFakeImage ) ;
 
63
        else
 
64
                oFakeImage = null ;
 
65
}
 
66
 
 
67
window.onload = function()
 
68
{
 
69
        // Translate the dialog box texts.
 
70
        oEditor.FCKLanguageManager.TranslatePage(document) ;
 
71
 
 
72
        // Load the selected link information (if any).
 
73
        LoadSelection() ;
 
74
 
 
75
        // Activate the "OK" button.
 
76
        window.parent.SetOkButton( true ) ;
 
77
        window.parent.SetAutoSize( true ) ;
 
78
        GetE('xTemplateRaw').focus();
 
79
}
 
80
 
 
81
function LoadSearchResults( result )
 
82
{
 
83
        var results = result.responseText.Trim().split( '\n' ) ;
 
84
        var select = GetE( 'xWikiResults' ) ;
 
85
 
 
86
        if ( results.length > 0 && !( results.length == 1 && results[0].length == 0 ) )
 
87
        {
 
88
                for ( var i = 0 ; i < results.length ; i++ )
 
89
                        FCKTools.AddSelectOption( select, 'Template:' + results[i], results[i] ) ;
 
90
        }
 
91
}
 
92
 
 
93
function LoadSelection()
 
94
{
 
95
        // Make an Ajax search for the pages.
 
96
        var empty = '';
 
97
        oEditor.window.parent.sajax_request_type = 'GET' ;
 
98
        oEditor.window.parent.sajax_do_call( 'wfSajaxSearchTemplateFCKeditor',[empty], LoadSearchResults ) ;
 
99
 
 
100
        if ( !oTemplateSpan ) return ;
 
101
 
 
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 )
 
105
        {
 
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('}}'));
 
111
 
 
112
                SetUrl(templateName.charAt(0).toUpperCase() + templateName.substr(1));
 
113
        }
 
114
        GetE('xTemplateRaw').value = inputText.replace(/fckLR/g,'\r\n').replace( /&quot;/g, '"' );
 
115
}
 
116
 
 
117
function SetUrl(link)
 
118
{
 
119
        var urlTemplate = oEditor.window.parent.location.pathname + '?title=Template:' + link + '&printable=yes';
 
120
        SetAttribute(GetE('xTemplateManual'),'src',urlTemplate);
 
121
        GetE('xTemplateRaw').value = "{{" + link + "}}";
 
122
}
 
123
 
 
124
//#### The OK button was hit.
 
125
function Ok()
 
126
{
 
127
        if ( !oTemplateSpan )
 
128
        {
 
129
                oTemplateSpan = FCK.EditorDocument.createElement( 'SPAN' ) ;
 
130
                oTemplateSpan.className = 'fck_mw_template' ;
 
131
        }
 
132
 
 
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, '&quot;' ) ;
 
135
 
 
136
        if ( !( /^{{[\s\S]+}}$/.test( templateData ) ) )
 
137
        {
 
138
                alert( FCKLang.wikiTmplEmpty || 'Templates must start with {{ and end with }}. Please check it.' ) ;
 
139
                return false ;
 
140
        }
 
141
 
 
142
        oTemplateSpan.innerHTML = templateData ;
 
143
 
 
144
        if ( !oFakeImage )
 
145
        {
 
146
                oFakeImage      = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__MWTemplate', oTemplateSpan ) ;
 
147
                oFakeImage.setAttribute( '_fck_mw_template', 'true', 0 ) ;
 
148
                oFakeImage      = FCK.InsertElement( oFakeImage ) ;
 
149
        }
 
150
 
 
151
        //GetE('xTestSpan').innerHTML = GetE('xTemplateRaw').value.Trim().replace( /"/g, '&quot;' ).replace(/(\r\n|\n)/g, '___') ;
 
152
        return true ;
 
153
}
 
154
 
 
155
        </script>
 
156
</head>
 
157
<body style="overflow: hidden">
 
158
        <div id="divEdit">
 
159
                <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
 
160
                        <tr>
 
161
                                <td>
 
162
                                        <span fcklang="wikiTmpl">Template raw definition (from {{ to }})</span><br />
 
163
                                </td>
 
164
                        </tr>
 
165
                        <tr>
 
166
                                <td height="100%">
 
167
                                        <textarea id="xTemplateRaw" style="width: 100%; height: 100%; font-family: Monospace"
 
168
                                                cols="50" rows="10" wrap="off"></textarea>
 
169
                                </td>
 
170
                        </tr>
 
171
                        <tr>
 
172
                                <td>
 
173
                                        <span id="xTestSpan" class="fck_mw_template"></span>
 
174
                                </td>
 
175
                        </tr>
 
176
                </table>
 
177
        </div>
 
178
        <div id="divManual" style="display: none">
 
179
                <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
 
180
                        <tr>
 
181
                                <select id="xWikiResults" style="width: 100%;" onchange="SetUrl( this.value );">
 
182
                                <option fcklang="wikiTmpsel" value="">&lt;Pick up a template manual here&gt;</option>
 
183
                                </select>
 
184
                        </tr>
 
185
                        <tr>
 
186
                                <td>
 
187
                                        <iframe id="xTemplateManual" width="100%" scrolling="yes" height="100%" src="" style="margin:5px;padding:0px;"></iframe>
 
188
                                </td>
 
189
                        </tr>
 
190
                </table>
 
191
        </div>
 
192
</body>
 
193
</html>