You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2015/01/07 18:51:13 UTC

git commit: updated refs/heads/ui-template-uploader to cc4606f

Repository: cloudstack
Updated Branches:
  refs/heads/ui-template-uploader b35fe9ad6 -> cc4606f08


Init iframe


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cc4606f0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cc4606f0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cc4606f0

Branch: refs/heads/ui-template-uploader
Commit: cc4606f087ac2455555a96f83d75e25e2aed65e9
Parents: b35fe9a
Author: Brian Federle <br...@citrix.com>
Authored: Wed Jan 7 09:50:57 2015 -0800
Committer: Brian Federle <br...@citrix.com>
Committed: Wed Jan 7 09:50:57 2015 -0800

----------------------------------------------------------------------
 ui/scripts/templates.js | 36 +++---------------------------------
 ui/scripts/ui/dialog.js | 30 +++++++++---------------------
 2 files changed, 12 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc4606f0/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 3ae46b7..2484318 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: {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc4606f0/ui/scripts/ui/dialog.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js
index ec4a417..b20cbe7 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($('<div>').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);
-
-                                args.after({
-                                    data: $.extend(data, { uploadData: successArgs.data }),
-                                    ref: args.ref, // For backwards compatibility; use context
-                                    context: args.context,
-                                    $form: $form
-                                });
+                                var $uploadFrame = $('<iframe>');
 
-                                $('div.overlay').remove();
-                                $('.tooltip-box').remove();
-                                $formContainer.remove();
-                                $(this).dialog('destroy');
-                                $('.hovered-elem').hide();
+                                $uploadFrame.appendTo('html body');
+
+                                
+                                // debug
+                                $uploadFrame.css({background:'white',width:320,height:240,position:'absolute',left:0,top:0,'z-index':12000}).show();
+                                //
                             },
                             error: function(msg) {
                                 cloudStack.dialog.error({ message: msg });