Annotation of kupuMPIWG/common/kupustart_multi.js, revision 1.1.1.1
1.1 dwinter 1: /*****************************************************************************
2: *
3: * Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
4: *
5: * This software is distributed under the terms of the Kupu
6: * License. See LICENSE.txt for license text. For a list of Kupu
7: * Contributors see CREDITS.txt.
8: *
9: *****************************************************************************/
10:
11: // $Id$
12:
13: function startKupu() {
14: // initialize the editor, this version groks an array of iframeids
15: var iframeids = new Array('kupu_1', 'kupu_2', 'kupu_3');
16: var kupu = initKupu(iframeids);
17:
18: // if there's no global 'i18n_message_catalog' variable available, don't
19: // try to load any translations
20: if (!window.i18n_message_catalog) {
21: continueStartKupu(kupu);
22: return kupu;
23: };
24: // loading will be done asynchronously (to keep Mozilla from freezing)
25: // so we'll continue in a follow-up function (continueStartKupu() below)
26: var handler = function(request) {
27: if (this.readyState == 4) {
28: var status = this.status;
29: if (status != '200') {
30: alert(_('Error loading translation (status ${status} ' +
31: '), falling back to english'), {'status': status});
32: continueStartKupu(kupu);
33: return;
34: };
35: var dom = this.responseXML;
36: window.i18n_message_catalog.initialize(dom);
37: continueStartKupu(kupu);
38: };
39: };
40: var request = new XMLHttpRequest();
41: request.onreadystatechange = (new ContextFixer(handler, request)).execute;
42: request.open('GET', 'kupu.pox', true);
43: request.send('');
44:
45: // we need to return a reference to the editor here for certain 'external'
46: // stuff, developers should note that it's not yet initialized though, we
47: // need to wait for i18n data before we can do that
48: return kupu;
49: };
50:
51: function continueStartKupu(kupu) {
52: kupu.initialize();
53:
54: return kupu;
55: };
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>