cyrilleinvalides/choupas/www/admin/editor/scripts/fileobject.js

126 lines
1.8 KiB
JavaScript
Executable File

/*
object browser(url) { // url est l'adresse du script conforme à la norme de dialogue machine2m dadisoft pour les fichier qui implemente l'interface.
xmlString browse(dir)
}
*/
function DSbrowser(url, uploadmod) {
if (!url.test('?')) url += '?';
/* variables d'initialisation */
this.gateway = url;
this.flashO = uploadmod;
/* evenements */
this.onprogress = null;
this.onfileselect = null;
this.onfilesupload = null;
/* données internes */
this.files = new Array();
/* variables local */
var self = this;
/************/
/* Methodes */
/************/
this.getO = function () {
return document[this.flashO]
}
this.onFileSelect = function (name, total) {
this.files[name]['up'] = 0;
this.files[name]['total'] = total;
if (this.onfileselect) this.onfileselect(name, total);
}
/* appelée lors de l'évenement du flash object filReference onProgress */
this.onFileProgress = function (name, upped, total) {
this.files[name]['up'] = upped;
this.files[name]['total'] = total;
if (this.onprogress) this.onprogress(name, upped, total);
}
this.browseForUp = function () {
if (!this.flashO) {
alert("pas d'objet flash detecté !");
return false;
}
this.getO().parcourir();
return true;
}
function upload() {
if (!this.flashO) {
alert("pas d'objet flash detecté !");
return false;
}
if (this.onfilesupload) this.onfilesupload();
this.flashO.upload(this.gateway + "action=upload");
return true;
}
function download() {
}
function write(file, content) {
}
function append() {
}
function read() {
}
function writeHex() {
}
function readHex() {
}
function browse() {
}
function newFile() {
}
function mkDir() {
}
function delete() {
}
function rename() {
}
}