[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/include/fckeditor/editor/dialog/fck_link/ -> fck_link.js (source)

   1  /*
   2   * FCKeditor - The text editor for internet
   3   * Copyright (C) 2003-2005 Frederico Caldeira Knabben
   4   * 
   5   * Licensed under the terms of the GNU Lesser General Public License:
   6   *         http://www.opensource.org/licenses/lgpl-license.php
   7   * 
   8   * For further information visit:
   9   *         http://www.fckeditor.net/
  10   * 
  11   * "Support Open Source software. What about a donation today?"
  12   * 
  13   * File Name: fck_link.js
  14   *     Scripts related to the Link dialog window (see fck_link.html).
  15   * 
  16   * File Authors:
  17   *         Frederico Caldeira Knabben (fredck@fckeditor.net)
  18   */
  19  
  20  var oEditor        = window.parent.InnerDialogLoaded() ;
  21  var FCK            = oEditor.FCK ;
  22  var FCKLang        = oEditor.FCKLang ;
  23  var FCKConfig    = oEditor.FCKConfig ;
  24  
  25  //#### Dialog Tabs
  26  
  27  // Set the dialog tabs.
  28  window.parent.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ;
  29  
  30  if ( !FCKConfig.LinkDlgHideTarget )
  31      window.parent.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ;
  32  
  33  if ( FCKConfig.LinkUpload )
  34      window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ;
  35  
  36  if ( !FCKConfig.LinkDlgHideAdvanced )
  37      window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ;
  38  
  39  // Function called when a dialog tag is selected.
  40  function OnDialogTabChange( tabCode )
  41  {
  42      ShowE('divInfo'        , ( tabCode == 'Info' ) ) ;
  43      ShowE('divTarget'    , ( tabCode == 'Target' ) ) ;
  44      ShowE('divUpload'    , ( tabCode == 'Upload' ) ) ;
  45      ShowE('divAttribs'    , ( tabCode == 'Advanced' ) ) ;
  46  }
  47  
  48  //#### Regular Expressions library.
  49  var oRegex = new Object() ;
  50  
  51  oRegex.UriProtocol = new RegExp('') ;
  52  oRegex.UriProtocol.compile( '^(((http|https|ftp|news):\/\/)|mailto:)', 'gi' ) ;
  53  
  54  oRegex.UrlOnChangeProtocol = new RegExp('') ;
  55  oRegex.UrlOnChangeProtocol.compile( '^(http|https|ftp|news)://(?=.)', 'gi' ) ;
  56  
  57  oRegex.UrlOnChangeTestOther = new RegExp('') ;
  58  //oRegex.UrlOnChangeTestOther.compile( '^(javascript:|#|/)', 'gi' ) ;
  59  oRegex.UrlOnChangeTestOther.compile( '^((javascript:)|[#/\.])', 'gi' ) ; 
  60  
  61  oRegex.ReserveTarget = new RegExp('') ;
  62  oRegex.ReserveTarget.compile( '^_(blank|self|top|parent)$', 'i' ) ;
  63  
  64  oRegex.PopupUri = new RegExp('') ;
  65  oRegex.PopupUri.compile( "^javascript:void\\(\\s*window.open\\(\\s*'([^']+)'\\s*,\\s*(?:'([^']*)'|null)\\s*,\\s*'([^']*)'\\s*\\)\\s*\\)\\s*$" ) ;
  66  
  67  oRegex.PopupFeatures = new RegExp('') ;
  68  oRegex.PopupFeatures.compile( '(?:^|,)([^=]+)=(\\d+|yes|no)', 'gi' ) ;
  69  
  70  //#### Parser Functions
  71  
  72  var oParser = new Object() ;
  73  
  74  oParser.ParseEMailUrl = function( emailUrl )
  75  {
  76      // Initializes the EMailInfo object.
  77      var oEMailInfo = new Object() ;
  78      oEMailInfo.Address    = '' ;
  79      oEMailInfo.Subject    = '' ;
  80      oEMailInfo.Body        = '' ;
  81  
  82      var oParts = emailUrl.match( /^([^\?]+)\??(.+)?/ ) ;
  83      if ( oParts )
  84      {
  85          // Set the e-mail address.
  86          oEMailInfo.Address = oParts[1] ;
  87  
  88          // Look for the optional e-mail parameters.
  89          if ( oParts[2] )
  90          {
  91              var oMatch = oParts[2].match( /(^|&)subject=([^&]+)/i ) ;
  92              if ( oMatch ) oEMailInfo.Subject = unescape( oMatch[2] ) ;
  93  
  94              oMatch = oParts[2].match( /(^|&)body=([^&]+)/i ) ;
  95              if ( oMatch ) oEMailInfo.Body = unescape( oMatch[2] ) ;
  96          }
  97      }
  98  
  99      return oEMailInfo ;
 100  }
 101  
 102  oParser.CreateEMailUri = function( address, subject, body )
 103  {
 104      var sBaseUri = 'mailto:' + address ;
 105  
 106      var sParams = '' ;
 107  
 108      if ( subject.length > 0 )
 109          sParams = '?subject=' + escape( subject ) ;
 110  
 111      if ( body.length > 0 )
 112      {
 113          sParams += ( sParams.length == 0 ? '?' : '&' ) ;
 114          sParams += 'body=' + escape( body ) ;
 115      }
 116  
 117      return sBaseUri + sParams ;
 118  }
 119  
 120  //#### Initialization Code
 121  
 122  // oLink: The actual selected link in the editor.
 123  var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ;
 124  if ( oLink )
 125      FCK.Selection.SelectNode( oLink ) ;
 126  
 127  window.onload = function()
 128  {
 129      // Translate the dialog box texts.
 130      oEditor.FCKLanguageManager.TranslatePage(document) ;
 131  
 132      // Fill the Anchor Names and Ids combos.
 133      LoadAnchorNamesAndIds() ;
 134  
 135      // Load the selected link information (if any).
 136      LoadSelection() ;
 137  
 138      // Update the dialog box.
 139      SetLinkType( GetE('cmbLinkType').value ) ;
 140  
 141      // Show/Hide the "Browse Server" button.
 142      GetE('divBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ;
 143  
 144      // Show the initial dialog content.
 145      GetE('divInfo').style.display = '' ;
 146  
 147      // Set the actual uploader URL.
 148      if ( FCKConfig.LinkUpload )
 149          GetE('frmUpload').action = FCKConfig.LinkUploadURL ;
 150  
 151      // Activate the "OK" button.
 152      window.parent.SetOkButton( true ) ;
 153  }
 154  
 155  var bHasAnchors ;
 156  
 157  function LoadAnchorNamesAndIds()
 158  {
 159      // Since version 2.0, the anchors are replaced in the DOM by IMGs so the user see the icon 
 160      // to edit them. So, we must look for that images now.
 161      var aAnchors = new Array() ;
 162      
 163      var oImages = oEditor.FCK.EditorDocument.getElementsByTagName( 'IMG' ) ;
 164      for( var i = 0 ; i < oImages.length ; i++ )
 165      {
 166          if ( oImages[i].getAttribute('_fckanchor') )
 167              aAnchors[ aAnchors.length ] = oEditor.FCK.GetRealElement( oImages[i] ) ;
 168      }
 169      
 170      var aIds = oEditor.FCKTools.GetAllChildrenIds( oEditor.FCK.EditorDocument.body ) ;
 171  
 172      bHasAnchors = ( aAnchors.length > 0 || aIds.length > 0 ) ;
 173  
 174      for ( var i = 0 ; i < aAnchors.length ; i++ )
 175      {
 176          var sName = aAnchors[i].name ;
 177          if ( sName && sName.length > 0 )
 178              oEditor.FCKTools.AddSelectOption( document, GetE('cmbAnchorName'), sName, sName ) ;
 179      }
 180  
 181      for ( var i = 0 ; i < aIds.length ; i++ )
 182      {
 183          oEditor.FCKTools.AddSelectOption( document, GetE('cmbAnchorId'), aIds[i], aIds[i] ) ;
 184      }
 185  
 186      ShowE( 'divSelAnchor'    , bHasAnchors ) ;
 187      ShowE( 'divNoAnchor'    , !bHasAnchors ) ;
 188  }
 189  
 190  function LoadSelection()
 191  {
 192      if ( !oLink ) return ;
 193  
 194      var sType = 'url' ;
 195  
 196      // Get the actual Link href.
 197      var sHRef = oLink.getAttribute( '_fcksavedurl' ) ;
 198      if ( !sHRef || sHRef.length == 0 )
 199          sHRef = oLink.getAttribute( 'href' , 2 ) + '' ;
 200      
 201      // TODO: Wait stable version and remove the following commented lines.
 202  //    if ( sHRef.startsWith( FCK.BaseUrl ) )
 203  //        sHRef = sHRef.remove( 0, FCK.BaseUrl.length ) ;
 204  
 205      // Look for a popup javascript link.
 206      var oPopupMatch = oRegex.PopupUri.exec( sHRef ) ;
 207      if( oPopupMatch )
 208      {
 209          GetE('cmbTarget').value = 'popup' ;
 210          sHRef = oPopupMatch[1] ;
 211          FillPopupFields( oPopupMatch[2], oPopupMatch[3] ) ;
 212          SetTarget( 'popup' ) ;
 213      }
 214  
 215      // Search for the protocol.
 216      var sProtocol = oRegex.UriProtocol.exec( sHRef ) ;
 217  
 218      if ( sProtocol )
 219      {
 220          sProtocol = sProtocol[0].toLowerCase() ;
 221          GetE('cmbLinkProtocol').value = sProtocol ;
 222  
 223          // Remove the protocol and get the remainig URL.
 224          var sUrl = sHRef.replace( oRegex.UriProtocol, '' ) ;
 225  
 226          if ( sProtocol == 'mailto:' )    // It is an e-mail link.
 227          {
 228              sType = 'email' ;
 229  
 230              var oEMailInfo = oParser.ParseEMailUrl( sUrl ) ;
 231              GetE('txtEMailAddress').value    = oEMailInfo.Address ;
 232              GetE('txtEMailSubject').value    = oEMailInfo.Subject ;
 233              GetE('txtEMailBody').value        = oEMailInfo.Body ;
 234          }
 235          else                // It is a normal link.
 236          {
 237              sType = 'url' ;
 238              GetE('txtUrl').value = sUrl ;
 239          }
 240      }
 241      else if ( sHRef.substr(0,1) == '#' && sHRef.length > 1 )    // It is an anchor link.
 242      {
 243          sType = 'anchor' ;
 244          GetE('cmbAnchorName').value = GetE('cmbAnchorId').value = sHRef.substr(1) ;
 245      }
 246      else                    // It is another type of link.
 247      {
 248          sType = 'url' ;
 249  
 250          GetE('cmbLinkProtocol').value = '' ;
 251          GetE('txtUrl').value = sHRef ;
 252      }
 253  
 254      if ( !oPopupMatch )
 255      {
 256          // Get the target.
 257          var sTarget = oLink.target ;
 258  
 259          if ( sTarget && sTarget.length > 0 )
 260          {
 261              if ( oRegex.ReserveTarget.test( sTarget ) )
 262              {
 263                  sTarget = sTarget.toLowerCase() ;
 264                  GetE('cmbTarget').value = sTarget ;
 265              }
 266              else
 267                  GetE('cmbTarget').value = 'frame' ;
 268              GetE('txtTargetFrame').value = sTarget ;
 269          }
 270      }
 271  
 272      // Get Advances Attributes
 273      GetE('txtAttId').value            = oLink.id ;
 274      GetE('txtAttName').value        = oLink.name ;
 275      GetE('cmbAttLangDir').value        = oLink.dir ;
 276      GetE('txtAttLangCode').value    = oLink.lang ;
 277      GetE('txtAttAccessKey').value    = oLink.accessKey ;
 278      GetE('txtAttTabIndex').value    = oLink.tabIndex <= 0 ? '' : oLink.tabIndex ;
 279      GetE('txtAttTitle').value        = oLink.title ;
 280      GetE('txtAttContentType').value    = oLink.type ;
 281      GetE('txtAttCharSet').value        = oLink.charset ;
 282  
 283      if ( oEditor.FCKBrowserInfo.IsIE )
 284      {
 285          GetE('txtAttClasses').value    = oLink.getAttribute('className',2) || '' ;
 286          GetE('txtAttStyle').value    = oLink.style.cssText ;
 287      }
 288      else
 289      {
 290          GetE('txtAttClasses').value    = oLink.getAttribute('class',2) || '' ;
 291          GetE('txtAttStyle').value    = oLink.getAttribute('style',2) ;
 292      }
 293  
 294      // Update the Link type combo.
 295      GetE('cmbLinkType').value = sType ;
 296  }
 297  
 298  //#### Link type selection.
 299  function SetLinkType( linkType )
 300  {
 301      ShowE('divLinkTypeUrl'        , (linkType == 'url') ) ;
 302      ShowE('divLinkTypeAnchor'    , (linkType == 'anchor') ) ;
 303      ShowE('divLinkTypeEMail'    , (linkType == 'email') ) ;
 304  
 305      if ( !FCKConfig.LinkDlgHideTarget )
 306          window.parent.SetTabVisibility( 'Target'    , (linkType == 'url') ) ;
 307  
 308      if ( FCKConfig.LinkUpload )
 309          window.parent.SetTabVisibility( 'Upload'    , (linkType == 'url') ) ;
 310  
 311      if ( !FCKConfig.LinkDlgHideAdvanced )
 312          window.parent.SetTabVisibility( 'Advanced'    , (linkType != 'anchor' || bHasAnchors) ) ;
 313  
 314      if ( linkType == 'email' )
 315          window.parent.SetAutoSize( true ) ;
 316  }
 317  
 318  //#### Target type selection.
 319  function SetTarget( targetType )
 320  {
 321      GetE('tdTargetFrame').style.display    = ( targetType == 'popup' ? 'none' : '' ) ;
 322      GetE('tdPopupName').style.display    =
 323          GetE('tablePopupFeatures').style.display = ( targetType == 'popup' ? '' : 'none' ) ;
 324  
 325      switch ( targetType )
 326      {
 327          case "_blank" :
 328          case "_self" :
 329          case "_parent" :
 330          case "_top" :
 331              GetE('txtTargetFrame').value = targetType ;
 332              break ;
 333          case "" :
 334              GetE('txtTargetFrame').value = '' ;
 335              break ;
 336      }
 337  
 338      if ( targetType == 'popup' )
 339          window.parent.SetAutoSize( true ) ;
 340  }
 341  
 342  //#### Called while the user types the URL.
 343  function OnUrlChange()
 344  {
 345      var sUrl = GetE('txtUrl').value ;
 346      var sProtocol = oRegex.UrlOnChangeProtocol.exec( sUrl ) ;
 347  
 348      if ( sProtocol )
 349      {
 350          sUrl = sUrl.substr( sProtocol[0].length ) ;
 351          GetE('txtUrl').value = sUrl ;
 352          GetE('cmbLinkProtocol').value = sProtocol[0].toLowerCase() ;
 353      }
 354      else if ( oRegex.UrlOnChangeTestOther.test( sUrl ) )
 355      {
 356          GetE('cmbLinkProtocol').value = '' ;
 357      }
 358  }
 359  
 360  //#### Called while the user types the target name.
 361  function OnTargetNameChange()
 362  {
 363      var sFrame = GetE('txtTargetFrame').value ;
 364  
 365      if ( sFrame.length == 0 )
 366          GetE('cmbTarget').value = '' ;
 367      else if ( oRegex.ReserveTarget.test( sFrame ) )
 368          GetE('cmbTarget').value = sFrame.toLowerCase() ;
 369      else
 370          GetE('cmbTarget').value = 'frame' ;
 371  }
 372  
 373  //#### Builds the javascript URI to open a popup to the specified URI.
 374  function BuildPopupUri( uri )
 375  {
 376      var oReg = new RegExp( "'", "g" ) ;
 377      var sWindowName = "'" + GetE('txtPopupName').value.replace(oReg, "\\'") + "'" ;
 378  
 379      var sFeatures = '' ;
 380      var aChkFeatures = document.getElementsByName('chkFeature') ;
 381      for ( var i = 0 ; i < aChkFeatures.length ; i++ )
 382      {
 383          if ( i > 0 ) sFeatures += ',' ;
 384          sFeatures += aChkFeatures[i].value + '=' + ( aChkFeatures[i].checked ? 'yes' : 'no' ) ;
 385      }
 386  
 387      if ( GetE('txtPopupWidth').value.length > 0 )    sFeatures += ',width=' + GetE('txtPopupWidth').value ;
 388      if ( GetE('txtPopupHeight').value.length > 0 )    sFeatures += ',height=' + GetE('txtPopupHeight').value ;
 389      if ( GetE('txtPopupLeft').value.length > 0 )    sFeatures += ',left=' + GetE('txtPopupLeft').value ;
 390      if ( GetE('txtPopupTop').value.length > 0 )        sFeatures += ',top=' + GetE('txtPopupTop').value ;
 391  
 392      return ( "javascript:void(window.open('" + uri + "'," + sWindowName + ",'" + sFeatures + "'))" ) ;
 393  }
 394  
 395  //#### Fills all Popup related fields.
 396  function FillPopupFields( windowName, features )
 397  {
 398      if ( windowName )
 399          GetE('txtPopupName').value = windowName ;
 400  
 401      var oFeatures = new Object() ;
 402      var oFeaturesMatch ;
 403      while( ( oFeaturesMatch = oRegex.PopupFeatures.exec( features ) ) != null )
 404      {
 405          var sValue = oFeaturesMatch[2] ;
 406          if ( sValue == ( 'yes' || '1' ) )
 407              oFeatures[ oFeaturesMatch[1] ] = true ;
 408          else if ( ! isNaN( sValue ) && sValue != 0 )
 409              oFeatures[ oFeaturesMatch[1] ] = sValue ;
 410      }
 411  
 412      // Update all features check boxes.
 413      var aChkFeatures = document.getElementsByName('chkFeature') ;
 414      for ( var i = 0 ; i < aChkFeatures.length ; i++ )
 415      {
 416          if ( oFeatures[ aChkFeatures[i].value ] )
 417              aChkFeatures[i].checked = true ;
 418      }
 419  
 420      // Update position and size text boxes.
 421      if ( oFeatures['width'] )    GetE('txtPopupWidth').value        = oFeatures['width'] ;
 422      if ( oFeatures['height'] )    GetE('txtPopupHeight').value    = oFeatures['height'] ;
 423      if ( oFeatures['left'] )    GetE('txtPopupLeft').value        = oFeatures['left'] ;
 424      if ( oFeatures['top'] )        GetE('txtPopupTop').value        = oFeatures['top'] ;
 425  }
 426  
 427  //#### The OK button was hit.
 428  function Ok()
 429  {
 430      var sUri ;
 431  
 432      switch ( GetE('cmbLinkType').value )
 433      {
 434          case 'url' :
 435              sUri = GetE('txtUrl').value ;
 436  
 437              if ( sUri.length == 0 )
 438              {
 439                  alert( FCKLang.DlnLnkMsgNoUrl ) ;
 440                  return false ;
 441              }
 442  
 443              sUri = GetE('cmbLinkProtocol').value + sUri ;
 444  
 445              if( GetE('cmbTarget').value == 'popup' )
 446                  sUri = BuildPopupUri( sUri ) ;
 447  
 448              break ;
 449  
 450          case 'email' :
 451              sUri = GetE('txtEMailAddress').value ;
 452  
 453              if ( sUri.length == 0 )
 454              {
 455                  alert( FCKLang.DlnLnkMsgNoEMail ) ;
 456                  return false ;
 457              }
 458  
 459              sUri = oParser.CreateEMailUri(
 460                  sUri,
 461                  GetE('txtEMailSubject').value,
 462                  GetE('txtEMailBody').value ) ;
 463              break ;
 464  
 465          case 'anchor' :
 466              var sAnchor = GetE('cmbAnchorName').value ;
 467              if ( sAnchor.length == 0 ) sAnchor = GetE('cmbAnchorId').value ;
 468  
 469              if ( sAnchor.length == 0 )
 470              {
 471                  alert( FCKLang.DlnLnkMsgNoAnchor ) ;
 472                  return false ;
 473              }
 474  
 475              sUri = '#' + sAnchor ;
 476              break ;
 477      }
 478  
 479      if ( oLink )    // Modifying an existent link.
 480      {
 481          oEditor.FCKUndo.SaveUndoStep() ;
 482          oLink.href = sUri ;
 483      }
 484      else            // Creating a new link.
 485      {
 486          oLink = oEditor.FCK.CreateLink( sUri ) ;
 487          if ( ! oLink )
 488              return true ;
 489      }
 490      
 491      SetAttribute( oLink, '_fcksavedurl', sUri ) ;
 492  
 493      // Target
 494      if( GetE('cmbTarget').value != 'popup' )
 495          SetAttribute( oLink, 'target', GetE('txtTargetFrame').value ) ;
 496      else
 497          SetAttribute( oLink, 'target', null ) ;
 498  
 499      // Advances Attributes
 500      SetAttribute( oLink, 'id'        , GetE('txtAttId').value ) ;
 501      SetAttribute( oLink, 'name'        , GetE('txtAttName').value ) ;        // No IE. Set but doesnt't update the outerHTML.
 502      SetAttribute( oLink, 'dir'        , GetE('cmbAttLangDir').value ) ;
 503      SetAttribute( oLink, 'lang'        , GetE('txtAttLangCode').value ) ;
 504      SetAttribute( oLink, 'accesskey', GetE('txtAttAccessKey').value ) ;
 505      SetAttribute( oLink, 'tabindex'    , ( GetE('txtAttTabIndex').value > 0 ? GetE('txtAttTabIndex').value : null ) ) ;
 506      SetAttribute( oLink, 'title'    , GetE('txtAttTitle').value ) ;
 507      SetAttribute( oLink, 'type'        , GetE('txtAttContentType').value ) ;
 508      SetAttribute( oLink, 'charset'    , GetE('txtAttCharSet').value ) ;
 509  
 510      if ( oEditor.FCKBrowserInfo.IsIE )
 511      {
 512          SetAttribute( oLink, 'className', GetE('txtAttClasses').value ) ;
 513          oLink.style.cssText = GetE('txtAttStyle').value ;
 514      }
 515      else
 516      {
 517          SetAttribute( oLink, 'class', GetE('txtAttClasses').value ) ;
 518          SetAttribute( oLink, 'style', GetE('txtAttStyle').value ) ;
 519      }
 520  
 521      return true ;
 522  }
 523  
 524  function BrowseServer()
 525  {
 526      OpenFileBrowser( FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ;
 527  }
 528  
 529  function SetUrl( url )
 530  {
 531      document.getElementById('txtUrl').value = url ;
 532      OnUrlChange() ;
 533      window.parent.SetSelectedTab( 'Info' ) ;
 534  }
 535  
 536  function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
 537  {
 538      switch ( errorNumber )
 539      {
 540          case 0 :    // No errors
 541              alert( 'Your file has been successfully uploaded' ) ;
 542              break ;
 543          case 1 :    // Custom error
 544              alert( customMsg ) ;
 545              return ;
 546          case 101 :    // Custom warning
 547              alert( customMsg ) ;
 548              break ;
 549          case 201 :
 550              alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
 551              break ;
 552          case 202 :
 553              alert( 'Invalid file type' ) ;
 554              return ;
 555          case 203 :
 556              alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
 557              return ;
 558          default :
 559              alert( 'Error on file upload. Error number: ' + errorNumber ) ;
 560              return ;
 561      }
 562  
 563      SetUrl( fileUrl ) ;
 564      GetE('frmUpload').reset() ;
 565  }
 566  
 567  var oUploadAllowedExtRegex    = new RegExp( FCKConfig.LinkUploadAllowedExtensions, 'i' ) ;
 568  var oUploadDeniedExtRegex    = new RegExp( FCKConfig.LinkUploadDeniedExtensions, 'i' ) ;
 569  
 570  function CheckUpload()
 571  {
 572      var sFile = GetE('txtUploadFile').value ;
 573      
 574      if ( sFile.length == 0 )
 575      {
 576          alert( 'Please select a file to upload' ) ;
 577          return false ;
 578      }
 579      
 580      if ( ( FCKConfig.LinkUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) ||
 581          ( FCKConfig.LinkUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) )
 582      {
 583          OnUploadCompleted( 202 ) ;
 584          return false ;
 585      }
 586      
 587      return true ;
 588  }


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7