Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Image Uploader for ActiveX and Image Uploader for Java have the same API, but they have syntax differences due ActiveX and Java nature: 1. We should include applet on page different ways for different browsers. Here is how Sun recommends to include it on page: Code:<object
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
<param name="code" value="com.aurigma.imageuploader.ImageUploader.class">
<param name="archive" value="ImageUploader.jar,ImageUploaderHC.jar">
<param name="MaxFileCount" value="10"> <-----Our parameter
<comment>
<embed
type="application/x-java-applet;jpi-version=1.4.0"
code="com.aurigma.imageuploader.ImageUploader.class"
archive="ImageUploader.jar,ImageUploaderHC.jar"
MaxFileCount="10" <-----Our parameter
>
<noembed>
No Java Support.
</noembed>
</embed>
</comment>
</object>
As you see we need to duplicate our MaxFileCount parameter in several sections. To pevent it we have implemented special iulink.js script which writes appropriate HTML code for different browsers, and even for Java or ActiveX version using common syntax: Code:
<html>
<head>
<script SRC='../iulink.js'></script>
</head>
<body>
<script language="javascript">
var iu=new ImageUploader("ImageUploader",750,500);
iu.enableActiveX=true;
iu.enableJava=true;
iu.addParam("Layout", "ThreePanes");
iu.addParam("FolderView", "Thumbnails");
iu.addParam("UploadView", "Thumbnails");
iu.addParam("UploadThumbnail1FitMode", "fit");
iu.addParam("UploadThumbnail1Width", "120");
iu.addParam("UploadThumbnail1Height", "120");
iu.addParam("UploadThumbnail1JpegQuality", "60");
iu.addParam("BackgroundColor", "#FFF8EE");
iu.addParam("PaneBackgroundColor", "#FFFFFF");
iu.addParam("ShowFileNames", "False");
iu.addParam("ShowDescriptions", "False");
iu.addParam("ShowButtons", "False");
iu.addParam("ShowStatusPane", "False");
iu.addParam("ShowDebugWindow", "True");
iu.addParam("AdditionalFormName", "Form1");
iu.addParam("Action", "<%=Request.QueryString("path")%>");
iu.writeHtml();
</script>
</body>
</html>
2. In Java for accessing properties we should use explicit getters and setters via setPropertyName and getPropertyName methods: Code:[ActiveX]
ImageUploader.MaxFileCount = ImageUploader.MaxFileCount * 2;
Code:[Java]
ImageUploader.setMaxFileCount(ImageUploader.getMaxFileCount() * 2);
On other side if you use iulink.js you can access to both ActiveX and Java using setPropertyName/ getPropertyName methods as iulink.js expands ActiveX object with explicit setters and getters. 3. In Java version for handling events we should use other syntax then in ActiveX one: Code:[ActiveX]
<script for="ImageUploader" event="Progress(Status, Progress, ValueMax, Value, StatusText)">
if (Status=="COMPLETE"){
// When upload is finished, we are redirecting to the PictureGalery.aspx page
window.location = 'PictureGallery.aspx';
}
</script>
Code:[Java]
<script>
function ImageUploader1_Progress(Status, Progress, ValueMax, Value, StatusText){
if (Status=="COMPLETE"){
// When upload is finished, we are redirecting to the PictureGalery.aspx page
window.location = 'PictureGallery.aspx';
}
}
</script>
<object
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
<param name="code" value="com.aurigma.imageuploader.ImageUploader.class">
<param name="archive" value="ImageUploader.jar,ImageUploaderHC.jar">
<param name="Progress" value="ImageUploader1_Progress"> <-----Our parameter
<comment>
<embed
type="application/x-java-applet;jpi-version=1.4.0"
code="com.aurigma.imageuploader.ImageUploader.class"
archive="ImageUploader.jar,ImageUploaderHC.jar"
Progress="ImageUploader1_Progress" <-----Our parameter
>
<noembed>
No Java Support.
</noembed>
</embed>
</comment>
</object>
For handling events you can also use common syntax using iulink.js script: Code:
<html>
<head>
<script SRC='../iulink.js'></script>
</head>
<body>
<script language="javascript">
function ImageUploader1_Progress(Status, Progress, ValueMax, Value, StatusText){
if (Status=="COMPLETE"){
// When upload is finished, we are redirecting to the PictureGalery.aspx page
window.location = 'PictureGallery.aspx';
}
}
</script>
<script language="javascript">
var iu=new ImageUploader("ImageUploader",750,500);
iu.addEventListener("Progress", "ImageUploader1_Progress");
iu.writeHtml();
</script>
</body>
</html>
In general using iulink.js script will simplify migration process gracefully and we will publish several migration samples. Edited by user Monday, December 24, 2007 4:07:31 PM(UTC)
| Reason: Not specified |
Best regards, Fedor Skvortsov
|