~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/link.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>Link 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
// oLink: The actual selected link in the editor.
 
44
var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ;
 
45
if ( oLink )
 
46
        FCK.Selection.SelectNode( oLink ) ;
 
47
 
 
48
var bLinkEqualsName     = false ;
 
49
 
 
50
window.onload = function()
 
51
{
 
52
        // Translate the dialog box texts.
 
53
        oEditor.FCKLanguageManager.TranslatePage(document) ;
 
54
 
 
55
        // Load the selected link information (if any).
 
56
        LoadSelection() ;
 
57
 
 
58
        // Activate the "OK" button.
 
59
        window.parent.SetOkButton( true ) ;
 
60
        window.parent.SetAutoSize( true ) ;
 
61
        GetE('txtUrl').focus();
 
62
}
 
63
 
 
64
function LoadSelection()
 
65
{
 
66
        if ( !oLink ) return ;
 
67
 
 
68
        // Get the actual Link href.
 
69
        var sHRef = oLink.getAttribute( '_fcksavedurl' ) ;
 
70
        if ( sHRef == null )
 
71
                sHRef = oLink.getAttribute( 'href' , 2 ) || '' ;
 
72
 
 
73
        sHRef = FCKConfig.ProtectedSource.Revert(sHRef, 0);             //#2509
 
74
 
 
75
        if ( sHRef == oLink.innerHTML )
 
76
                bLinkEqualsName = true ;
 
77
 
 
78
        if ( sHRef.toLowerCase().StartsWith( 'rtecolon' ) )
 
79
                sHRef = ":" + sHRef.substring(8) ;
 
80
 
 
81
        GetE('txtUrl').value = sHRef ;
 
82
}
 
83
 
 
84
var searchTimer ;
 
85
 
 
86
//#### Called while the user types the URL.
 
87
function OnUrlChange()
 
