[system] / trunk / pg / lib / Applet.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Applet.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5574 Revision 5583
1################################################################################ 1################################################################################
2# WeBWorK Online Homework Delivery System 2# WeBWorK Online Homework Delivery System
3# Copyright 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ 3# Copyright 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: pg/macros/PG.pl,v 1.34 2007/10/25 17:11:59 sh002i Exp $ 4# $CVSHeader: pg/lib/Applet.pm,v 1.2 2007/11/05 16:45:33 gage Exp $
5# 5#
6# This program is free software; you can redistribute it and/or modify it under 6# This program is free software; you can redistribute it and/or modify it under
7# the terms of either: (a) the GNU General Public License as published by the 7# the terms of either: (a) the GNU General Public License as published by the
8# Free Software Foundation; either version 2, or (at your option) any later 8# Free Software Foundation; either version 2, or (at your option) any later
9# version, or (b) the "Artistic License" which comes with this package. 9# version, or (b) the "Artistic License" which comes with this package.
94 94
95use MIME::Base64 qw( encode_base64 decode_base64); 95use MIME::Base64 qw( encode_base64 decode_base64);
96 96
97use constant DEFAULT_HEADER_TEXT =><<'END_HEADER_SCRIPT'; 97use constant DEFAULT_HEADER_TEXT =><<'END_HEADER_SCRIPT';
98 <script language="javascript">AC_FL_RunContent = 0;</script> 98 <script language="javascript">AC_FL_RunContent = 0;</script>
99 <script src="http://hosted2.webwork.rochester.edu/webwork2_files/applets/AC_RunActiveContent.js" language="javascript"></script> 99 <script src="http://hosted2.webwork.rochester.edu/webwork2_files/applets/AC_RunActiveContent.js" language="javascript">
100
101 <script type="text/javascript" src="http://hosted2.webwork.rochester.edu/webwork2_files/js/BrowserSniffer.js">
102 </script> 100 </script>
101
102
103 <script language="JavaScript"> 103 <script language="JavaScript">
104 104
105 var flash; 105 var flash;
106 function getFlashMovie(movieName) { 106 function getFlashMovie(movieName) {
107 var isIE = navigator.appName.indexOf("Microsoft") != -1; 107 var isIE = navigator.appName.indexOf("Microsoft") != -1;
108 return (isIE) ? window[movieName] : window.document[movieName]; 108 return (isIE) ? window[movieName] : window.document[movieName];
109 //return window.document[movieName]; 109 //return window.document[movieName];
110 } 110 }
111 function getBrowser() { 111
112 return new BrowserSniffer();
113 }
114 112
115 function initialize() { 113 function initialize() {
116 getFlashMovie("$appletId").$initializeAction("$base64_xmlString"); 114 getFlashMovie("$appletId").$initializeAction("$base64_xmlString");
117 } 115 }
118 function submitAction() { 116 function submitAction() {
119 document.problemMainForm.$returnFieldName.value = getFlashMovie("$appletId").$submitAction(); 117 document.problemMainForm.$returnFieldName.value = getFlashMovie("$appletId").$submitAction();
120 } 118 }
121 119
122 </script>, 120 </script>
123 121
124END_HEADER_SCRIPT 122END_HEADER_SCRIPT
125 123
126 124
127# <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" 125# <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
137# allowFullScreen="false" 135# allowFullScreen="false"
138# type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> 136# type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
139# <param name="quality" value="high" /><param name="bgcolor" value="#ffffcc" /> 137# <param name="quality" value="high" /><param name="bgcolor" value="#ffffcc" />
140# </object> 138# </object>
141 139
140=pod
141
142The secret to making this applet work with IE in addition to normal browsers
143is the addition of the C(<form></form>) construct just before the object.
144
145For some reason IE has trouble locating a flash object which is contained
146within a form. Adding this second blank form with the larger problemMainForm
147seems to solve the problem.
148
149This follows method2 of the advice given in url(http://kb.adobe.com/selfservice/viewContent.do?externalId=kb400730&sliceId=2)
150Method1 and methods involving SWFObject(Geoff Stearns) and SWFFormFix (Steve Kamerman) have yet to be fully investigated:
151http://devel.teratechnologies.net/swfformfix/swfobject_swfformfix_source.js
152http://www.teratechnologies.net/stevekamerman/index.php?m=01&y=07&entry=entry070101-033933
153
154=cut
155
142use constant DEFAULT_OBJECT_TEXT =><<'END_OBJECT_TEXT'; 156use constant DEFAULT_OBJECT_TEXT =><<'END_OBJECT_TEXT';
157 <form></form>
143 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 158 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
144 id="ExternalInterface" width="500" height="375" 159 id="ExternalInterface" width="500" height="375"
145 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"> 160 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
146 <param name="movie" value="$codebase/$appletName.swf" /> 161 <param name="movie" value="$codebase/$appletName.swf" />
147 <param name="quality" value="high" /> 162 <param name="quality" value="high" />

Legend:
Removed from v.5574  
changed lines
  Added in v.5583

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9