!import
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is TransforMiiX XSLT processor code.
16 *
17 * The Initial Developer of the Original Code is
18 * Axel Hecht.
19 * Portions created by the Initial Developer are Copyright (C) 2002
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * Axel Hecht <axel@pike.org>
24 * Peter Van der Beken <peterv@propagandism.org>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 // helper function to shortcut component creation
doCreate
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
41 function doCreate(aContract, aInterface)
42 {
43 return Components.classes[aContract].createInstance(aInterface);
44 }
45
46 // for the items, loading a text file
47 const IOSERVICE_CTRID = "@mozilla.org/network/io-service;1";
48 const nsIIOService = Components.interfaces.nsIIOService;
49 const SIS_CTRID = "@mozilla.org/scriptableinputstream;1"
50 const nsISIS = Components.interfaces.nsIScriptableInputStream;
51
52 // rdf foo, onload handler
53 const kRDFSvcContractID = "@mozilla.org/rdf/rdf-service;1";
54 const kRDFInMemContractID =
55 "@mozilla.org/rdf/datasource;1?name=in-memory-datasource";
56 const kRDFContUtilsID = "@mozilla.org/rdf/container-utils;1";
57 const kRDFXMLSerializerID = "@mozilla.org/rdf/xml-serializer;1";
58 const kIOSvcContractID = "@mozilla.org/network/io-service;1";
59 const kStandardURL = Components.classes["@mozilla.org/network/standard-url;1"];
60 const nsIURL = Components.interfaces.nsIURL;
61 const nsIStandardURL = Components.interfaces.nsIStandardURL;
62 const nsIFilePicker = Components.interfaces.nsIFilePicker;
63 const nsIXULTreeBuilder = Components.interfaces.nsIXULTreeBuilder;
64 const nsIXULTemplateBuilder = Components.interfaces.nsIXULTemplateBuilder;
65 const kIOSvc = Components.classes[kIOSvcContractID]
66 .getService(Components.interfaces.nsIIOService);
67 const nsIRDFService = Components.interfaces.nsIRDFService;
68 const nsIRDFDataSource = Components.interfaces.nsIRDFDataSource;
69 const nsIRDFRemoteDataSource = Components.interfaces.nsIRDFRemoteDataSource;
70 const nsIRDFPurgeableDataSource =
71 Components.interfaces.nsIRDFPurgeableDataSource;
72 const nsIRDFResource = Components.interfaces.nsIRDFResource;
73 const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
74 const nsIRDFInt = Components.interfaces.nsIRDFInt;
75 const nsIRDFContainerUtils = Components.interfaces.nsIRDFContainerUtils;
76 const nsIRDFXMLSerializer = Components.interfaces.nsIRDFXMLSerializer;
77 const nsIRDFXMLSource = Components.interfaces.nsIRDFXMLSource;
78 const kRDFSvc =
79 Components.classes[kRDFSvcContractID].getService(nsIRDFService);
80 const krTypeCat = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#category");
81 const krTypeFailCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#failCount");
82 const krTypeName = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#name");
83 const krTypeSucc = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#succ");
84 const krTypeOrigSucc = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_succ");
85 const krTypeOrigFailCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_failCount");
86 const krTypeOrigSuccCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_succCount");
87 const krTypePath = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#path");
88 const krTypeParent = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#parent");
89 const krTypePurp = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#purp");
90 const krTypeSuccCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#succCount");
91 const kGood = kRDFSvc.GetLiteral("yes");
92 const kBad = kRDFSvc.GetLiteral("no");
93 const kMixed = kRDFSvc.GetLiteral("+-");
94 const kContUtils = doCreate(kRDFContUtilsID, nsIRDFContainerUtils);
95
doCreateRDFFP
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
96 function doCreateRDFFP(aTitle, aMode)
97 {
98 var fp = doCreate("@mozilla.org/filepicker;1", nsIFilePicker);
99 fp.init(window, aTitle, aMode);
100 fp.appendFilter('*.rdf', '*.rdf');
101 fp.appendFilters(nsIFilePicker.filterAll);
102 return fp;
103 }
104
goDoCommand
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
105 function goDoCommand(aCommand)
106 {
107 try {
108 var controller =
109 top.document.commandDispatcher.getControllerForCommand(aCommand);
110 if (controller && controller.isCommandEnabled(aCommand))
111 controller.doCommand(aCommand);
112 }
113 catch(e) {
114 dump("An error "+e+" occurred executing the "+aCommand+" command\n");
115 }
116 }
117
registerController
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
118 function registerController(aController)
119 {
120 top.controllers.appendController(aController);
121 }