summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/core.js9
-rw-r--r--js/codeq/problem_list.js27
-rw-r--r--js/codeq/prolog.js21
-rw-r--r--js/codeq/python.js28
-rw-r--r--js/codeq/robot.js28
5 files changed, 5 insertions, 108 deletions
diff --git a/js/codeq/core.js b/js/codeq/core.js
index 50322c0..84bbfa8 100644
--- a/js/codeq/core.js
+++ b/js/codeq/core.js
@@ -362,17 +362,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
},
// reset the app
- reset: function (reason) {
+ 'reset': function (reason) {
codeq.log.info('App reset: ' + (reason || 'no reason given'));
codeq.globalStateMachine.transition('login');
codeq.wait(
-/* codeq.comms.getSid() == null ? Q() : codeq.comms.logout()
- .finally(
- codeq.comms.disconnect
- )
- .fail(function (e) {
- codeq.log.debug(e)
- }) // ignore errors*/
codeq.comms.forceReset()
)
.fin(function () {
diff --git a/js/codeq/problem_list.js b/js/codeq/problem_list.js
index e28e672..97bac25 100644
--- a/js/codeq/problem_list.js
+++ b/js/codeq/problem_list.js
@@ -280,32 +280,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
if (!ref) {
codeq.log.error('Clicked on a problem link having erroneous index: ' + index);
return;
- }//TODO
- /*codeq.wait(
- Q.all([
- codeq.comms.getCurrentSolution(ref.id), // the current user's solution to the selected problem
- getProblemData(language, ref.g, ref.p) // the (cached) result of processProblemData()
- ])
- .spread(function (userProblemData, generalProblemData) {
- if (userProblemData.code !== 0) throw new Error('Failed to obtain user problem data, code: ' + userProblemData.code + ', message: ' + userProblemData.message);
- if (!generalProblemData) throw new Error('General problem data is not defined');
- codeq.globalStateMachine.transition(language, generalProblemData, data.commonDef, userProblemData.data.solution);
- })
- )
- .fail(function (reason) {
- codeq.log.error('Failed to obtain the problem definition: ' + reason, reason);
- alert('Failed to obtain the problem definition: ' + reason);
- })
- .done();*/
- /*loadProblemData(ref,data).then(function(tmp){
- codeq.log.debug("then:"+JSON.stringify(tmp));
- return tmp;
- })
- .fail(function (reason) {
- codeq.log.error('Failed to obtain the problem definition: ' + reason, reason);
- alert('Failed to obtain the problem definition: ' + reason);
- })
- .done(codeq.log.debug("done"));*/
+ }
codeq.globalStateMachine.transition(language,ref,data);
});
},
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js
index a3779d7..4ec453d 100644
--- a/js/codeq/prolog.js
+++ b/js/codeq/prolog.js
@@ -105,9 +105,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
var prologHandler; //created when we enter the prolog state and destroyed once we leave it
codeq.globalStateMachine.register('prolog', {
'jqScreen': jqScreen,
- //'enter': function (problemDef, commonDef, currentSolution) {
- 'enter': function (ref, data) {//function (problemDef, commonDef, currentSolution) {//
-
+ 'enter': function (ref, data) {
codeq.loadProblemData(ref,data).then(function(problem){
//codeq.log.debug("then:"+JSON.stringify(problem));
enterFun(problem.generalProblemData,data.commonDef,problem.solution);
@@ -119,28 +117,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
history.back();//TODO test
})
.done();
- /*$('#navigation-problem_list').css('display', '');
- $("#navigation-prolog").addClass("active");
- $('#navigation-prolog').css('display', '');
-
- jqScreen.css('display', '');//we have to show the screen now so the code editor shows its initial values correctly
- prologHandler = createPrologHandler(problemDef, commonDef, currentSolution);
- subScreens = codeq.makeStateMachine(substates);
- subScreens.transition(jqDescription.data(stateNameTag));
-
- jqAllButtons.on(transitionEventName, function (event) {
- subScreens.transition('info'); // set focus on the hints quadrant
- event.stopPropagation(); // don't allow the event to go on and trigger further transition
- });
- jqAllQuadrants.on(transitionEventName, function () {
- subScreens.transition($(this).data(stateNameTag));
- });*/
},
'exit': function () {
jqAllButtons.off(); // unregister all event handlers
jqAllQuadrants.off();
jqScreen.css('display', 'none');
-// jqAllQuadrants.removeClass('transition');
prologHandler.destroy();
prologHandler = null;
subScreens.destroy();
diff --git a/js/codeq/python.js b/js/codeq/python.js
index c28ee53..4402fa6 100644
--- a/js/codeq/python.js
+++ b/js/codeq/python.js
@@ -116,8 +116,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
codeq.globalStateMachine.register('python', {
'jqScreen': jqScreen,
- 'enter': function (ref, data) {//function (problemDef, commonDef, currentSolution) {//
-
+ 'enter': function (ref, data) {
codeq.loadProblemData(ref,data).then(function(problem){
//codeq.log.debug("then:"+JSON.stringify(problem));
enterFun(problem.generalProblemData,data.commonDef,problem.solution);
@@ -129,36 +128,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
history.back();//TODO test
})
.done();
-
-
- /*$('#navigation-problem_list').css('display', '');
- var navigationPhython = $("#navigation-python");
- navigationPhython.addClass("active");
- navigationPhython.css('display', '');
-
- jqScreen.css('display', '');//we have to show the screen now so the code editor shows its initial values correctly
- pythonHandler = createPythonHandler(problemDef, commonDef, currentSolution);
- subScreens = codeq.makeStateMachine(substates);
- subScreens.transition(jqDescription.data(stateNameTag));
-
- jqInfoButtons.on(transitionEventName, function (event) {
- subScreens.transition('info'); // set focus on the hints quadrant
- event.stopPropagation(); // don't allow the event to go on and trigger further transition
- });
- jqBtnRun.on(transitionEventName, function (event) {
- subScreens.transition('console'); // set focus on the hints quadrant
- event.stopPropagation(); // don't allow the event to go on and trigger further transition
- });
-
- jqAllQuadrants.on(transitionEventName, function () {
- subScreens.transition($(this).data(stateNameTag));
- });*/
},
'exit': function () {
jqAllButtons.off(); // unregister all event handlers
jqAllQuadrants.off();
jqScreen.css('display', 'none');
-// jqAllQuadrants.removeClass('transition');
pythonHandler.destroy();
pythonHandler = null;
subScreens.destroy();
diff --git a/js/codeq/robot.js b/js/codeq/robot.js
index 7f67025..8b23e44 100644
--- a/js/codeq/robot.js
+++ b/js/codeq/robot.js
@@ -111,9 +111,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
codeq.globalStateMachine.register('robot', {
'jqScreen': jqScreen,
- //'enter': function (problemDef, commonDef, currentSolution) {
- 'enter': function (ref, data) {//function (problemDef, commonDef, currentSolution) {//
-
+ 'enter': function (ref, data) {
codeq.loadProblemData(ref,data).then(function(problem){
//codeq.log.debug("then:"+JSON.stringify(problem));
enterFun(problem.generalProblemData,data.commonDef,problem.solution);
@@ -125,35 +123,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
history.back();//TODO test
})
.done();
-
-
- /*$('#navigation-problem_list').css('display', '');
- $("#navigation-robot").addClass("active");
- $('#navigation-robot').css('display', '');
-
- jqScreen.css('display', '');//we have to show the screen now so the code editor shows its initial values correctly
- robotHandler = createRobotHandler(problemDef, commonDef, currentSolution);
- subScreens = codeq.makeStateMachine(substates);
- subScreens.transition(jqDescription.data(stateNameTag));
-
- jqInfoButtons.on(transitionEventName, function (event) {
- subScreens.transition('info'); // set focus on the hints quadrant
- event.stopPropagation(); // don't allow the event to go on and trigger further transition
- });
- jqBtnRun.on(transitionEventName, function (event) {
- subScreens.transition('console'); // set focus on the hints quadrant
- event.stopPropagation(); // don't allow the event to go on and trigger further transition
- });
-
- jqAllQuadrants.on(transitionEventName, function () {
- subScreens.transition($(this).data(stateNameTag));
- });*/
},
'exit': function () {
jqAllButtons.off(); // unregister all event handlers
jqAllQuadrants.off();
jqScreen.css('display', 'none');
-// jqAllQuadrants.removeClass('transition');
robotHandler.destroy();
robotHandler = null;
subScreens.destroy();