/*----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License.You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Fever Framework code. The Initial Developer of the Original Code is Romain Ecarnot. Portions created by Initial Developer are Copyright (C) 2006 the Initial Developer. All Rights Reserved. Contributor(s): Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -----------------------------------------------------------------------------*/ var phpBridge = "PHPJSBridge.php"; function getXhr() { var xhr = null; if( window.XMLHttpRequest ) xhr = new XMLHttpRequest(); else if( window.ActiveXObject ) { try { xhr = new ActiveXObject( "Msxml2.XMLHTTP" ); } catch (e) { xhr = new ActiveXObject( "Microsoft.XMLHTTP" ); } } else { alert( "Votre navigateur ne supporte pas les objets XMLHTTPRequest..." ); xhr = false; } xhr.open( "POST", phpBridge, false ); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); return xhr } function getContent() { var xhr = getXhr(); xhr.send( "command=getContent" ); return xhr.responseText; } function isDirectory( path ) { var xhr = getXhr(); xhr.send( "command=isDirectory&path=" + path ); var result = xhr.responseText; return result == '1'; } function createDirectory( path ) { var xhr = getXhr(); xhr.send( "command=createDirectory&path=" + path ); var result = xhr.responseText; return result == '1'; } function deleteDirectory( path ) { var xhr = getXhr(); xhr.send( "command=deleteDirectory&path=" + path ); var result = xhr.responseText; return result == '1'; } function renameDirectory( path, newName ) { var xhr = getXhr(); xhr.send( "command=renameDirectory&path=" + path + "&newName=" + newName ); var result = xhr.responseText; return result == '1'; } function isFile( path ) { var xhr = getXhr(); xhr.send( "command=isFile&path=" + path ); var result = xhr.responseText; return result == '1'; } function deleteFile( path ) { var xhr = getXhr(); xhr.send( "command=deleteFile&path=" + path ); var result = xhr.responseText; return result == '1'; } function renameFile( path, newName ) { var xhr = getXhr(); xhr.send( "command=renameFile&path=" + path + "&newName=" + newName ); var result = xhr.responseText; return result == '1'; } function readFile( path ) { var xhr = getXhr(); xhr.send( "command=readFileContent&path=" + path ); return xhr.responseText; } function writeToFile( data, path ) { var xhr = getXhr(); xhr.send( "command=writeToFile&path=" + path + "&data=" + data ); var result = xhr.responseText; return result == '1'; } function appendToFile( data, path ) { var xhr = getXhr(); xhr.send( "command=appendToFile&path=" + path + "&data=" + data ); var result = xhr.responseText; return result == '1'; }