From 5737f58b9576fca995af307528cc93eeb9cf5ae0 Mon Sep 17 00:00:00 2001 From: jmclaus Date: Wed, 30 Jan 2013 18:35:12 +0100 Subject: [PATCH] Added GWT Protex - reads target shape from xml writes answer to hidden input field --- .../capa/templates/designprotein2dinput.html | 14 +- common/static/js/capa/design-protein-2d.js | 64 +- ...C6A8521F649572545B3BA3AA9FA1A9B.cache.html | 733 +++++++++++ ...C6B778AF617337CF1AA0A282AC4D7B0.cache.html | 733 +++++++++++ ...04385F1071F71E1014982EA938C6B7E.cache.html | 750 +++++++++++ ...35B3434697F7AF2B11420E0CB0BE5AE.cache.html | 726 +++++++++++ ...F67986D033F86F91DDB3DF610449406.cache.html | 737 +++++++++++ ...3666BB82AEBB9EF82419B4F096E8C82.cache.html | 741 +++++++++++ common/static/js/capa/protex/Protex.css | 59 + common/static/js/capa/protex/clear.cache.gif | Bin 0 -> 43 bytes .../protex/gwt/standard/images/corner.png | Bin 0 -> 1140 bytes .../protex/gwt/standard/images/corner_ie6.png | Bin 0 -> 412 bytes .../protex/gwt/standard/images/hborder.png | Bin 0 -> 1384 bytes .../gwt/standard/images/hborder_ie6.png | Bin 0 -> 966 bytes .../images/ie6/corner_dialog_topleft.png | Bin 0 -> 195 bytes .../images/ie6/corner_dialog_topright.png | Bin 0 -> 232 bytes .../images/ie6/hborder_blue_shadow.png | Bin 0 -> 150 bytes .../images/ie6/hborder_gray_shadow.png | Bin 0 -> 153 bytes .../images/ie6/vborder_blue_shadow.png | Bin 0 -> 144 bytes .../images/ie6/vborder_gray_shadow.png | Bin 0 -> 148 bytes .../gwt/standard/images/splitPanelThumb.png | Bin 0 -> 308 bytes .../protex/gwt/standard/images/vborder.png | Bin 0 -> 190 bytes .../gwt/standard/images/vborder_ie6.png | Bin 0 -> 150 bytes .../js/capa/protex/gwt/standard/standard.css | 1152 ++++++++++++++++ .../capa/protex/gwt/standard/standard_rtl.css | 1153 +++++++++++++++++ common/static/js/capa/protex/hosted.html | 365 ++++++ .../static/js/capa/protex/protex.nocache.js | 18 + 27 files changed, 7209 insertions(+), 36 deletions(-) create mode 100644 common/static/js/capa/protex/2C6A8521F649572545B3BA3AA9FA1A9B.cache.html create mode 100644 common/static/js/capa/protex/2C6B778AF617337CF1AA0A282AC4D7B0.cache.html create mode 100644 common/static/js/capa/protex/304385F1071F71E1014982EA938C6B7E.cache.html create mode 100644 common/static/js/capa/protex/835B3434697F7AF2B11420E0CB0BE5AE.cache.html create mode 100644 common/static/js/capa/protex/9F67986D033F86F91DDB3DF610449406.cache.html create mode 100644 common/static/js/capa/protex/A3666BB82AEBB9EF82419B4F096E8C82.cache.html create mode 100644 common/static/js/capa/protex/Protex.css create mode 100644 common/static/js/capa/protex/clear.cache.gif create mode 100644 common/static/js/capa/protex/gwt/standard/images/corner.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/corner_ie6.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/hborder.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/hborder_ie6.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/ie6/corner_dialog_topleft.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/ie6/corner_dialog_topright.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/ie6/hborder_blue_shadow.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/ie6/hborder_gray_shadow.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/ie6/vborder_blue_shadow.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/ie6/vborder_gray_shadow.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/splitPanelThumb.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/vborder.png create mode 100644 common/static/js/capa/protex/gwt/standard/images/vborder_ie6.png create mode 100644 common/static/js/capa/protex/gwt/standard/standard.css create mode 100644 common/static/js/capa/protex/gwt/standard/standard_rtl.css create mode 100644 common/static/js/capa/protex/hosted.html create mode 100644 common/static/js/capa/protex/protex.nocache.js diff --git a/common/lib/capa/capa/templates/designprotein2dinput.html b/common/lib/capa/capa/templates/designprotein2dinput.html index 7b1c6b6f41..ff845f8713 100644 --- a/common/lib/capa/capa/templates/designprotein2dinput.html +++ b/common/lib/capa/capa/templates/designprotein2dinput.html @@ -1,4 +1,5 @@
+
% if status == 'unsubmitted': @@ -8,16 +9,11 @@ % elif status == 'incorrect':
% elif status == 'incomplete': -
+
% endif - - - - - - Applet failed to run. No Java plug-in was found. - - + +
+

