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)
|
Hello iuembed.js version 2.0 which will be included with Image Uploader 4.0 for ActiveX and Image Uploader 2.0 for Java will support. It is scheduled to be released in April. Here is preliminary iuembed.js code: Code:// Aurigma Image Uploader Embedding Script
// Version 2.0.0.0 April 1, 2006
// Copyright(c) Aurigma Inc. 2002-2006
var _agt=navigator.userAgent.toLowerCase();
var _isOpera=(_agt.indexOf("opera")!=-1);
var _isWinIE=(_agt.indexOf("msie")!=-1)&&(_agt.indexOf("win")!=-1)&&!_isOpera;
var _isSafari=(_agt.indexOf("safari")!=-1);
//Create set/get expando methods for ActiveX
function _createExpandoMethods(id){
var o=document.getElementById(id);
var props=new Array();
for (propName in o){
var c=propName.charAt(0);
if (c==c.toUpperCase()){
props.push(propName);
}
}
for (i=0;i<props.length;i++){
//Check whether property is indexed
if (typeof(o[props[i]])=="unknown"){
eval("o.set"+props[i]+"=function(i,v){this."+props[i]+"(i)=v;};");
eval("o.get"+props[i]+"=function(i){return this."+props[i]+"(i);};");
}
else{
eval("o.set"+props[i]+"=function(v){this."+props[i]+"=v};");
eval("o.get"+props[i]+"=function(){return this."+props[i]+"};");
}
}
}
function getJava14Available(){
}
function ControlWriter(id,width,height){
//Private
this._params=new Array();
this._events=new Array();
this._getObjectParamHtml=function(name,value){
return "<param name=\""+name+"\" value=\""+value+"\" />";
}
this._getObjectParamsHtml=function(){
var r="";
var p=this._params;
var i;
for (i=0;i<p.length;i++){
r+=this._getObjectParamHtml(p[i].name,p[i].value);
}
return r;
}
this._getObjectEventsHtml=function(){
var r="";
var e=this._events;
for (i=0;i<e.length;i++){
r+=this._getObjectParamHtml(e[i].name+"Listener",e[i].listener);
}
return r;
}
this._getEmbedParamHtml=function(name,value){
return " "+name+"=\""+value+"\"";
}
this._getEmbedParamsHtml=function(){
var r="";
var p=this._params;
var i;
for (i=0;i<p.length;i++){
r+=this._getEmbedParamHtml(p[i].name,p[i].value);
}
return r;
}
this._getEmbedEventsHtml=function(){
var r="";
var e=this._events;
for (i=0;i<e.length;i++){
r+=this._getEmbedParamHtml(e[i].name+"Listener",e[i].listener);
}
return r;
}
//Public
//Properties
this.id=id;
this.width=width;
this.height=height;
this.activeXControlEnabled=true;
this.activeXControlVersion="";
this.javaAppletEnabled=true;
this.javaAppletCodeBase="./";
this.javaAppletCached=true;
this.javaAppletVersion="";
this.fullPageLoadListenerName=null;
//Installation instructions
this.instructionsEnabled=true;
this.instructionsCommon="ActiveX control Image Uploader is necessary to upload "+
"your photos quickly and easily. You will be able to select multiple images "+
"in user-friendly interface instead of clumsy input fields with Browse button. "+
"Installation will take up to few minutes, please be patient. ";
this.instructionsNotWinXPSP2="If you are on other OS then Windows XP Service Pack 2 then "+
"please reload page and select \"Yes\" when you will see control installation dialog.";
this.instructionsWinXPSP2="If you are on Windows XP Service Pack 2 then please click "+
"on Information Bar to install control. After page reloading select \"Yes\" when "+
"you will see control installation dialog.";
//Methods
this.addParam=function(paramName,paramValue){
var p=new Object();
p.name=paramName;
p.value=paramValue;
this._params.push(p);
}
this.addEventListener=function(eventName,eventListener){
var p=new Object();
p.name=eventName;
p.listener=eventListener;
this._events.push(p);
}
this.getActiveXInstalled=function(){
if (this.progID){
try{
var a=new ActiveXObject(this.progID);
return true;
}
catch(e){
return false;
}
}
return false;
}
this.getHtml=function(){
var r="";
if (this.fullPageLoadListenerName){
r+="<" + "script language=\"javascript\">";
r+="var __"+this.id+"_pageLoaded=false;";
r+="var __"+this.id+"_controlLoaded=false;";
r+="function __fire_"+this.id+"_fullPageLoad(){";
r+="if (__"+this.id+"_pageLoaded&&__"+this.id+"_controlLoaded){";
r+=this.fullPageLoadListenerName + "();";
r+="}";
r+="}";
var pageLoadCode="new Function(\"__"+this.id+"_pageLoaded=true;__fire_"+this.id+"_fullPageLoad();\")";
if (_isWinIE){
r+="window.attachEvent(\"onload\","+pageLoadCode+");";
}
else{
r+="var r=window.addEventListener?window:document.addEventListener?document:null;";
r+="if (r){r.addEventListener(\"load\","+pageLoadCode+",false);}";
}
r+="<"+"/script>";
}
//ActiveX control
if(_isWinIE&&this.activeXControlEnabled){
this.controlType="ActiveX";
var v=this.activeXControlVersion.replace(/\./g,",")
var cb=this.activeXControlCodeBase+(v==""?"":"#version="+v);
r+="<object id=\""+this.id+"\" name=\""+this.id+"\" classid=\"clsid:"+this.activeXClassID+"\" codebase=\""+cb+"\" width=\""+this.width+"\" height=\""+this.height+"\">";
if (this.instructionsEnabled){
r+=this.instructionsCommon;
var isXPSP2=(window.navigator.userAgent.indexOf("SV1") != -1);
if (isXPSP2){
r+=this.instructionsWinXPSP2;
}
else{
r+=this.instructionsNotWinXPSP2;
}
}
r+=this._getObjectParamsHtml();
r+="</object>";
//Event handlers
var e=this._events;
var eventParams;
for (i=0;i<e.length;i++){
//TODO
if (e[i].name=="Progress"){
eventParams="Status, Progress, ValueMax, Value, StatusText";
}
else if (e[i].name=="ViewChange"){
eventParams="Pane";
}
else{
eventParams="";
}
r+="<" + "script for=\""+this.id+"\" event=\""+e[i].name+"("+eventParams+")\">";
if (e[i].name=="BeforeUpload"){
r+="return ";
}
r+=e[i].listener+"("+eventParams+");";
r+="<"+"/script>";
}
r+="<" + "script for=\""+this.id+"\" event=\"InitComplete()\">";
r+="_createExpandoMethods(\""+this.id+"\");";
if (this.fullPageLoadListenerName){
r+="__"+this.id+"_controlLoaded=true;";
r+="__fire_"+this.id+"_fullPageLoad();";
}
r+="<"+"/script>";
}
else
//Java appplet
if(this.javaAppletEnabled){
this.controlType="Java";
if (this.fullPageLoadListenerName){
r+="<" + "script language=\"javascript\">";
r+="function __"+this.id+"_InitComplete(){";
r+="__"+this.id+"_controlLoaded=true;";
r+="__fire_"+this.id+"_fullPageLoad();";
r+="}";
r+="<"+"/script>";
}
//<object> for IE and <applet> for Safari
if (_isWinIE||_isSafari){
if (_isWinIE){
r+="<object id=\""+this.id+"\" classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\" codebase=\""+window.location.protocol+"//java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0\" width=\""+this.width+"\" height=\""+this.height+"\">";
}
else{
r+="<applet id=\""+this.id+"\" code=\""+this.javaAppletClassName+"\" java_codebase=\"../\" align=\"baseline\" archive=\""+this.javaAppletJarFileName+"\" mayscript=\"true\" scriptable=\"true\" width=\""+this.width+"\" height=\""+this.height+"\">";
}
if (this.javaAppletCached&&this.javaAppletVersion!=""){
r+=this._getObjectParamHtml("cache_archive",this.javaAppletJarFileName);
var v=this.javaAppletVersion.replace(/\,/g,".");
r+=this._getObjectParamHtml("cache_version",v+","+v);
}
r+=this._getObjectParamHtml("type","application/x-java-applet;version=1.4");
r+=this._getObjectParamHtml("codebase",this.javaAppletCodeBase);
r+=this._getObjectParamHtml("archive",this.javaAppletJarFileName);
r+=this._getObjectParamHtml("code",this.javaAppletClassName);
r+=this._getObjectParamHtml("scriptable","true");
r+=this._getObjectParamHtml("mayscript","true");
r+=this._getObjectParamsHtml();
r+=this._getObjectEventsHtml();
if (this.fullPageLoadListenerName){
r+=this._getObjectParamHtml("InitCompleteListener","__"+this.id+"_InitComplete");
}
if (_isWinIE){
r+="</object>";
}
else{
r+="</applet>";
}
}
//<embed> for all other browsers
else{
r+="<embed id=\""+this.id+"\" type=\"application/x-java-applet;version=1.4\" codebase=\""+this.javaAppletCodeBase+"\" code=\""+this.javaAppletClassName+"\" archive=\""+this.javaAppletJarFileName+"\" width=\""+this.width+"\" height=\""+this.height+"\" scriptable=\"true\" mayscript=\"true\" pluginspage=\""+window.location.protocol+"//java.sun.com/products/plugin/index.html#download\"";
if (this.javaAppletCached&&this.javaAppletVersion!=""){
r+=this._getEmbedParamHtml("cache_archive",this.javaAppletJarFileName);
var v=this.javaAppletVersion.replace(/\,/g,".");
r+=this._getEmbedParamHtml("cache_version",v+","+v);
}
r+=this._getEmbedParamsHtml();
r+=this._getEmbedEventsHtml();
if (this.fullPageLoadListenerName){
r+=this._getEmbedParamHtml("InitCompleteListener","__"+this.id+"_InitComplete");
}
r+=">";
r+="</embed>";
}
}
else
{
this.controlType="None";
r+="Your browser is not supported.";
}
return r;
}
this.writeHtml=function(){
document.write(this.getHtml());
}
}
function ImageUploaderWriter(id,width,height){
this._base=ControlWriter;
this._base(id,width,height);
//These properties should be modified for private label versions only
this.activeXControlCodeBase="ImageUploader3.cab";
this.activeXClassID="A18962F6-E6ED-40B1-97C9-1FB36F38BFA8";
this.progID="Aurigma.ImageUploader3";
this.javaAppletJarFileName="ImageUploader.jar";
this.javaAppletClassName="com.aurigma.imageuploader.ImageUploader.class";
}
function ThumbnailWriter(id,width,height){
this._base=ControlWriter;
this._base(id,width,height);
//These properties should be modified for private label versions only
this.activeXControlCodeBase="ImageUploader3.cab";
this.activeXClassID="A18962F6-E6ED-40B1-97C9-1FB36F38BFA8";
this.javaAppletJarFileName="";//null
this.javaAppletClassName="";//null
}
function ShellComboBoxWriter(id,width,height){
this._base=ControlWriter;
this._base(id,width,height);
//These properties should be modified for private label versions only
this.activeXControlCodeBase="ImageUploader3.cab";
this.activeXClassID="92E7E45A-D8C8-480E-AF99-176E43997CAA";
this.javaAppletJarFileName="";//null
this.javaAppletClassName="";//null
}
function getImageUploader(id){
if (_isSafari){
return document[id];
}
else{
return document.getElementById(id);
}
}
Edited by user Thursday, December 20, 2007 4:51:03 PM(UTC)
| Reason: Not specified |
Best regards, Fedor Skvortsov
|