Page 1 of 1

Integrated jsapi.jar in jbatchupload

Posted: Fri Oct 28, 2011 2:16 am
by quangdongst
I use jBacthUpload, I want user javascript callback

applet_http_batchupload.js

Code: Select all

<!--
var _info = navigator.userAgent;
var _ns = false;
var _ns6 = false;
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
if (_info.indexOf("Opera") > 0) _ie = false;
var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0)));
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
if (_ie == true) {
  document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="430" HEIGHT="300" NAME="fileupload" codebase="http://java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0">');
}
else if (_ns == true && _ns6 == false) { 
  // BEGIN: Update parameters below for NETSCAPE 3.x and 4.x support.
  document.write('<EMBED ');
  document.write('type="application/x-java-applet;version=1.4" ');
  document.write('CODE="jfileupload.upload.client.MApplet.class" ');
  document.write('JAVA_CODEBASE="./" ');
  document.write('ARCHIVE="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/batchui.jar" ');
  document.write('NAME="fileupload" ');
  document.write('WIDTH="430" ');
  document.write('HEIGHT="300" ');
  document.write('url="http://localhost:8080/upload/process.jsp" ');
  document.write('paramfile="uploadfile" ');
  document.write('param1="todo" ');
  document.write('value1="upload" ');
  document.write('transferui="jfileupload.transfer.client.edesign.BatchTransferUI" ');
  document.write('transferuiresources="i18n_pane" ');
  document.write('resources="i18n_bar" ');
  document.write('resetprogressbar="true" '); 
  document.write('mode="http" ');
  document.write('scriptable=true ');
  document.writeln('pluginspage="http://java.sun.com/products/plugin/index.html#download"><NOEMBED>');
  // END
}
else {
  document.writeln('<APPLET CODE="jfileupload.upload.client.MApplet.class" JAVA_CODEBASE="http://localhost/upload/" ARCHIVE="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/batchui.jar,lib/jsapi.jar" WIDTH="430" HEIGHT="300" NAME="fileupload">');
}
// BEGIN: Update parameters below for INTERNET EXPLORER, FIREFOX, SAFARI, OPERA, MOZILLA, NETSCAPE 6+ support.
document.writeln('<PARAM NAME=CODE VALUE="jfileupload.upload.client.MApplet.class">');
document.writeln('<PARAM NAME=CODEBASE VALUE="http://localhost/upload/">');
document.writeln('<PARAM NAME=ARCHIVE VALUE="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/batchui.jar">');
document.writeln('<PARAM NAME=NAME VALUE="fileupload">');
document.writeln('<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">');
document.writeln('<PARAM NAME="scriptable" VALUE="true">');
document.writeln('<PARAM NAME="url" VALUE="http://localhost/upload/upload.php">');
document.writeln('<PARAM NAME="paramfile" VALUE="uploadfile">');
document.write('filter="jfileupload.upload.client.filter.ImageFilter" ');
document.write('filterproperties="scaling.properties" '); 
document.writeln('<PARAM NAME="filter" VALUE="jfileupload.upload.client.filter.ImageFilter">');
document.writeln('<PARAM NAME="filterproperties" VALUE="scaling.properties">');
document.writeln('<PARAM NAME="param1" VALUE="todo">');
document.writeln('<PARAM NAME="value1" VALUE="upload">');
document.writeln('<PARAM NAME="transferui" VALUE="jfileupload.transfer.client.edesign.BatchTransferUI">');
document.writeln('<PARAM NAME="transferuiresources" VALUE="i18n_pane">');
document.writeln('<PARAM NAME="resources" VALUE="i18n_bar">');
document.writeln('<PARAM NAME="resetprogressbar" VALUE="true">');
document.writeln('<PARAM NAME="mode" VALUE="http">');

// END
if (_ie == true) {
  document.writeln('</OBJECT>');
}
else if (_ns == true && _ns6 == false) {
  document.writeln('</NOEMBED></EMBED>');
}
else {
  document.writeln('</APPLET>');
}
//-->
index.html

Code: Select all

<html>
<script src="applet_http_batchupload.js"></script>
<body>
<script type="text/javascript">
function JSAppletInitialized(version)
{

	document.write(version);
}
</script>


</body>
</html>

function JSAppletInitialized is not work???

Thanks

Re: Integrated jsapi.jar in jbatchupload

