[ Index ]
 

Code source de Seagull 0.6.1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tinyfck/filemanager/js/ -> fckxml.js (source)

   1  /*

   2   * FCKeditor - The text editor for internet

   3   * Copyright (C) 2003-2005 Frederico Caldeira Knabben

   4   * 

   5   * Licensed under the terms of the GNU Lesser General Public License:

   6   *         http://www.opensource.org/licenses/lgpl-license.php

   7   * 

   8   * For further information visit:

   9   *         http://www.fckeditor.net/

  10   * 

  11   * "Support Open Source software. What about a donation today?"

  12   * 

  13   * File Name: fckxml.js

  14   *     Defines the FCKXml object that is used for XML data calls

  15   *     and XML processing.

  16   *     This script is shared by almost all pages that compose the 

  17   *     File Browser frameset.

  18   * 

  19   * File Authors:

  20   *         Frederico Caldeira Knabben (fredck@fckeditor.net)

  21   */
  22  
  23  var FCKXml = function()
  24  {}
  25  
  26  FCKXml.prototype.GetHttpRequest = function()
  27  {
  28      if ( window.XMLHttpRequest )        // Gecko
  29          return new XMLHttpRequest() ;
  30      else if ( window.ActiveXObject )    // IE
  31          return new ActiveXObject("MsXml2.XmlHttp") ;
  32  }
  33  
  34  FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer )
  35  {
  36      var oFCKXml = this ;
  37  
  38      var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ;
  39  
  40      var oXmlHttp = this.GetHttpRequest() ;
  41          
  42      oXmlHttp.open( "GET", urlToCall, bAsync ) ;
  43      
  44      if ( bAsync )
  45      {    
  46          oXmlHttp.onreadystatechange = function() 
  47          {
  48              if ( oXmlHttp.readyState == 4 )
  49              {
  50                  oFCKXml.DOMDocument = oXmlHttp.responseXML ;
  51                  if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
  52                      asyncFunctionPointer( oFCKXml ) ;
  53                  else
  54                      alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
  55              }
  56          }
  57      }
  58      
  59      oXmlHttp.send( null ) ;
  60      
  61      if ( ! bAsync )
  62      {
  63          if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
  64              this.DOMDocument = oXmlHttp.responseXML ;
  65          else
  66          {
  67              alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
  68          }
  69      }
  70  }
  71  
  72  FCKXml.prototype.SelectNodes = function( xpath )
  73  {
  74      if ( document.all )        // IE
  75          return this.DOMDocument.selectNodes( xpath ) ;
  76      else                    // Gecko
  77      {
  78          var aNodeArray = new Array();
  79  
  80          var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument, 
  81                  this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
  82          if ( xPathResult ) 
  83          {
  84              var oNode = xPathResult.iterateNext() ;
  85               while( oNode )
  86               {
  87                   aNodeArray[aNodeArray.length] = oNode ;
  88                   oNode = xPathResult.iterateNext();
  89               }
  90          } 
  91          return aNodeArray ;
  92      }
  93  }
  94  
  95  FCKXml.prototype.SelectSingleNode = function( xpath ) 
  96  {
  97      if ( document.all )        // IE
  98          return this.DOMDocument.selectSingleNode( xpath ) ;
  99      else                    // Gecko
 100      {
 101          var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
 102                  this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
 103  
 104          if ( xPathResult && xPathResult.singleNodeValue )
 105              return xPathResult.singleNodeValue ;
 106          else    
 107              return null ;
 108      }
 109  }


Généré le : Fri Mar 30 01:27:52 2007 par Balluche grâce à PHPXref 0.7