[1349] | 1 | /* |
---|
| 2 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net |
---|
| 3 | * Copyright (C) 2003-2007 Frederico Caldeira Knabben |
---|
| 4 | * |
---|
| 5 | * == BEGIN LICENSE == |
---|
| 6 | * |
---|
| 7 | * Licensed under the terms of any of the following licenses at your |
---|
| 8 | * choice: |
---|
| 9 | * |
---|
| 10 | * - GNU General Public License Version 2 or later (the "GPL") |
---|
| 11 | * http://www.gnu.org/licenses/gpl.html |
---|
| 12 | * |
---|
| 13 | * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
---|
| 14 | * http://www.gnu.org/licenses/lgpl.html |
---|
| 15 | * |
---|
| 16 | * - Mozilla Public License Version 1.1 or later (the "MPL") |
---|
| 17 | * http://www.mozilla.org/MPL/MPL-1.1.html |
---|
| 18 | * |
---|
| 19 | * == END LICENSE == |
---|
| 20 | * |
---|
| 21 | * Scripts related to the Image dialog window (see fck_image.html). |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | var oEditor = window.parent.InnerDialogLoaded() ; |
---|
| 25 | var FCK = oEditor.FCK ; |
---|
| 26 | var FCKLang = oEditor.FCKLang ; |
---|
| 27 | var FCKConfig = oEditor.FCKConfig ; |
---|
| 28 | var FCKDebug = oEditor.FCKDebug ; |
---|
| 29 | |
---|
| 30 | var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ; |
---|
| 31 | |
---|
| 32 | //#### Dialog Tabs |
---|
| 33 | |
---|
| 34 | // Set the dialog tabs. |
---|
| 35 | window.parent.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ; |
---|
| 36 | |
---|
| 37 | if ( !bImageButton && !FCKConfig.ImageDlgHideLink ) |
---|
| 38 | window.parent.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ; |
---|
| 39 | |
---|
| 40 | if ( FCKConfig.ImageUpload ) |
---|
| 41 | window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; |
---|
| 42 | |
---|
| 43 | if ( !FCKConfig.ImageDlgHideAdvanced ) |
---|
| 44 | window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; |
---|
| 45 | |
---|
| 46 | // Function called when a dialog tag is selected. |
---|
| 47 | function OnDialogTabChange( tabCode ) |
---|
| 48 | { |
---|
| 49 | ShowE('divInfo' , ( tabCode == 'Info' ) ) ; |
---|
| 50 | ShowE('divLink' , ( tabCode == 'Link' ) ) ; |
---|
| 51 | ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; |
---|
| 52 | ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | // Get the selected image (if available). |
---|
| 56 | var oImage = FCK.Selection.GetSelectedElement() ; |
---|
| 57 | |
---|
| 58 | if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) ) |
---|
| 59 | oImage = null ; |
---|
| 60 | |
---|
| 61 | // Get the active link. |
---|
| 62 | var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; |
---|
| 63 | |
---|
| 64 | var oImageOriginal ; |
---|
| 65 | |
---|
| 66 | function UpdateOriginal( resetSize ) |
---|
| 67 | { |
---|
| 68 | if ( !eImgPreview ) |
---|
| 69 | return ; |
---|
| 70 | |
---|
| 71 | if ( GetE('txtUrl').value.length == 0 ) |
---|
| 72 | { |
---|
| 73 | oImageOriginal = null ; |
---|
| 74 | return ; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | oImageOriginal = document.createElement( 'IMG' ) ; // new Image() ; |
---|
| 78 | |
---|
| 79 | if ( resetSize ) |
---|
| 80 | { |
---|
| 81 | oImageOriginal.onload = function() |
---|
| 82 | { |
---|
| 83 | this.onload = null ; |
---|
| 84 | ResetSizes() ; |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | oImageOriginal.src = eImgPreview.src ; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | var bPreviewInitialized ; |
---|
| 92 | |
---|
| 93 | window.onload = function() |
---|
| 94 | { |
---|
| 95 | // Translate the dialog box texts. |
---|
| 96 | oEditor.FCKLanguageManager.TranslatePage(document) ; |
---|
| 97 | |
---|
| 98 | GetE('btnLockSizes').title = FCKLang.DlgImgLockRatio ; |
---|
| 99 | GetE('btnResetSize').title = FCKLang.DlgBtnResetSize ; |
---|
| 100 | |
---|
| 101 | // Load the selected element information (if any). |
---|
| 102 | LoadSelection() ; |
---|
| 103 | |
---|
| 104 | // Show/Hide the "Browse Server" button. |
---|
| 105 | GetE('tdBrowse').style.display = FCKConfig.ImageBrowser ? '' : 'none' ; |
---|
| 106 | GetE('divLnkBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; |
---|
| 107 | |
---|
| 108 | UpdateOriginal() ; |
---|
| 109 | |
---|
| 110 | // Set the actual uploader URL. |
---|
| 111 | if ( FCKConfig.ImageUpload ) |
---|
| 112 | GetE('frmUpload').action = FCKConfig.ImageUploadURL ; |
---|
| 113 | |
---|
| 114 | window.parent.SetAutoSize( true ) ; |
---|
| 115 | |
---|
| 116 | // Activate the "OK" button. |
---|
| 117 | window.parent.SetOkButton( true ) ; |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | function LoadSelection() |
---|
| 121 | { |
---|
| 122 | if ( ! oImage ) return ; |
---|
| 123 | |
---|
| 124 | var sUrl = oImage.getAttribute( '_fcksavedurl' ) ; |
---|
| 125 | if ( sUrl == null ) |
---|
| 126 | sUrl = GetAttribute( oImage, 'src', '' ) ; |
---|
| 127 | |
---|
| 128 | GetE('txtUrl').value = sUrl ; |
---|
| 129 | GetE('txtAlt').value = GetAttribute( oImage, 'alt', '' ) ; |
---|
| 130 | GetE('txtVSpace').value = GetAttribute( oImage, 'vspace', '' ) ; |
---|
| 131 | GetE('txtHSpace').value = GetAttribute( oImage, 'hspace', '' ) ; |
---|
| 132 | GetE('txtBorder').value = GetAttribute( oImage, 'border', '' ) ; |
---|
| 133 | GetE('cmbAlign').value = GetAttribute( oImage, 'align', '' ) ; |
---|
| 134 | |
---|
| 135 | var iWidth, iHeight ; |
---|
| 136 | |
---|
| 137 | var regexSize = /^\s*(\d+)px\s*$/i ; |
---|
| 138 | |
---|
| 139 | if ( oImage.style.width ) |
---|
| 140 | { |
---|
| 141 | var aMatchW = oImage.style.width.match( regexSize ) ; |
---|
| 142 | if ( aMatchW ) |
---|
| 143 | { |
---|
| 144 | iWidth = aMatchW[1] ; |
---|
| 145 | oImage.style.width = '' ; |
---|
| 146 | } |
---|
| 147 | } |
---|
| 148 | |
---|
| 149 | if ( oImage.style.height ) |
---|
| 150 | { |
---|
| 151 | var aMatchH = oImage.style.height.match( regexSize ) ; |
---|
| 152 | if ( aMatchH ) |
---|
| 153 | { |
---|
| 154 | iHeight = aMatchH[1] ; |
---|
| 155 | oImage.style.height = '' ; |
---|
| 156 | } |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | GetE('txtWidth').value = iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ; |
---|
| 160 | GetE('txtHeight').value = iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ; |
---|
| 161 | |
---|
| 162 | // Get Advances Attributes |
---|
| 163 | GetE('txtAttId').value = oImage.id ; |
---|
| 164 | GetE('cmbAttLangDir').value = oImage.dir ; |
---|
| 165 | GetE('txtAttLangCode').value = oImage.lang ; |
---|
| 166 | GetE('txtAttTitle').value = oImage.title ; |
---|
| 167 | GetE('txtLongDesc').value = oImage.longDesc ; |
---|
| 168 | |
---|
| 169 | if ( oEditor.FCKBrowserInfo.IsIE ) |
---|
| 170 | { |
---|
| 171 | GetE('txtAttClasses').value = oImage.getAttribute('className') || '' ; |
---|
| 172 | GetE('txtAttStyle').value = oImage.style.cssText ; |
---|
| 173 | } |
---|
| 174 | else |
---|
| 175 | { |
---|
| 176 | GetE('txtAttClasses').value = oImage.getAttribute('class',2) || '' ; |
---|
| 177 | GetE('txtAttStyle').value = oImage.getAttribute('style',2) ; |
---|
| 178 | } |
---|
| 179 | |
---|
| 180 | if ( oLink ) |
---|
| 181 | { |
---|
| 182 | var sLinkUrl = oLink.getAttribute( '_fcksavedurl' ) ; |
---|
| 183 | if ( sLinkUrl == null ) |
---|
| 184 | sLinkUrl = oLink.getAttribute('href',2) ; |
---|
| 185 | |
---|
| 186 | GetE('txtLnkUrl').value = sLinkUrl ; |
---|
| 187 | GetE('cmbLnkTarget').value = oLink.target ; |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | UpdatePreview() ; |
---|
| 191 | } |
---|
| 192 | |
---|
| 193 | //#### The OK button was hit. |
---|
| 194 | function Ok() |
---|
| 195 | { |
---|
| 196 | if ( GetE('txtUrl').value.length == 0 ) |
---|
| 197 | { |
---|
| 198 | window.parent.SetSelectedTab( 'Info' ) ; |
---|
| 199 | GetE('txtUrl').focus() ; |
---|
| 200 | |
---|
| 201 | alert( FCKLang.DlgImgAlertUrl ) ; |
---|
| 202 | |
---|
| 203 | return false ; |
---|
| 204 | } |
---|
| 205 | |
---|
| 206 | var bHasImage = ( oImage != null ) ; |
---|
| 207 | |
---|
| 208 | if ( bHasImage && bImageButton && oImage.tagName == 'IMG' ) |
---|
| 209 | { |
---|
| 210 | if ( confirm( 'Do you want to transform the selected image on a image button?' ) ) |
---|
| 211 | oImage = null ; |
---|
| 212 | } |
---|
| 213 | else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' ) |
---|
| 214 | { |
---|
| 215 | if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) ) |
---|
| 216 | oImage = null ; |
---|
| 217 | } |
---|
| 218 | |
---|
| 219 | if ( !bHasImage ) |
---|
| 220 | { |
---|
| 221 | if ( bImageButton ) |
---|
| 222 | { |
---|
| 223 | oImage = FCK.EditorDocument.createElement( 'INPUT' ) ; |
---|
| 224 | oImage.type = 'image' ; |
---|
| 225 | oImage = FCK.InsertElementAndGetIt( oImage ) ; |
---|
| 226 | } |
---|
| 227 | else |
---|
| 228 | oImage = FCK.CreateElement( 'IMG' ) ; |
---|
| 229 | } |
---|
| 230 | else |
---|
| 231 | oEditor.FCKUndo.SaveUndoStep() ; |
---|
| 232 | |
---|
| 233 | UpdateImage( oImage ) ; |
---|
| 234 | |
---|
| 235 | var sLnkUrl = GetE('txtLnkUrl').value.Trim() ; |
---|
| 236 | |
---|
| 237 | if ( sLnkUrl.length == 0 ) |
---|
| 238 | { |
---|
| 239 | if ( oLink ) |
---|
| 240 | FCK.ExecuteNamedCommand( 'Unlink' ) ; |
---|
| 241 | } |
---|
| 242 | else |
---|
| 243 | { |
---|
| 244 | if ( oLink ) // Modifying an existent link. |
---|
| 245 | oLink.href = sLnkUrl ; |
---|
| 246 | else // Creating a new link. |
---|
| 247 | { |
---|
| 248 | if ( !bHasImage ) |
---|
| 249 | oEditor.FCKSelection.SelectNode( oImage ) ; |
---|
| 250 | |
---|
| 251 | oLink = oEditor.FCK.CreateLink( sLnkUrl ) ; |
---|
| 252 | |
---|
| 253 | if ( !bHasImage ) |
---|
| 254 | { |
---|
| 255 | oEditor.FCKSelection.SelectNode( oLink ) ; |
---|
| 256 | oEditor.FCKSelection.Collapse( false ) ; |
---|
| 257 | } |
---|
| 258 | } |
---|
| 259 | |
---|
| 260 | SetAttribute( oLink, '_fcksavedurl', sLnkUrl ) ; |
---|
| 261 | SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ; |
---|
| 262 | } |
---|
| 263 | |
---|
| 264 | return true ; |
---|
| 265 | } |
---|
| 266 | |
---|
| 267 | function UpdateImage( e, skipId ) |
---|
| 268 | { |
---|
| 269 | e.src = GetE('txtUrl').value ; |
---|
| 270 | SetAttribute( e, "_fcksavedurl", GetE('txtUrl').value ) ; |
---|
| 271 | SetAttribute( e, "alt" , GetE('txtAlt').value ) ; |
---|
| 272 | SetAttribute( e, "width" , GetE('txtWidth').value ) ; |
---|
| 273 | SetAttribute( e, "height", GetE('txtHeight').value ) ; |
---|
| 274 | SetAttribute( e, "vspace", GetE('txtVSpace').value ) ; |
---|
| 275 | SetAttribute( e, "hspace", GetE('txtHSpace').value ) ; |
---|
| 276 | SetAttribute( e, "border", GetE('txtBorder').value ) ; |
---|
| 277 | SetAttribute( e, "align" , GetE('cmbAlign').value ) ; |
---|
| 278 | |
---|
| 279 | // Advances Attributes |
---|
| 280 | |
---|
| 281 | if ( ! skipId ) |
---|
| 282 | SetAttribute( e, 'id', GetE('txtAttId').value ) ; |
---|
| 283 | |
---|
| 284 | SetAttribute( e, 'dir' , GetE('cmbAttLangDir').value ) ; |
---|
| 285 | SetAttribute( e, 'lang' , GetE('txtAttLangCode').value ) ; |
---|
| 286 | SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; |
---|
| 287 | SetAttribute( e, 'class' , GetE('txtAttClasses').value ) ; |
---|
| 288 | SetAttribute( e, 'longDesc' , GetE('txtLongDesc').value ) ; |
---|
| 289 | |
---|
| 290 | if ( oEditor.FCKBrowserInfo.IsIE ) |
---|
| 291 | e.style.cssText = GetE('txtAttStyle').value ; |
---|
| 292 | else |
---|
| 293 | SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; |
---|
| 294 | } |
---|
| 295 | |
---|
| 296 | var eImgPreview ; |
---|
| 297 | var eImgPreviewLink ; |
---|
| 298 | |
---|
| 299 | function SetPreviewElements( imageElement, linkElement ) |
---|
| 300 | { |
---|
| 301 | eImgPreview = imageElement ; |
---|
| 302 | eImgPreviewLink = linkElement ; |
---|
| 303 | |
---|
| 304 | UpdatePreview() ; |
---|
| 305 | UpdateOriginal() ; |
---|
| 306 | |
---|
| 307 | bPreviewInitialized = true ; |
---|
| 308 | } |
---|
| 309 | |
---|
| 310 | function UpdatePreview() |
---|
| 311 | { |
---|
| 312 | if ( !eImgPreview || !eImgPreviewLink ) |
---|
| 313 | return ; |
---|
| 314 | |
---|
| 315 | if ( GetE('txtUrl').value.length == 0 ) |
---|
| 316 | eImgPreviewLink.style.display = 'none' ; |
---|
| 317 | else |
---|
| 318 | { |
---|
| 319 | UpdateImage( eImgPreview, true ) ; |
---|
| 320 | |
---|
| 321 | if ( GetE('txtLnkUrl').value.Trim().length > 0 ) |
---|
| 322 | eImgPreviewLink.href = 'javascript:void(null);' ; |
---|
| 323 | else |
---|
| 324 | SetAttribute( eImgPreviewLink, 'href', '' ) ; |
---|
| 325 | |
---|
| 326 | eImgPreviewLink.style.display = '' ; |
---|
| 327 | } |
---|
| 328 | } |
---|
| 329 | |
---|
| 330 | var bLockRatio = true ; |
---|
| 331 | |
---|
| 332 | function SwitchLock( lockButton ) |
---|
| 333 | { |
---|
| 334 | bLockRatio = !bLockRatio ; |
---|
| 335 | lockButton.className = bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ; |
---|
| 336 | lockButton.title = bLockRatio ? 'Lock sizes' : 'Unlock sizes' ; |
---|
| 337 | |
---|
| 338 | if ( bLockRatio ) |
---|
| 339 | { |
---|
| 340 | if ( GetE('txtWidth').value.length > 0 ) |
---|
| 341 | OnSizeChanged( 'Width', GetE('txtWidth').value ) ; |
---|
| 342 | else |
---|
| 343 | OnSizeChanged( 'Height', GetE('txtHeight').value ) ; |
---|
| 344 | } |
---|
| 345 | } |
---|
| 346 | |
---|
| 347 | // Fired when the width or height input texts change |
---|
| 348 | function OnSizeChanged( dimension, value ) |
---|
| 349 | { |
---|
| 350 | // Verifies if the aspect ration has to be mantained |
---|
| 351 | if ( oImageOriginal && bLockRatio ) |
---|
| 352 | { |
---|
| 353 | var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ; |
---|
| 354 | |
---|
| 355 | if ( value.length == 0 || isNaN( value ) ) |
---|
| 356 | { |
---|
| 357 | e.value = '' ; |
---|
| 358 | return ; |
---|
| 359 | } |
---|
| 360 | |
---|
| 361 | if ( dimension == 'Width' ) |
---|
| 362 | value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value / oImageOriginal.width ) ) ; |
---|
| 363 | else |
---|
| 364 | value = value == 0 ? 0 : Math.round( oImageOriginal.width * ( value / oImageOriginal.height ) ) ; |
---|
| 365 | |
---|
| 366 | if ( !isNaN( value ) ) |
---|
| 367 | e.value = value ; |
---|
| 368 | } |
---|
| 369 | |
---|
| 370 | UpdatePreview() ; |
---|
| 371 | } |
---|
| 372 | |
---|
| 373 | // Fired when the Reset Size button is clicked |
---|
| 374 | function ResetSizes() |
---|
| 375 | { |
---|
| 376 | if ( ! oImageOriginal ) return ; |
---|
| 377 | |
---|
| 378 | GetE('txtWidth').value = oImageOriginal.width ; |
---|
| 379 | GetE('txtHeight').value = oImageOriginal.height ; |
---|
| 380 | |
---|
| 381 | UpdatePreview() ; |
---|
| 382 | } |
---|
| 383 | |
---|
| 384 | function BrowseServer() |
---|
| 385 | { |
---|
| 386 | OpenServerBrowser( |
---|
| 387 | 'Image', |
---|
| 388 | FCKConfig.ImageBrowserURL, |
---|
| 389 | FCKConfig.ImageBrowserWindowWidth, |
---|
| 390 | FCKConfig.ImageBrowserWindowHeight ) ; |
---|
| 391 | } |
---|
| 392 | |
---|
| 393 | function LnkBrowseServer() |
---|
| 394 | { |
---|
| 395 | OpenServerBrowser( |
---|
| 396 | 'Link', |
---|
| 397 | FCKConfig.LinkBrowserURL, |
---|
| 398 | FCKConfig.LinkBrowserWindowWidth, |
---|
| 399 | FCKConfig.LinkBrowserWindowHeight ) ; |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | function OpenServerBrowser( type, url, width, height ) |
---|
| 403 | { |
---|
| 404 | sActualBrowser = type ; |
---|
| 405 | OpenFileBrowser( url, width, height ) ; |
---|
| 406 | } |
---|
| 407 | |
---|
| 408 | var sActualBrowser ; |
---|
| 409 | |
---|
| 410 | function SetUrl( url, width, height, alt ) |
---|
| 411 | { |
---|
| 412 | if ( sActualBrowser == 'Link' ) |
---|
| 413 | { |
---|
| 414 | GetE('txtLnkUrl').value = url ; |
---|
| 415 | UpdatePreview() ; |
---|
| 416 | } |
---|
| 417 | else |
---|
| 418 | { |
---|
| 419 | GetE('txtUrl').value = url ; |
---|
| 420 | GetE('txtWidth').value = width ? width : '' ; |
---|
| 421 | GetE('txtHeight').value = height ? height : '' ; |
---|
| 422 | |
---|
| 423 | if ( alt ) |
---|
| 424 | GetE('txtAlt').value = alt; |
---|
| 425 | |
---|
| 426 | UpdatePreview() ; |
---|
| 427 | UpdateOriginal( true ) ; |
---|
| 428 | } |
---|
| 429 | |
---|
| 430 | window.parent.SetSelectedTab( 'Info' ) ; |
---|
| 431 | } |
---|
| 432 | |
---|
| 433 | function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) |
---|
| 434 | { |
---|
| 435 | switch ( errorNumber ) |
---|
| 436 | { |
---|
| 437 | case 0 : // No errors |
---|
| 438 | alert( 'Your file has been successfully uploaded' ) ; |
---|
| 439 | break ; |
---|
| 440 | case 1 : // Custom error |
---|
| 441 | alert( customMsg ) ; |
---|
| 442 | return ; |
---|
| 443 | case 101 : // Custom warning |
---|
| 444 | alert( customMsg ) ; |
---|
| 445 | break ; |
---|
| 446 | case 201 : |
---|
| 447 | alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; |
---|
| 448 | break ; |
---|
| 449 | case 202 : |
---|
| 450 | alert( 'Invalid file type' ) ; |
---|
| 451 | return ; |
---|
| 452 | case 203 : |
---|
| 453 | alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; |
---|
| 454 | return ; |
---|
| 455 | default : |
---|
| 456 | alert( 'Error on file upload. Error number: ' + errorNumber ) ; |
---|
| 457 | return ; |
---|
| 458 | } |
---|
| 459 | |
---|
| 460 | sActualBrowser = '' ; |
---|
| 461 | SetUrl( fileUrl ) ; |
---|
| 462 | GetE('frmUpload').reset() ; |
---|
| 463 | } |
---|
| 464 | |
---|
| 465 | var oUploadAllowedExtRegex = new RegExp( FCKConfig.ImageUploadAllowedExtensions, 'i' ) ; |
---|
| 466 | var oUploadDeniedExtRegex = new RegExp( FCKConfig.ImageUploadDeniedExtensions, 'i' ) ; |
---|
| 467 | |
---|
| 468 | function CheckUpload() |
---|
| 469 | { |
---|
| 470 | var sFile = GetE('txtUploadFile').value ; |
---|
| 471 | |
---|
| 472 | if ( sFile.length == 0 ) |
---|
| 473 | { |
---|
| 474 | alert( 'Please select a file to upload' ) ; |
---|
| 475 | return false ; |
---|
| 476 | } |
---|
| 477 | |
---|
| 478 | if ( ( FCKConfig.ImageUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || |
---|
| 479 | ( FCKConfig.ImageUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) |
---|
| 480 | { |
---|
| 481 | OnUploadCompleted( 202 ) ; |
---|
| 482 | return false ; |
---|
| 483 | } |
---|
| 484 | |
---|
| 485 | return true ; |
---|
| 486 | } |
---|