Repository: cloudstack Updated Branches: refs/heads/volume-upload ad6b7b30c -> e4d104909
Allow passing custom data in POST request Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e4d10490 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e4d10490 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e4d10490 Branch: refs/heads/volume-upload Commit: e4d1049096152cb9fcd4b937666c8dfe8a035392 Parents: 8641de8 Author: Brian Federle <brian.fede...@citrix.com> Authored: Mon Jan 19 11:35:17 2015 -0800 Committer: Brian Federle <brian.fede...@citrix.com> Committed: Mon Jan 19 11:35:42 2015 -0800 ---------------------------------------------------------------------- ui/scripts/templates.js | 6 +++++- ui/scripts/ui/dialog.js | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e4d10490/ui/scripts/templates.js ---------------------------------------------------------------------- diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 1b6400a..faf0403 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -110,7 +110,11 @@ fileUpload: { getURL: function(args) { args.response.success({ - url: 'http://10.223.183.3/test-upload.php' + url: 'http://10.223.183.3/test-upload.php', + data: { + testData1: '1', + testData2: '2' + } }); }, postUpload: function(args) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e4d10490/ui/scripts/ui/dialog.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index 1c7904a..00d2303 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -701,6 +701,17 @@ var $file = $form.find('input[type=file]'); var $field = $file.closest('.form-item .value'); + // Add additional passed data + $.map(successArgs.data, function(v, k) { + var $hidden = $('<input>').attr({ + type: 'hidden', + name: k, + value: v + }); + + $hidden.appendTo($frameForm); + }); + $uploadFrame.css({ width: $field.outerWidth(), height: $field.height() }).show(); $frameForm.append($file); $field.append($uploadFrame);