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>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">
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">
43
// oLink: The actual selected link in the editor.
44
var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ;
46
FCK.Selection.SelectNode( oLink ) ;
48
var bLinkEqualsName = false ;
50
window.onload = function()
52
// Translate the dialog box texts.
53
oEditor.FCKLanguageManager.TranslatePage(document) ;
55
// Load the selected link information (if any).
58
// Activate the "OK" button.
59
window.parent.SetOkButton( true ) ;
60
window.parent.SetAutoSize( true ) ;
61
GetE('txtUrl').focus();
64
function LoadSelection()
66
if ( !oLink ) return ;
68
// Get the actual Link href.
69
var sHRef = oLink.getAttribute( '_fcksavedurl' ) ;
71
sHRef = oLink.getAttribute( 'href' , 2 ) || '' ;
73
sHRef = FCKConfig.ProtectedSource.Revert(sHRef, 0); //#2509
75
if ( sHRef == oLink.innerHTML )
76
bLinkEqualsName = true ;
78
if ( sHRef.toLowerCase().StartsWith( 'rtecolon' ) )
79
sHRef = ":" + sHRef.substring(8) ;
81
GetE('txtUrl').value = sHRef ;
86
//#### Called while the user types the URL.
87
function OnUrlChange()
89
var link = GetE('txtUrl').value.Trim() ;
92
window.clearTimeout( searchTimer ) ;
94
if ( link.StartsWith( '#' ) )
96
SetSearchMessage( FCKLang.wikiLnkNoSearchAnchor || 'anchor link... no search for it' ) ;
100
if ( link.StartsWith( 'mailto:' ) )
102
SetSearchMessage( FCKLang.wikiLnkNoSearchMail || 'e-mail link... no search for it' ) ;
106
if( /^\w+:\/\//.test( link ) )
108
SetSearchMessage( FCKLang.wikiLnkNoSearchExt || 'external link... no search for it' ) ;
112
if ( link.length < 3 )
116
if ( link.length == 0 )
117
SetSearchMessage( FCKLang.wikiLnkStartTyping || 'start typing in the above field' ) ;
119
SetSearchMessage( FCKLang.wikiLnkTooShort || 'too short... type more' ) ;
123
SetSearchMessage( FCKLang.wikiLnkStopTyping || 'stop typing to search' ) ;
124
searchTimer = window.setTimeout( StartSearch, 500 ) ;
127
function StartSearch()
129
var link = GetE('txtUrl').value.Trim() ;
131
if ( link.length < 3 )
134
SetSearchMessage( FCKLang.wikiLnkSearching || 'searching...' ) ;
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 ) ;
141
function LoadSearchResults( result )
143
var results = result.responseText.Trim().split( '\n' ) ;
144
var select = GetE( 'xWikiResults' ) ;
148
if ( results.length == 0 || ( results.length == 1 && results[0].length == 0 ) )
150
SetSearchMessage( FCKLang.wikiLnkSearchNothing || 'no articles found' ) ;
154
if ( results.length == 1 )
155
SetSearchMessage( FCKLang.wikiLnkSearch1Found || 'one article found' ) ;
157
SetSearchMessage( (FCKLang.wikiLnkSearchSeveral || '%1 articles found').replace( /%1/g, results.length ) ) ;
159
for ( var i = 0 ; i < results.length ; i++ )
160
FCKTools.AddSelectOption( select, results[i], results[i] ) ;
164
function ClearSearch()
166
var select = GetE( 'xWikiResults' ) ;
168
while ( select.options.length > 0 )
172
function SetSearchMessage( message )
174
GetE('xWikiSearchStatus').innerHTML = message ;
177
function SetUrl( url )
179
GetE('txtUrl').value = url ;
182
//#### The OK button was hit.
185
var sUri = GetE('txtUrl').value ;
186
sUri = FCKConfig.ProtectedSource.Protect(sUri); //#2509
188
if (sUri.StartsWith( ':' ) )
189
sUri = sUri.replace(/:/, "rtecolon");
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 ) ;
195
// If no selection, no links are created, so use the uri as the link text (by dom, 2006-05-26)
197
var aHasSelection = ( aLinks.length > 0 ) ;
198
if ( !aHasSelection )
200
sInnerHtml = realUri;
203
var oLinkPathRegEx = new RegExp("//?([^?\"']+)([?].*)?$") ;
204
var asLinkPath = oLinkPathRegEx.exec( realUri ) ;
205
if (asLinkPath != null)
206
sInnerHtml = asLinkPath[1]; // use matched path
208
// Create a new (empty) anchor.
209
aLinks = [ oEditor.FCK.InsertElement( 'a' ) ] ;
212
oEditor.FCKUndo.SaveUndoStep() ;
214
for ( var i = 0 ; i < aLinks.length ; i++ )
219
sInnerHtml = oLink.innerHTML ; // Save the innerHTML (IE changes it if it is like an URL).
222
SetAttribute( oLink, '_fcksavedurl', sUri ) ;
224
if ( bLinkEqualsName )
225
oLink.innerHTML = realUri ;
227
oLink.innerHTML = sInnerHtml ; // Set (or restore) the innerHTML
230
SetAttribute( oLink, '_fcknotitle','true');
233
// Select the (first) link.
234
oEditor.FCKSelection.SelectNode( aLinks[0] );
241
<body scroll="no" style="overflow: hidden">
243
<div id="divLinkTypeUrl">
244
<span fcklang="wikiLnk">Link</span><br />
245
<input id="txtUrl" style="width: 100%" type="text" onkeyup="OnUrlChange();" />
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 );">