88
{
 
89
        var link = GetE('txtUrl').value.Trim() ;
 
90
 
 
91
        if ( searchTimer )
 
92
                window.clearTimeout( searchTimer ) ;
 
93
 
 
94
        if ( link.StartsWith( '#' ) )
 
95
        {
 
96
                SetSearchMessage( FCKLang.wikiLnkNoSearchAnchor || 'anchor link... no search for it' ) ;
 
97
                return ;
 
98
        }
 
99
 
 
100
        if ( link.StartsWith( 'mailto:' ) )
 
101
        {
 
102
                SetSearchMessage( FCKLang.wikiLnkNoSearchMail || 'e-mail link... no search for it' ) ;
 
103
                return ;
 
104
        }
 
105
 
 
106
        if( /^\w+:\/\//.test( link ) )
 
107
        {
 
108
                SetSearchMessage( FCKLang.wikiLnkNoSearchExt || 'external link... no search for it' ) ;
 
109
                return ;
 
110
        }
 
111
 
 
112
        if ( link.length < 3  )
 
113
        {
 
114
                ClearSearch() ;
 
115
 
 
116
                if ( link.length == 0 )
 
117
                        SetSearchMessage( FCKLang.wikiLnkStartTyping || 'start typing in the above field' ) ;
 
118
                else
 
119
                        SetSearchMessage( FCKLang.wikiLnkTooShort || 'too short... type more' ) ;
 
120
                return ;
 
121
        }
 
122
 
 
123
        SetSearchMessage( FCKLang.wikiLnkStopTyping || 'stop typing to search' ) ;
 
124
        searchTimer = window.setTimeout( StartSearch, 500 ) ;
 
125
}
 
126
 
 
127
function StartSearch()
 
128
{
 
129
        var link = GetE('txtUrl').value.Trim() ;
 
130
 
 
131
        if ( link.length < 3  )
 
132
                return ;
 
133
 
 
134
        SetSearchMessage( FCKLang.wikiLnkSearching || 'searching...' ) ;
 
135
 
 
136
        // Make an Ajax search for the pages.
 
137
        oEditor.window.parent.sajax_request_type = 'GET' ;
 
138
        oEditor.window.parent.sajax_do_call( 'wfSajaxSearchArticleFCKeditor', [link], LoadSearchResults ) ;
 
139
}
 
140
 
 
141
function LoadSearchResults( result )
 
142
{
 
143
        var results = result.responseText.Trim().split( '\n' ) ;
 
144
        var select = GetE( 'xWikiResults' ) ;
 
145
 
 
146
        ClearSearch() ;
 
147
 
 
148
        if ( results.length == 0 || ( results.length == 1 && results[0].length == 0 ) )
 
149
        {
 
150
                SetSearchMessage( FCKLang.wikiLnkSearchNothing || 'no articles found' ) ;
 
151
        }
 
152
        else
 
153
        {
 
154
                if ( results.length == 1 )
 
155
                        SetSearchMessage( FCKLang.wikiLnkSearch1Found || 'one article found' ) ;
 
156
                else
 
157
                        SetSearchMessage( (FCKLang.wikiLnkSearchSeveral || '%1 articles found').replace( /%1/g, results.length ) ) ;
 
158
 
 
159
                for ( var i = 0 ; i < results.length ; i++ )
 
160
                        FCKTools.AddSelectOption( select, results[i], results[i] ) ;
 
161
        }
 
162
}
 
163
 
 
164
function ClearSearch()
 
165
{
 
166
        var select = GetE( 'xWikiResults' ) ;
 
167
 
 
168
        while ( select.options.length > 0 )
 
169
                select.remove( 0 )
 
170
}
 
171
 
 
172
function SetSearchMessage( message )
 
173
{
 
174
        GetE('xWikiSearchStatus').innerHTML = message ;
 
175
}
 
176
 
 
177
function SetUrl( url )
 
178
{
 
179
        GetE('txtUrl').value = url ;
 
180
}
 
181
 
 
182
//#### The OK button was hit.
 
183
function Ok()
 
184
{
 
185
        var sUri = GetE('txtUrl').value ;
 
186
        sUri  = FCKConfig.ProtectedSource.Protect(sUri);                //#2509
 
187
        var realUri = sUri;
 
188
        if (sUri.StartsWith( ':' ) )
 
189
                sUri = sUri.replace(/:/, "rtecolon");
 
190
        var sInnerHtml ;
 
191
 
 
192
        // If no link is selected, create a new one (it may result in more than one link creation - #220).
 
193
        var aLinks = oLink ? [ oLink ] : oEditor.FCK.CreateLink( sUri ) ;
 
194
 
 
195
        // If no selection, no links are created, so use the uri as the link text (by dom, 2006-05-26)
 
196
        var noTitle = false;
 
197
        var aHasSelection = ( aLinks.length > 0 ) ;
 
198
        if ( !aHasSelection )
 
199
        {
 
200
                sInnerHtml = realUri;
 
201
                noTitle = true;
 
202
 
 
203
                var oLinkPathRegEx = new RegExp("//?([^?\"']+)([?].*)?$") ;
 
204
                var asLinkPath = oLinkPathRegEx.exec( realUri ) ;
 
205
                if (asLinkPath != null)
 
206
                        sInnerHtml = asLinkPath[1];  // use matched path
 
207
 
 
208
                // Create a new (empty) anchor.
 
209
                aLinks = [ oEditor.FCK.InsertElement( 'a' ) ] ;
 
210
        }
 
211
 
 
212
        oEditor.FCKUndo.SaveUndoStep() ;
 
213
 
 
214
        for ( var i = 0 ; i < aLinks.length ; i++ )
 
215
        {
 
216
                oLink = aLinks[i] ;
 
217
 
 
218
                if ( aHasSelection )
 
219
                        sInnerHtml = oLink.innerHTML ;          // Save the innerHTML (IE changes it if it is like an URL).
 
220
 
 
221
                oLink.href = sUri ;
 
222
                SetAttribute( oLink, '_fcksavedurl', sUri ) ;
 
223
 
 
224
                if ( bLinkEqualsName )
 
225
                        oLink.innerHTML = realUri ;
 
226
                else
 
227
                        oLink.innerHTML = sInnerHtml ;          // Set (or restore) the innerHTML
 
228
 
 
229
                if ( noTitle )
 
230
                        SetAttribute( oLink, '_fcknotitle','true');
 
231
        }
 
232
 
 
233
        // Select the (first) link.
 
234
        oEditor.FCKSelection.SelectNode( aLinks[0] );
 
235
 
 
236
        return true ;
 
237
}
 
238
 
 
239
        </script>
 
240
</head>
 
241
<body scroll="no" style="overflow: hidden">
 
242
        <div id="divInfo">
 
243
                <div id="divLinkTypeUrl">
 
244
                        <span fcklang="wikiLnk">Link</span><br />
 
245
                        <input id="txtUrl" style="width: 100%" type="text" onkeyup="OnUrlChange();" />
 
246
                        <br />
 
247
                        <span fcklang="wikiLnkAutomatic">Automatic search results</span> (<span fcklang="wikiLnkStartTyping" id="xWikiSearchStatus">start typing in the above field</span>)<br />
 
248
                        <select id="xWikiResults" size="10" style="width: 100%; height:150px" onclick="SetUrl( this.value );">
 
249
                        </select>
 
250
                </div>
 
251
        </div>
 
252
</body>
 
253
</html>