~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/FCK/editor/_source/classes/fcktoolbarfontformatcombo.js

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 * FCKToolbarPanelButton Class: Handles the Fonts combo selector.
 
22
 */
 
23
 
 
24
var FCKToolbarFontFormatCombo = function( tooltip, style )
 
25
{
 
26
        this.CommandName = 'FontFormat' ;
 
27
        this.Label              = this.GetLabel() ;
 
28
        this.Tooltip    = tooltip ? tooltip : this.Label ;
 
29
        this.Style              = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
 
30
 
 
31
        this.NormalLabel = 'Normal' ;
 
32
 
 
33
        this.PanelWidth = 190 ;
 
34
}
 
35
 
 
36
// Inherit from FCKToolbarSpecialCombo.
 
37
FCKToolbarFontFormatCombo.prototype = new FCKToolbarSpecialCombo ;
 
38
 
 
39
 
 
40
FCKToolbarFontFormatCombo.prototype.GetLabel = function()
 
41
{
 
42
        return FCKLang.FontFormat ;
 
43
}
 
44
 
 
45
FCKToolbarFontFormatCombo.prototype.CreateItems = function( targetSpecialCombo )
 
46
{
 
47
        var oTargetDoc = targetSpecialCombo._Panel.Document ;
 
48
 
 
49
        // Add the Editor Area CSS to the panel to create a realistic preview.
 
50
        FCKTools.AppendStyleSheet( oTargetDoc, FCKConfig.ToolbarComboPreviewCSS ) ;
 
51
 
 
52
        // Add ID and Class to the body
 
53
        if ( FCKConfig.BodyId && FCKConfig.BodyId.length > 0 )
 
54
                oTargetDoc.body.id = FCKConfig.BodyId ;
 
55
        if ( FCKConfig.BodyClass && FCKConfig.BodyClass.length > 0 )
 
56
                oTargetDoc.body.className += ' ' + FCKConfig.BodyClass ;
 
57
 
 
58
        // Get the format names from the language file.
 
59
        var aNames = FCKLang['FontFormats'].split(';') ;
 
60
        var oNames = {
 
61
                p               : aNames[0],
 
62
                pre             : aNames[1],
 
63
                address : aNames[2],
 
64
                h1              : aNames[3],
 
65
                h2              : aNames[4],
 
66
                h3              : aNames[5],
 
67
                h4              : aNames[6],
 
68
                h5              : aNames[7],
 
69
                h6              : aNames[8],
 
70
                div             : aNames[9]
 
71
        } ;
 
72
 
 
73
        // Get the available formats from the configuration file.
 
74
        var aTags = FCKConfig.FontFormats.split(';') ;
 
75
 
 
76
        for ( var i = 0 ; i < aTags.length ; i++ )
 
77
        {
 
78
                // Support for DIV in Firefox has been reintroduced on version 2.2.
 
79
//              if ( aTags[i] == 'div' && FCKBrowserInfo.IsGecko )
 
80
//                      continue ;
 
81
 
 
82
                var sTag        = aTags[i] ;
 
83
                var sLabel      = oNames[sTag] ;
 
84
 
 
85
                if ( sTag == 'p' )
 
86
                        this.NormalLabel = sLabel ;
 
87
 
 
88
                this._Combo.AddItem( sTag, '<div class="BaseFont"><' + sTag + '>' + sLabel + '</' + sTag + '></div>', sLabel ) ;
 
89
        }
 
90
}
 
91
 
 
92
if ( FCKBrowserInfo.IsIE )
 
93
{
 
94
        FCKToolbarFontFormatCombo.prototype.RefreshActiveItems = function( combo, value )
 
95
        {
 
96
//              FCKDebug.Output( 'FCKToolbarFontFormatCombo Value: ' + value ) ;
 
97
 
 
98
                // IE returns normal for DIV and P, so to avoid confusion, we will not show it if normal.
 
99
                if ( value == this.NormalLabel )
 
100
                {
 
101
                        if ( combo.Label != '&nbsp;' )
 
102
                                combo.DeselectAll(true) ;
 
103
                }
 
104
                else
 
105
                {
 
106
                        if ( this._LastValue == value )
 
107
                                return ;
 
108
 
 
109
                        combo.SelectItemByLabel( value, true ) ;
 
110
                }
 
111
 
 
112
                this._LastValue = value ;
 
113
        }
 
114
}
 
 
b'\\ No newline at end of file'