Wednesday, July 18, 2007

Change double click behaviour on SSGD application

This post contains information for administrators who present the browser based webtop (version 4.x and higher) to their users and the users are using Internet Explorer.
(If someone can make this work for other browsers as well I will be very happy to recieve that sollution)

When a users starts an application from a normal Windows Desktop he/she needs to double click the application icon. I have seen many users doing the same (double click) with the application icon on the SSGD webtop. Since the double click is not implemented on the webtop the browser treads this behaviour as clicking the link twice and therefor SSGD will try to start the application twice.

Looking a bit deeper into SSGD the click on an application icon results in a signal to the tcc.exe to start a new application session. When the tcc.exe has started the application session it will give a signal back to the webtop refresh the application list. This step normally takes one to two seconds. When during those one or two seconds an other click on the icon occurs a new signal is given to the tcc.exe. This second click may not be valid when the limit of applications for this application has been reached. This will result in an error 'Error - Launch failed'.

I have been searching for a sollution and found a simple sollution. But this sollution only works for Internet Explorer. (I have tested this with Mozilla as well, but Mozilla treads javascript a bit different.)

A small adaption of the webtop can be made to disable the application link after it has been clicked and enable it again when the application list has been refreshed.
This adaption can be done by changing one single file: webtop.jsp

The changes below will change the behaviour of the webtop in the following manner:
When a users starts an application the webtop will not allow the users to start/resume/suspend the same application again until the webtop application list has been refreshed.
It will still be possible to start multiple different applications.

The file location of webtop.jsp can differ between different SSGD versions. For SSGD version 4.3 the location is:

/opt/tarantella/webserver/tomcat/5.0.28_axis1.2/webapps/sgd/webtops/standard/webtop

The location for version 4.2 is:
/opt/tarantella/webserver/tomcat/5.0.28_axis1.2final_jk1.2.8/webapps/sgd/webtops/standard/locale=en-us/webtop/


Changes in javasctript of the webtop.jsp are:

add array link_active_names (contains the already started applications
add variable link_counter = 0 (contains the number of applications in the array)
Add function ActivateLink(..) (being called when an application starts)
Change function OnKeyPress(..) (return false when the application has already been started)

Changes have to be made on all the function calls (8 times) to OnKeyPress(..). The name of the applcation link has to be added as the first parameter.
Changes have to be made on the application links which start a new application (4 times). The OnClick events must also call the ActivateLink() function.

The actual code for these changes are:

Replace the function OnKeyPress in the webtop.jsp

var link_counter = 0;
var link_active_names = new Array();
function ActivateLink( linkname )

link_active_names[link_counter] = linkname;
link_counter = link_counter + 1;
}
function OnKeyPress( linkname, event, url, target, toggleTarget, resumeOpt, toggleResumeOpt )
{
var newurl;

var disable_link = 0;
for (i=0;i<link_active_names.length;i++)
if (link_active_names[i] == linkname)
{
disable_link = 1;
}


if (disable_link==0) {
if (window.event)
{
ctrl = window.event.ctrlKey;
shift = window.event.shiftKey;
}
else if (event)
{
ctrl = event.ctrlKey;
shift = event.shiftKey;
}
else
{
ctrl = false;
shift = false;
}

if (ctrl && shift)
{
newurl=url+"&toggledisplay=true&forceauthentication=true"+toggleResumeOpt;
window.open(newurl, toggleTarget);
}
else if (ctrl)
{
newurl=url+"&toggledisplay=true"+toggleResumeOpt;
window.open(newurl, toggleTarget);
}
else if (shift)
{
newurl=url+"&forceauthentication=true"+resumeOpt;
window.open(newurl, target);
}
else
{
return true;
}
}

if (window.event)
{
window.event.returnValue=false;
}
else if (event)
{
event.returnValue=false;
event.cancelBubble=true;
}

return false;
}


All the function calls changes in the webtop.jsp are shown via a diff between the old 4.3 version of the webtop.jsp and the changed webtop.jsp:

