diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py index 813da3ca3e..f614743e67 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -974,11 +974,12 @@ class EditAGeneInput(InputTypeBase): @classmethod def get_attributes(cls): """ - Note: width, hight, and dna_sequencee are required. - """ + Note: width, height, and dna_sequencee are required. + """ return [Attribute('width'), Attribute('height'), - Attribute('dna_sequence') + Attribute('dna_sequence'), + Attribute('genex_problem_number') ] def _extra_context(self): diff --git a/common/lib/capa/capa/templates/editageneinput.html b/common/lib/capa/capa/templates/editageneinput.html index 8dd4fa89d1..3465c62593 100644 --- a/common/lib/capa/capa/templates/editageneinput.html +++ b/common/lib/capa/capa/templates/editageneinput.html @@ -1,4 +1,5 @@ -
+
+
% if status == 'unsubmitted': @@ -8,16 +9,12 @@ % elif status == 'incorrect':
% elif status == 'incomplete': -
+
% endif - - - - - - Applet failed to run. No Java plug-in was found. - - + +
+ +

@@ -37,3 +34,4 @@

% endif
+ diff --git a/common/static/js/capa/edit-a-gene.js b/common/static/js/capa/edit-a-gene.js index 48753e507d..bd6d10cc64 100644 --- a/common/static/js/capa/edit-a-gene.js +++ b/common/static/js/capa/edit-a-gene.js @@ -1,27 +1,44 @@ (function () { var timeout = 1000; - function initializeApplet(applet) { - console.log("Initializing " + applet); - waitForApplet(applet); - } + waitForGenex(); - function waitForApplet(applet) { - if (applet.isActive && applet.isActive()) { - console.log("Applet is ready."); - var answerStr = applet.checkAnswer(); - console.log(answerStr); - var input = $('.editageneinput input'); - console.log(input); - input.val(answerStr); - } else if (timeout > 30 * 1000) { - console.error("Applet did not load on time."); - } else { - console.log("Waiting for applet..."); - setTimeout(function() { waitForApplet(applet); }, timeout); + function waitForGenex() { + if (typeof(genex) !== "undefined" && genex) { + genex.onInjectionDone("genex"); + } + else { + setTimeout(function() { waitForGenex(); }, timeout); } } - var applets = $('.editageneinput object'); - applets.each(function(i, el) { initializeApplet(el); }); + //NOTE: + // Genex uses six global functions: + // genexSetDNASequence (exported from GWT) + // genexSetClickEvent (exported from GWT) + // genexSetKeyEvent (exported from GWT) + // genexSetProblemNumber (exported from GWT) + // + // It calls genexIsReady with a deferred command when it has finished + // initialization and has drawn itself + // genexStoreAnswer(answer) is called when the GWT [Store Answer] button + // is clicked + + genexIsReady = function() { + //Load DNA sequence + var dna_sequence = $('#dna_sequence').val(); + genexSetDNASequence(dna_sequence); + //Now load mouse and keyboard handlers + genexSetClickEvent(); + genexSetKeyEvent(); + //Now load problem + var genex_problem_number = $('#genex_problem_number').val(); + genexSetProblemNumber(genex_problem_number); + }; + genexStoreAnswer = function(ans) { + var problem = $('#genex_container').parents('.problem'); + var input_field = problem.find('input[type="hidden"][name!="dna_sequence"][name!="genex_problem_number"]'); + input_field.val(ans); + }; }).call(this); + diff --git a/common/static/js/capa/genex/026A6180B5959B8660E084245FEE5E9E.cache.html b/common/static/js/capa/genex/026A6180B5959B8660E084245FEE5E9E.cache.html new file mode 100644 index 0000000000..13f25ec581 --- /dev/null +++ b/common/static/js/capa/genex/026A6180B5959B8660E084245FEE5E9E.cache.html @@ -0,0 +1,649 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/genex/1F433010E1134C95BF6CB43F552F3019.cache.html b/common/static/js/capa/genex/1F433010E1134C95BF6CB43F552F3019.cache.html new file mode 100644 index 0000000000..1e99fe0f19 --- /dev/null +++ b/common/static/js/capa/genex/1F433010E1134C95BF6CB43F552F3019.cache.html @@ -0,0 +1,649 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/genex/2DDA730EDABB80B88A6B0DFA3AFEACA2.cache.html b/common/static/js/capa/genex/2DDA730EDABB80B88A6B0DFA3AFEACA2.cache.html new file mode 100644 index 0000000000..743492768b --- /dev/null +++ b/common/static/js/capa/genex/2DDA730EDABB80B88A6B0DFA3AFEACA2.cache.html @@ -0,0 +1,639 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/genex/4EEB1DCF4B30D366C27968D1B5C0BD04.cache.html b/common/static/js/capa/genex/4EEB1DCF4B30D366C27968D1B5C0BD04.cache.html new file mode 100644 index 0000000000..4aa12e55d4 --- /dev/null +++ b/common/static/js/capa/genex/4EEB1DCF4B30D366C27968D1B5C0BD04.cache.html @@ -0,0 +1,651 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/genex/5033ABB047340FB9346B622E2CC7107D.cache.html b/common/static/js/capa/genex/5033ABB047340FB9346B622E2CC7107D.cache.html new file mode 100644 index 0000000000..167a193adb --- /dev/null +++ b/common/static/js/capa/genex/5033ABB047340FB9346B622E2CC7107D.cache.html @@ -0,0 +1,625 @@ + + + \ No newline at end of file diff --git a/common/static/js/capa/genex/DF3D3A7FAEE63D711CF2D95BDB3F538C.cache.html b/common/static/js/capa/genex/DF3D3A7FAEE63D711CF2D95BDB3F538C.cache.html new file mode 100644 index 0000000000..913b90be20 --- /dev/null +++ b/common/static/js/capa/genex/DF3D3A7FAEE63D711CF2D95BDB3F538C.cache.html @@ -0,0 +1,639 @@ + + + + \ No newline at end of file diff --git a/common/static/js/capa/genex/clear.cache.gif b/common/static/js/capa/genex/clear.cache.gif new file mode 100644 index 0000000000..e565824aaf Binary files /dev/null and b/common/static/js/capa/genex/clear.cache.gif differ diff --git a/common/static/js/capa/genex/genex.css b/common/static/js/capa/genex/genex.css new file mode 100644 index 0000000000..459c854f92 --- /dev/null +++ b/common/static/js/capa/genex/genex.css @@ -0,0 +1,122 @@ +.genex-button { + margin-right: -8px; + height: 40px !important; +} + +.genex-label { + /*font: normal normal normal 10pt/normal 'Open Sans', Verdana, Geneva, sans-serif !important;*/ + /*padding: 4px 0px 0px 10px !important;*/ + font-family: sans-serif !important; + font-size: 13px !important; + font-style: normal !important; + font-variant: normal !important; + font-weight: bold !important; + padding-top: 6px !important; + margin-left: 18px; +} + +.gwt-HTML { + cursor: default; + overflow-x: auto !important; + overflow-y: auto !important; + background-color: rgb(248, 248, 248) !important; +} + +.genex-scrollpanel { + word-wrap: normal !important; + white-space: pre !important; +} + +pre, #dna-strand { + font-family: 'courier new', courier !important; + font-size: 13px !important; + font-style: normal !important; + font-variant: normal !important; + font-weight: normal !important; + border-style: none !important; + background-color: rgb(248, 248, 248) !important; + word-wrap: normal !important; + white-space: pre !important; + overflow-x: visible !important; + overflow-y: visible !important; +} + +.gwt-DialogBox .Caption { + background: #F1F1F1; + padding: 4px 8px 4px 4px; + cursor: default; + font-family: Arial Unicode MS, Arial, sans-serif; + font-weight: bold; + border-bottom: 1px solid #bbbbbb; + border-top: 1px solid #D2D2D2; +} +.gwt-DialogBox .dialogContent { +} +.gwt-DialogBox .dialogMiddleCenter { + padding: 3px; + background: white; +} +.gwt-DialogBox .dialogBottomCenter { + background: url(images/hborder.png) repeat-x 0px -2945px; + -background: url(images/hborder_ie6.png) repeat-x 0px -2144px; +} +.gwt-DialogBox .dialogMiddleLeft { + background: url(images/vborder.png) repeat-y -31px 0px; +} +.gwt-DialogBox .dialogMiddleRight { + background: url(images/vborder.png) repeat-y -32px 0px; + -background: url(images/vborder_ie6.png) repeat-y -32px 0px; +} +.gwt-DialogBox .dialogTopLeftInner { + width: 10px; + height: 8px; + zoom: 1; +} +.gwt-DialogBox .dialogTopRightInner { + width: 12px; + zoom: 1; +} +.gwt-DialogBox .dialogBottomLeftInner { + width: 10px; + height: 12px; + zoom: 1; +} +.gwt-DialogBox .dialogBottomRightInner { + width: 12px; + height: 12px; + zoom: 1; +} +.gwt-DialogBox .dialogTopLeft { + background: url(images/circles.png) no-repeat -20px 0px; + -background: url(images/circles_ie6.png) no-repeat -20px 0px; +} +.gwt-DialogBox .dialogTopRight { + background: url(images/circles.png) no-repeat -28px 0px; + -background: url(images/circles_ie6.png) no-repeat -28px 0px; +} +.gwt-DialogBox .dialogBottomLeft { + background: url(images/circles.png) no-repeat 0px -36px; + -background: url(images/circles_ie6.png) no-repeat 0px -36px; +} +.gwt-DialogBox .dialogBottomRight { + background: url(images/circles.png) no-repeat -8px -36px; + -background: url(images/circles_ie6.png) no-repeat -8px -36px; +} +* html .gwt-DialogBox .dialogTopLeftInner { + width: 10px; + overflow: hidden; +} +* html .gwt-DialogBox .dialogTopRightInner { + width: 12px; + overflow: hidden; +} +* html .gwt-DialogBox .dialogBottomLeftInner { + width: 10px; + height: 12px; + overflow: hidden; +} +* html .gwt-DialogBox .dialogBottomRightInner { + width: 12px; + height: 12px; + overflow: hidden; +} \ No newline at end of file diff --git a/common/static/js/capa/genex/genex.nocache.js b/common/static/js/capa/genex/genex.nocache.js new file mode 100644 index 0000000000..07da038234 --- /dev/null +++ b/common/static/js/capa/genex/genex.nocache.js @@ -0,0 +1,18 @@ +function genex(){var P='',xb='" for "gwt:onLoadErrorFn"',vb='" for "gwt:onPropertyErrorFn"',ib='"><\/script>',Z='#',Xb='.cache.html',_='/',lb='//',Qb='026A6180B5959B8660E084245FEE5E9E',Rb='1F433010E1134C95BF6CB43F552F3019',Sb='2DDA730EDABB80B88A6B0DFA3AFEACA2',Tb='4EEB1DCF4B30D366C27968D1B5C0BD04',Ub='5033ABB047340FB9346B622E2CC7107D',Wb=':',pb='::',dc=' + +This html file is for Development Mode support. +