~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/editor/_source/classes/fckcontextmenugroup.js

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
Import upstream version 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: fckcontextmenugroup.js
 
14
 *      FCKContextMenuGroup Class: represents a group of items in the context 
 
15
 *      menu. Generaly a group of items is directly dependent of the same rules.
 
16
 * 
 
17
 * File Authors:
 
18
 *              Frederico Caldeira Knabben (fredck@fckeditor.net)
 
19
 */
 
20
 
 
21
var FCKContextMenuGroup = function( addSeparator, contextMenu, firstItemCommand, firstItemLabel, hasIcon )
 
22
{
 
23
        this.IsVisible = true ;
 
24
        
 
25
        // Array with all available context menu items of this group.
 
26
        this.Items = new Array() ;
 
27
        
 
28
        if ( addSeparator )
 
29
                this.Add( new FCKContextMenuSeparator() ) ;
 
30
        
 
31
        if ( contextMenu && firstItemCommand && firstItemLabel )
 
32
                this.Add( new FCKContextMenuItem( contextMenu, firstItemCommand, firstItemLabel, hasIcon ) ) ;
 
33
 
 
34
        // This OPTIONAL function checks if the group must be shown.
 
35
        this.ValidationFunction = null ;
 
36
}
 
37
 
 
38
// Adds an item to the group's items collecion.
 
39
FCKContextMenuGroup.prototype.Add = function( contextMenuItem )
 
40
{
 
41
        this.Items[ this.Items.length ] = contextMenuItem ;
 
42
}
 
43
 
 
44
// Creates the <TR> elements that represent the item in a table (usually the rendered context menu).
 
45
FCKContextMenuGroup.prototype.CreateTableRows = function( table )
 
46
{
 
47
        for ( var i = 0 ; i < this.Items.length ; i++ )
 
48
        {
 
49
                this.Items[i].CreateTableRow( table ) ;
 
50
        }
 
51
}
 
52
 
 
53
FCKContextMenuGroup.prototype.SetVisible = function( isVisible )
 
54
{
 
55
        for ( var i = 0 ; i < this.Items.length ; i++ )
 
56
        {
 
57
                this.Items[i].SetVisible( isVisible ) ;
 
58
        }
 
59
        
 
60
        this.IsVisible = isVisible ;
 
61
}
 
62
 
 
63
FCKContextMenuGroup.prototype.RefreshState = function()
 
64
{
 
65
        if ( ! this.IsVisible ) return ;
 
66
        
 
67
        for ( var i = 0 ; i < this.Items.length ; i++ )
 
68
        {
 
69
                this.Items[i].RefreshState() ;
 
70
        }
 
71
}
 
 
b'\\ No newline at end of file'