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
4268f040
Commit
4268f040
authored
Dec 26, 2012
by
Valera Rozuvan
Committed by
Alexander Kryklia
Jan 21, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated JS part to use new XML format.
parent
36b1d4f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
common/static/js/capa/drag_and_drop/update_input.js
+27
-15
No files found.
common/static/js/capa/drag_and_drop/update_input.js
View file @
4268f040
...
...
@@ -8,34 +8,46 @@ define(['logme'], function (logme) {
return
updateInput
;
function
updateInput
(
state
)
{
var
inputEl
,
stateStr
,
targets
;
var
inputEl
,
stateStr
,
targets
,
draggables
,
c1
,
c2
,
tempObj
;
draggables
=
[];
if
(
state
.
individualTargets
===
false
)
{
for
(
c1
=
0
;
c1
<
state
.
draggables
.
length
;
c1
++
)
{
if
(
state
.
draggables
[
c1
].
x
!==
-
1
)
{
tempObj
=
{};
tempObj
[
state
.
draggables
[
c1
].
id
]
=
{
'x'
:
state
.
draggables
[
c1
].
x
,
'y'
:
state
.
draggables
[
c1
].
y
};
draggables
.
push
(
tempObj
);
}
}
stateStr
=
JSON
.
stringify
({
'
individualT
argets'
:
false
,
'draggables'
:
state
.
draggables
'
t
argets'
:
false
,
'draggables'
:
draggables
});
}
else
{
targets
=
[];
(
function
(
c1
)
{
while
(
c1
<
state
.
targets
.
length
)
{
targets
.
push
({
'id'
:
state
.
targets
[
c1
].
id
,
'draggables'
:
state
.
targets
[
c1
].
draggable
});
c1
+=
1
;
for
(
c1
=
0
;
c1
<
state
.
targets
.
length
;
c1
++
)
{
for
(
c2
=
0
;
c2
<
state
.
targets
[
c1
].
draggable
.
length
;
c2
++
)
{
tempObj
=
{};
tempObj
[
state
.
targets
[
c1
].
draggable
[
c2
]]
=
state
.
draggables
[
c1
].
id
;
draggables
.
push
(
tempObj
);
}
}
(
0
));
}
stateStr
=
JSON
.
stringify
({
'
individualT
argets'
:
true
,
'
targets'
:
target
s
'
t
argets'
:
true
,
'
draggables'
:
draggable
s
});
}
inputEl
=
$
(
'#input_'
+
state
.
problemId
);
inputEl
.
val
(
stateStr
);
logme
(
inputEl
.
val
());
}
});
...
...
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