Browse Source

Fixed upload/paste create/add to vault not passing variable correctly.

tags/2.0.6
Teknikode 3 years ago
parent
commit
c17637ccad

+ 2
- 2
Teknik/Areas/Paste/Scripts/Paste.js View File

@@ -12,7 +12,7 @@ function linkCreateVault(element) {
element.click(function () {
var pasteUrl = $(this).data('paste-url');
var pasteTitle = $(this).data('paste-title');
window.open(createVaultURL + '&items=' + encodeURIComponent(pasteUrl + ':' + pasteTitle), '_blank');
window.open(addParamsToUrl(createVaultURL, { items: encodeURIComponent(pasteUrl + ':' + pasteTitle) }), '_blank');
});
}

@@ -21,6 +21,6 @@ function linkAddToVault(element) {
var addToVaultURL = $(this).data('add-to-vault-url');
var pasteUrl = $(this).data('paste-url');
var pasteTitle = $(this).data('paste-title');
window.open(addToVaultURL + '&items=' + encodeURIComponent(pasteUrl + ':' + pasteTitle), '_blank');
window.open(addParamsToUrl(addToVaultURL, { items: encodeURIComponent(pasteUrl + ':' + pasteTitle) }), '_blank');
});
}

+ 4
- 2
Teknik/Areas/Upload/Scripts/Upload.js View File

@@ -94,7 +94,8 @@ function linkCreateVault(element) {
});
if (allUploads.length > 0) {
var urlList = allUploads.join();
window.open(createVaultURL + '&items=' + encodeURIComponent(urlList), '_blank');
var finalUrl = addParamsToUrl(createVaultURL, { items: encodeURIComponent(urlList) });
window.open(finalUrl, '_blank');
}
else {
window.open(createVaultURL, '_blank');
@@ -118,7 +119,8 @@ function linkAddToVault(element) {
});
if (allUploads.length > 0) {
var urlList = allUploads.join();
window.open(addToVaultURL + '&items=' + encodeURIComponent(urlList), '_blank');
var finalUrl = addParamsToUrl(addToVaultURL, { items: encodeURIComponent(urlList) });
window.open(finalUrl, '_blank');
}
else {
window.open(addToVaultURL, '_blank');

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

@@ -113,7 +113,8 @@ namespace Teknik.Areas.Vault.Controllers
ViewBag.Title = "Create Vault";
ModifyVaultViewModel model = new ModifyVaultViewModel();

string[] allURLs = items.Split(',');
string decodedItems = HttpUtility.UrlDecode(items);
string[] allURLs = decodedItems.Split(',');
int index = 0;
foreach (string url in allURLs)
{
@@ -191,7 +192,8 @@ namespace Teknik.Areas.Vault.Controllers
// If they passed any new items in via the parameters, let's add them
if (!string.IsNullOrEmpty(type) && !string.IsNullOrEmpty(items))
{
string[] allItems = items.Split(',');
string decodedItems = HttpUtility.UrlDecode(items);
string[] allItems = decodedItems.Split(',');
foreach (string newItem in allItems)
{
string[] urlInfo = newItem.Split(':');

+ 8
- 0
Teknik/Scripts/Common.js View File

@@ -240,6 +240,14 @@ function moveDown(item) {
item.insertAfter(next);
});
}

function addParamsToUrl(origUrl, params) {
var paramStr = $.param(params);
var hasQuery = origUrl.indexOf("?") + 1;
var hasHash = origUrl.indexOf("#") + 1;
var appendix = (hasQuery ? "&" : "?") + paramStr;
return hasHash ? origUrl.replace("#", appendix + "#") : origUrl + appendix;
}
/***************************** TIMER Page Load *******************************/
var loopTime;
var startTime = new Date();

Loading…
Cancel
Save