From cc4606f087ac2455555a96f83d75e25e2aed65e9 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Wed, 7 Jan 2015 09:50:57 -0800 Subject: [PATCH] Init iframe --- ui/scripts/templates.js | 36 +++--------------------------------- ui/scripts/ui/dialog.js | 28 ++++++++-------------------- 2 files changed, 11 insertions(+), 53 deletions(-) diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 3ae46b78c27..24843180a4f 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -110,41 +110,11 @@ title: 'label.action.register.template', docID: 'helpNetworkOfferingName', preFilter: cloudStack.preFilter.createTemplate, - - // Handles POST to upload server - // -- standard action handler won't be called until success() callback fileUpload: { - action: function(args) { - var fileData = args.fileData; - var ajax = $.ajax({ - xhr: function() { - var xhr = jQuery.ajaxSettings.xhr(); - - if (xhr instanceof window.XMLHttpRequest) { - xhr.upload.addEventListener('progress', function(e) { - console.log('progress -> ', e); - }); - } - - return xhr; - }, - url: '/test-upload.php', - type: 'POST', - data: fileData, - cache: false, - dataType: 'json', - processData: false, // Don't process the files - contentType: false, // jQuery will tell the server this is a query string request - success: function(uploadData, textStatus, jqXHR) { - // Files uploaded successfully; proceed to handle rest of action - args.response.success({ data: uploadData }); - }, - error: function(error) { - args.response.error('Error uploading files'); - } + getURL: function(args) { + args.response.success({ + data: 'http://10.223.183.3/test-upload.json' }); - - debugger; } }, fields: { diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index ec4a41780b1..b20cbe70406 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -684,32 +684,20 @@ } var uploadFiles = function() { - var formData = new FormData(); - $form.prepend($('
').addClass('loading-overlay').text('Uploading files...')); - $.each($form.data('files'), function(key, value) { - formData.append(key, value); - }); - args.form.fileUpload.action({ + args.form.fileUpload.getURL({ + formData: data, context: args.context, - fileData: formData, response: { success: function(successArgs) { - $form.find('.loading-overlay').remove(); - $form.data('files', null); + var $uploadFrame = $('