diff --git a/common/static/js/capa/design-protein-2d.js b/common/static/js/capa/design-protein-2d.js index 66a6338e53..d210765559 100644 --- a/common/static/js/capa/design-protein-2d.js +++ b/common/static/js/capa/design-protein-2d.js @@ -1,34 +1,44 @@ (function () { var timeout = 1000; - function initializeApplet(applet) { - console.log("Initializing " + applet); - waitForApplet(applet); - } + waitForProtex(); - function waitForApplet(applet) { - if (applet.isActive && applet.isActive()) { - console.log("Applet is ready."); - - // FIXME: [rocha] This is a hack to capture the click on the check - // button and update the hidden field with the applet values - var input_field = $('.designprotein2dinput input'); - - var problem = $(applet).parents('.problem'); - var check_button = problem.find('input.check'); - check_button.on('click', function() { - var answerStr = applet.checkAnswer(); - console.log(answerStr); - input_field.val(answerStr); - }); - - } else { - console.log("Waiting for applet..."); - setTimeout(function() { waitForApplet(applet); }, timeout); + function waitForProtex() { + if (typeof(protex) !== "undefined" && protex) { + protex.onInjectionDone("protex"); + } + if (typeof(protex) !== "undefined") { + initializeProtex(); + } + else { + setTimeout(function() { waitForProtex(); }, timeout); + } + } + + function initializeProtex() { + //Check to see if the two exported GWT functions protexSetTargetShape + // and protexCheckAnswer have been appended to global scope -- this + //happens at the end of onModuleLoad() in GWT + if (typeof(protexSetTargetShape) === "function" && + typeof(protexCheckAnswer) === "function") { + + //Load target shape + var target_shape = $('#target_shape').val(); + protexSetTargetShape(target_shape); + + //Get answer from protex and store it into the hidden input field + //when Check button is clicked + var problem = $('#protex_container').parents('.problem'); + var check_button = problem.find('input.check'); + var input_field = problem.find('input[type=hidden]'); + check_button.on('click', function() { + var protex_answer = protexCheckAnswer(); + var value = {protex_answer: protex_answer}; + input_field.val(JSON.stringify(value)); + }); + } + else { + setTimeout(function() {initializeProtex(); }, timeout); } } - - var applets = $('.designprotein2dinput object'); - applets.each(function(i, el) { initializeApplet(el); }); - }).call(this); diff --git a/common/static/js/capa/protex/2C6A8521F649572545B3BA3AA9FA1A9B.cache.html b/common/static/js/capa/protex/2C6A8521F649572545B3BA3AA9FA1A9B.cache.html new file mode 100644 index 0000000000..99d9fe5ba9 --- /dev/null +++ b/common/static/js/capa/protex/2C6A8521F649572545B3BA3AA9FA1A9B.cache.html @@ -0,0 +1,733 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/protex/2C6B778AF617337CF1AA0A282AC4D7B0.cache.html b/common/static/js/capa/protex/2C6B778AF617337CF1AA0A282AC4D7B0.cache.html new file mode 100644 index 0000000000..30ee538a52 --- /dev/null +++ b/common/static/js/capa/protex/2C6B778AF617337CF1AA0A282AC4D7B0.cache.html @@ -0,0 +1,733 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/protex/304385F1071F71E1014982EA938C6B7E.cache.html b/common/static/js/capa/protex/304385F1071F71E1014982EA938C6B7E.cache.html new file mode 100644 index 0000000000..1ef6576374 --- /dev/null +++ b/common/static/js/capa/protex/304385F1071F71E1014982EA938C6B7E.cache.html @@ -0,0 +1,750 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/protex/835B3434697F7AF2B11420E0CB0BE5AE.cache.html b/common/static/js/capa/protex/835B3434697F7AF2B11420E0CB0BE5AE.cache.html new file mode 100644 index 0000000000..eb39b0f341 --- /dev/null +++ b/common/static/js/capa/protex/835B3434697F7AF2B11420E0CB0BE5AE.cache.html @@ -0,0 +1,726 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/protex/9F67986D033F86F91DDB3DF610449406.cache.html b/common/static/js/capa/protex/9F67986D033F86F91DDB3DF610449406.cache.html new file mode 100644 index 0000000000..cdd92f5237 --- /dev/null +++ b/common/static/js/capa/protex/9F67986D033F86F91DDB3DF610449406.cache.html @@ -0,0 +1,737 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/protex/A3666BB82AEBB9EF82419B4F096E8C82.cache.html b/common/static/js/capa/protex/A3666BB82AEBB9EF82419B4F096E8C82.cache.html new file mode 100644 index 0000000000..900187e9bf --- /dev/null +++ b/common/static/js/capa/protex/A3666BB82AEBB9EF82419B4F096E8C82.cache.html @@ -0,0 +1,741 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/protex/Protex.css b/common/static/js/capa/protex/Protex.css new file mode 100644 index 0000000000..4c8ecd1c52 --- /dev/null +++ b/common/static/js/capa/protex/Protex.css @@ -0,0 +1,59 @@ +/** Add css rules here for your application. */ + + +/** Example rules used by the template application */ +h1 { + font-size: 2em; + font-weight: bold; + color: #777777; + margin: 40px 0px 70px; + text-align: center; +} + +/** Most GWT widgets already have a style name defined */ +/*.gwt-Button1 { + width: 400px; + font-size: 150%; +}*/ + +#fold-button { + /*font-size: 14pt;*/ +} + +#ssbond-choice { + /*font-size: 14pt;*/ +} + +#ps-textbox { + font-size: 14pt; + spellCheck: false; +} + +#absolute-panel { + /*background-color: #B2B2FF;*/ + background-color: #BBBBBB; +} + +#target-panel { + background-color: #B2B2FF; + border:2px solid #4E4E4E; + font-size: 14pt; +} + +#aap-panel { + background-color: #B2B2FF; + border:2px solid #4E4E4E; + font-size: 14pt; +} + +#pstb-panel { + background-color: #B2B2FF; + border:2px solid #4E4E4E; + font-size: 14pt; +} + +#gc-panel { + background-color: #B2B2FF; + border:2px solid #4E4E4E; + font-size: 14pt; +} diff --git a/common/static/js/capa/protex/clear.cache.gif b/common/static/js/capa/protex/clear.cache.gif new file mode 100644 index 0000000000000000000000000000000000000000..e565824aafafe632011b281cba976baf8b3ba89a GIT binary patch literal 43 qcmZ?wbhEHbWMp7uXkcLY4+e@qSs1y10y+#p0Fq%~V)9{Rum%7ZWeN!Z literal 0 HcmV?d00001 diff --git a/common/static/js/capa/protex/gwt/standard/images/corner.png b/common/static/js/capa/protex/gwt/standard/images/corner.png new file mode 100644 index 0000000000000000000000000000000000000000..51aa4582aa3bd35c0178c337f83bf75e6b9024cf GIT binary patch literal 1140 zcmV-)1dIELP)1^@s6g3A^000006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru*aQy_83lf>^63Bo1OZ7z zK~z}7?U-LkTUQ*%KQ{@%rp3AFVzOB>N!AdZOd49-N|hEfRv*mEUYzVP%%{EXvA8#1 z_f+QNuzMH`?qDr)9mNb?rzm2G(#`BUI`U>KmY#qqk2 zfZP^MuTMqu10xv?P2UMnfOf#6>*Enn9}w0*%pxMmhv;=17}{K%Af1KuQ81%#faqcE zzz?!4NA;ixr4<2qzBIw}r3rwK3qbU+i-2F2<)Pdtbe93j_cWK$=Zt_M%ks7bWAaq! zdCwxUtCXfODT_$qQj)6y8V5#-ct(WBlx%<|9=2L+!B!(80AB28+tiHa6xS?jMsvQ{ z&$i`vcy<1!;fSQvp*G%l)-tHSVYf=njc28ssYC7k`Z{SS7gaiIFrsIB+0ptsX|Rx? zzD^o^wwE0RE^oVUkj@wzMax@fq);i7@Oy z8Be!-D4lC;cIA>o&1i|eRO*l2wOOBd3oigq07KE)Vo8<$tDpRwn7RM%?&G*0&?m58 z92bCHU|$@KW!=5y1NyJs8cWRFj~4K)iens@HC5~GEg#T+?beuhsJ<p-viElyZ|Kd7absSQs#3kn)kZ_F;jAlH3b5eanOe>JWUEa?CpL7api_`(**4}C zsiUKVcs#Du7Szzo#$)gvRp{D*0Q%b;Bxa5)bZtOEbxvDf1c$>>)VN~5bX-)u@U5YU z`uh5cnkFYFt21=v$h$M8JNpk8)rwyey4U(?3Hra)x@xVHlAv%nEQ#HXTxOj}dM}(5 zXtm~`NF;)yC^vvBK&!aC4m=Ep!=HUKwS(!Rswm1B5CB5H4+0LC%MHNR)@Ez+&qvLQ zqQp?=9UVj7oI;`nV@b8U$7lcC@X*DQ z>emGz`M{v?8lI!pGP5ZJw0_y!U>Fpvz#lZbj>?tcb@UGgBT0GyAom*p0000EMUMH{Tt)^YzrjulMdhy7%DGg(u%Wef{#r~0e*ORdfA{X)+txWagA6SR@(X5gcy=QV#7XjYcVXyYmGuB}I14-?iy0WWg+Z8+ zVb&Z8pdfpRr>`sfO-2DeWd?=She578b~+rKoHwFvIpv^3&S znZ$cbsf~tw4yym-^Sy57)jqp;M6*THt?XH_{{o%buOAdeR%h&a+GARJeNx~5sz*!B z*IZS&m*YLZq-ye8N6o%VGd7f4+A4bP0l+XkK Dn$5EQ literal 0 HcmV?d00001 diff --git a/common/static/js/capa/protex/gwt/standard/images/hborder.png b/common/static/js/capa/protex/gwt/standard/images/hborder.png new file mode 100644 index 0000000000000000000000000000000000000000..1c8e78b7694550fa4926c07804f2a991b89eb0df GIT binary patch literal 1384 zcmeAS@N?(olHy`uVBq!ia0vp^3JeVFuQ}L&th1k1@d7EfByV>YhW{YAVDIwDKoQOY zkH}&M25w;xW@MN(M*=9wUgGKN%6@}YhF{;{KEI470|U!fPZ!6Kid%1Q9L!`k6k!Q? zyUy?3|0!XQ#Dszz3|KBX9MDmT_@$Z5Q+2yRZt=zGZ{9xsy+-WMH?e;};~q8q`}(b_ zmnkayedd95k%FBuag!R>u8MK%KHvEI>nzqe&oc#d?K<8)pYJ%uw(aKZ1zY9f?CYh! z&AQ3+YmG%h8>2Gsij7rFnFnUP)SdB?<=89EGbK#QcAS@^1Cqa<*7zg$Q48e95dkv( zmhIM^cVOS!!~+xA-XtC8Qf7q|cGwi+f;y+$Fehr%TX#9EX);*Wb}@M%00-ou{L$lmF>qNQ$z#zM~>zr=pb z7Z|SLv*7=?H4FQ>)IZEfJTPNx1yg?sQ}UX54SW`D{et(Iju(79ePS}taP>S1{!-w( zv1-+%22is3@XLR~ffzeR*$#DsQU~@Dh4~FaS_}Df<{hxtZRME1bo(qTkinj=elF{r G5}E+scDM)t literal 0 HcmV?d00001 diff --git a/common/static/js/capa/protex/gwt/standard/images/hborder_ie6.png b/common/static/js/capa/protex/gwt/standard/images/hborder_ie6.png new file mode 100644 index 0000000000000000000000000000000000000000..87d7cf7d5d879ad204099ba773c849ebe139c888 GIT binary patch literal 966 zcmb7A`%6=C6u&dd@)-n@5z%jTn`Q((A*6EXc2)FdqO&N96@`S%qU=Eriin~g>Tbgx z6x9{O%3LpKtzl`)%UGE+n{#uoJLk6Rw!6FUee7YA{sB9j^ErpZhY#m-Zq(IQ=I5-) zfgmVfT2+B&`f3Qu4lZ7hnS>H~IRuGn>Z%(geSLj*`Xj2ZQJqew|D^96jOz7zgTe67 zNcZ>mKOUk71_qv)V%_H0ccZcACqocK@2|MYWO`$Xo6Y7AzrpbE@JB1KSS+7y?AX}Y z7dty{wGK{lHk)n8#o6ul5eKk1fXU4{9FEaRFzN)(N#}1T_~`{>F7U?%tZv|PyR05| z+{4$m=KNeQAVH{o?#d|F2v#j0|dYVz$REO!ErptCwU<$Boaa*l}x5msdPG%>GbUE zZ26k49hv_wX{%~(hoIbLb0vcAJy@PuW}lSSNV2V>!ordw`GLyA5R{cCt=QRcW}LFU zQ!a&;N`|lNbi3P5YaUD6P9tqu-dQB)xNlS5*Q@QpJ)uym&bmJ*l507l*1pA#;ni4r zQTOh2?#&hAlxTyTu%QRyEcy-MQNoBiRCE_+#3xG0v#>_Ct%Zo91sbgZdx*D+741th z*UUFANecqK7Z#2noqLG~s86MRjSb=@WeNq{gEY4g0=ikfZ_|9mGQ4Ebr*)(R{(*Ef z5_i#6YNY`?hfly{BfLdc3@f^^9=u?^W@8g^4K=H_Z{1HkM{Cu}C)i%Ch09LvXFh!r((kF2?#(4uNg+l?*6O=XG` z@EfGFp0J=@*nimiM|EBlEyI&*$rjjypD!ib;YTvQj!2;2WW}ZADYy*jkP}bQRhUwT o-N*AZ%9ofJ-&aDOhmXq2MYj*#YC6#{S~VvnmDE{XE)7O>#1`9vGCb#>fW-XvlfTxRNh{fr*rw;NuIEXkL+^8Mc zw8D|m>cVWkFN;`1R~$N8G%07xgZ+=6nEozoGMg$Y{OjAUmqj-Xk{Yf&-E@V4vzS-^ ko88j)Ul$z!0{chIhqAfrfAmW{2Aa*_>FVdQ&MBb@0Q(R`g8%>k literal 0 HcmV?d00001 diff --git a/common/static/js/capa/protex/gwt/standard/images/ie6/corner_dialog_topright.png b/common/static/js/capa/protex/gwt/standard/images/ie6/corner_dialog_topright.png new file mode 100644 index 0000000000000000000000000000000000000000..a786ccc12eb32e00bf90d7eb942cacc35bcc202a GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^96;>M!3HE3PH<5HQfx`y?k)`fL2$v|<&%LToCO|{ z#S9GG!XV7ZFl&wkP>{XE)7O>#1`9vGhGMHx^wx9-T^_S^E?i)>@Z7~H^JDFOfl2ocGJH(#7rSBm@<1aqJD-fjkNOQv YzjlZ{E-#*>4|D*7r>mdKI;Vst05#ZASO5S3 literal 0 HcmV?d00001 diff --git a/common/static/js/capa/protex/gwt/standard/images/ie6/hborder_blue_shadow.png b/common/static/js/capa/protex/gwt/standard/images/ie6/hborder_blue_shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..7b52b8e43e2b748aaaa09c583db5b77f1757da11 GIT binary patch literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^j6lr6!3HEPq^3FoDYhhUcNd2LAh=-f^2tCE&H|6f zVg?3oVGw3ym^DWND9B#o>FdgVgN2`8Mf{oVLJgphvZsq<2*>s09Uq?Du2*9Nf|5rM nZ{Dq*At51g&d|`n;0`0h_Ck*KwxH0HK;;acu6{1-oD!MFdgVgHc{g+GKjyt}>vInx~6n2*-8bBZh(u3Op{XE)7O>#1`9vGiroB%l085nSx*{XE)7O>#2BW-~H1COiqdK6FqNj^v2*>s0KmY&#uV+))kbYjS nE&u+$w}}Y}7RL`9C}3we#=%|XpVhb%sF=ai)z4*}Q$iB}JFF^) literal 0 HcmV?d00001 diff --git a/common/static/js/capa/protex/gwt/standard/images/splitPanelThumb.png b/common/static/js/capa/protex/gwt/standard/images/splitPanelThumb.png new file mode 100644 index 0000000000000000000000000000000000000000..d2ef0255d8c7d1fdf624039abfc875e50ecd15cb GIT binary patch literal 308 zcmV-40n7f0P)rjY>%7y|+VqilhJXvmQ~s#EIV@K73FEn#6RHkB^TNBq1&?&H!XH{{H=&O;}iXCnLx~g@uLtfr9!#{QJ|V zPpm>hLKE}z^BcjEAkfj#Vb8_Ir2%xq;mpj;YalUz00RJZxI%?M`nN^^0000x@Qfx`y?k)`fL2$v|<&%LToCO|{ z#S9GG!XV7ZFl&wkP>{XE)7O>#2CEFe0o&d8?S4QZZ%-G;5Rc=@dp|3k*F{R#`7rEL_~yhr|%#VP)7F WEVyGRknt+xtG^Bw-;+`&! sArhC94cM516~)Bc9a!4}&F