From ca00d37a710673fa359daf1817da78787a137f01 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 18 Apr 2011 15:40:17 +0200 Subject: [PATCH] Make the download button work --- files/ajax/download.php | 37 +++++++++++++++++++++++++++++++++++++ files/js/files.js | 14 ++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 files/ajax/download.php diff --git a/files/ajax/download.php b/files/ajax/download.php new file mode 100644 index 0000000000..0b2f894a11 --- /dev/null +++ b/files/ajax/download.php @@ -0,0 +1,37 @@ +. +* +*/ + +// Init owncloud +require_once('../../lib/base.php'); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +$files = $_GET["files"]; +$dir = $_GET["dir"]; + +OC_FILES::get($dir,$files); +?> diff --git a/files/js/files.js b/files/js/files.js index 906f33a9dd..4bf1c77fdb 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -99,6 +99,20 @@ $(document).ready(function() { } return false; }); + + $('.download').click(function(event) { + var files=''; + $('td.selection input:checkbox:checked').parent().parent().children('.filename').each(function(i,element){ + files+=';'+$(element).text(); + }); + files=files.substr(1);//remove leading ; + + //send the browser to the download location + var dir=$('#dir').val()||'/'; +// alert(files); + window.location='ajax/download.php?files='+files+'&dir='+dir; + return false; + }); }); function uploadFinished() {