294c312
< <a onclick="OnKeyPress(event, '<%= launchUrl %>', '<%= target %>', '<%= toggleTarget %>', '<%= resumeOpt %>', '<%= toggleResumeOpt %>')" href="<%= launchUrl + resumeOpt %>" target="<%= target %>" title="<%= toolTip %>"><img src="<%= getIconGif(icon) %>" alt="<%= displayname %>" border="0" width="20" height="20"></a>
---
> <a onclick="OnKeyPress('<%= displayname %>', event, '<%= launchUrl %>', '<%= target %>', '<%= toggleTarget %>', '<%= resumeOpt %>', '<%= toggleResumeOpt %>');ActivateLink('<%= displayname %>');" href="<%= launchUrl + resumeOpt %>" target="<%= target %>" title="<%= toolTip %>"><img src="<%= getIconGif(icon) %>" alt="<%= displayname %>" border="0" width="20" height="20"></a>
336c354
< <a onclick="OnKeyPress(event, '<%= launchUrl %>', '<%= target %>', '<%= toggleTarget %>', '<%= resumeOpt %>', '<%= toggleResumeOpt %>')" href="<%= launchUrl + resumeOpt %>" target="<%= target %>" title="<%= toolTip %>"><%= displayname %></a></p>
---
> <a onclick="OnKeyPress('<%= displayname %>', event, '<%= launchUrl %>', '<%= target %>', '<%= toggleTarget %>', '<%= resumeOpt %>', '<%= toggleResumeOpt %>');ActivateLink('<%= displayname %>');" href="<%= launchUrl + resumeOpt %>" target="<%= target %>" title="<%= toolTip %>"><%= displayname %></a></p>
471c489
< <a onclick="OnKeyPress(event, '<%= resumeUrl %>', '<%= target %>', '<%= toggleTarget %>', '', '')" href="<%= resumeUrl %>" target="<%= target %>">Session <%= i.toString(sess_no++)%></a>
---
> <a onclick="OnKeyPress('<%= displayname %>', event, '<%= resumeUrl %>', '<%= target %>', '<%= toggleTarget %>', '', '')" href="<%= resumeUrl %>" target="<%= target %>">Session <%= i.toString(sess_no++)%></a>
488c506
< <a onclick="OnKeyPress(event, '<%= resumeUrl %>', '<%= target %>', '<%= toggleTarget %>', '', '')" href="<%= resumeUrl %>" target="<%= target %>"><img src="<%= getWebtopGif("play.gif")%>" alt="<%=getWebtopString("I0_AltResume")%>" title="<%=getWebtopString("I0_AltResume")%>" width="12" height="10" hspace="2" border="0" align="absmiddle" id="Resume"></a>
---
> <a onclick="OnKeyPress('<%= displayname %>', event, '<%= resumeUrl %>', '<%= target %>', '<%= toggleTarget %>', '', '')" href="<%= resumeUrl %>" target="<%= target %>"><img src="<%= getWebtopGif("play.gif")%>" alt="<%=getWebtopString("I0_AltResume")%>" title="<%=getWebtopString("I0_AltResume")%>" width="12" height="10" hspace="2" border="0" align="absmiddle" id="Resume"></a>
568c586
< <a onclick="OnKeyPress(event, '<%= launchUrl %>', '<%= target %>', '<%= toggleTarget %>', '<%= resumeOpt %>', '<%= toggleResumeOpt %>')" href="<%= launchUrl + resumeOpt %>" target="<%= target %>" title="<%= toolTip %>"><img src="<%= getIconGif(icon) %>" alt="<%= displayname %>" border="0" width="20" height="20"></a>
---
> <a onclick="OnKeyPress('<%= displayname %>', event, '<%= launchUrl %>', '<%= target %>', '<%= toggleTarget %>', '<%= resumeOpt %>', '<%= toggleResumeOpt %>');ActivateLink('<%= displayname %>');" href="<%= launchUrl + resumeOpt %>" target="<%= target %>" title="<%= toolTip %>"><img src="<%= getIconGif(icon) %>" alt="<%= displayname %>" border="0" width="20" height="20"></a>
610c628
< <a onclick="OnKeyPress(event, '<%= launchUrl %>', '<%= target %>', '<%= toggleTarget %>', '<%= resumeOpt %>', '<%= toggleResumeOpt %>')" href="<%= launchUrl + resumeOpt %>" target="<%= target %>" title="<%= toolTip %>"><%= displayname %></a></p>
---
> <a onclick="OnKeyPress('<%= displayname %>', event, '<%= launchUrl %>', '<%= target %>', '<%= toggleTarget %>', '<%= resumeOpt %>', '<%= toggleResumeOpt %>');ActivateLink('<%= displayname %>');" href="<%= launchUrl + resumeOpt %>" target="<%= target %>" title="<%= toolTip %>"><%= displayname %></a></p>
695c713
< <a onclick="OnKeyPress(event, '<%= resumeUrl %>', '<%= target %>', '<%= toggleTarget %>', '', '')" href="<%= resumeUrl %>" target="<%= target %>">Session <%= i.toString(sess_no++)%></a>
---
> <a onclick="OnKeyPress('<%= displayname %>', event, '<%= resumeUrl %>', '<%= target %>', '<%= toggleTarget %>', '', '')" href="<%= resumeUrl %>" target="<%= target %>">Session <%= i.toString(sess_no++)%></a>
712c730
< <a onclick="OnKeyPress(event, '<%= resumeUrl %>', '<%= target %>', '<%= toggleTarget %>', '', '')" href="<%= resumeUrl %>" target="<%= target %>"><img src="<%= getWebtopGif("play.gif")%>" alt="<%=getWebtopString("I0_AltResume")%>" title="<%=getWebtopString("I0_AltResume")%>" width="12" height="10" hspace="2" border="0" align="absmiddle" id="Resume"></a>
---
> <a onclick="OnKeyPress('<%= displayname %>', event, '<%= resumeUrl %>', '<%= target %>', '<%= toggleTarget %>', '', '')" href="<%= resumeUrl %>" target="<%= target %>"><img src="<%= getWebtopGif("play.gif")%>" alt="<%=getWebtopString("I0_AltResume")%>" title="<%=getWebtopString("I0_AltResume")%>" width="12" height="10" hspace="2" border="0" align="absmiddle" id="Resume"></a>