Posted: Tue Nov 01, 2011 10:26 am
by quangdongst
I had integrated jsapi into jbacthupload sucess, but button Cancel on javaapplet not working when press button Upload

Code: Select all

<script type="text/javascript" >
var _info = navigator.userAgent;
var _ns = false;
var _ns6 = false;
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
if (_info.indexOf("Opera") > 0) _ie = false;
var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0)));
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
if (_ie == true) {
  document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="500" HEIGHT="350" NAME="fileupload" codebase="http://java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0">');
}
else if (_ns == true && _ns6 == false) { 
  // BEGIN: Update parameters below for NETSCAPE 3.x and 4.x support.
  document.write('<EMBED ');
  document.write('type="application/x-java-applet;version=1.4" ');
  document.write('CODE="jfileupload.upload.client.JSMApplet.class" ');
  document.write('JAVA_CODEBASE="/comicabi/web/" ');
  document.write('ARCHIVE="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/batchui.jar" ');
  document.write('NAME="fileupload" ');
  document.write('WIDTH="400" ');
  document.write('HEIGHT="400" ');
  document.write('url="http://localhost/upload/doupload.php" ');
  document.write('paramfile="uploadfile" ');
  document.write('param1="todo" ');
  
  document.write('value1="upload" ');
  document.write('transferui="jfileupload.transfer.client.edesign.BatchTransferUI" ');
  document.write('transferuiresources="http://localhost/upload/i18n_pane" ');
  document.write('resources="http://localhost/upload/i18n_bar" ');
  document.write('resetprogressbar="true" '); 
  document.write('mode="http" ');
  document.write('scriptable=true ');
  document.writeln('pluginspage="http://java.sun.com/products/plugin/index.html#download"><NOEMBED>');
  // END
}
else {
  document.writeln('<APPLET CODE="jfileupload.upload.client.JSMApplet.class" JAVA_CODEBASE="http://localhost/upload/" ARCHIVE="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/jsapi.jar" WIDTH="500" HEIGHT="350" NAME="fileupload" MAYSCRIPT>');
}
// BEGIN: Update parameters below for INTERNET EXPLORER, FIREFOX, SAFARI, OPERA, MOZILLA, NETSCAPE 6+ support.
document.writeln('<PARAM NAME=CODE VALUE="jfileupload.upload.client.JSMApplet.class">');
document.writeln('<PARAM NAME=CODEBASE VALUE="http://localhost/upload/">');
document.writeln('<PARAM NAME=ARCHIVE VALUE="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/batchui.jar,lib/jsapi.jar">');
document.writeln('<PARAM NAME=NAME VALUE="fileupload">');
document.writeln('<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">');
document.writeln('<PARAM NAME="scriptable" VALUE="true">');
document.writeln('<PARAM NAME="url" VALUE="http://localhost/upload/doupload.php">');
document.writeln('<PARAM NAME="paramfile" VALUE="uploadfile">');
document.writeln('<PARAM NAME="param1" VALUE="todo">');
document.writeln('<PARAM NAME="value1" VALUE="upload">');
document.writeln('<PARAM NAME="whitelist" VALUE="*.pdf">');
document.writeln('<PARAM NAME="chunksize" VALUE="400000096">');
document.writeln('<PARAM NAME="overwrite" VALUE="false">');
document.writeln('<PARAM NAME="scriptable" VALUE="true">');
document.writeln('<PARAM NAME="maxfiles" VALUE=1>');

document.writeln('<PARAM NAME="transferui" VALUE="jfileupload.transfer.client.edesign.BatchTransferUI">');
document.writeln('<PARAM NAME="transferuiresources" VALUE="http://localhost/upload/i18n_pane">');
document.writeln('<PARAM NAME="resources" VALUE="http://localhost/upload/lib/i18n_bar">');
document.writeln('<PARAM NAME="resetprogressbar" VALUE="true">');
document.writeln('<PARAM NAME="mode" VALUE="http">');
document.writeln('<PARAM NAME="initcallbackonstart" VALUE="true">');


// END
if (_ie == true) {
  document.writeln('</OBJECT>');
}
else if (_ns == true && _ns6 == false) {
  document.writeln('</NOEMBED></EMBED>');
}
else {
  document.writeln('</APPLET>');
}
</script>

How do I do