aboutsummaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorFrank Karlitschek <karlitschek@kde.org>2011-08-13 15:19:40 +0200
committerFrank Karlitschek <karlitschek@kde.org>2011-08-13 15:19:40 +0200
commit9ac084d0b89b3f2d4a86e1c73a2017bd67c4284d (patch)
tree3a7eb972c3478c0d758423252c8997bded997ce1 /js
parent93bc69011b7a89a654732496f872a248b69c78c2 (diff)
downloadnextcloud-server-9ac084d0b89b3f2d4a86e1c73a2017bd67c4284d.tar.gz
nextcloud-server-9ac084d0b89b3f2d4a86e1c73a2017bd67c4284d.zip
remove for now. main repository is at projects.kde.org/owncloud
Diffstat (limited to 'js')
-rw-r--r--js/ajax.js23
-rw-r--r--js/filebrowser.js578
-rw-r--r--js/lib_ajax.js237
-rw-r--r--js/lib_api.js34
-rw-r--r--js/lib_drag.js348
-rw-r--r--js/lib_event.js48
-rw-r--r--js/lib_files.js412
-rw-r--r--js/lib_notification.js48
-rw-r--r--js/lib_timer.js52
-rw-r--r--js/lib_xmlloader.js154
10 files changed, 0 insertions, 1934 deletions
diff --git a/js/ajax.js b/js/ajax.js
deleted file mode 100644
index 534dd46a290..00000000000
--- a/js/ajax.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
-* 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_onload.add(OC_FILES.browser.showInitial); \ No newline at end of file
diff --git a/js/filebrowser.js b/js/filebrowser.js
deleted file mode 100644
index d0232fa741f..00000000000
--- a/js/filebrowser.js
+++ /dev/null
@@ -1,578 +0,0 @@
-/**
-* 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.browser=new Object();
-
-OC_FILES.browser.showInitial=function(){
- if(document.getElementById('content')){
- var dir=''
- var loc=document.location.toString();
- if(loc.indexOf('#')!=-1){
- dir=loc.substring(loc.indexOf('#')+1);
- }
- OC_FILES.getdirectorycontent(dir,OC_FILES.browser.show_callback,true);
- }
-}
-
-OC_FILES.browser.show=function(dir,forceReload){
- if(!dir || !dir.split){
- dir='';
- }
- OC_FILES.getdirectorycontent(dir,OC_FILES.browser.show_callback,forceReload);
-}
-
-OC_FILES.browser.breadcrumb=new Object();
-OC_FILES.browser.breadcrumb.node=null;
-OC_FILES.browser.breadcrumb.crumbs=Array();
-OC_FILES.browser.breadcrumb.show=function(parent,path){
- if((!OC_FILES.browser.breadcrumb.node==parent && parent) || OC_FILES.browser.breadcrumb.node==null){
- OC_FILES.browser.breadcrumb.clear();
- OC_FILES.browser.breadcrumb.node=parent;
- OC_FILES.browser.breadcrumb.add('Home','/');
- }
- var dirs=path.split('/');
- var currentPath='/';
- var paths=Array();
- var currentPath;
- if(dirs.length>0){
- for(var i=0;i<dirs.length;i++){
- dir=dirs[i];
- if(dir){
- currentPath+=dir+'/';
- paths[currentPath]=true;
- if(!OC_FILES.browser.breadcrumb.crumbs[currentPath]){
- OC_FILES.browser.breadcrumb.add(dir,currentPath);
- }
- }
- }
- }
- //remove all crumbs that are not part of our current path
- for(currentPath in OC_FILES.browser.breadcrumb.crumbs){
- if(!paths[currentPath] && currentPath!='/'){
- OC_FILES.browser.breadcrumb.remove(currentPath);
- }
- }
-
-}
-OC_FILES.browser.breadcrumb.add=function(name,path){
- var a=document.createElement('a');
- var div=document.createElement('div');
- OC_FILES.browser.breadcrumb.crumbs[path]=div;
- div.className='breadcrumb';
- a.setAttribute('href','#'+path);
- a.addEvent('onclick',OC_FILES.browser.show,path);
- img=document.createElement('img');
- img.src=WEBROOT+'/img/arrow.png';
- a.appendChild(document.createTextNode(' ' +name));
- a.appendChild(img);
- OC_FILES.files[path]=new OC_FILES.file('',path,'dir');
- div.makeDropTarget();
- div.file=OC_FILES.files[path];
- div.addEvent('ondropon',OC_FILES.browser.handleDropOn);
- div.appendChild(a);
-
- OC_FILES.browser.breadcrumb.node.appendChild(div);
-}
-OC_FILES.browser.breadcrumb.remove=function(path){
- if(OC_FILES.browser.breadcrumb.crumbs[path]){
- var div=OC_FILES.browser.breadcrumb.crumbs[path];
- if(div.parentNode){
- div.parentNode.removeChild(div);
- }
- delete OC_FILES.browser.breadcrumb.crumbs[path];
- }
-}
-OC_FILES.browser.breadcrumb.clear=function(){
- for(path in OC_FILES.browser.breadcrumb.crumbs){
- OC_FILES.browser.breadcrumb.remove(path);
- }
-}
-
-OC_FILES.browser.files=new Object();
-OC_FILES.browser.files.fileNodes=Array();
-OC_FILES.browser.files.node=null;
-OC_FILES.browser.files.tbody=null;
-OC_FILES.browser.files.show=function(parent,fileList){
- if(parent){
- OC_FILES.browser.files.node=parent;
- }
- var table=document.createElement('table');
- OC_FILES.browser.files.node.appendChild(table);
- var tbody=document.createElement('tbody');
- OC_FILES.browser.files.tbody=tbody;
- table.appendChild(tbody);
- table.setAttribute('cellpadding',6);
- table.setAttribute('cellspacing',0);
- if(fileList){
- var name;
- //remove files that no longer are in the folder
- for(name in OC_FILES.browser.files.fileNodes){
- if(!fileList[name]){
- OC_FILES.browser.files.remove(name);
- }
- }
- //add the files that arent in the list yet
- for(name in fileList){
- file=fileList[name];
- if(!OC_FILES.browser.files.fileNodes[file.name]){
- OC_FILES.browser.files.add(file.name,file.type,file.size,file.date,file.mime);
- }
- }
- }
-}
-OC_FILES.browser.files.add=function(name,type,size,date,mime){
- if(name){
- if(!size) size=0;
- if(!date) date=getTimeString();
- OC_FILES.files[name]=new OC_FILES.file(OC_FILES.dir,name,type,mime);
- tr=document.createElement('tr');
- OC_FILES.browser.files.fileNodes[name]=tr;
- OC_FILES.browser.files.tbody.appendChild(tr);
- tr.className='browserline';
- td=document.createElement('td');
- tr.appendChild(td);
- td.className='fileSelector';
- input=document.createElement('input');
- input.setAttribute('type','checkbox');
- input.setAttribute('name','fileSelector');
- input.setAttribute('value',name);
- td.appendChild(input);
- tr.appendChild(OC_FILES.browser.showicon(type));
- td=document.createElement('td');
- tr.appendChild(td);
- td.makeDropTarget();
- td.addEvent('ondropon',OC_FILES.browser.handleDropOn);
- td.className='nametext';
- td.setAttribute('name',name);
- td.setAttribute('id',name);
- var fileObject=OC_FILES.files[name];
- td.file=fileObject;
- a=document.createElement('a');
- td.appendChild(a);
- a.appendChild(document.createTextNode(name));
- a.addEvent('onclick',fileObject.actions['default'].bindScope(fileObject));
- a.makeDraggable();
- a.addEvent('ondrop',OC_FILES.browser.handleDrop);
- if(type=='dir'){
- td.setAttribute('colspan',2);
- var dirname=name;
- if(OC_FILES.dir[OC_FILES.dir.length-1]!='/'){
- dirname='/'+name;
- }
- a.setAttribute('href','#'+OC_FILES.dir+dirname);
- }else{
- a.setAttribute('href','#'+OC_FILES.dir);
- if(!SMALLSCREEN){
- sizeTd=document.createElement('td');
- tr.appendChild(sizeTd);
- sizeTd.className='sizetext';
- sizeTd.appendChild(document.createTextNode(sizeFormat(size)));
- }else{
- td.setAttribute('colspan',2);
- }
- }
- a=document.createElement('a');
- var img=document.createElement('img');
- td.appendChild(img);
- img.className='file_actions';
- img.alt=''
- img.title='actions';
- img.src=WEBROOT+'/img/arrow_down.png';
- img.addEvent('onclick',OC_FILES.browser.showactions.bind(name));
- if(!SMALLSCREEN){
- td=document.createElement('td');
- tr.appendChild(td);
- td.className='sizetext';
- td.appendChild(document.createTextNode(date));
- }
- }
-}
-
-OC_FILES.browser.files.remove=function(name){
- if(OC_FILES.browser.files.fileNodes[name]){
- tr=OC_FILES.browser.files.fileNodes[name];
- tr.parentNode.removeChild(tr);
- delete OC_FILES.browser.files.fileNodes[name];
- }
-
-}
-OC_FILES.browser.files.clear=function(){
- for(name in OC_FILES.browser.files.fileNodes){
- OC_FILES.browser.files.remove(name);
- }
-}
-
-OC_FILES.browser.table=null;
-OC_FILES.browser.show_callback=function(content){
- var dir=OC_FILES.dir
- var tr=null;
- var td=null;
- var img=null;
- if(!OC_FILES.browser.table){
- body=document.getElementsByTagName('body').item(0);
- body.addEvent('onclick',OC_FILES.browser.hideallactions);
-
- //remove current content;
- var contentNode=document.getElementById('content');
- contentNode.className='center';
- if(contentNode.hasChildNodes()){
- while(contentNode.childNodes.length >=1){
- contentNode.removeChild(contentNode.firstChild);
- }
- }
- var table=document.createElement('table');
- OC_FILES.browser.table=table;
- table.className='browser';
- var tbody=document.createElement('tbody');
- var thead=document.createElement('thead');
- var tfoot=document.createElement('tfoot');
- table.appendChild(thead);
- table.appendChild(tbody);
- table.appendChild(tfoot);
- OC_FILES.files=Array();
- table.setAttribute('cellpadding',6);
-
- tr=document.createElement('tr');
- thead.appendChild(tr);
- tr.className='breadcrumb';
- td=document.createElement('td');
- tr.appendChild(td);
- input=document.createElement('input');
- input.className='fileSelector'
- input.setAttribute('type','checkbox');
- input.setAttribute('name','fileSelector');
- input.setAttribute('value','select_all');
- input.setAttribute('id','select_all');
- input.addEvent('onclick',OC_FILES.selectAll);
- td.appendChild(input);
- td.className='breadcrumb';
- OC_FILES.browser.breadcrumb.show(td,dir);
- // files and directories
- tr=document.createElement('tr');
- tbody.appendChild(tr);
- td=document.createElement('td');
- tr.appendChild(td);
- div=document.createElement('div');
- div.className='fileList';
- td.appendChild(div);
- OC_FILES.browser.files.show(div,content);
- tr=document.createElement('tr');
- tfoot.appendChild(tr);
- tr.className='utilityline';
- td=document.createElement('td');
- tr.appendChild(td);
- td.className='actionsSelected';
- dropdown=document.createElement('select');
- td.appendChild(dropdown);
- dropdown.setAttribute('id','selected_action');
- for(index in OC_FILES.actions_selected){
- if(OC_FILES.actions_selected[index].call){
- option=document.createElement('option');
- dropdown.appendChild(option);
- option.setAttribute('value',index);
- option.appendChild(document.createTextNode(capitaliseFirstLetter(index)));
- }
- }
- td.appendChild(document.createTextNode(' Selected '));
- button=document.createElement('button');
- td.appendChild(button);
- button.appendChild(document.createTextNode('Go'));
- button.addEvent('onclick',OC_FILES.action_selected);
- div=document.createElement('div');
- td.appendChild(div);
- div.className='moreActionsButton';
- OC_FILES.maxUpload=content['max_upload'];
- var p=document.createElement('p');
- div.appendChild(p);
- p.appendChild(document.createTextNode('More Actions'));
- div.setAttribute('id','moreActionsButton');
- OC_FILES.browser.moreActionsShown=false;
- p.addEvent('onclick',OC_FILES.browser.showMoreActions);
- contentNode.appendChild(table);
- }else{
- OC_FILES.browser.breadcrumb.show(null,dir);
- OC_FILES.browser.files.show(null,content);
- }
- if(OC_FILES.uploadForm){
- OC_FILES.uploadForm.setAttribute('action','files/upload.php?dir='+encodeURIComponent(dir));
- }
-}
-
-OC_FILES.browser.handleDropOn=function(event,node){
- var dropTargetFile=this.file;
- var dropFile=node.parentNode.file;
- if(dropTargetFile!=dropFile){
- if(dropTargetFile.actions.dropOn && dropTargetFile.actions.dropOn.call){
- dropTargetFile.actions.dropOn.call(dropTargetFile,dropFile);
- }
- return false;
- }
-}
-
-OC_FILES.browser.handleDrop=function(event,node){
- var dropTargetFile=node.file;
- var dropFile=this.parentNode.file;
- if(dropFile.actions.drop && dropFile.actions.drop.call){
- dropFile.actions.drop.call(dropFile,dropTargetFile);
- }
- return false;
-}
-
-OC_FILES.browser.showMoreActions=function(){
- if(!OC_FILES.browser.moreActionsList){
- var div=document.createElement('div');
- div.className='moreActionsList';
- var table=document.createElement('table');
- div.appendChild(table);
- var tbody=document.createElement('tbody');
- table.appendChild(tbody);
- var tr=document.createElement('tr');
- tbody.appendChild(tr);
- var td=document.createElement('td');
- tr.appendChild(td);
- OC_FILES.browser.showuploader(OC_FILES.dir,td,OC_FILES.maxUpload);
- tr=document.createElement('tr');
- tbody.appendChild(tr);
- td=document.createElement('td');
- tr.appendChild(td);
- var form=document.createElement('form');
- td.appendChild(form);
- form.appendChild(document.createTextNode('New '));
- var dropdown=document.createElement('select');
- form.appendChild(dropdown);
- dropdown.setAttribute('id','newFileType');
- var option=document.createElement('option');
- dropdown.appendChild(option);
- option.setAttribute('value','dir');
- option.appendChild(document.createTextNode('Folder'));
- option=document.createElement('option');
- dropdown.appendChild(option);
- option.setAttribute('value','file');
- option.appendChild(document.createTextNode('File'));
- form.appendChild(document.createTextNode(' '));
- var input=document.createElement('input');
- form.appendChild(input);
- input.setAttribute('id','newFileName');
- form.addEvent('onsubmit',OC_FILES.browser.newFile);
- var submit=document.createElement('input');
- submit.type='submit';
- form.appendChild(submit);
- submit.value='Create';
- OC_FILES.browser.moreActionsList=div;
- }else{
- var div=OC_FILES.browser.moreActionsList;
- }
- var button=document.getElementById('moreActionsButton');
- if(!OC_FILES.browser.moreActionsShown){
- button.appendChild(div);
- OC_FILES.browser.moreActionsShown=true;
- button.className='moreActionsButton moreActionsButtonClicked';
- }else{
- OC_FILES.browser.moreActionsShown=false;
- button.removeChild(div);
- button.className='moreActionsButton';
- }
-}
-
-OC_FILES.browser.newFile=function(event){
- if(event.preventDefault){
- event.preventDefault();
- };
- var typeSelect=document.getElementById('newFileType');
- var type=typeSelect.options[typeSelect.selectedIndex].value;
- var name=document.getElementById('newFileName').value;
- OC_FILES.newFile(type,name,OC_FILES.dir);
- return false;
-}
-
-OC_FILES.browser.showicon=function(filetype){
- var td=document.createElement('td');
- td.className='fileicon';
- var img=document.createElement('img');
- td.appendChild(img);
- img.setAttribute('width',16);
- img.setAttribute('height',16);
- if(filetype=='dir'){
- img.src=WEBROOT+'/img/icons/folder.png';
- }else if(filetype=='incomplete'){
- img.src=WEBROOT+'/img/icons/loading.gif';
- }else{
- img.src=WEBROOT+'/img/icons/other.png';
- }
- return td;
-}
-
-OC_FILES.uploadIFrames=Array();
-OC_FILES.browser.showuploader=function(dir,parent,max_upload){
- var iframeId=OC_FILES.uploadIFrames.length
- OC_FILES.uploadForm=document.createElement('form');
- OC_FILES.uploadForm.setAttribute('target','uploadIFrame'+iframeId);
- OC_FILES.uploadForm.setAttribute('action','files/upload.php?dir='+encodeURIComponent(dir));
- OC_FILES.uploadForm.method='post';
- OC_FILES.uploadForm.setAttribute('enctype','multipart/form-data');
- OC_FILES.uploadIFrames[iframeId]=document.createElement('iframe');
- OC_FILES.uploadIFrames[iframeId].uploadParent=parent;
- OC_FILES.uploadIFrames[iframeId].className='hidden';
- OC_FILES.uploadIFrames[iframeId].name='uploadIFrame'+iframeId;
- var input=document.createElement('input');
- input.setAttribute('type','hidden');
- input.setAttribute('name','MAX_FILE_SIZE');
- input.setAttribute('value',max_upload);
- input.setAttribute('id','max_upload');
- OC_FILES.uploadForm.appendChild(input);
- var file=document.createElement('input');
- file.name='file';
- file.setAttribute('id','fileSelector');
- file.setAttribute('type','file');
- file.addEvent('onchange',OC_FILES.upload.bind(iframeId));
- OC_FILES.uploadForm.appendChild(document.createTextNode('Upload file: '));
- OC_FILES.uploadForm.appendChild(file);
- parent.appendChild(OC_FILES.uploadForm);
- var body=document.getElementsByTagName('body').item(0);
- body.appendChild(OC_FILES.uploadIFrames[iframeId]);
-}
-
-OC_FILES.browser.show_rename=function(dir,file){
- var item=document.getElementById(file);
- item.oldContent=Array();
- if(item.hasChildNodes()){
- while(item.childNodes.length >=1){
- item.oldContent[item.oldContent.length]=item.firstChild;
- item.removeChild(item.firstChild);
- }
- }
- var form=document.createElement('form');
- form.addEvent('onsubmit',OC_FILES.rename.bind(dir).bind(file));
- var input=document.createElement('input');
- input.setAttribute('type','text');
- input.setAttribute('name','newname');
- input.setAttribute('value',file);
- input.setAttribute('id',file+'_newname')
- input.addEvent('onblur',OC_FILES.browser.rename_cancel.bind(file));
- form.appendChild(input);
- item.appendChild(form);
- input.focus();
-}
-
-OC_FILES.browser.rename_cancel=function(file){
- var item=document.getElementsByName(file).item(0);
- if(item.hasChildNodes()){
- while(item.childNodes.length >=1){
- item.removeChild(item.firstChild);
- }
- }
- for(index in item.oldContent){
- if(item.oldContent[index].nodeType){
- item.appendChild(item.oldContent[index]);
- }
- }
-}
-
-OC_FILES.browser.showactions=function(file,hide){
- var node=document.getElementById(file);
- if(node &&(node.actionsshown || hide===true)){
- if(node.actionsshown){
- node.actionsdiv.parentNode.removeChild(node.actionsdiv);
- }
- node.actionsdiv=null;
- node.actionsshown=false
- }else if(node){
- node.actionsshown=true
- div=document.createElement('div');
- node.actionsdiv=div;
- div.className='fileactionlist';
- table=document.createElement('table');
- div.appendChild(table);
- tbody=document.createElement('tbody');
- table.appendChild(tbody);
- var file=OC_FILES.files[file]
- var actions=file.actions;
- var name;
- for(name in actions){
- if(actions[name].call && name!='default' && name!='dropOn' && name!='drop'){
- tr=document.createElement('tr');
- tbody.appendChild(tr);
- td=document.createElement('td');
- tr.appendChild(td);
- a=document.createElement('a');
- td.appendChild(a);
- a.appendChild(document.createTextNode(capitaliseFirstLetter(name)));
- var action=actions[name];
- td.addEvent('onclick',action.bindScope(file));
- }
- }
- node.appendChild(div);
- OC_FILES.hideallenabled=false;
- setTimeout('OC_FILES.hideallenabled=true',50);
- }
-}
-
-OC_FILES.browser.hideallactions=function(){
- if(OC_FILES.hideallenabled){
- for(name in OC_FILES.files){
- if(OC_FILES.files[name]){
- if(OC_FILES.files[name].hideactions){
- OC_FILES.files[name].hideactions.call(OC_FILES.files[name]);
- }
- }
- }
- }
-}
-
-OC_FILES.hideallenabled=true; //used to prevent browsers from hiding actionslists right after they are displayed;
-
-sizeFormat=function(size){
- if(isNaN(size)){
- return false;
- }
- var orig=size;
- var steps=Array('B','KiB','MiB','GiB','TiB');
- var step=0;
- while(size>(1024*2)){
- step++;
- size=size/1024;
- }
- if(size.toFixed){
- size=size.toFixed(2);
- }
- return ''+size+' '+steps[step];
-}
-
-OC_FILES.browser.showImage=function(dir,file){
- var path=WEBROOT+'/files/open_file.php?dir='+encodeURIComponent(dir)+'&file='+encodeURIComponent(file);
- var div=document.createElement('div');
- div.setAttribute('id','imageframe');
- div.addEvent('onclick',OC_FILES.browser.hideImage)
- var img=document.createElement('img');
- img.setAttribute('src',path);
- div.appendChild(img);
- body=document.getElementsByTagName('body').item(0);
- body.appendChild(div);
-}
-
-OC_FILES.browser.hideImage=function(){
- var div=document.getElementById('imageframe');
- div.parentNode.removeChild(div);
-}
-
-function capitaliseFirstLetter(string){
- return string.charAt(0).toUpperCase() + string.slice(1);
-} \ No newline at end of file
diff --git a/js/lib_ajax.js b/js/lib_ajax.js
deleted file mode 100644
index c962f2e5c0e..00000000000
--- a/js/lib_ajax.js
+++ /dev/null
@@ -1,237 +0,0 @@
-/**
-* 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/>.
-*
-*/
-
-//The callBack object provides an easy way to pass a member of an object as callback parameter and makes sure that the 'this' is always set correctly when called.
-//bindScope provides a much cleaner sollution but we keep this one for compatibility and instead implement is with bindScope
-callBack=function(func,obj){
- var newFunction=func.bindScope(obj);
- callBack.callBacks[this.id]=newFunction;
-}
-
-callBack.callBacks=Array();
-
-callBack.call=function(id){
- callback=callBack.callBacks[id];
- var args=[];
- for (var m = 1; m < arguments.length; m++){
- args.push(arguments[m]);
- }
- if(callback){
- return callback.apply(null,args);
- }
-}
-
-//provide a simple way to add things to the onload
-OC_onload=new Object();
-
-OC_onload.items=new Array();
-OC_onload.itemsPriority=new Array();
-OC_onload.add=function(callback,priority){
- if(priority){
- OC_onload.itemsPriority[OC_onload.items.length]=callback;
- }else{
- OC_onload.items[OC_onload.items.length]=callback;
- }
-}
-OC_onload.run=function(){
- for(index in OC_onload.itemsPriority){
- if(OC_onload.itemsPriority[index].call){
- OC_onload.itemsPriority[index].call();
- }
- }
- for(index in OC_onload.items){
- if(OC_onload.items[index]&&OC_onload.items[index].call){
- OC_onload.items[index].call();
- }
- }
-}
-
-//implement Node.prototype under IE
-if(typeof Node=='undefined'){
- Node=function(){};
- Node.prototype=new Object();
-
- tmpObj=new Object();
- tmpObj.prototype=document.createElement;
- document.createElementNative=document.createElement;
- tmpObj=null;
-
- document.createElement=function(tagName){
-// alert(tagName);
- node=document.createElementNative(tagName);
- var proto=new Node()
- var name;
- for(name in proto){
- node[name]=proto[name];
- }
- return node;
- }
-
- addNodePrototype=function(node){
- if(!node){
- node=document.getElementsByTagName('body');
- node=node.item(0)
- }
- if(node.nodeType==1){
- var proto=new Node()
- for(name in proto){
- node[name]=proto[name];
- }
- if(node.hasChildNodes){
- var childs=node.childNodes;
- for(var i=0;i<childs.length;i++){
- addNodePrototype(childs[i]);
- }
- }
- }
- }
- OC_onload.add(new function(){addNodePrototype(document.documentElement);});
- OC_onload.add(addNodePrototype,true);
-}
-
-function getStyle(x,styleProp)
-{
- if (x.currentStyle){
- var y = x.currentStyle[styleProp];
- }else if (window.getComputedStyle){
- var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
- }
- return y;
-}
-
-Node.prototype.getStyle=function(styleProp){
- return getStyle(this,styleProp)
-}
-
-Node.prototype.clearNode=function(){
- if (this.hasChildNodes() ){
- while(this.childNodes.length>= 1){
- this.removeChild(this.firstChild);
- }
- }
-}
-
-setDebug=function(text){
- node=document.getElementById('debug');
- if(node){
- node.clearNode();
- node.appendChild(document.createTextNode(text));
- }
-}
-
-arrayMerge=function(array1,array2){
- var array=Array();
- for(i in array1){
- array[i]=array1[i];
- }
- for(i in array2){
- array[i]=array2[i];
- }
- return array;
-}
-
-if(!Math.sign){
- Math.sign=function(x){
- return x/Math.abs(x);
- }
-}
-
-if(!Node.prototype.clearNode){
- Node.prototype.clearNode=function(){
- if(this.hasChildNodes()){
- while(this.childNodes.length >=1){
- this.removeChild(this.firstChild);
- }
- }
- }
-}
-
-getTimeString=function(){
- var date=new Date();
- var months=new Array(12);
- months[0]="Jan";
- months[1]="Feb";
- months[2]="Mar";
- months[3]="Apr";
- months[4]="May";
- months[5]="Jun";
- months[6]="Jul";
- months[7]="Aug";
- months[8]="Sep";
- months[9]="Oct";
- months[10]="Nov";
- months[11]="Dec";
- return date.getDate()+' '+months[date.getMonth()]+' '+date.getFullYear()+' '+date.getHours()+':'+date.getMinutes();
-}
-
-loadScript=function(url){//dynamicly load javascript files
- url=WEBROOT+'/'+url;
- var script=document.createElement('script');
- script.setAttribute('type','text/javascript');
- script.setAttribute('src',url);
- body=document.getElementsByTagName('body').item(0);
- body.appendChild(script);
-}
-
-Function.prototype.bindScope=function(obj){
- var o=obj;
- var fn=this;
- return function(){
- return fn.apply(o,arguments);
- }
-}
-
-Function.prototype.bind=function(){
- var args = [];
- var fn=this;
- for (var n = 0; n < arguments.length; n++){
- args.push(arguments[n]);
- }
- return function (){
- var myargs = [];
- for (var m = 0; m < arguments.length; m++){
- myargs.push(arguments[m]);
- }
- return fn.apply(this, args.concat(myargs));
- };
-}
-
-Array.prototype.foreach=function(func,that){
- if (!func) return;
- that=that||this;
- var returns=[];
- for(var i=0;i<this.length;i++){
- returns.push(func.call(that,this[i]));
- }
- return returns;
-}
-
-Array.prototype.where = function(func,that) {
- var found = [];
- that=that||this;
- for(var i = 0, l = this.length; i < l; ++i) {
- var item = this[i];
- if(func.call(that,item)){
- found.push(item);
- }
- }
- return found;
-}; \ No newline at end of file
diff --git a/js/lib_api.js b/js/lib_api.js
deleted file mode 100644
index 51fc843967d..00000000000
--- a/js/lib_api.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
-* 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_API=new Object();
-
-OC_API.run=function(action,params,callback,callbackparams){
- var xmlloader=new OCXMLLoader();
- xmlloader.setCallBack(callback);
- xmlloader.method="POST";
- var paramString='action='+action;
- for(name in params){
- paramString+='&'+name+'='+encodeURIComponent(params[name]);
- }
- xmlloader.arg=callbackparams;
- xmlloader.load('files/api.php',paramString);
-} \ No newline at end of file
diff --git a/js/lib_drag.js b/js/lib_drag.js
deleted file mode 100644
index 5e6ae8ccadc..00000000000
--- a/js/lib_drag.js
+++ /dev/null
@@ -1,348 +0,0 @@
-/**
-* Javascript Drag&Drop - Modified for ownCloud
-*
-* @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/>.
-*
-*/
-
-position=function(x,y){
- if(x)this.x=x;
- if(y)this.y=y;
- return this;
-}
-position.prototype={
- x:0,
- y:0,
- add:function(pos2){
- return new position(this.x+pos2.x,this.y+pos2.y);
- },
- substract:function(pos2){
- return new position(this.x-pos2.x,this.y-pos2.y);
- },toString:function(){
- return 'x:'+this.x+',y:'+this.y;
- },inside:function(pos2){
- return Math.abs(this.x)<Math.abs(pos2.x) && Math.abs(this.y)<Math.abs(pos2.y) && Math.sign(this.x)==Math.sign(pos2.x) && Math.sign(this.y)==Math.sign(pos2.y);
- },outside:function(pos2){
- return !this.inside(pos2);
- }
-}
-
-Node.prototype.drag=new Object
-/**
- * is the node dragable
- */
-Node.prototype.drag.dragable=false;
-/**
- * Are we currently dragging the node
- */
-Node.prototype.drag.active=false;
-/**
- * Create a clone to drag around
- */
-Node.prototype.drag.clone=true;
-/**
- * The node we (visually drag around)
- */
-Node.prototype.drag.node=false;
-/**
- * can we drop nodes on this
- */
-Node.prototype.drag.isDropTarget=false;
-/**
- * our current drop target
- */
-Node.prototype.drag.dropTarget=null;
-/**
- * can we drop this node now
- */
-Node.prototype.drag.dropable=false;
-/**
- * function called when we are being dropped on a node
- * @return bool
- */
-Node.prototype.drag.onDrop=function(node){};
-/**
- * function called when an node is dropped on us
- * @param Node node
- * @return bool
- */
-Node.prototype.drag.onDropOn=function(node){};
-/**
- * where did we start the drag
- */
-Node.prototype.drag.startPosition=new position();
-/**
- * where are we now
- */
-Node.prototype.drag.position=new position();
-/**
- * how big are we
- */
-Node.prototype.drag.size=new position();
-/**
- * where is the mouse
- */
-Node.prototype.drag.mousePosition=new position();
-/**
- * where is the mouse relative to our node
- */
-Node.prototype.drag.mouseOffset=new position();
-
-document.drag=new Object();
-/**
- * is there currently something dragged
- */
-document.drag.active=false;
-/**
- * what is currently being dragged
- */
-document.drag.node=null;
-document.drag.dropTargets=Array();
-/**
- * start the dragging. (onmousedown)
- * @param Event event
- */
-Node.prototype.drag.start=function(event){
- if(!event)var event=window.event;
- if(!this.drag.active && this.drag.dragable){
- document.drag.active=true;
- document.drag.node=this;
- this.drag.active=true;
- this.drag.position=this.getPosition();
- this.drag.startPosition=this.getPosition();
- this.drag.mousePosition=getMousePosition(event);
- this.drag.mouseOffset=this.drag.mousePosition.substract(this.drag.position);
- }
-}
-
-/**
- * update the dragging. (onmousemove)
- * @param Event event
- */
-Node.prototype.drag.update=function(event){
- if(!event)var event=window.event;
- if(this.drag.active && this.drag.dragable){
- this.drag.mousePosition=getMousePosition(event);
- this.drag.position=this.drag.mousePosition.substract(this.drag.mouseOffset);
- if(this.drag.clone && !this.drag.node){
- this.drag.node=this.cloneNode(true);
- this.drag.node.className='dragClone';
- if(this.drag.node.hasAttribute('id')){
- this.drag.node.setAttribute('id',this.drag.node.getAttribute('id')+'_dragClone');
- }
- document.getElementsByTagName('body').item(0).appendChild(this.drag.node);
- }else if(!this.drag.node){
- this.drag.node=this;
- this.drag.node.style.position='absolute';
- }
- this.drag.node.style.left=this.drag.position.x+'px';
- this.drag.node.style.top=this.drag.position.y+'px';
- }
- return true;
-}
-
-/**
- * stop the dragging/drop. (onmouseup)
- * @param Event event
- * @return bool
- */
-Node.prototype.drag.stop=function(event){
- if(!event)var event=window.event;
- if(this.drag.active && this.drag.dragable){
- this.drag.active=false;
- this.drag.mousePosition=getMousePosition(event);
- this.drag.position=this.drag.mousePosition.substract(this.drag.mouseOffset);
- if(this.drag.node){
- this.drag.node.style.left=this.drag.position.x;
- this.drag.node.style.top=this.drag.position.y;
- }
- var target;
- this.drag.dropTarget=null;
- this.drag.dropable=false;
- for(var i=0;i<document.drag.dropTargets.length;i++){
- target=document.drag.dropTargets[i];
- target.drag.checkDropTarget.call(target,event);
- }
- if(this.drag.dropable && this.drag.dropTarget){
- if(this.drag.onDrop){
- this.drag.onDrop.call(this,event,this.drag.dropTarget);
- this.triggerEvent.call(this,'ondrop',event,this.drag.dropTarget);
- }
- if(this.drag.dropTarget.drag.onDropOn){
- this.drag.dropTarget.drag.onDropOn.call(this.drag.dropTarget,event,this);
- this.drag.dropTarget.triggerEvent.call(this.drag.dropTarget,'ondropon',event,this);
- }
- }
- if(this.drag.clone && this.drag.node){
- this.drag.node.parentNode.removeChild(this.drag.node);
- this.drag.node=null;
- }
- document.drag.active=false;
- document.drag.node=null;
- }
-}
-
-/**
- * is there currently something being dragged over us
- * @param Event event
- */
-Node.prototype.drag.checkDropTarget=function(event){
- if(this.drag.isDropTarget & document.drag.active){
- mousePos=getMousePosition(event);
- this.drag.position=this.getPosition();
- this.drag.size=this.getSize(true);
- var offSet=mousePos.substract(this.drag.position);
- if(offSet.inside(this.drag.size)){
- document.drag.node.drag.dropTarget=this;
- document.drag.node.drag.dropable=true;
- setDebug('ontarget');
- }
- }
-}
-
-/**
- * called when the mouse is leaving a drop target
- * @param Event event
- */
-Node.prototype.drag.leaveDropTarget=function(event){
- if(this.drag.isDropTarget & document.drag.active){
- document.drag.node.drag.dropTarget=null;
- document.drag.node.drag.dropable=false;
- setDebug('offtarget');
- }
-}
-/**
- * initiate the node as drop target
- */
-Node.prototype.drag.initDropTarget=function(){
- this.drag.isDropTarget=true;
- document.drag.dropTargets.push(this);
-}
-Node.prototype.makeDropTarget=function(){
- this.drag.initDropTarget.call(this);
-}
-
-/**
- * initiate the node as draggable
- */
-Node.prototype.drag.init=function(){
- this.drag.dragable=true;
- this.drag.size.x=this.getStyle('width');
- this.drag.size.y=this.getStyle('height');
- this.addEvent('onmousedown',new callBack(this.drag.start,this));
-}
-Node.prototype.makeDraggable=function(){
- this.drag.init.call(this);
-}
-
-/**
- * update the dragging. (onmousemove)
- * @param Event event
- */
-document.drag.update=function(event){
- var target;
- if(document.drag.active && document.drag.node){
- document.drag.node.drag.update.call(document.drag.node,event);
- }
-}
-
-/**
- * update the dragging. (onmousemove)
- * @param Event event
- */
-document.drag.stop=function(event){
- if(document.drag.active && document.drag.node){
- document.drag.node.drag.stop.call(document.drag.node,event);
- }
-}
-document.events.add(document,'onmousemove',document.drag.update);
-document.events.add(document,'onmouseup',document.drag.stop);
-
-function getMousePosition(event){
- var pos=new position();
- if(!event)var event = window.event;
- if(event.pageX||event.pageY){
- pos.x=event.pageX;
- pos.y=event.pageY;
- }
- else if(event.clientX||event.clientY){
- pos.x=event.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
- pos.y=event.clientY+document.body.scrollTop+document.documentElement.scrollTop;
- }
- return pos;
-}
-
-/**
- * get our position
- **/
-Node.prototype.getPosition=function(){
- var pos=new position();
- element=this;
- do{
- pos.y+=element.offsetTop;
- pos.x+=element.offsetLeft;
- }while(element=element.offsetParent);
- return pos;
-}
-
-/**
- * get our size
-* @param bool full (also include padding and border)
- **/
-Node.prototype.getSize=function(full){
- var pos=new position();
- pos.y= parseInt(this.getStyle('height'));
- pos.x= parseInt(this.getStyle('width'));
- if(full){
- var extraY=['border-size','padding-top','padding-bottom','border-size'];
- var extraX=['border-size','padding-left','padding-right','border-size'];
- var tmp;
- for(var i=0;i<extraY.length;i++){
- tmp=parseInt(this.getStyle(extraY[i]));
- if(tmp){
- pos.y+=tmp;
- }
- }
- for(var i=0;i<extraX.length;i++){
- tmp=parseInt(this.getStyle(extraX[i]));
- if(tmp){
- pos.x+=tmp;
- }
- }
- }
- return pos;
-}
-
-function mouseTest(event){
- var pos=getMousePosition(event);
- setDebug(pos.toString());
-}
-
-function testDrag(){
- var node=document.getElementById('debug');
-// document.addEvent('onclick',getOffSet,[node]);
- node.makeDropTarget();
-}
-
-function getOffSet(node,event){
- var nodePos=node.getPosition();
- var mousePos=getMousePosition(event);
- return mousePos.substract(nodePos);
-}
-
-
-// OC_onload.add(testDrag); \ No newline at end of file
diff --git a/js/lib_event.js b/js/lib_event.js
deleted file mode 100644
index fe48f6dbc8b..00000000000
--- a/js/lib_event.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*event handling
-usage: document.events.add(node,type,function,arguments);
- or: node.addEvent(type,function,arguments);
-*/
-
-document.events=new Object;
-document.events.functions=Array();
-document.events.args=Array();
-
-document.events.add=function(element,type,func,args){
- if(args){
- if(!args.push){
- args=[args];
- }
- }
- args=args||[];
- if (type && element){
- args.foreach(function(argument){
- func.bind(argument);
- })
- if(element.addEventListener){
- if(type.substr(0,2)=='on'){
- type=type.substr(2);
- }
- element.addEventListener(type,func,false);
- }else if(element.attachEvent){
- element.attachEvent(type,func);
- }
- return func;
- }
-}
-document.events.remove=function(element,type,func){
- if(element.removeEventListener){
- if(type.substr(0,2)=='on'){
- type=type.substr(2);
- }
- element.removeEventListener(type,func,false);
- }else if(element.detachEvent){
- element.detachEvent(type,func)
- }
-}
-
-Node.prototype.addEvent=function(type,func,args){
- return document.events.add(this,type,func,args);
-}
-Node.prototype.removeEvent=function(type,func){
- document.events.remove(this,type,func);
-} \ No newline at end of file
diff --git a/js/lib_files.js b/js/lib_files.js
deleted file mode 100644
index 54af643272a..00000000000
--- a/js/lib_files.js
+++ /dev/null
@@ -1,412 +0,0 @@
-/**
-* 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){
- OC_FILES.dir=dir;
- if(callback){
- OC_FILES.getdirectorycontent_callback=callback;
- }
- OC_FILES.xmlloader.setCallBack(OC_FILES.getdirectorycontent_parse);
-// OC_FILES.xmlloader.load('files/get_files.php?dir='+encodeURIComponent(dir));
- OC_FILES.xmlloader.load('files/api.php?action=getfiles&dir='+encodeURIComponent(dir));
- }else{
- var files=OC_FILES.cache.files
- if(OC_FILES.cache.incomplete[OC_FILES.dir]){
- files=arrayMerge(files,OC_FILES.cache.incomplete[OC_FILES.dir]);
- }
- callback(files);
- }
-}
-
-OC_FILES.dir='';
-
-OC_FILES.get=function(dir,file){
- window.location='files/api.php?action=get&dir='+encodeURIComponent(dir)+'&file='+encodeURIComponent(file);
-}
-
-OC_FILES.upload=function(iframeId){
- var dir=OC_FILES.dir;
- var file=new Object;
- var fileSelector=document.getElementById('fileSelector');
- var max_upload=document.getElementById('max_upload').value;
- var name=false;
- if(fileSelector.files && fileSelector.files[0].fileName){
- name=fileSelector.files[0].fileName;
- }
- if(fileSelector.files && fileSelector.files[0].fileSize){
- var size=fileSelector.files[0].fileSize;
- if(size>max_upload){
- new OCNotification('File too large',10000)
- return false;
- }
- }
- var mime='';
- if(fileSelector.files && fileSelector.files[0].type){
- var mime=fileSelector.files[0].type;
- }
- file.dir=OC_FILES.dir;
- file.name=name;
- file.type='file';
- file.size=size;
- file.iframeId=iframeId;
- if(!OC_FILES.cache.incomplete[dir]){
- OC_FILES.cache.incomplete[dir]=Array();
- }
- OC_FILES.cache.incomplete[dir][name]=Array();
- OC_FILES.cache.incomplete[dir][name]['name']=name;
- OC_FILES.cache.incomplete[dir][name]['type']='incomplete';
- OC_FILES.cache.incomplete[dir][name]['size']=size;
- OC_FILES.cache.incomplete[dir][name]['mime']=mime;
- OC_FILES.uploadIFrames[iframeId].file=file;
- OC_FILES.uploadIFrames[iframeId].addEvent('onload',new callBack(OC_FILES.upload_callback,OC_FILES.uploadIFrames[iframeId]));
- OC_FILES.browser.files.add(name,'incomplete',size,null,mime);
- OC_FILES.uploadForm.submit();
- if(OC_FILES.uploadForm.parentElement){
- OC_FILES.uploadForm.className='hidden';
- OC_FILES.uploadForm.parentNode.removeChild(OC_FILES.uploadForm);
- var body=document.getElementsByTagName('body').item(0);
- body.appendChild(OC_FILES.uploadForm);
- OC_FILES.uploadIFrames[iframeId].uploadForm=OC_FILES.uploadForm;
- OC_FILES.browser.showuploader(OC_FILES.dir,OC_FILES.uploadIFrames[iframeId].uploadParent,OC_FILES.maxUpload)
- }
-}
-
-OC_FILES.upload_callback=function(iframeId){
- var file=this.file;
- if(OC_FILES.cache.incomplete[file.dir][file.name]){
- OC_FILES.browser.files.remove(file.name);
- OC_FILES.cache.files[file.name]=OC_FILES.cache.incomplete[file.dir][file.name]
- delete OC_FILES.cache.incomplete[file.dir][file.name];
- OC_FILES.cache.files[file.name]['type']=file.type;
- this.uploadForm.parentNode.removeChild(this.uploadForm);
- this.parentNode.removeChild(this);
- OC_FILES.uploadIFrames[file.iframeId]=null;
- if(file.name){
- OC_FILES.browser.show(file.dir);
- }else{
- OC_FILES.browser.show(file.dir,true);//if the data from the file isn't correct, force a reload of the cache
- }
- }else{
- OC_FILES.browser.show(OC_FILES.dir);
- }
-}
-
-OC_FILES.rename=function(dir,file,event){
- if(event && event.preventDefault){
- event.preventDefault();
- }
- var item=document.getElementById(file+'_newname');
- var newname=item.value;
- if(newname==''){
- return false;
- }else if(file==newname){
- OC_FILES.browser.show(OC_FILES.dir);
- return false;
- }
- arg=new Object;
- arg.oldname=file;
- arg.newname=newname;
- arg.dir=dir;
- arg.type=OC_FILES.cache.files[file]['type'];
- OC_API.run('rename',{dir:dir,file:file,newname:newname},OC_FILES.rename_callback,arg)
- if(!OC_FILES.cache.incomplete[dir]){
- OC_FILES.cache.incomplete[dir]=Array();
- }
- OC_FILES.cache.files[file]['type']='incomplete';
- OC_FILES.cache.incomplete[dir][newname]=OC_FILES.cache.files[file];
- OC_FILES.cache.incomplete[dir][newname]['name']=newname;
- OC_FILES.browser.files.remove(file);
- OC_FILES.browser.files.add(newname,'incomplete');
- return false;
-}
-
-
-OC_FILES.rename_callback=function(req,file){
- delete OC_FILES.cache.files[file.oldname]
- OC_FILES.cache.files[file.newname]=OC_FILES.cache.incomplete[file.dir][file.newname];
- delete OC_FILES.cache.incomplete[file.dir][file.newname];
- OC_FILES.browser.files.remove(file.newname);
- OC_FILES.cache.files[file.newname]['type']=file.type;
- OC_FILES.browser.show(OC_FILES.dir);
-}
-
-OC_FILES.remove=function(dir,file,force){
- remove=force||confirm('Delete file \''+file+'\'?');
- if(remove){
- OC_API.run('delete',{dir:dir,file:file},OC_FILES.remove_callback,file)
- OC_FILES.browser.files.remove(file);
- delete OC_FILES.cache.files[file];
- }
-}
-
-OC_FILES.remove_callback=function(req,name){
-// OC_FILES.browser.files.remove(name);
-// OC_FILES.browser.show(OC_FILES.dir);
-}
-
-OC_FILES.getSelected=function(){
- var nodes=document.getElementsByName('fileSelector');
- var files=Array();
- for(var index=0;index<nodes.length;index++){
- if(nodes[index].checked){
- files[files.length]=nodes[index].value;
- }
- }
- return files;
-}
-
-OC_FILES.newFile=function(type,name,dir){
- arg=new Object;
- arg.name=name;
- arg.dir=dir;
- if(OC_FILES.cache.files[name]){//check if the file already exists
- alert(((type=='dir')?'folder ':'file ')+name+' already exists.');
- return;
- }
- arg.type=type;
- OC_API.run('new',{dir:dir,name:name,type:type},OC_FILES.new_callback,arg)
- if(!OC_FILES.cache.incomplete[dir]){
- OC_FILES.cache.incomplete[dir]=Array();
- }
- OC_FILES.cache.incomplete[dir][name]=Array();
- OC_FILES.cache.incomplete[dir][name]['name']=name;
- OC_FILES.cache.incomplete[dir][name]['type']='incomplete';
- OC_FILES.cache.incomplete[dir][name]['size']=0;
- OC_FILES.browser.files.add(name,'incomplete');
-}
-
-OC_FILES.new_callback=function(req,file){
- OC_FILES.cache.files[file.name]=OC_FILES.cache.incomplete[file.dir][file.name];
- delete OC_FILES.cache.incomplete[file.dir][file.name];
- OC_FILES.cache.files[file.name]['type']=file.type;
- OC_FILES.browser.files.remove(file.name);
-// OC_FILES.browser.files.add(name);
- OC_FILES.browser.show(OC_FILES.dir,true);
-}
-
-OC_FILES.move=function(source,target,sourceDir,targetDir){
- if(sourceDir!=targetDir || source!=target){
- if(!OC_FILES.cache.incomplete[sourceDir]){
- OC_FILES.cache.incomplete[sourceDir]=Array();
- }
- if(!OC_FILES.cache.incomplete[targetDir]){
- OC_FILES.cache.incomplete[targetDir]=Array();
- }
- if(!OC_FILES.cache.incomplete[targetDir+'/'+target]){
- OC_FILES.cache.incomplete[targetDir+'/'+target]=Array();
- }
- arg=new Object;
- arg.source=source;
- arg.target=target;
- arg.sourceDir=sourceDir;
- arg.targetDir=targetDir;
- arg.type=OC_FILES.cache.files[source]['type'];
- OC_FILES.cache.files[source]['type']='incomplete';
- OC_FILES.cache.incomplete[targetDir+'/'+target][source]=OC_FILES.cache.files[source];
- OC_API.run('move',{sourcedir:sourceDir,source:source,targetdir:targetDir,target:target},OC_FILES.move_callback,arg);
- }
-}
-
-OC_FILES.move_callback=function(req,file){
- OC_FILES.cache.incomplete[file.targetDir+'/'+file.target][file.source]['type']=file.type;
- delete OC_FILES.cache.files[file.source];
- OC_FILES.browser.show(OC_FILES.dir);
-}
-
-OC_FILES.selectAll=function(){
- var value=document.getElementById('select_all').checked;
- var nodes=document.getElementsByName('fileSelector');
- for(var index=0;index<nodes.length;index++){
- if(nodes[index].value){
- nodes[index].checked=value;
- }
- }
-}
-
-OC_FILES.action_selected=function(){
- var dropdown=action=document.getElementById('selected_action');
- var action=dropdown.options[dropdown.selectedIndex].value;
- if(OC_FILES.actions_selected[action] && OC_FILES.actions_selected[action].call){
- OC_FILES.actions_selected[action].call(OC_FILES);
- }
-}
-
-OC_FILES.actions_selected=new Object();
-
-OC_FILES.actions_selected.download=function(){
- files=OC_FILES.getSelected();
- if(files.length==0){
- return false;
- }else if(files.length>1){
- files=files.join(';');
- }else{
- files=files[0];
- }
- OC_FILES.get(this.dir,files);
-}
-
-OC_FILES.actions_selected['delete']=function(){
- files=OC_FILES.getSelected();
- remove=confirm('Delete files \''+files.join('\', \'')+'\'?');
- if(remove){
- for(index in files){
- OC_FILES.remove(OC_FILES.dir,files[index],true);
- }
- }
-}
-
-OC_FILES.files=Array();
-
-OC_FILES.file=function(dir,file,type,mime){
- if(file){
- this.type=type;
- this.file=file;
- this.dir=dir;
- this.mime=mime;
- if(mime){
- var mimeParts=mime.split('/');
- this.mime1=mimeParts[0];
- this.mime2=mimeParts[1];
- }
- this.actions=new Object();
- if(file.lastIndexOf('.')){
- this.extention=file.substr(file.lastIndexOf('.')+1);
- }else{
- this.extention;
- }
- for(index in OC_FILES.fileActions.all){
- if(OC_FILES.fileActions.all[index].call){
- this.actions[index]=OC_FILES.fileActions.all[index];
- }
- }
- if(OC_FILES.fileActions[this.type]){
- for(index in OC_FILES.fileActions[this.type]){
- if(OC_FILES.fileActions[this.type][index].call){
- this.actions[index]=OC_FILES.fileActions[this.type][index];
- }
- }
- }
- if(OC_FILES.fileActions[this.mime1]){
- for(index in OC_FILES.fileActions[this.mime1]){
- if(OC_FILES.fileActions[this.mime1][index].call){
- this.actions[index]=OC_FILES.fileActions[this.mime1][index];
- }
- }
- }
- if(OC_FILES.fileActions[this.mime]){
- for(index in OC_FILES.fileActions[this.mime]){
- if(OC_FILES.fileActions[this.mime][index].call){
- this.actions[index]=OC_FILES.fileActions[this.mime][index];
- }
- }
- }
- }
-}
-
-OC_FILES.file.prototype.showactions=function(){
- OC_FILES.browser.showactions(this.file);
-}
-
-OC_FILES.file.prototype.hideactions=function(){
- OC_FILES.browser.showactions(this.file,true);
-}
-
-OC_FILES.fileActions=new Object();
-
-OC_FILES.fileActions.all=new Object();
-
-OC_FILES.fileActions.all.remove=function(){
- OC_FILES.remove(this.dir,this.file);
-}
-OC_FILES.fileActions.all.rename=function(){
- OC_FILES.browser.show_rename(this.dir,this.file);
-}
-OC_FILES.fileActions.all.download=function(){
- OC_FILES.get(this.dir,this.file);
-}
-OC_FILES.fileActions.all['default']=OC_FILES.fileActions.all.download;
-
-OC_FILES.fileActions.dir=new Object()
-
-OC_FILES.fileActions.dir.open=function(){
- OC_FILES.browser.show(this.dir+'/'+this.file);
-}
-OC_FILES.fileActions.dir['default']=OC_FILES.fileActions.dir.open;
-
-OC_FILES.fileActions.dir.dropOn=function(file){
- OC_FILES.move(file.file,file.file,file.dir,this.dir+'/'+this.file);
-}
-
-OC_FILES.fileActions.image=new Object()
-
-OC_FILES.fileActions.image.show=function(){
- OC_FILES.browser.showImage(this.dir,this.file);
-}
-
-OC_FILES.fileActions.image['default']=OC_FILES.fileActions.image.show;
diff --git a/js/lib_notification.js b/js/lib_notification.js
deleted file mode 100644
index 7c19a04b58e..00000000000
--- a/js/lib_notification.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * StarLight - A client side webpage framework
- *
- * @package StarLight
- * @author Icewind <icewind (at) derideal (dot) com>
- * @copyright 2009
- * @license http://www.gnu.org/licenses/gpl.html GNU Public License
- * @url http://blacklight.metalwarp.com/starlight
- * @version 0.1
- */
-
-OCNotification=function(text,time){
- this.text=text;
- this.time=(time)?time:0;
- this.notify();
-}
-
-OCNotification.prototype={
- notify:function(){
- this.holder=document.getElementById('OCNotificationHolder');
- if (!this.holder){
- this.holder=document.createElement('div');
- this.holder.className='OCNotificationHolder';
- this.holder.setAttribute('class','OCNotificationHolder');
- this.holder.setAttribute('id','OCNotificationHolder');
- document.getElementsByTagName('body').item(0).appendChild(this.holder);
- }
- this.notification=document.createElement('div');
- this.notification.className='OCNotification';
- this.notification.setAttribute('class','OCNotification');
- if (document.documentElement.innerHTML){
- this.notification.innerHTML=this.text;
- }else{
- var text=document.createTextNode(this.text);
- this.notification.appendChild(text);
- }
- this.holder.insertBefore(this.notification,this.holder.firstChild);
- this.notification.addEvent('onclick',new callBack(this.removeNotification,this));
- if (this.time>0){
- this.timer = new OCTimer(this.removeNotification, this.time,false,this);
- }
- },
- removeNotification:function(){
- if(this.notification){
- this.holder.removeChild(this.notification);
- }
- }
-} \ No newline at end of file
diff --git a/js/lib_timer.js b/js/lib_timer.js
deleted file mode 100644
index aadea90ba27..00000000000
--- a/js/lib_timer.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * StarLight - A client side webpage framework
- *
- * @package StarLight
- * @author Icewind <icewind (at) derideal (dot) com>
- * @copyright 2009
- * @license http://www.gnu.org/licenses/gpl.html GNU Public License
- * @url http://blacklight.metalwarp.com/starlight
- * @version 0.1
- */
-OCTimer=function(callback,time,repeat,object){
- this.object=(object)?object:false;
- this.repeat=(!(repeat===undefined))?repeat:true;
- this.callback=callback;
- this.time=time;
- this.timer=0;
- this.number=OCTimer.count;
- OCTimer.count++;
- OCTimer.timers[this.number]=this;
- if(this.time){
- this.start();
- }
-}
-
-OCTimer.count=0;
-OCTimer.timers=Array();
-
-OCTimer.prototype={
- start:function(){
- this.running=true;
- eval('var func=function(){OCTimer.timers['+this.number+'].run();};');
- if(this.repeat){
- this.timer = setInterval(func, this.time);
- }else{
- this.timer = setTimeout(func, this.time);
- }
- },
- run:function(){
- if (!this.repeat){
- this.stop();
- }
- if (this.object){
- this.callback.call(this.object);
- }else{
- this.callback.call();
- }
- },
- stop:function(){
- clearInterval(this.timer);
- this.running=false;
- }
-} \ No newline at end of file
diff --git a/js/lib_xmlloader.js b/js/lib_xmlloader.js
deleted file mode 100644
index 12ebfa474b6..00000000000
--- a/js/lib_xmlloader.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
-* 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/>.
-*
-*/
-
-var READY_STATE_UNINITIALIZED=0;
-var READY_STATE_LOADING=1;
-var READY_STATE_LOADED=2;
-var READY_STATE_INTERACTIVE=3;
-var READY_STATE_COMPLETE=4;
-
-/**
-* Class for loaded browser independant xml loading
-*/
-OCXMLLoader=function(){
- this.errorCallBack=this.defaultError;
-}
-
-OCXMLLoader.prototype={
- contentType:'',
- method:'GET',
- request:'',
- callBack:null,
- async:true,
- arg:null,
-
- /**
- * Loads an XML document
- * @param string url
- * @param string request
- * @none
- */
- load:function(url,request){
- request=(request)?request:"";
- method=this.method;
- contentType=(!this.contentType && method=="POST")?"application/x-www-form-urlencoded":this.contentType;
- if(window.XMLHttpRequest){
- req=new XMLHttpRequest();
- }else if(window.XDomainRequest){
- req=new XDomainRequest();
- }else if(window.ActiveXObject){
- req=new ActiveXObject('Microsoft.XMLHTTP')
- }
- if (req){
- this.req=req;
- try{
-// var loader=this;
-// req.onreadystatechange=function(){
-// loader.onReadyState.call(loader,req)
-// }
- var callback=new callBack(this.onReadyState,this);
- req.onreadystatechange=function(){eval('callBack.call('+callback.id+')');};
- req.open(method,url,this.async);
- if (contentType){
- req.setRequestHeader("Content-Type",contentType);
- }
- if(method=="POST"){
- req.setRequestHeader("Content-length", request.length);
- req.setRequestHeader("Connection", "close");
- }
- req.send(request);
- }catch (err){
- this.errorCallBack(req);
- }
- }
- },
- onReadyState:function(){
- var ready=this.req.readyState;
- if (ready==READY_STATE_COMPLETE){
- var HttpStatus=req.status;
- if (HttpStatus==200 || HttpStatus==0){
- //alert("response: "+this.req.responseText);
- this.callBack(this.req,this.arg);
- }else{
- this.errorCallBack(this.req,this.arg);
- }
- }
- },
- defaultError:function(req){
- alert("Error fetching data!"
- +"\n\n<br/><br/>ReadyState: "+req.readyState
- +"\n<br/>Status: "+req.status
- +"\n<br/>Headers: "+req.getAllResponseHeaders()
- +"\n<br/>File: "+req.url
- +"\n<br/>Response: "+req.responseText);
- },
- /**
- * Sets the request method
- * @param string method
- * @none
- */
- setMethod:function(method){
- this.method=method;
- },
- /**
- * Sets the content type
- * @param string type
- * @none
- */
- setType:function(type){
- this.type=type;
- },
- /**
- * Sets the callback function
- * @param function callBack
- * @none
- */
- setCallBack:function(callBack){
- this.callBack=callBack;
- },
- /**
- * Sets the error callback function
- * @param function errorCallBack
- * @none
- */
- setErrorCallBack:function(errorCallBack){
- this.errorCallBack=errorCallBack;
- }
-}
-
-testClass=function(){
-}
-
-testClass.prototype={
- testFunc:function(){
- this.test="test";
- test=new OCXMLLoader(this);
- test.setCallBack(this.callBack);
- test.load(parseUri('%root%/data/sites/index.xml'));
- },
- callBack:function(req){
- alert(this.test);
- alert(req.responseText);
- }
-}
-test=new testClass()
-test.testFunc
-// mainLoadStack.append(test.testFunc,test);