kasparkuldkepp / upload-at-click

Automatically exported from code.google.com/p/upload-at-click
0 stars 0 forks source link

Help needed #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi Vital,

this might probably not be the proper place, but I couldn't find another way of 
contacting you.

I love your solution of upload-at-click, I have been looking for something like 
this for quite some time.
However, I have the problem, that I need to incorporate this feature in a GWT 
application. My knowledge of JS/HTML/etc is rather limited. hence my question...

Is there a way to put your solution into a GWT application and how would I go 
about it?

Thanx,

Thomas

Original issue reported on code.google.com by tkloe...@googlemail.com on 1 Dec 2010 at 4:29

GoogleCodeExporter commented 8 years ago
Hi, Thomas,

this is a good place to discuss issues.
And you can post you code to vital.fadeev@gmail.com

I do not use Google Web Toolkit, but will try to help you.

What is the problem?

Original comment by vital.fadeev on 2 Dec 2010 at 9:19

GoogleCodeExporter commented 8 years ago
Hi Vital,

thanx for taking the time...
Since this is a project under code.google.com I thought you'd use GWT as well ;)
Anyway, my problem is to integrate your .js Files into my "Java" Code. This is 
what I try (it's actually using SmartGWT):

    private IButton upload() {
        IButton button = new IButton("Upload");
        button.setID("uploader");
        upclick();
        return button;
    }
    private native void upclick() /*-{
      var uploader = document.getElementById('uploader');
      upclick({
        element: uploader,
        action: '/upload',
        onstart:
          function(filename) { alert('Start upload: ' + filename); },
        oncomplete:
          function(response_data) { alert(response_data); }
      });
    }-*/;

But when it comes to execute the code I get a JavaScriptException saying that  
upclick() is not defined. My .html file includes this in its header section:
<script type="text/javascript" src="editor/upclick-min.js"></script>

Any ideas what I need to do to get all pieces together in "Java" code?

Original comment by tkloe...@googlemail.com on 2 Dec 2010 at 9:35

GoogleCodeExporter commented 8 years ago
I think need add next line into <head> of you host HTML page (before GWT):
...
<script type="text/javascript" src="/path_to/upclick.js"></script>
...

and code wiil be like this:
...
public class Hello implements EntryPoint {

  public void onModuleLoad() {
    Button button = new Button("Click me");
    button.setID("uploader");

    RootPanel.get().add(button);

    var uploader = document.getElementById('uploader');
    upclick({
        element: uploader,
        action: '/upload',
        onstart:
          function(filename) { alert('Start upload: ' + filename); },
        oncomplete:
          function(response_data) { alert(response_data); }
    });
  }
}
...

Original comment by vital.fadeev on 2 Dec 2010 at 10:27

GoogleCodeExporter commented 8 years ago
...
        button.setID("uploader");
        upclick();
        return button;
...
I think need call upclick outside return
And can I see GWT generated javascript?

Original comment by vital.fadeev on 2 Dec 2010 at 10:40

GoogleCodeExporter commented 8 years ago
Vital,

thanx for your help!
I'm trying to put this into a test app, so it's easier to investigate, but it 
will take a bit. I'll post everything when I have it...

Original comment by tkloe...@googlemail.com on 2 Dec 2010 at 11:42

GoogleCodeExporter commented 8 years ago
Vital,

I sent you a war file and my sources to your gmail address...

Thanks,

Thomas

Original comment by tkloe...@googlemail.com on 2 Dec 2010 at 3:03

GoogleCodeExporter commented 8 years ago
Check email.
Solution (not require button ID):
...
    private IButton upload(Cell cell) {
        if (!cell.hasValueMap()) return null;
        IButton button = new IButton("Upload");
        upclickIt(button);
        return button;
    }
    private native void upclickIt(button) /*-{
      upclick({
        element: button,
        action: '/upload',
        onstart:
          function(filename) { alert('Start upload: ' + filename); },
        oncomplete:
          function(response_data) { alert(response_data); }
      });
    }-*/;
...

Original comment by vital.fadeev on 2 Dec 2010 at 3:40

GoogleCodeExporter commented 8 years ago
what is the difference between upclick-min.js and upclick.js?
Do I need both?

Original comment by tkloe...@googlemail.com on 2 Dec 2010 at 3:50

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
upclick-min.js is a packed version of upclick.js
Without comments and spaces.

Include in project upclick-min.js only.

Original comment by vital.fadeev on 3 Dec 2010 at 3:36

GoogleCodeExporter commented 8 years ago
Vitali,

thanks for your help, I will look into the "GWT Java syntax" issue...

Original comment by tkloe...@googlemail.com on 3 Dec 2010 at 7:56

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
can u explain me how to post the argument to server from action url in php

Original comment by pramodz...@gmail.com on 19 Sep 2011 at 7:37

GoogleCodeExporter commented 8 years ago
Hi,
I am getting error on IIS ImportXL:78Uncaught ReferenceError: upclick is not 
defined
but not if i directly run it from source code or on local host

Original comment by I.shaikh...@gmail.com on 2 Dec 2011 at 7:08