[ 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/_source/classes/ -> fckcontextmenuitem.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: fckcontextmenuitem.js
  14   *     FCKContextMenuItem Class: represents a item in the context menu.
  15   * 
  16   * File Authors:
  17   *         Frederico Caldeira Knabben (fredck@fckeditor.net)
  18   */
  19  
  20  var FCKContextMenuItem = function( contextMenu, commandName, label, hasIcon )
  21  {
  22      this.ContextMenu    = contextMenu ;
  23      this.Command        = FCKCommands.GetCommand( commandName ) ;
  24      this.Label            = label ? label : commandName ;
  25      this.HasIcon        = hasIcon ? true : false ;
  26  }
  27  
  28  function FCKContextMenuItem_OnMouseOver()
  29  {
  30      if ( this.className != 'CM_Disabled' )
  31          this.className = 'CM_Over' ;
  32  }
  33      
  34  function FCKContextMenuItem_OnMouseOut()
  35  {
  36      if ( this.className != 'CM_Disabled' )
  37          this.className = 'CM_Option' ;
  38  }
  39      
  40  function FCKContextMenuItem_OnClick()
  41  {
  42      if ( this.className != 'CM_Disabled' )
  43      {
  44          this.FCKContextMenuItem.ContextMenu.Hide() ;
  45          this.FCKContextMenuItem.Command.Execute() ;
  46      }
  47      return false ;
  48  }
  49  
  50  FCKContextMenuItem.prototype.CreateTableRow = function( targetTable )
  51  {
  52      // Creates the <TR> element.
  53      this._Row = targetTable.insertRow(-1) ;
  54      this._Row.className = 'CM_Disabled' ;
  55      this._Row.FCKContextMenuItem = this ;
  56      
  57      this._Row.onmouseover    = FCKContextMenuItem_OnMouseOver ;
  58      this._Row.onmouseout    = FCKContextMenuItem_OnMouseOut ;
  59      this._Row.onclick        = FCKContextMenuItem_OnClick ;
  60      
  61      var oCell = this._Row.insertCell(-1) ;
  62      oCell.className = 'CM_Icon' ;
  63      
  64      if ( this.HasIcon ) oCell.innerHTML = '<img alt="" src="' + FCKConfig.SkinPath + 'toolbar/' + this.Command.Name.toLowerCase() + '.gif" width="21" height="20">' ;
  65      
  66      oCell = this._Row.insertCell(-1) ;
  67      oCell.className        = 'CM_Label' ;
  68      oCell.noWrap        = true ;
  69      oCell.innerHTML        = this.Label ;
  70  }
  71  
  72  FCKContextMenuItem.prototype.SetVisible = function( isVisible )
  73  {
  74      this._Row.style.display = isVisible ? '' : 'none' ;
  75  }
  76  
  77  FCKContextMenuItem.prototype.RefreshState = function()
  78  {
  79      switch ( this.Command.GetState() )
  80      {
  81          case FCK_TRISTATE_ON :
  82          case FCK_TRISTATE_OFF :
  83              this._Row.className = 'CM_Option' ;
  84              break ;
  85          default :
  86              this._Row.className = 'CM_Disabled' ;
  87              break ;
  88      }
  89  } 
  90  
  91  /*
  92  Sample output.
  93  -----------------------------------------
  94  <tr class="CM_Disabled">
  95      <td class="CM_Icon"><img alt="" src="icons/cut.gif" width="21" height="20"></td>
  96      <td class="CM_Label">Cut</td>
  97  </tr>
  98  -----------------------------------------
  99  <tr class="CM_Option" onmouseover="OnOver(this);" onmouseout="OnOut(this);">
 100      <td class="CM_Icon"></td>
 101      <td class="CM_Label">Do Something</td>
 102  </tr>
 103  */


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