diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-07-26 16:14:20 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-07-26 16:16:47 +0200 |
commit | 543bdb8ccd8971f0c7123c1a2f9f5b01ba536e2c (patch) | |
tree | a2bf8d8515f9fb8da3315cd08fa4e348153b0667 /files/js/files.js | |
parent | de7c110225a7831e84c89b86cff459804583426f (diff) | |
parent | 0e05a8648404d48fb974bb069e1b465219165a44 (diff) | |
download | nextcloud-server-543bdb8ccd8971f0c7123c1a2f9f5b01ba536e2c.tar.gz nextcloud-server-543bdb8ccd8971f0c7123c1a2f9f5b01ba536e2c.zip |
merge master into interface
Diffstat (limited to 'files/js/files.js')
-rw-r--r-- | files/js/files.js | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/files/js/files.js b/files/js/files.js index 49e2f412d49..2f1ba907ba5 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -112,12 +112,8 @@ $(document).ready(function() { } }); - $('.download').live('click',function(event) { - var files=''; - $('td.filename input:checkbox:checked').parent().parent().each(function(i,element){ - files+=';'+$(element).attr('data-file'); - }); - files=files.substr(1);//remove leading ; + $('.download').click('click',function(event) { + var files=getSelectedFiles('name').join(';'); //send the browser to the download location var dir=$('#dir').val()||'/'; @@ -127,11 +123,7 @@ $(document).ready(function() { }); $('.delete').click(function(event) { - var files=''; - $('td.filename input:checkbox:checked').parent().parent().each(function(i,element){ - files+=';'+$(element).attr('data-file'); - }); - files=files.substr(1);//remove leading ; + var files=getSelectedFiles('name').join(';'); $.ajax({ url: 'ajax/delete.php', @@ -371,4 +363,30 @@ function procesSelection(){ } $('#headerName>span.name').text(selection+' Selected'); } +} + +/** + * @brief get a list of selected files + * @param string property (option) the property of the file requested + * @return array + * + * possible values for property: name, mime + * if property is set, an array with that property for each file is returnd + * if it's ommited an array of objects with all properties is returned + */ +function getSelectedFiles(property){ + var elements=$('td.selection input:checkbox:checked').parent().parent(); + var files=[]; + elements.each(function(i,element){ + var file={ + name:$(element).attr('data-file'), + mime:$(element).attr('data-mime') + }; + if(property){ + files.push(file[property]); + }else{ + files.push(); + } + }); + return files; }
\ No newline at end of file |