Skip to content

Commit 4c35843

Browse files
author
Max Burnette
committed
Improve comments and minor bugfix
1 parent 1eebfe2 commit 4c35843

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

app/api/Datasets.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2065,6 +2065,10 @@ class Datasets @Inject()(
20652065
* @param dataset dataset from which to get teh files
20662066
* @param chunkSize chunk size in memory in which to buffer the stream
20672067
* @param compression java built in compression value. Use 0 for no compression.
2068+
* @param bagit whether or not to include bagit structures in zip
2069+
* @param user an optional user to include in metadata
2070+
* @param fileIDs a list of UUIDs of files in the dataset to include (i.e. marked file downloads)
2071+
* @param folderId a folder UUID in the dataset to include (i.e. folder download)
20682072
* @return Enumerator to produce array of bytes from a zipped stream containing the bytes of each file
20692073
* in the dataset
20702074
*/
@@ -2440,6 +2444,7 @@ class Datasets @Inject()(
24402444
}
24412445
}
24422446

2447+
// Takes dataset ID and a comma-separated string of file UUIDs in the dataset and streams just those files as a zip
24432448
def downloadPartial(id: UUID, fileList: String) = PermissionAction(Permission.DownloadFiles, Some(ResourceRef(ResourceRef.dataset, id))) { implicit request =>
24442449
implicit val user = request.user
24452450
datasets.get(id) match {
@@ -2479,7 +2484,7 @@ class Datasets @Inject()(
24792484
// Use a 1MB in memory byte array
24802485
Ok.chunked(enumeratorFromDataset(dataset,1024*1024, -1, bagit, user, None, Some(folderId))).withHeaders(
24812486
CONTENT_TYPE -> "application/zip",
2482-
CONTENT_DISPOSITION -> (FileUtils.encodeAttachment(dataset.name+ " ( "+fo.name+" Folder).zip", request.headers.get("user-agent").getOrElse("")))
2487+
CONTENT_DISPOSITION -> (FileUtils.encodeAttachment(dataset.name+ " ("+fo.name+" Folder).zip", request.headers.get("user-agent").getOrElse("")))
24832488
)
24842489
}
24852490
case None => NotFound

app/views/datasets/filesAndFolders.scala.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@
8585
$('#selected-count-box').html('<div class="dropdown"><a href="#" class="dropdown-toggle" ' +
8686
'data-toggle="dropdown" aria-expanded="false"> Marked Files (<b>'+fileUUIDs.length+'</b>)' +
8787
'<b class="caret"></b></a><ul class="dropdown-menu">' +
88-
// TODO: Need better solution than cookies to support 'Show Only Marked' request
89-
//'<li><a onclick="showOnlyMarked();"><span class="glyphicon glyphicon-ok"/>&nbsp;Show Only Marked</a></li>' +
90-
//'<li><a onclick="showAllFiles();"><span class="glyphicon glyphicon-ok"/>&nbsp;Show All Files</a></li>' +
91-
// TODO: Support for downloading by folder and marked list will be implemented in the future
88+
@* TODO: Need better solution than cookies to support 'Show Only Marked' request
89+
'<li><a onclick="showOnlyMarked();"><span class="glyphicon glyphicon-ok"/>&nbsp;Show Only Marked</a></li>' +
90+
'<li><a onclick="showAllFiles();"><span class="glyphicon glyphicon-ok"/>&nbsp;Show All Files</a></li>' +
91+
*@
9292
'<li><a onclick="downloadMarked();"><span class="glyphicon glyphicon-download-alt"/>&nbsp;Download All</a></li>' +
9393
'<li><a onclick="confirmTagMarked();"><span class="glyphicon glyphicon-tag"/>&nbsp;Tag All</a></li>' +
9494
'<li><a onclick="confirmDeleteMarked();"><span class="glyphicon glyphicon-trash"/>&nbsp;Delete All</a></li>' +
@@ -136,7 +136,6 @@
136136
}
137137

138138
function deleteAllMarked() {
139-
// TODO: Would be nice to have a bulk endpoint for this eventually that takes a string of comma-separated UUIDs
140139
var selected = $.cookie('[email protected]');
141140
if (selected) {
142141
selected = selected.split(',');
@@ -210,7 +209,6 @@ <h4 class="modal-title">Tag All Marked Files</h4>
210209
}
211210

212211
function tagMarked() {
213-
// TODO: Would be nice to have a bulk endpoint for this eventually that takes a string of comma-separated UUIDs
214212
var tag = $('#bulk-tag-selector')[0].value;
215213
if (tag.length > 0) {
216214
var selected = $.cookie('[email protected]');
@@ -265,7 +263,6 @@ <h4 class="modal-title">Tag All Marked Files</h4>
265263
}
266264

267265
function addFileToMarked(file_id) {
268-
// TODO: Use Play framework cookies instead of jquery flavor for better security
269266
var selected = $.cookie('[email protected]');
270267
if (selected) {
271268
if (selected.indexOf(file_id) == -1)

0 commit comments

Comments
 (0)