Fix for Applet/JavaScript incompatibility in FireFox (tested under WindowXP, Firefox/2.0.0.12 [and IE 7]). Updated to use the 'object' tag, instead of deprecated 'applet'.

It seems wrapping the object/applet in a div tag was the solution to preventing FireFox from crashing.
This commit is contained in:
Daniel Blankenberg
2008-03-19 18:52:40 +00:00
parent 4d3c8fd595
commit 8c075e0d70
2 changed files with 68 additions and 39 deletions
+44 -3
View File
@@ -76,11 +76,44 @@ class Image( data.Data ):
dataset.peek = 'Image in %s format (%s)' % ( dataset.extension, data.nice_size( dataset.get_size() ) )
dataset.blurb = 'image'
def create_applet_tag_peek( class_name, archive, params ):
text = """
<!--[if !IE]>-->
<object classid="java:%s"
type="application/x-java-applet"
height="30" width="200" align="center" >
<param name="archive" value="%s"/>""" % ( class_name, archive )
for name, value in params.iteritems():
text += """<param name="%s" value="%s"/>""" % ( name, value )
text += """
<!--<![endif]-->
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
height="30" width="200" >
<param name="code" value="%s" />
<param name="archive" value="%s"/>""" % ( class_name, archive )
for name, value in params.iteritems():
text += """<param name="%s" value="%s"/>""" % ( name, value )
text += """</object>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
"""
return """<div><p align="center">%s</p></div>""" % text
class Gmaj( data.Data ):
"""Class describing a GMAJ Applet"""
file_ext = "gmaj.zip"
def set_peek( self, dataset ):
dataset.peek = "<p align=\"center\"><applet code=\"edu.psu.bx.gmaj.MajApplet.class\" archive=\"/static/gmaj/gmaj.jar\" width=\"200\" height=\"30\" align=\"middle\"> <param name=bundle value=\"display?id="+str(dataset.id)+"&tofile=yes&toext=.zip\"> <param name=buttonlabel value=\"Launch GMAJ\"><param name=nobutton value=\"false\"><param name=urlpause value=\"100\"><param name=debug value=\"false\"><i>Your browser is not responding to the &lt;applet&gt; tag.</i></applet></p>"
params = {
"bundle":"display?id=%s&tofile=yes&toext=.zip" % dataset.id,
"buttonlabel": "Launch GMAJ",
"nobutton": "false",
"urlpause" :"100",
"debug": "false",
}
class_name = "edu.psu.bx.gmaj.MajApplet.class"
archive = "/static/gmaj/gmaj.jar"
dataset.peek = create_applet_tag_peek( class_name, archive, params )
dataset.blurb = 'GMAJ Multiple Alignment Viewer'
def display_peek(self, dataset):
try:
@@ -142,8 +175,16 @@ class Laj( data.Text ):
"""Class describing a LAJ Applet"""
file_ext = "laj"
def set_peek( self, dataset ):
export_url = "/history_add_to?"+urlencode({'history_id':dataset.history_id,'ext':'lav','name':'LAJ Output','info':'Added by LAJ','dbkey':dataset.dbkey})
dataset.peek = "<p align=\"center\"><applet code=\"edu.psu.cse.bio.laj.LajApplet.class\" archive=\"static/laj/laj.jar\" width=\"200\" height=\"30\"><param name=buttonlabel value=\"Launch LAJ\"><param name=title value=\"LAJ in Galaxy\"><param name=posturl value=\""+export_url+"\"><param name=alignfile1 value=\"display?id="+str(dataset.id)+"\"><param name=noseq value=\"true\"></applet></p>"
params = {
"alignfile1": "display?id=%s" % dataset.id,
"buttonlabel": "Launch LAJ",
"title": "LAJ in Galaxy",
"posturl": "history_add_to?%s" % urlencode( { 'history_id': dataset.history_id, 'ext': 'lav', 'name': 'LAJ Output', 'info': 'Added by LAJ', 'dbkey': dataset.dbkey } ),
"noseq": "true"
}
class_name = "edu.psu.cse.bio.laj.LajApplet.class"
archive = "/static/laj/laj.jar"
dataset.peek = create_applet_tag_peek( class_name, archive, params )
dataset.blurb = 'LAJ Multiple Alignment Viewer'
def display_peek(self, dataset):
try:
+24 -36
View File
@@ -1,51 +1,39 @@
#post processing, add sequence and additional annoation info if available
from urllib import urlencode
from galaxy.datatypes.images import create_applet_tag_peek
def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
maf_input = None
seq_file1 = None
seq_file2 = None
exonfile = None
repeatfile = None
annotationfile = None
underlayfile = None
highlightfile = None
primary_data = out_data.items()[0][1]
#default params for LAJ type
params = {
"alignfile1": "display?id=%s" % primary_data.id,
"buttonlabel": "Launch LAJ",
"title": "LAJ in Galaxy",
"posturl": "history_add_to?%s" % urlencode( { 'history_id': primary_data.history_id, 'ext': 'lav', 'name': 'LAJ Output', 'info': 'Added by LAJ', 'dbkey': primary_data.dbkey } )
}
for name,data in inp_data.items():
if name == "maf_input":
maf_input = "/display?id="+str(data.id)
params["alignfile1"] = "display?id=%s" % data.id
elif name == "seq_file1" and data.state == data.states.OK and data.has_data():
seq_file1 = "/display?id="+str(data.id)
params["file1seq1"] = "display?id=%s" % data.id
elif name == "seq_file2" and data.state == data.states.OK and data.has_data():
seq_file2 = "/display?id="+str(data.id)
params["file1seq2"] = "display?id=%s" % data.id
elif name == "exonfile" and data.state == data.states.OK and data.has_data():
exonfile = "/display?id="+str(data.id)
params["exonfile"] = "display?id=%s" % data.id
elif name == "repeatfile" and data.state == data.states.OK and data.has_data():
repeatfile = "/display?id="+str(data.id)
params["repeatfile"] = "display?id=%s" % data.id
elif name == "annotationfile" and data.state == data.states.OK and data.has_data():
annotationfile = "/display?id="+str(data.id)
params["annotationfile"] = "display?id=%s" % data.id
elif name == "underlayfile" and data.state == data.states.OK and data.has_data():
underlayfile = "/display?id="+str(data.id)
params["underlayfile"] = "display?id=%s" % data.id
elif name == "highlightfile" and data.state == data.states.OK and data.has_data():
highlightfile = "/display?id="+str(data.id)
export_url = "/history_add_to?"+urlencode({'history_id':primary_data.history_id,'ext':'lav','name':'LAJ Output','info':'Added by LAJ','dbkey':primary_data.dbkey})
primary_data.peek = "<p align=\"center\"><applet code=\"edu.psu.cse.bio.laj.LajApplet.class\" archive=\"static/laj/laj.jar\" width=\"200\" height=\"30\"><param name=buttonlabel value=\"Launch LAJ\"><param name=title value=\"LAJ in Galaxy\"><param name=posturl value=\""+export_url+"\"><param name=alignfile1 value=\""+maf_input+"\">"
if seq_file1:
primary_data.peek = primary_data.peek + "<param name=file1seq1 value=\""+seq_file1+"\">"
if seq_file2:
primary_data.peek = primary_data.peek + "<param name=file1seq2 value=\""+seq_file2+"\">"
if exonfile:
primary_data.peek = primary_data.peek + "<param name=exonfile value=\""+exonfile+"\">"
if repeatfile:
primary_data.peek = primary_data.peek + "<param name=repeatfile value=\""+repeatfile+"\">"
if annotationfile:
primary_data.peek = primary_data.peek + "<param name=annotationfile value=\""+annotationfile+"\">"
if underlayfile:
primary_data.peek = primary_data.peek + "<param name=underlayfile value=\""+underlayfile+"\">"
if highlightfile:
primary_data.peek = primary_data.peek + "<param name=highlightfile value=\""+highlightfile+"\">"
params["highlightfile"] = "display?id=%s" % data.id
if not seq_file1 and not seq_file2:
primary_data.peek = primary_data.peek + "<param name=noseq value=\"true\">"
primary_data.peek = primary_data.peek +"</applet></p>"
if "file1seq1" not in params and "file1seq2" not in params:
params["noseq"] = "true"
class_name = "edu.psu.cse.bio.laj.LajApplet.class"
archive = "/static/laj/laj.jar"
primary_data.peek = create_applet_tag_peek( class_name, archive, params )
primary_data.flush()