Thursday, July 12, 2007

Configure Windows Application in SSGD

Before configuring a Windows Application make sure the application is running on the Windows Application Server (Windows Terminal Server).

  1. First connect to the Windows Terminal Server directly via RDP with an RDP Client.
  2. Start a command prompt (Start->Run->cmd.exe)
  3. cd to the directory from where the application must be started (Startup Directory)
  4. start the program (Application Command Line)
If the application starts you are ready to configure the application in SSGD. First prepare the parameters used in SSGD:
  • Split the Application Command Line in "Application Command" and "Arguments for Command"
    • The Application Command is the first part of the Application Command Line until the extention exe, bat, com, vbs (and alike)
    • The remainder of the Application Command Line are the Arguments for the Command
    • Replace in both the \ with a double \\, So c:\Program Files\Internet Explorer\iexplore.exe will be c:\\Program Files\\Internet Explorer\\iexplore.exe
  • The protocol arguments are: -dir "Startup Directory" (with the \ replaced by \\)
    For example: -dir "c:\\Program Files\\Internet Explorer\\"

Configure the application in SSGD. This can be done in several ways. In this example I will use the command line:

tarantella object new_windowsapp \
--name ".../_ens/o=organization/cn=WindowsApplication" \
--width 1000 --height 800 \
--app Application Command \
--args Arguments for Command \
--protoargs "-dir Startup Directory" \
--appserv ".../_ens/o=organization/cn=ApplicationServerName"

Wednesday, July 11, 2007

Introduction to Sun Secure Global Desktop

It should be wise to start this blog with a small introduction of Sun Secure Global Desktop (SSGD).

In 2005 Sun Microsystems bought the company Tarantella and renamed the product Tarantella Secure Global Desktop to Sun Secure Global Desktop. Tarantella was by then almost 10 years old and was started as a small project within Santa Cruz Operation. The goal of this project was


"any application, any client, anywhere":
to provide access to applications of any type (hosted on back-end servers) from any client device that supported a Java-enabled web browser.

Source: Wikipedia

The current version of Sun Secure Global Desktop is version 4.31 released in May 2007 still has the same goal. When looking a the main product picture of SSGD all the objectives of the goal are still visible:



Besides the full list of features SSGD can be easily modified, extended and incorporated.
I have the intention to elaborate on these modifications, extensions and incorporations within this blog.

Monday, July 9, 2007

Start of the Virtual Desktops Blog

This is the start of a new blog. The main purpose of this blog will be to share information about Virtual Desktops mostly based on Sun Secure Global Desktop (formally known as Tarantella).

My current position within the organization Everett is Senior Technical Consultant Secure Platform Services. Besides having a broad focus I am also trying to specialize in the field of Secure Remote Access. To become a Premier Solution Provider of Tarantella we (Everett) performed the Tarantella Certification Training, which I attended in 2004. After this training I have done multiple totally different Tarantella projects. During those days Everett was also partner of Sun Microsystems, so after Sun bought Tarantalla, we knew the product and the new owner of the product. After this sell we still are doing many projects with the newly named product Sun Secure Global Destop.