~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/fckscriptloader.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
 * This is a utility object which can be used to load specific components of
 
22
 * FCKeditor, including all dependencies.
 
23
 */
 
24
 
 
25
var FCK_GENERIC = 1 ;
 
26
var FCK_GENERIC_SPECIFIC = 2 ;
 
27
var FCK_SPECIFIC = 3 ;
 
28
 
 
29
var FCKScriptLoader = new Object() ;
 
30
FCKScriptLoader.FCKeditorPath = '/fckeditor/' ;
 
31
 
 
32
FCKScriptLoader._Scripts = new Object() ;
 
33
FCKScriptLoader._LoadedScripts = new Object() ;
 
34
 
 
35
FCKScriptLoader._IsIE = (/msie/).test( navigator.userAgent.toLowerCase() ) ;
 
36
 
 
37
FCKScriptLoader.Load = function( scriptName )
 
38
{
 
39
        // Check if the script has already been loaded.
 
40
        if ( scriptName in FCKScriptLoader._LoadedScripts )
 
41
                return ;
 
42
 
 
43
        var oScriptInfo = this._Scripts[ scriptName ] ;
 
44
 
 
45
        if ( !oScriptInfo )
 
46
        {
 
47
                alert( 'FCKScriptLoader: The script "' + scriptName + '" could not be loaded' ) ;
 
48
                return ;
 
49
        }
 
50
 
 
51
        for ( var i = 0 ; i < oScriptInfo.Dependency.length ; i++ )
 
52
        {
 
53
                this.Load( oScriptInfo.Dependency[i] ) ;
 
54
        }
 
55
 
 
56
        var sBaseScriptName = oScriptInfo.BasePath + scriptName.toLowerCase() ;
 
57
 
 
58
        if ( oScriptInfo.Compatibility == FCK_GENERIC || oScriptInfo.Compatibility == FCK_GENERIC_SPECIFIC )
 
59
                this._LoadScript( sBaseScriptName + '.js' ) ;
 
60
 
 
61
        if ( oScriptInfo.Compatibility == FCK_SPECIFIC || oScriptInfo.Compatibility == FCK_GENERIC_SPECIFIC )
 
62
        {
 
63
                if ( this._IsIE )
 
64
                        this._LoadScript( sBaseScriptName + '_ie.js' ) ;
 
65
                else
 
66
                        this._LoadScript( sBaseScriptName + '_gecko.js' ) ;
 
67
        }
 
68
 
 
69
        FCKScriptLoader._LoadedScripts[ scriptName ] = true ;
 
70
}
 
71
 
 
72
FCKScriptLoader._LoadScript = function( scriptPathFromSource )
 
73
{
 
74
        document.write( '<script type="text/javascript" src="' + this.FCKeditorPath + 'editor/_source/' + scriptPathFromSource + '" onerror="alert(\'Error loading \' + scriptPathFromSource);"><\/script>' ) ;
 
75
}
 
76
 
 
77
FCKScriptLoader.AddScript = function( scriptName, scriptBasePath, dependency, compatibility )
 
78
{
 
79
        this._Scripts[ scriptName ] =
 
80
        {
 
81
                BasePath : scriptBasePath || '',
 
82
                Dependency : dependency || [],
 
83
                Compatibility : compatibility || FCK_GENERIC
 
84
        } ;
 
85
}
 
86
 
 
87
/*
 
88
 * ####################################
 
89
 * ### Scripts Definition List
 
90
 */
 
91
 
 
92
FCKScriptLoader.AddScript( 'FCKConstants' ) ;
 
93
FCKScriptLoader.AddScript( 'FCKJSCoreExtensions' ) ;
 
94
FCKScriptLoader.AddScript( 'FCKImagePreloader'  , 'classes/' ) ;
 
95
FCKScriptLoader.AddScript( 'FCKBrowserInfo'             , 'internals/'  , ['FCKJSCoreExtensions'] ) ;
 
96
FCKScriptLoader.AddScript( 'FCKConfig'                  , 'internals/' ) ;
 
97
FCKScriptLoader.AddScript( 'FCKListsLib'                , 'internals/' ) ;
 
98
FCKScriptLoader.AddScript( 'FCKDebug'                   , 'internals/'  , ['FCKConfig'] ) ;
 
99
FCKScriptLoader.AddScript( 'FCKDomTools'                , 'internals/'  , ['FCKJSCoreExtensions'], FCK_GENERIC ) ;
 
100
FCKScriptLoader.AddScript( 'FCKTools'                   , 'internals/'  , ['FCKJSCoreExtensions','FCKBrowserInfo'], FCK_GENERIC_SPECIFIC ) ;
 
101
FCKScriptLoader.AddScript( 'FCKElementPath'             , 'classes/'    , ['FCKListsLib'], FCK_GENERIC ) ;
 
102
FCKScriptLoader.AddScript( 'FCKDocumentFragment', 'classes/'    , ['FCKDomTools'], FCK_SPECIFIC ) ;
 
103
FCKScriptLoader.AddScript( 'FCKDomRange'                , 'classes/'    , ['FCKBrowserInfo','FCKJSCoreExtensions','FCKW3CRange','FCKElementPath','FCKDomTools','FCKTools','FCKDocumentFragment'], FCK_GENERIC_SPECIFIC ) ;
 
104
FCKScriptLoader.AddScript( 'FCKEnterKey'                , 'classes/'    , ['FCKDomRange','FCKDomTools','FCKTools','FCKKeystrokeHandler','FCKListHandler'], FCK_GENERIC ) ;
 
105
FCKScriptLoader.AddScript( 'FCKKeystrokeHandler', 'classes/'    , ['FCKConstants','FCKBrowserInfo','FCKTools'], FCK_GENERIC ) ;
 
106
FCKScriptLoader.AddScript( 'FCKListHandler'             , 'internals/'  , ['FCKJSCoreExtensions','FCKDomTools','FCKTools'], FCK_GENERIC ) ;
 
107
FCKScriptLoader.AddScript( 'FCKW3CRange'                , 'classes/'    , ['FCKDomTools','FCKTools','FCKDocumentFragment'], FCK_GENERIC ) ;
 
108
// ####################################
 
 
b'\\ No newline at end of file'