Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
JHealy  
#1 Posted : Sunday, March 2, 2008 10:51:31 PM(UTC)
JHealy

Rank: Newbie

Groups: Member
Joined: 1/16/2008(UTC)
Posts: 8

Hi, I was wondering if there was a way I would be able to bind the install of the image uploader to a button etc. Some users are hesitant about the activeX information bar pop up and I was thinking of making the install part of the site registration.

Many thanks,

J Healy
Fedor  
#2 Posted : Monday, March 3, 2008 4:04:48 PM(UTC)
Fedor

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,

I have written small code snippet with custom install button. Please note that we need to remember that user selected Image Uploader installation, as control should be displayed automatically on next page load. It is especially important for IE+ActiveX as after initial installation button click the yellow information bar will be displayed. If user will accept ActiveX control installation then the page will be reloaded. After the page reload Image Uploader should be displayed right on page load for successful control installation.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Aurigma Image Uploader - Custom Install Button</title>

    <script type="text/javascript" src="iuembed.js"></script>

    <script type="text/javascript">
//<![CDATA[
function createImageUploader(){
    var c = document.getElementById("iucontainer");
    c.style.display = "block";

    var iu = new ImageUploaderWriter("ImageUploader1", 650, 400);

    iu.activeXControlCodeBase = "./ImageUploader5.cab";

    iu.javaAppletJarFileName = "ImageUploader5.jar";
    iu.javaAppletCodeBase = "./";

    iu.showNonemptyResponse = "off";

    c.innerHTML = iu.getHtml();
}

function btninstall_click(){
    createImageUploader();

    document.getElementById("btninstall").style.display = "none";
    //Save in cookies that user installed Image Uploader
    //We can also retrieve it on server side and save it in profile settings    
    var expdate = new Date();
    expdate.setTime (expdate.getTime() + 100 * (24 * 60 * 60 * 1000)); //Current date + 100 days
    document.cookie = "ImageUploaderInstalled=1; expires=" + expdate.toGMTString();
}

function window_load(){
    //Check whether user installed Image Uploader 
    if (document.cookie.indexOf("ImageUploaderInstalled") != -1){
        createImageUploader();    
    }
    else{
        document.getElementById("btninstall").style.display = "block";	
    }
}

window.onload = window_load;
//]]>
    </script>
</head>
<body>
    <div id="iucontainer" style="display:none">
    
    </div>
    <button id="btninstall" onclick="btninstall_click();" style="display:none">Install Image Uploader</button>
</body>
</html>

Edited by user Tuesday, March 4, 2008 3:20:39 PM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
JHealy  
#3 Posted : Wednesday, March 5, 2008 6:19:43 PM(UTC)
JHealy

Rank: Newbie

Groups: Member
Joined: 1/16/2008(UTC)
Posts: 8

This is great, was hoping just for a link to instructions or brief explanation, code works perfectly!

Many thanks,

J Healy
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.