[ 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/common/ -> fck_dialog_common.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_dialog_common.js
  14   *     Useful functions used by almost all dialog window pages.
  15   * 
  16   * File Authors:
  17   *         Frederico Caldeira Knabben (fredck@fckeditor.net)
  18   */
  19  
  20  // Gets a element by its Id. Used for shorter coding.
  21  function GetE( elementId )
  22  {
  23      return document.getElementById( elementId )  ;
  24  }
  25  
  26  function ShowE( element, isVisible )
  27  {
  28      if ( typeof( element ) == 'string' )
  29          element = GetE( element ) ;
  30      element.style.display = isVisible ? '' : 'none' ;
  31  }
  32  
  33  function SetAttribute( element, attName, attValue )
  34  {
  35      if ( attValue == null || attValue.length == 0 )
  36          element.removeAttribute( attName, 0 ) ;            // 0 : Case Insensitive
  37      else
  38          element.setAttribute( attName, attValue, 0 ) ;    // 0 : Case Insensitive
  39  }
  40  
  41  function GetAttribute( element, attName, valueIfNull )
  42  {
  43      var oAtt = element.attributes[attName] ;
  44  
  45      if ( oAtt == null || !oAtt.specified )
  46          return valueIfNull ? valueIfNull : '' ;
  47  
  48      var oValue ;
  49      
  50      if ( !( oValue = element.getAttribute( attName, 2 ) ) )
  51          oValue = oAtt.nodeValue ;
  52  
  53      return ( oValue == null ? valueIfNull : oValue ) ;
  54  }
  55  
  56  // Functions used by text fiels to accept numbers only.
  57  function IsDigit( e )
  58  {
  59      e = e || event ;
  60      var iCode = ( e.keyCode || e.charCode ) ;
  61  
  62      event.returnValue =
  63          (
  64              ( iCode >= 48 && iCode <= 57 )        // Numbers
  65              || (iCode >= 37 && iCode <= 40)        // Arrows
  66              || iCode == 8                        // Backspace
  67              || iCode == 46                        // Delete
  68          ) ;
  69  
  70      return event.returnValue ;
  71  }
  72  
  73  String.prototype.trim = function()
  74  {
  75      return this.replace( /(^\s*)|(\s*$)/g, '' ) ;
  76  }
  77  
  78  String.prototype.startsWith = function( value )
  79  {
  80      return ( this.substr( 0, value.length ) == value ) ;
  81  }
  82  
  83  String.prototype.remove = function( start, length )
  84  {
  85      var s = '' ;
  86  
  87      if ( start > 0 )
  88          s = this.substring( 0, start ) ;
  89  
  90      if ( start + length < this.length )
  91          s += this.substring( start + length , this.length ) ;
  92  
  93      return s ;
  94  }
  95  
  96  function OpenFileBrowser( url, width, height )
  97  {
  98      // oEditor must be defined.
  99      
 100      var iLeft = ( oEditor.FCKConfig.ScreenWidth  - width ) / 2 ;
 101      var iTop  = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ;
 102  
 103      var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes" ;
 104      sOptions += ",width=" + width ;
 105      sOptions += ",height=" + height ;
 106      sOptions += ",left=" + iLeft ;
 107      sOptions += ",top=" + iTop ;
 108  
 109      // The "PreserveSessionOnFileBrowser" because the above code could be 
 110      // blocked by popup blockers.
 111      if ( oEditor.FCKConfig.PreserveSessionOnFileBrowser && oEditor.FCKBrowserInfo.IsIE )
 112      {
 113          // The following change has been made otherwise IE will open the file 
 114          // browser on a different server session (on some cases):
 115          // http://support.microsoft.com/default.aspx?scid=kb;en-us;831678
 116          // by Simone Chiaretta.
 117          var oWindow = oEditor.window.open( url, 'FCKBrowseWindow', sOptions ) ;
 118          if ( oWindow )
 119              oWindow.opener = window ;
 120          else
 121              alert( oEditor.FCKLang.BrowseServerBlocked ) ;
 122      }
 123      else
 124          window.open( url, 'FCKBrowseWindow', sOptions ) ;
 125  }


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