diff options
Diffstat (limited to 'files/js')
-rw-r--r-- | files/js/admin.js | 28 | ||||
-rw-r--r-- | files/js/fileactions.js | 29 | ||||
-rw-r--r-- | files/js/filelist.js | 10 | ||||
-rw-r--r-- | files/js/files.js | 38 |
4 files changed, 59 insertions, 46 deletions
diff --git a/files/js/admin.js b/files/js/admin.js index 5cbb2b9f5ac..bfa96670635 100644 --- a/files/js/admin.js +++ b/files/js/admin.js @@ -1,15 +1,23 @@ -function switchPublicFolder() +function switchPublicFolder() { - var publicEnable = $('#publicEnable').is(':checked'); - var sharingaimGroup = $('input:radio[name=sharingaim]'); //find all radiobuttons of that group - $.each(sharingaimGroup, function(index, sharingaimItem) { - sharingaimItem.disabled = !publicEnable; //set all buttons to the correct state - }); + var publicEnable = $('#publicEnable').is(':checked'); + var sharingaimGroup = $('input:radio[name=sharingaim]'); //find all radiobuttons of that group + $.each(sharingaimGroup, function(index, sharingaimItem) { + sharingaimItem.disabled = !publicEnable; //set all buttons to the correct state + }); } $(document).ready(function(){ - switchPublicFolder(); // Execute the function after loading DOM tree - $('#publicEnable').click(function(){ - switchPublicFolder(); // To get rid of onClick() - }); + switchPublicFolder(); // Execute the function after loading DOM tree + $('#publicEnable').click(function(){ + switchPublicFolder(); // To get rid of onClick() + }); + + $('#allowZipDownload').bind('change', function() { + if($('#allowZipDownload').attr('checked')) { + $('#maxZipInputSize').removeAttr('disabled'); + } else { + $('#maxZipInputSize').attr('disabled', 'disabled'); + } + }); }); diff --git a/files/js/fileactions.js b/files/js/fileactions.js index 384ffc92cf2..07838261b87 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -59,6 +59,7 @@ FileActions={ if($('tr').filterAttr('data-file',file).data('renaming')){ return; } + parent.children('a.name').append('<span class="fileactions" />'); var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); for(name in actions){ if((name=='Download' || actions[name]!=defaultAction) && name!='Delete'){ @@ -66,11 +67,10 @@ FileActions={ if(img.call){ img=img(file); } - var html='<a href="#" title="'+name+'" class="action" style="display:none" />'; + var html='<a href="#" class="action" style="display:none">'; + if(img) { html+='<img src="'+img+'"/> '; } + html += name+'</a>'; var element=$(html); - if(img){ - element.append($('<img src="'+img+'"/>')); - } element.data('action',name); element.click(function(event){ event.stopPropagation(); @@ -81,7 +81,7 @@ FileActions={ action(currentFile); }); element.hide(); - parent.children('a.name').append(element); + parent.find('a.name>span.fileactions').append(element); } } if(actions['Delete']){ @@ -89,7 +89,7 @@ FileActions={ if(img.call){ img=img(file); } - var html='<a href="#" title="Delete" class="action" style="display:none" />'; + var html='<a href="#" original-title="Delete" class="action delete" style="display:none" />'; var element=$(html); if(img){ element.append($('<img src="'+img+'"/>')); @@ -106,14 +106,14 @@ FileActions={ element.hide(); parent.parent().children().last().append(element); } - $('#fileList .action').css('-o-transition-property','none');//temporarly disable + $('#fileList .action').css('-o-transition-property','none');//temporarly disable $('#fileList .action').fadeIn(200,function(){ $('#fileList .action').css('-o-transition-property','opacity'); }); return false; }, hide:function(){ - $('#fileList .action').fadeOut(200,function(){ + $('#fileList span.fileactions').fadeOut(200,function(){ $(this).remove(); }); }, @@ -128,8 +128,15 @@ FileActions={ } } -FileActions.register('all','Download',function(){return OC.imagePath('core','actions/download')},function(filename){ - window.location='ajax/download.php?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val()); +$(document).ready(function(){ + if($('#allowZipDownload').val() == 1){ + var downloadScope = 'all'; + } else { + var downloadScope = 'file'; + } + FileActions.register(downloadScope,'Download',function(){return OC.imagePath('core','actions/download')},function(filename){ + window.location='ajax/download.php?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val()); + }); }); FileActions.register('all','Delete',function(){return OC.imagePath('core','actions/delete')},function(filename){ @@ -157,4 +164,4 @@ FileActions.register('dir','Open','',function(filename){ window.location='index.php?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename); }); -FileActions.setDefault('dir','Open'); +FileActions.setDefault('dir','Open'); diff --git a/files/js/filelist.js b/files/js/filelist.js index 0faff08a73f..c8ceb474413 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -7,15 +7,15 @@ FileList={ var html='<tr data-type="file" data-size="'+size+'">'; if(name.indexOf('.')!=-1){ var basename=name.substr(0,name.lastIndexOf('.')); - var extention=name.substr(name.lastIndexOf('.')); + var extension=name.substr(name.lastIndexOf('.')); }else{ var basename=name; - var extention=false; + var extension=false; } html+='<td class="filename" style="background-image:url('+img+')"><input type="checkbox" />'; html+='<a class="name" href="download.php?file='+$('#dir').val()+'/'+name+'"><span class="nametext">'+basename - if(extention){ - html+='<span class="extention">'+extention+'</span>'; + if(extension){ + html+='<span class="extension">'+extension+'</span>'; } html+='</span></a></td>'; if(size!='Pending'){ @@ -148,7 +148,7 @@ FileList={ span.text(basename); td.children('a.name').append(span); if(newname.indexOf('.')>0){ - span.append($('<span class="extention">'+newname.substr(newname.lastIndexOf('.'))+'</span>')); + span.append($('<span class="extension">'+newname.substr(newname.lastIndexOf('.'))+'</span>')); } $.get(OC.filePath('files','ajax','rename.php'), { dir : $('#dir').val(), newname: newname, file: name },function(){ tr.data('renaming',false); diff --git a/files/js/files.js b/files/js/files.js index 6eed25dfe99..89101ce4b8f 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -25,11 +25,11 @@ $(document).ready(function() { //little hack to set unescape filenames in attribute $(this).attr('data-file',decodeURIComponent($(this).attr('data-file'))); }); - + if($('tr[data-file]').length==0){ $('.file_upload_filename').addClass('highlight'); } - + $('#file_action_panel').attr('activeAction', false); //drag/drop of files @@ -38,7 +38,7 @@ $(document).ready(function() { $('div.crumb').droppable(crumbDropOptions); $('ul#apps>li:first-child').data('dir',''); $('ul#apps>li:first-child').droppable(crumbDropOptions); - + // Triggers invisible file input $('.file_upload_button_wrapper').live('click', function() { $(this).parent().children('.file_upload_start').trigger('click'); @@ -103,9 +103,9 @@ $(document).ready(function() { } } } - + }); - + // Sets the select_all checkbox behaviour : $('#select_all').click(function() { if($(this).attr('checked')){ @@ -119,8 +119,8 @@ $(document).ready(function() { } procesSelection(); }); - - $('td.filename input:checkbox').live('click',function(event) { + + $('td.filename input:checkbox').live('change',function(event) { if (event.shiftKey) { var last = $(lastChecked).parent().parent().prevAll().length; var first = $(this).parent().parent().prevAll().length; @@ -148,23 +148,22 @@ $(document).ready(function() { } procesSelection(); }); - + $('#file_newfolder_name').click(function(){ if($('#file_newfolder_name').val() == 'New Folder'){ $('#file_newfolder_name').val(''); } }); - + $('.download').click('click',function(event) { var files=getSelectedFiles('name').join(';'); - - //send the browser to the download location var dir=$('#dir').val()||'/'; -// alert(files); + $('#notification').text(t('files','generating ZIP-file, it may take some time.')); + $('#notification').fadeIn(); window.location='ajax/download.php?files='+encodeURIComponent(files)+'&dir='+encodeURIComponent(dir); return false; }); - + $('.delete').click(function(event) { var files=getSelectedFiles('name'); event.preventDefault(); @@ -354,7 +353,6 @@ $(document).ready(function() { }) }); - //add multiply file upload attribute to all browsers except konqueror (which crashes when it's used) if(navigator.userAgent.search(/konqueror/i)==-1){ $('.file_upload_start').attr('multiple','multiple') @@ -381,7 +379,7 @@ $(document).ready(function() { text=text.substr(0,text.length-6)+'...'; crumb.text(text); } - + $(window).click(function(){ $('#new>ul').hide(); $('#new').removeClass('active'); @@ -405,14 +403,14 @@ $(document).ready(function() { if($(this).children('p').length==0){ return; } - + $('#new li').each(function(i,element){ if($(element).children('p').length==0){ $(element).children('input').remove(); $(element).append('<p>'+$(element).data('text')+'</p>'); } }); - + var type=$(this).data('type'); var text=$(this).children('p').text(); $(this).data('text',text); @@ -474,7 +472,7 @@ $(document).ready(function() { tr.find('td.filename').attr('style','background-image:url('+path+')'); }); }else{ - + } } ); @@ -544,7 +542,7 @@ var folderDropOptions={ var dir=$('#dir').val(); $.ajax({ url: 'ajax/move.php', - data: "dir="+dir+"&file="+file+'&target='+dir+'/'+target, + data: "dir="+encodeURIComponent(dir)+"&file="+encodeURIComponent(file)+'&target='+encodeURIComponent(dir)+'/'+encodeURIComponent(target), complete: function(data){boolOperationFinished(data, function(){ var el = $('#fileList tr').filterAttr('data-file',file).find('td.filename'); el.draggable('destroy'); @@ -570,7 +568,7 @@ var crumbDropOptions={ } $.ajax({ url: 'ajax/move.php', - data: "dir="+dir+"&file="+file+'&target='+target, + data: "dir="+encodeURIComponent(dir)+"&file="+encodeURIComponent(file)+'&target='+encodeURIComponent(target), complete: function(data){boolOperationFinished(data, function(){ FileList.remove(file); });} |