Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d74b21e4
Commit
d74b21e4
authored
Jan 09, 2013
by
jmclaus
Committed by
Victor Shnayder
Feb 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added edit a gene
parent
752a4552
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
1 deletions
+102
-1
common/lib/capa/capa/inputtypes.py
+35
-0
common/lib/capa/capa/responsetypes.py
+1
-1
common/lib/capa/capa/templates/editageneinput.html
+39
-0
common/static/applets/capa/genex.jar
+0
-0
common/static/js/capa/edit-a-gene.js
+27
-0
No files found.
common/lib/capa/capa/inputtypes.py
View file @
d74b21e4
...
...
@@ -899,3 +899,38 @@ class DesignProtein2dInput(InputTypeBase):
registry
.
register
(
DesignProtein2dInput
)
#-----------------------------------------------------------------------------
class
EditAGeneInput
(
InputTypeBase
):
"""
An input type for editing a gene. Integrates with the genex java applet.
Example:
<editagene width="800" hight="500" dna_sequence="ETAAGGCTATAACCGA" />
"""
template
=
"editageneinput.html"
tags
=
[
'editageneinput'
]
@classmethod
def
get_attributes
(
cls
):
"""
Note: width, hight, and dna_sequencee are required.
"""
return
[
Attribute
(
'width'
),
Attribute
(
'height'
),
Attribute
(
'dna_sequence'
)
]
def
_extra_context
(
self
):
"""
"""
context
=
{
'applet_loader'
:
'/static/js/capa/edit-a-gene.js'
,
}
return
context
registry
.
register
(
EditAGeneInput
)
common/lib/capa/capa/responsetypes.py
View file @
d74b21e4
...
...
@@ -876,7 +876,7 @@ def sympy_check2():
allowed_inputfields
=
[
'textline'
,
'textbox'
,
'crystallography'
,
'chemicalequationinput'
,
'vsepr_input'
,
'drag_and_drop_input'
,
'editamoleculeinput'
,
'designprotein2dinput'
]
'designprotein2dinput'
,
'editageneinput'
]
def
setup_response
(
self
):
xml
=
self
.
xml
...
...
common/lib/capa/capa/templates/editageneinput.html
0 → 100644
View file @
d74b21e4
<section
id=
"editageneinput_${id}"
class=
"editageneinput"
>
<div
class=
"script_placeholder"
data-src=
"${applet_loader}"
/>
% if status == 'unsubmitted':
<div
class=
"unanswered"
id=
"status_${id}"
>
% elif status == 'correct':
<div
class=
"correct"
id=
"status_${id}"
>
% elif status == 'incorrect':
<div
class=
"incorrect"
id=
"status_${id}"
>
% elif status == 'incomplete':
<div
class=
"incorrect"
id=
"status_${id}"
>
% endif
<object
type=
"application/x-java-applet"
id=
"applet_${id}"
class=
"applet"
width=
"${width}"
height=
"${height}"
>
<param
name=
"archive"
value=
"/static/applets/capa/genex.jar"
/>
<param
name=
"code"
value=
"GX.GenexApplet.class"
/>
<param
name=
"DNA_SEQUENCE"
value=
"${dna_sequence}"
/>
Applet failed to run. No Java plug-in was found.
</object>
<input
type=
"hidden"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value|h}"
/>
<p
class=
"status"
>
% if status == 'unsubmitted':
unanswered
% elif status == 'correct':
correct
% elif status == 'incorrect':
incorrect
% elif status == 'incomplete':
incomplete
% endif
</p>
<p
id=
"answer_${id}"
class=
"answer"
></p>
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
</div>
% endif
</section>
common/static/applets/capa/genex.jar
0 → 100644
View file @
d74b21e4
File added
common/static/js/capa/edit-a-gene.js
0 → 100644
View file @
d74b21e4
(
function
()
{
var
timeout
=
1000
;
function
initializeApplet
(
applet
)
{
console
.
log
(
"Initializing "
+
applet
);
waitForApplet
(
applet
);
}
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
);
}
}
var
applets
=
$
(
'.editageneinput object'
);
applets
.
each
(
function
(
i
,
el
)
{
initializeApplet
(
el
);
});
}).
call
(
this
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment