Browse Source

Added original filenames to each item for creating a new vault from uploads.

tags/2.0.6
Teknikode 3 years ago
parent
commit
6f475d6e03

+ 5
- 1
Teknik/Areas/Upload/Scripts/Upload.js View File

@@ -81,12 +81,16 @@ function linkCreateVault(element) {
$("div[id^='upload-panel-']").each(function () {
var url = $(this).find('#upload-url').val();
if (url !== '') {
var origFile = $(this).find('#upload-title').text();
if (origFile !== null && origFile !== '') {
url += ':' + origFile;
}
allUploads.unshift(url);
}
});
if (allUploads.length > 0) {
var urlList = allUploads.join();
window.open(createVaultURL + '&urls=' + urlList, '_blank');
window.open(createVaultURL + '&urls=' + encodeURIComponent(urlList), '_blank');
}
else {
window.open(createVaultURL, '_blank');

+ 11
- 2
Teknik/Areas/Vault/Controllers/VaultController.cs View File

@@ -96,10 +96,19 @@ namespace Teknik.Areas.Vault.Controllers
string[] allURLs = urls.Split(',');
foreach (string url in allURLs)
{
if (IsValidItem(type, url))
string[] urlInfo = url.Split(':');
string uploadId = urlInfo[0];
string title = string.Empty;
if (urlInfo.GetUpperBound(0) >= 1)
{
// They also passed in the original filename, so let's use it as our title
title = urlInfo[1];
}
if (IsValidItem(type, uploadId))
{
NewVaultItemViewModel item = new NewVaultItemViewModel();
item.url = url;
item.title = title;
item.url = uploadId;
item.type = type;
model.items.Add(item);
}

Loading…
Cancel
Save