Select Git revision
lib_files.js
-
Robin Appelman authored
fixes https://bugs.kde.org/show_bug.cgi?id=259616
Robin Appelman authoredfixes https://bugs.kde.org/show_bug.cgi?id=259616
lib_files.js 12.57 KiB
/**
* ownCloud - ajax frontend
*
* @author Robin Appelman
* @copyright 2010 Robin Appelman icewind1991@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC_FILES=new Object();
OC_FILES.cache=new Object();
OC_FILES.cache.files=Array();
OC_FILES.cache.incomplete=Array();
OC_FILES.cache.actions=new Object();
OC_FILES.cache.actions.move=Array();
OC_FILES.cache.actions.rename=Array();
OC_FILES.cache.actions['new']=Array();
OC_FILES.cache.actions['delete']=Array();
OC_FILES.cache.actions.upload=Array();
OC_FILES.cache.refresh=function(){
OC_FILES.getdirectorycontent(OC_FILES.dir,false,true);
}
OC_FILES.xmlloader=new OCXMLLoader();
OC_FILES.getdirectorycontent_parse=function(req){
var files=new Array();
var json=eval('('+req.responseText+')');
OC_FILES.cache.files=Array();
if(json){
for(var name in json){
if(name!='__max_upload'){
var file=new Array();
var attributes=Array('size','name','type','directory','date','mime');
for(var i in attributes){
var attributeName=attributes[i];
file[attributeName]=json[name][attributeName];
}
files[file.name]=file;
}
}
OC_FILES.cache.files=files;
if(OC_FILES.cache.incomplete[OC_FILES.dir]){
files=arrayMerge(files,OC_FILES.cache.incomplete[OC_FILES.dir]);
}
files['max_upload']=json['__max_upload'];
if(OC_FILES.getdirectorycontent_callback){
OC_FILES.getdirectorycontent_callback(files);
}
}
}
OC_FILES.getdirectorycontent=function(dir,callback,refresh){
if(refresh || OC_FILES.dir!=dir){