Index: trunk/admin/editor/cmseditor/editor/dialog/fck_link/fck_link.js =================================================================== diff -u -N -r4175 -r6797 --- trunk/admin/editor/cmseditor/editor/dialog/fck_link/fck_link.js (.../fck_link.js) (revision 4175) +++ trunk/admin/editor/cmseditor/editor/dialog/fck_link/fck_link.js (.../fck_link.js) (revision 6797) @@ -1,19 +1,19 @@ /* * FCKeditor - The text editor for internet * Copyright (C) 2003-2004 Frederico Caldeira Knabben - * + * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php - * + * * For further information visit: * http://www.fckeditor.net/ - * + * * File Name: fck_link.js * Scripts related to the Link dialog window (see fck_link.html). - * + * * Version: 2.0 RC3 * Modified: 2005-02-09 13:53:13 - * + * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ @@ -124,7 +124,7 @@ if ( oLink ) { FCK.Selection.MoveToNode( oLink ) ; - //show_props(oLink.attributes, 'LINK: ') + //show_props(oLink.attributes, 'LINK: ') } function OnDialogTabChange( tabCode ) @@ -171,11 +171,11 @@ function InternalLinksEsists() { - if (typeof(oEditor.FCKConfig.InternalLinksEsists) != 'undefined') + if (typeof(oEditor.FCKConfig.InternalLinksEsists) != 'undefined') { - if (oEditor.FCKConfig.InternalLinksEsists != 'Off') + if (oEditor.FCKConfig.InternalLinksEsists != 'Off') return true; - } else + } else return true; } @@ -191,8 +191,8 @@ bHasAnchors = ( aAnchors.length > 0) ; if (GetE('cmbAnchorName').options.length > 0) { GetE('cmbAnchorName').options.length = 0; - } - + } + oEditor.FCKTools.AddSelectOption( document, GetE('cmbAnchorName'), '', '' ) ; for ( var i = 0 ; i < aAnchors.length ; i++ ) { @@ -206,13 +206,13 @@ else bHasAnchors = false ; ShowE( 'divSelAnchor' , bHasAnchors ) ; ShowE( 'divNoAnchor' , !bHasAnchors ) ; - for ( var i = 0 ; i < GetE('cmbAnchorName').length ; i++ ) + for ( var i = 0 ; i < GetE('cmbAnchorName').length ; i++ ) { if (anchor_ == GetE('cmbAnchorName').options[i].value) GetE('cmbAnchorName').options[i].selected=1; } - } + } } function LoadSelection() @@ -230,11 +230,11 @@ } else if ( !oLink ) { if (InternalLinksEsists() === true) SetLinkType('internal'); - else + else SetLinkType('external'); return ; } - if (sHRef.length == 0) + if (sHRef.length == 0) { // Get the actual Link href. var sHRef = oLink.getAttribute('href',2) + '' ; @@ -264,7 +264,7 @@ // Remove the protocol and get the remainig URL. var sUrl = sHRef.replace( oRegex.UriProtocol, '' ) ; - + if ( sProtocol == 'mailto:' ) // It is an e-mail link. { sType = 'email' ; @@ -281,7 +281,7 @@ GetE('cmbLinkProtocol').value = '' ; GetE('txtUrl').value = sHRef ; } - + if (oLink) { //if (!window.location.search) if (sType.length == 0) @@ -293,30 +293,30 @@ if (sType == 'Doc' && sHRef.length > 2) { GetE('fileUrl').value = sHRef ; } - - + + if (sType == 'internal' && sHRef.length > 2 && sHRef.indexOf('#') > 0) { anchor_ = sHRef.slice(sHRef.lastIndexOf('#')+1); sHRef = sHRef.slice(0,sHRef.lastIndexOf('#')); GetE('txtUrl').value = sHRef ; } - + if ( !oPopupMatch ) { // Get the target. if (oLink) var sTarget = oLink.target; else if (window.parent.parentData['linkCmbTarget']) var sTarget = window.parent.parentData['linkCmbTarget']; - + if ( sTarget && sTarget.length > 0 ) { if ( oRegex.ReserveTarget.test( sTarget ) ) { sTarget = sTarget.toLowerCase() ; GetE('cmbTarget').value = sTarget ; } - else + else GetE('cmbTarget').value = '' ; } } @@ -344,18 +344,18 @@ ShowE('divLinkTypeExternal' , (linkType == 'external') ) ; ShowE('divLinkTypeEMail' , (linkType == 'email') ) ; ShowE('divLinkTypeFile' , (linkType == 'Doc') ) ; - + if(GetE('cmbTarget')) { if (GetE('cmbTarget').value == 'popup' ) { ShowE('divPopupSize',1); - } else + } else ShowE('divPopupSize',0); - } else + } else ShowE('divPopupSize',0); - + if ( linkType == 'internal' ) LoadResources(); - + if ( linkType == 'email') window.parent.SetAutoSize( true ) ; } @@ -370,9 +370,9 @@ function GetCmsTreeCallBack( fckXml ) { - //alert(show_props(fckXml, 'oNodes')); +// alert(show_props(fckXml, 'oNodes')); var oNodes = fckXml.SelectNodes( 'Connector/CmsPages/CmsPage' ) ; - + for ( var i = 0 ; i < oNodes.length ; i++ ) { var sCmsPage = oNodes[i].attributes.getNamedItem('path').value ; @@ -384,8 +384,8 @@ GetE('cmbImternalPagName').options[i] = new Option(sTitle, SetIDtag(sCmsId)); } else - GetE('cmbImternalPagName').options[i] = new Option(sTitle, sCmsPage); - + GetE('cmbImternalPagName').options[i] = new Option(sTitle, sCmsPage); + if (GetE('txtUrl')) { tmpUrl = GetE('txtUrl').value; if (tmpUrl.length == 0 && i == 0) { @@ -406,17 +406,17 @@ window.frames["frmInternal"].document.location.href = tmpUrl+GetAdmin(); } } - } + } } } function LinkTypeID() { - if (typeof(oEditor.FCKConfig.LocalLinkType) != 'undefined') + if (typeof(oEditor.FCKConfig.LocalLinkType) != 'undefined') { - if (oEditor.FCKConfig.LocalLinkType == 'ID') + if (oEditor.FCKConfig.LocalLinkType == 'ID') return true; - } + } return false; } @@ -441,16 +441,20 @@ function ChangeInternalUrl(url,obj) { +// alert('ChangeInternalUrl '+ServerPath + url+GetAdmin()); if(LinkTypeID()) { +// alert('by Link ID') for (var i=0; i < obj.options.length; i++) { if (obj.options[i].value == url) { url=links_path[i]; window.frames["frmInternal"].document.location.href = ServerPath + url + GetAdmin(); return; - } + } } - } else + } else { +// alert('no link ID'); window.frames["frmInternal"].document.location.href = ServerPath + url+GetAdmin(); + } } function EncodeHrefTag(text) @@ -462,7 +466,7 @@ text = text.replace(/</g, "<"); text = text.replace(/&gt;/g, ">"); text = text.replace(/>/g, ">"); - text = text.replace(/%27/g, "\'") ; + text = text.replace(/%27/g, "\'") ; text = text.replace(/%3C/g, "<") ; text = text.replace(/%3E/g, ">") ; text = text.replace(/%&39/g, "\"") ; @@ -475,14 +479,25 @@ function GetAdmin() -{ - if (oEditor.FCKConfig.Admin != 'undefined') { +{ + if (typeof(oEditor.FCKConfig.K4) && oEditor.FCKConfig.K4 ) { + return '?admin=1'; + } + if (typeof(oEditor.FCKConfig.Admin) != 'undefined' && oEditor.FCKConfig.Admin == 1) { add_admin = '&admin=1&cmseditor=1'; - if (oEditor.FCKConfig.AdminSid != 'undefined') + if (typeof(oEditor.FCKConfig.AdminSid) != 'undefined') { add_admin+='&sid='+oEditor.FCKConfig.AdminSid; - if (oEditor.FCKConfig.Admin == 1) return add_admin; - else return ''; - } else return ''; + } + if (oEditor.FCKConfig.Admin == 1) { + return add_admin; + } + else { + return ''; + } + } + else { + return ''; + } } @@ -512,15 +527,15 @@ break ; } - if ( targetType == 'popup' ) + if ( targetType == 'popup' ) { ShowE('divPopupSize',1); window.parent.SetAutoSize( true ) ; if (!GetE('txtPopupWidth').value) GetE('txtPopupWidth').value = 800; if (!GetE('txtPopupHeight').value) GetE('txtPopupHeight').value = 600; - } else + } else ShowE('divPopupSize',0); } @@ -561,18 +576,18 @@ { switch ( GetE('cmbLinkType').value ) { - + case 'internal' : if (LinkTypeID()) sUri = GetE('cmbImternalPagName').value else - sUri = ServerPath+GetE('cmbImternalPagName').value; + sUri = ServerPath+GetE('cmbImternalPagName').value; //sUri = GetE('cmbLinkProtocol').value + sUri ; //alert(sUri); var cmbAnchorName = GetE('cmbAnchorName').value if (cmbAnchorName.length > 0) - sUri = sUri+'#'+cmbAnchorName - + sUri = sUri+'#'+cmbAnchorName + if( GetE('cmbTarget').value == 'popup' ) sUri = BuildPopupUri( sUri ) ; break ; @@ -609,7 +624,7 @@ break ; - + case 'email' : sUri = GetE('txtEMailAddress').value ; @@ -633,16 +648,16 @@ var sUri = BuildUrlByType(); if (sUri == false) return false; - + if (window.location.search.substr(1) == 'from') { updateDataArray(); window.location.href='dialog/fck_image.html?create'; return ; } - - if ( oLink ) + + if ( oLink ) oLink.href = sUri ; - else + else { oLink = oEditor.FCK.CreateLink( sUri ) ; if ( ! oLink )