import rt 3.8.7
[freeside.git] / rt / share / html / NoAuth / RichText / FCKeditor / editor / _source / classes / fckxml_ie.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  * FCKXml Class: class to load and manipulate XML files.\r
22  * (IE specific implementation)\r
23  */\r
24 \r
25 FCKXml.prototype =\r
26 {\r
27         LoadUrl : function( urlToCall )\r
28         {\r
29                 this.Error = false ;\r
30 \r
31                 var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;\r
32 \r
33                 if ( !oXmlHttp )\r
34                 {\r
35                         this.Error = true ;\r
36                         return ;\r
37                 }\r
38 \r
39                 oXmlHttp.open( "GET", urlToCall, false ) ;\r
40 \r
41                 oXmlHttp.send( null ) ;\r
42 \r
43                 if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 || ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 ) )\r
44                 {\r
45                         this.DOMDocument = oXmlHttp.responseXML ;\r
46 \r
47                         // #1426: Fallback if responseXML isn't set for some\r
48                         // reason (e.g. improperly configured web server)\r
49                         if ( !this.DOMDocument || this.DOMDocument.firstChild == null )\r
50                         {\r
51                                 this.DOMDocument = FCKTools.CreateXmlObject( 'DOMDocument' ) ;\r
52                                 this.DOMDocument.async = false ;\r
53                                 this.DOMDocument.resolveExternals = false ;\r
54                                 this.DOMDocument.loadXML( oXmlHttp.responseText ) ;\r
55                         }\r
56                 }\r
57                 else\r
58                 {\r
59                         this.DOMDocument = null ;\r
60                 }\r
61 \r
62                 if ( this.DOMDocument == null || this.DOMDocument.firstChild == null )\r
63                 {\r
64                         this.Error = true ;\r
65                         if (window.confirm( 'Error loading "' + urlToCall + '"\r\nDo you want to see more info?' ) )\r
66                                 alert( 'URL requested: "' + urlToCall + '"\r\n' +\r
67                                                         'Server response:\r\nStatus: ' + oXmlHttp.status + '\r\n' +\r
68                                                         'Response text:\r\n' + oXmlHttp.responseText ) ;\r
69                 }\r
70         },\r
71 \r
72         SelectNodes : function( xpath, contextNode )\r
73         {\r
74                 if ( this.Error )\r
75                         return new Array() ;\r
76 \r
77                 if ( contextNode )\r
78                         return contextNode.selectNodes( xpath ) ;\r
79                 else\r
80                         return this.DOMDocument.selectNodes( xpath ) ;\r
81         },\r
82 \r
83         SelectSingleNode : function( xpath, contextNode )\r
84         {\r
85                 if ( this.Error )\r
86                         return null ;\r
87 \r
88                 if ( contextNode )\r
89                         return contextNode.selectSingleNode( xpath ) ;\r
90                 else\r
91                         return this.DOMDocument.selectSingleNode( xpath ) ;\r
92         }\r
93 } ;\r