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
ce7a01dd
Commit
ce7a01dd
authored
Dec 10, 2012
by
Valera Rozuvan
Committed by
Alexander Kryklia
Jan 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GST work in progress.
parent
080e96fd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
18 deletions
+77
-18
common/lib/xmodule/xmodule/gst_module.py
+1
-1
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js
+62
-0
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/gst_main.js
+6
-1
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/mod5.js
+0
-16
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js
+8
-0
No files found.
common/lib/xmodule/xmodule/gst_module.py
View file @
ce7a01dd
...
...
@@ -30,7 +30,7 @@ class GraphicalSliderToolModule(XModule):
resource_string
(
__name__
,
'js/src/graphical_slider_tool/logme.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/general_methods.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/sliders.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/
mod5
.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/
graph
.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/gst.js'
)
]
...
...
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js
0 → 100644
View file @
ce7a01dd
// Wrapper for RequireJS. It will make the standard requirejs(), require(), and
// define() functions from Require JS available inside the anonymous function.
(
function
(
requirejs
,
require
,
define
)
{
define
(
'Graph'
,
[
'logme'
],
function
(
logme
)
{
return
Graph
;
function
Graph
(
gstId
,
state
)
{
var
plotDiv
,
data
;
logme
(
'We are inside Graph module.'
,
gstId
,
state
);
plotDiv
=
$
(
'#'
+
gstId
+
'_plot'
);
if
(
plotDiv
.
length
===
0
)
{
return
;
}
plotDiv
.
width
(
300
);
plotDiv
.
height
(
300
);
plotDiv
.
bind
(
'update_plot'
,
function
(
event
,
forGstId
)
{
if
(
forGstId
!==
gstId
)
{
logme
(
'update_plot event not for current ID'
);
}
logme
(
'redrawing plot'
);
generateData
();
updatePlot
();
});
generateData
();
updatePlot
();
return
;
function
generateData
()
{
var
a
,
b
,
c1
;
a
=
state
.
getConstValue
(
'a'
);
b
=
state
.
getConstValue
(
'b'
);
data
=
[];
data
.
push
([]);
for
(
c1
=
0
;
c1
<
30
;
c1
++
)
{
data
[
0
].
push
([
c1
,
a
*
c1
*
(
c1
+
a
)
*
(
c1
-
b
)
+
b
*
c1
*
(
c1
+
b
*
a
)]);
}
}
function
updatePlot
()
{
$
.
plot
(
plotDiv
,
data
,
{
xaxis
:
{
min
:
0
,
max
:
30
}});
}
}
});
// End of wrapper for RequireJS. As you can see, we are passing
// namespaced Require JS variables to an anonymous function. Within
// it, you can use the standard requirejs(), require(), and define()
// functions as if they were in the global namespace.
}(
RequireJS
.
requirejs
,
RequireJS
.
require
,
RequireJS
.
define
));
// End-of: (function (requirejs, require, define)
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/gst_main.js
View file @
ce7a01dd
...
...
@@ -2,7 +2,10 @@
// define() functions from Require JS available inside the anonymous function.
(
function
(
requirejs
,
require
,
define
)
{
define
(
'GstMain'
,
[
'State'
,
'logme'
,
'GeneralMethods'
,
'Sliders'
],
function
(
State
,
logme
,
GeneralMethods
,
Sliders
)
{
define
(
'GstMain'
,
[
'State'
,
'logme'
,
'GeneralMethods'
,
'Sliders'
,
'Graph'
],
function
(
State
,
logme
,
GeneralMethods
,
Sliders
,
Graph
)
{
logme
(
GeneralMethods
);
return
GstMain
;
...
...
@@ -15,6 +18,8 @@ define('GstMain', ['State', 'logme', 'GeneralMethods', 'Sliders'], function (Sta
state
=
State
(
gstId
,
config
);
Sliders
(
gstId
,
config
,
state
);
Graph
(
gstId
,
state
);
}
});
...
...
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/mod5.js
deleted
100644 → 0
View file @
080e96fd
// Wrapper for RequireJS. It will make the standard requirejs(), require(), and
// define() functions from Require JS available inside the anonymous function.
(
function
(
requirejs
,
require
,
define
)
{
define
(
'mod5'
,
[],
function
()
{
console
.
log
(
'we are in the mod5 callback'
);
return
{
'module_status'
:
'OK'
};
});
// End of wrapper for RequireJS. As you can see, we are passing
// namespaced Require JS variables to an anonymous function. Within
// it, you can use the standard requirejs(), require(), and define()
// functions as if they were in the global namespace.
}(
RequireJS
.
requirejs
,
RequireJS
.
require
,
RequireJS
.
define
));
// End-of: (function (requirejs, require, define)
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js
View file @
ce7a01dd
...
...
@@ -76,6 +76,8 @@ define('State', ['logme'], function (logme) {
}
function
setConstValue
(
constName
,
constValue
)
{
var
plotDiv
;
if
(
constants
.
hasOwnProperty
(
constName
)
===
false
)
{
// If the name of the constant is not tracked by state, return an
// 'undefined' value.
...
...
@@ -90,6 +92,12 @@ define('State', ['logme'], function (logme) {
constants
[
constName
]
=
parseFloat
(
constValue
);
logme
(
'From setConstValue: new value for "'
+
constName
+
'" is '
+
constValue
);
plotDiv
=
$
(
'#'
+
gstId
+
'_plot'
);
if
(
plotDiv
.
length
===
1
)
{
plotDiv
.
trigger
(
'update_plot'
,
[
gstId
]);
}
}
function
addConstFromInput
(
obj
)
{
...
...
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