From: Thyamad c. <th...@us...> - 2005-09-29 19:50:12
|
Update of /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/dialog/fck_link In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv563/thywidgets/external/fckeditor/editor/dialog/fck_link Modified Files: fck_link.js Log Message: Commiting file additions and modification from SVN revision 2028 to 2029... Changes made by frank on 2005-09-29 21:42:57 +0200 (Thu, 29 Sep 2005) corresponding to SVN revision 2029 with message: updating fckeditor in dynapi Index: fck_link.js =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/dialog/fck_link/fck_link.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fck_link.js 1 Sep 2005 18:15:42 -0000 1.1 --- fck_link.js 29 Sep 2005 19:49:18 -0000 1.2 *************** *** 1,5 **** ! /* * FCKeditor - The text editor for internet ! * Copyright (C) 2003-2004 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: --- 1,5 ---- ! /* * FCKeditor - The text editor for internet ! * Copyright (C) 2003-2005 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: *************** *** 12,25 **** * 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 (fr...@fc...) ! */ ! var oEditor = window.parent.InnerDialogLoaded() ; ! var FCK = oEditor.FCK ; ! var FCKLang = oEditor.FCKLang ; //#### Dialog Tabs --- 12,23 ---- * Scripts related to the Link dialog window (see fck_link.html). * * File Authors: ! * Frederico Caldeira Knabben (fr...@fc...) ! */ ! var oEditor = window.parent.InnerDialogLoaded() ; ! var FCK = oEditor.FCK ; ! var FCKLang = oEditor.FCKLang ; ! var FCKConfig = oEditor.FCKConfig ; //#### Dialog Tabs *************** *** 27,34 **** // Set the dialog tabs. window.parent.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ; ! window.parent.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ; ! // TODO : Enable File Upload (1/3). ! //window.parent.AddTab( 'Upload', 'Upload', true ) ; ! window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. --- 25,37 ---- // Set the dialog tabs. window.parent.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ; ! ! if ( !FCKConfig.LinkDlgHideTarget ) ! window.parent.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ; ! ! if ( FCKConfig.LinkUpload ) ! window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ; ! ! if ( !FCKConfig.LinkDlgHideAdvanced ) ! window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. *************** *** 37,42 **** ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divTarget' , ( tabCode == 'Target' ) ) ; ! // TODO : Enable File Upload (2/3). ! // ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAttribs' , ( tabCode == 'Advanced' ) ) ; } --- 40,44 ---- ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divTarget' , ( tabCode == 'Target' ) ) ; ! ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAttribs' , ( tabCode == 'Advanced' ) ) ; } *************** *** 118,122 **** var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; if ( oLink ) ! FCK.Selection.MoveToNode( oLink ) ; window.onload = function() --- 120,124 ---- var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; if ( oLink ) ! FCK.Selection.SelectNode( oLink ) ; window.onload = function() *************** *** 135,143 **** // Show/Hide the "Browse Server" button. ! GetE('divBrowseServer').style.display = oEditor.FCKConfig.LinkBrowser ? '' : 'none' ; // Show the initial dialog content. GetE('divInfo').style.display = '' ; // Activate the "OK" button. window.parent.SetOkButton( true ) ; --- 137,149 ---- // Show/Hide the "Browse Server" button. ! GetE('divBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; // Show the initial dialog content. GetE('divInfo').style.display = '' ; + // Set the actual uploader URL. + if ( FCKConfig.LinkUpload ) + GetE('frmUpload').action = FCKConfig.LinkUploadURL ; + // Activate the "OK" button. window.parent.SetOkButton( true ) ; *************** *** 282,289 **** ShowE('divLinkTypeEMail' , (linkType == 'email') ) ; ! window.parent.SetTabVisibility( 'Target' , (linkType == 'url') ) ; ! // TODO : Enable File Upload (3/3). ! // window.parent.SetTabVisibility( 'Upload' , (linkType == 'url') ) ; ! window.parent.SetTabVisibility( 'Advanced' , (linkType != 'anchor' || bHasAnchors) ) ; if ( linkType == 'email' ) --- 288,299 ---- ShowE('divLinkTypeEMail' , (linkType == 'email') ) ; ! if ( !FCKConfig.LinkDlgHideTarget ) ! window.parent.SetTabVisibility( 'Target' , (linkType == 'url') ) ; ! ! if ( FCKConfig.LinkUpload ) ! window.parent.SetTabVisibility( 'Upload' , (linkType == 'url') ) ; ! ! if ( !FCKConfig.LinkDlgHideAdvanced ) ! window.parent.SetTabVisibility( 'Advanced' , (linkType != 'anchor' || bHasAnchors) ) ; if ( linkType == 'email' ) *************** *** 453,457 **** --- 463,470 ---- if ( oLink ) // Modifying an existent link. + { + oEditor.FCKUndo.SaveUndoStep() ; oLink.href = sUri ; + } else // Creating a new link. { *************** *** 490,495 **** { // Set the browser window feature. ! var iWidth = oEditor.FCKConfig.LinkBrowserWindowWidth ; ! var iHeight = oEditor.FCKConfig.LinkBrowserWindowHeight ; var iLeft = (screen.width - iWidth) / 2 ; --- 503,508 ---- { // Set the browser window feature. ! var iWidth = FCKConfig.LinkBrowserWindowWidth ; ! var iHeight = FCKConfig.LinkBrowserWindowHeight ; var iLeft = (screen.width - iWidth) / 2 ; *************** *** 503,507 **** // Open the browser window. ! var oWindow = window.open( oEditor.FCKConfig.LinkBrowserURL, "FCKBrowseWindow", sOptions ) ; } --- 516,520 ---- // Open the browser window. ! var oWindow = window.open( FCKConfig.LinkBrowserURL, "FCKBrowseWindow", sOptions ) ; } *************** *** 510,512 **** --- 523,580 ---- document.getElementById('txtUrl').value = url ; OnUrlChange() ; + window.parent.SetSelectedTab( 'Info' ) ; + } + + function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) + { + switch ( errorNumber ) + { + case 0 : // No errors + alert( 'Your file has been successfully uploaded' ) ; + break ; + case 1 : // Custom error + alert( customMsg ) ; + return ; + case 101 : // Custom warning + alert( customMsg ) ; + break ; + case 201 : + alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; + break ; + case 202 : + alert( 'Invalid file type' ) ; + return ; + case 203 : + alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; + return ; + default : + alert( 'Error on file upload. Error number: ' + errorNumber ) ; + return ; + } + + SetUrl( fileUrl ) ; + GetE('frmUpload').reset() ; + } + + var oUploadAllowedExtRegex = new RegExp( FCKConfig.LinkUploadAllowedExtensions, 'i' ) ; + var oUploadDeniedExtRegex = new RegExp( FCKConfig.LinkUploadDeniedExtensions, 'i' ) ; + + function CheckUpload() + { + var sFile = GetE('txtUploadFile').value ; + + if ( sFile.length == 0 ) + { + alert( 'Please select a file to upload' ) ; + return false ; + } + + if ( ( FCKConfig.LinkUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || + ( FCKConfig.LinkUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) + { + OnUploadCompleted( 202 ) ; + return false ; + } + + return true ; } \ No newline at end of file |