You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2012/06/06 14:23:17 UTC

svn commit: r1346846 - /openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/js/tomee/view/ApplicationViewApps.js

Author: tveronezi
Date: Wed Jun  6 12:23:17 2012
New Revision: 1346846

URL: http://svn.apache.org/viewvc?rev=1346846&view=rev
Log:
https://issues.apache.org/jira/browse/TOMEE-205
preparing file upload

Modified:
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/js/tomee/view/ApplicationViewApps.js

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/js/tomee/view/ApplicationViewApps.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/js/tomee/view/ApplicationViewApps.js?rev=1346846&r1=1346845&r2=1346846&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/js/tomee/view/ApplicationViewApps.js (original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/js/tomee/view/ApplicationViewApps.js Wed Jun  6 12:23:17 2012
@@ -72,17 +72,23 @@ TOMEE.ApplicationViewApps = function (cf
         content.append(map.main);
 
         (function() {
-            var form = TOMEE.el.getElMap({
+            var frameId = TOMEE.Sequence.next('uploadFrame');
+            var fileForm= TOMEE.el.getElMap({
                 elName:'main',
-                tag:'div',
+                tag:'form',
                 attributes:{
-                    style:'background-color:#EEE; border-top: 1px solid #E5E5E5; height: 30px;margin-bottom: 0px;'
+                    style:'background-color:#EEE; border-top: 1px solid #E5E5E5; height: 30px;margin-bottom: 0px;',
+                    method: 'post',
+                    enctype: 'multipart/form-data',
+                    action: TOMEE.baseURL + 'upload',
+                    target: frameId
                 },
                 children:[
                     {
-                        elName: 'myForm',
-                        tag:'form',
+                        elName:'myFrame',
+                        tag: 'iframe',
                         attributes:{
+                            id: frameId,
                             style:'display: none'
                         }
                     },
@@ -91,11 +97,12 @@ TOMEE.ApplicationViewApps = function (cf
                         tag:'input',
                         attributes:{
                             style:'padding-left: 5px; float: left; position: relative;',
-                            type:"file"
+                            type:'file',
+                            name:'file'
                         },
                         listeners:{
                             'change':function (event) {
-                                submit();
+                                fileForm.main.submit();
                             }
                         }
                     }
@@ -103,27 +110,13 @@ TOMEE.ApplicationViewApps = function (cf
 
             });
 
-            var submit = function() {
-                var frameId = TOMEE.Sequence.next('iframe_upload');
-                var iframe = $(TOMEE.utils.stringFormat('<iframe id="{id}" style="display: none" />', {
-                    id: frameId
-                }));
-                $("body").append(iframe);
-
-
-                form.myForm.attr("action", TOMEE.baseURL + "deploy/file");
-                form.myForm.attr("method", "post");
-                form.myForm.attr("enctype", "multipart/form-data");
-                form.myForm.attr("encoding", "multipart/form-data");
-                form.myForm.attr("target", frameId);
-                form.myForm.attr("file", form.fileField.val());
-                form.myForm.submit();
-            };
+            fileForm.myFrame.bind('load', function(event) {
+                alert('Done');
+            });
 
-            content.append(form.main);
+            content.append(fileForm.main);
         })();
 
-
         return {
             getEl:function () {
                 return panel.getEl();