import rt 3.8.7
[freeside.git] / rt / share / html / NoAuth / RichText / FCKeditor / editor / _source / classes / fckplugin.js
1 /*\r
2  * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
3  * Copyright (C) 2003-2009 Frederico Caldeira Knabben\r
4  *\r
5  * == BEGIN LICENSE ==\r
6  *\r
7  * Licensed under the terms of any of the following licenses at your\r
8  * choice:\r
9  *\r
10  *  - GNU General Public License Version 2 or later (the "GPL")\r
11  *    http://www.gnu.org/licenses/gpl.html\r
12  *\r
13  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
14  *    http://www.gnu.org/licenses/lgpl.html\r
15  *\r
16  *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
17  *    http://www.mozilla.org/MPL/MPL-1.1.html\r
18  *\r
19  * == END LICENSE ==\r
20  *\r
21  * FCKPlugin Class: Represents a single plugin.\r
22  */\r
23 \r
24 var FCKPlugin = function( name, availableLangs, basePath )\r
25 {\r
26         this.Name = name ;\r
27         this.BasePath = basePath ? basePath : FCKConfig.PluginsPath ;\r
28         this.Path = this.BasePath + name + '/' ;\r
29 \r
30         if ( !availableLangs || availableLangs.length == 0 )\r
31                 this.AvailableLangs = new Array() ;\r
32         else\r
33                 this.AvailableLangs = availableLangs.split(',') ;\r
34 }\r
35 \r
36 FCKPlugin.prototype.Load = function()\r
37 {\r
38         // Load the language file, if defined.\r
39         if ( this.AvailableLangs.length > 0 )\r
40         {\r
41                 var sLang ;\r
42 \r
43                 // Check if the plugin has the language file for the active language.\r
44                 if ( this.AvailableLangs.IndexOf( FCKLanguageManager.ActiveLanguage.Code ) >= 0 )\r
45                         sLang = FCKLanguageManager.ActiveLanguage.Code ;\r
46                 else\r
47                         // Load the default language file (first one) if the current one is not available.\r
48                         sLang = this.AvailableLangs[0] ;\r
49 \r
50                 // Add the main plugin script.\r
51                 LoadScript( this.Path + 'lang/' + sLang + '.js' ) ;\r
52         }\r
53 \r
54         // Add the main plugin script.\r
55         LoadScript( this.Path + 'fckplugin.js' ) ;\r
56 }\r