summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-12-15 11:30:19 +0100
committerAleš Smodiš <aless@guru.si>2015-12-15 11:30:19 +0100
commited62d492323011741027c9d79973ccd30b4b0494 (patch)
tree26121de183f0f2019857581198b4e31a9ede5456
parent13c8be3d82350082093df8cd65771f09fcb83c54 (diff)
parent7de6dca9112d292803b801e0d370c45b0ca0eb13 (diff)
Merge branch 'master' of ssh://212.235.189.51:22122/codeq-web
Conflicts: js/codeq/navigation.js
-rw-r--r--config.xml6
-rw-r--r--css/codeq.css19
-rw-r--r--index.html1
-rw-r--r--js/codeq/core.js12
-rw-r--r--js/codeq/navigation.js4
-rw-r--r--js/codeq/robot.js20
-rw-r--r--res/en.json2
-rw-r--r--res/sl.json2
8 files changed, 47 insertions, 19 deletions
diff --git a/config.xml b/config.xml
index e40a3a8..cb2f6a1 100644
--- a/config.xml
+++ b/config.xml
@@ -4,7 +4,7 @@
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "si.uni-lj.fri.gameteam.codeq"
- version = "0.2.0">
+ version = "1.0.0">
<!--
1.0 first release
@@ -20,6 +20,10 @@
Artificial Intelligence Laboratory, Faculty of Computer and Information Science, University of Ljubljana.
</author>
+ <platform name="ios" />
+ <platform name="android" />
+ <platform name="winphone" />
+
<!--
If you do not want any permissions to be added to your app, add the
following tag to your config.xml; you will still have the INTERNET
diff --git a/css/codeq.css b/css/codeq.css
index c12be4d..1775c84 100644
--- a/css/codeq.css
+++ b/css/codeq.css
@@ -99,6 +99,7 @@ div.vertical-line{
.block.block1 {
border-bottom: 1px solid #ddd;
+ padding-bottom: 1em;
}
@@ -107,9 +108,13 @@ div.vertical-line{
padding: 0.5em 0.5em 20px 0.5em;
}
+.block.block4 {
+ padding-bottom: 1em;
+}
/* code_editor */
.block > .code_editor {
+ min-height: 8em;
}
.block.block2 {
@@ -122,7 +127,7 @@ div.vertical-line{
background: #222;
font-size: 14px;
padding: 0.5em;
- min-height: 4em;
+ min-height: 8em;
}
.block-label {
@@ -154,6 +159,18 @@ div.vertical-line{
padding: 0 4px;
}
+/* robot connection & sensor info */
+#screen_robot .block3 .status {
+ background-color: #666;
+ border: 1px solid #444;
+ color: yellow;
+ font-family: monospace;
+ padding: 0.5em;
+ position: absolute;
+ top: 1em;
+ right: 1em;
+}
+
/* block-toolbar */
.block-toolbar {
position: absolute;
diff --git a/index.html b/index.html
index aff6d4f..d89bdd7 100644
--- a/index.html
+++ b/index.html
@@ -444,6 +444,7 @@
</div>
<div class="col-lg-6 col-md-12 col-sm-12 block block3">
<div class="console"></div>
+ <div class="status"></div>
<div class="block-label" data-tkey="console">Console</div>
</div>
</div>
diff --git a/js/codeq/core.js b/js/codeq/core.js
index 28767f7..22f6a50 100644
--- a/js/codeq/core.js
+++ b/js/codeq/core.js
@@ -307,7 +307,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
traversedPath.push(fragment);
if (branch[resourceName]) candidate = traversedPath.join('/') + '/' + resourceName;
}
- if (candidate) return candidate;
+ if (candidate) return codeq.ajaxPrefix + candidate;
codeq.log.error('Resource ' + resourceName + ' was not found; path: "' + resourceBranches.join('/') + '"');
return null;
};
@@ -610,9 +610,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
codeq.log.info('App reset: ' + (reason || 'no reason given'));
codeq.globalStateMachine.transition('login');
codeq.wait(
- codeq.comms.logout()
- .finally(codeq.comms.disconnect)
- .fail(function () {}) // ignore errors
+ codeq.comms.getSid() == null ? Q() : codeq.comms.logout()
+ .finally(
+ codeq.comms.disconnect
+ )
+ .fail(function (e) {
+ codeq.log.debug(e)
+ }) // ignore errors
)
.then(function () {
if (reason) {
diff --git a/js/codeq/navigation.js b/js/codeq/navigation.js
index cfff71b..d806eea 100644
--- a/js/codeq/navigation.js
+++ b/js/codeq/navigation.js
@@ -95,11 +95,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
name = 'login';//this will cause the following code to transition to the login state instead of the original one given
}
-
var newState = def[name];//if the newState is not the same as the old or if it doesn't exist at all is already checked at this point
-// if (currState) currState.exit();
-// currState = newState;
-// currState.enter.apply(currState, Array.prototype.slice.apply(arguments, [1]));
if (currState) {
if (newState.isModal) {
if (currState.isModal) currState.exit();
diff --git a/js/codeq/robot.js b/js/codeq/robot.js
index cfff13d..32c3b35 100644
--- a/js/codeq/robot.js
+++ b/js/codeq/robot.js
@@ -136,13 +136,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
var makeRobotTerminalHandler = function (jqConsole, editor, problem_id, activityHandler) {
var terminal = codeq.makeConsole(jqConsole, {
- 'greeting': 'CodeQ Robot terminal proxy',
- 'autoHistory': true
+ 'greeting': 'Robot messages\n--------------\n\n',
});
-
- terminal.onInput = function (text) {
- terminal.append('Not implemented.\n', 'output');
- };
+ terminal.inputDisable();
return terminal;
};
@@ -153,7 +149,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
var createRobotHandler = function (problemDef, commonDef, currentSolution) {
var jqDescriptionContent = jqDescription.find('.description'),
jqEditor = jqCode.find('.code_editor'),
+ jqTerminal = jqConsole.find('.console'),
jqHints = jqInfo.find('.hints'),
+ jqStatus = jqConsole.find('.status'),
editor = codeq.makeEditor(jqEditor[0],
{
mode: 'python',
@@ -164,6 +162,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
jqBtnRun.focus();
}),
activityHandler = codeq.makeActivityHandler(editor, problemDef.id),
+ terminal = makeRobotTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler),
hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'robot_hints', problemDef, commonDef),
commError = function (error) {
alert(error);
@@ -175,6 +174,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
// set up the websocket events
socket.on('close', function (data) {
console.log('websocket closed, trying to reopen in 1 s');
+ jqStatus.html('Not connected.');
reconnectTimer = setTimeout(function () {
reconnectTimer = null;
socket.open();
@@ -190,7 +190,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
if (!sensors.hasOwnProperty(sensor)) continue;
text += sensor + ': ' + sensors[sensor] + '<br />\n'
}
- $('div.console').html('<p style="color: lightgreen; font-family: monospace;">'+text+'</p>');
+ jqStatus.html(text);
+ }
+ else if (json_obj.event == 'output') {
+ text = json_obj.text;
+ terminal.append(text, 'output');
}
});
@@ -248,10 +252,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
var program = editor.getDoc().getValue();
activityHandler.queueTrace({'typ': 'robot_run', 'program': program});
socket.send(JSON.stringify({action: 'run', program: program}));
+ terminal.append('<run>\n', 'output');
});
jqBtnStop.on('click', function () {
activityHandler.queueTrace({'typ': 'robot_stop'});
socket.send(JSON.stringify({action: 'stop'}));
+ terminal.append('<stop>\n', 'output');
});
codeq.comms.loadProblem(problemDef.id).done();
diff --git a/res/en.json b/res/en.json
index 1fcb894..65d68bc 100644
--- a/res/en.json
+++ b/res/en.json
@@ -67,5 +67,5 @@
"upgrade_to_aai_no_button": "No, make new",
"upgrade_to_aai_yes_button": "Yes, upgrade to AAI",
"about": "About",
- "about_html" : "<p>CodeQ™ is the ...<div class=\"about-logos\"><div style=\"width: 29%;\"><img src=\"res/fri_logo.png\"></div><div class=\"vertical-line\"></div><div style=\"width: 29%;\"><img src=\"res/ai_lab_logo.png\"></div></div><hr><p>Programming by Guru Ltd, Ljubljana, Slovenia. Design by Loni DBS Ltd, Ljubljana, Slovenia.</p><hr></p>The project was co-funded by European Regional Development Fund and Slovenian Ministry of Education, Science, and Sport.<p></p><div class=\"about-logos\"><div style=\"width: 45%;\"><img src=\"res/nalozba_v_vaso_prihodnost.png\" style=\"max-height: 80%;max-width: 80%;\"></div><div class=\"vertical-line\"></div><div style=\"width: 45%;\"><img src=\"res/MIZS_slo.png\" style=\"max-height: 60%;max-width: 60%;\"></div></div><hr><h3>Contact</h3><p>Aleksander Sadikov, PhD, project leader.</p><hr><h3>Minimal requirements</h3><p>Android: version 3.1, iOS: version 5, Windows Phone: version 8</p>"
+ "about_html" : "<p>CodeQ™ is an e-service and a mobile app for teaching programming. The application enables the user to work on his or her own by solving a number of carefully prepared programming exercises and by guiding the user with automatically generated hints and test. ...<div class=\"about-logos\"><div style=\"width: 29%;\"><img src=\"res/fri_logo.png\"></div><div class=\"vertical-line\"></div><div style=\"width: 29%;\"><img src=\"res/ai_lab_logo.png\"></div></div><hr></p>The project was co-funded by European Regional Development Fund and Slovenian Ministry of Education, Science, and Sport.<p></p><div class=\"about-logos\"><div style=\"width: 45%;\"><img src=\"res/nalozba_v_vaso_prihodnost.png\" style=\"max-height: 80%;max-width: 80%;\"></div><div class=\"vertical-line\"></div><div style=\"width: 45%;\"><img src=\"res/MIZS_slo.png\" style=\"max-height: 60%;max-width: 60%;\"></div></div><hr><h3>Contact</h3><p>Aleksander Sadikov, PhD, project leader.</p><hr><h3>Mobile applications - minimum requirements</h3><p>Android: version 3.1, iOS: version 5, Windows Phone: version 8</p><hr><p>Programming by Guru Ltd, Ljubljana, Slovenia.</p>"
}
diff --git a/res/sl.json b/res/sl.json
index b97cc1f..1a72aca 100644
--- a/res/sl.json
+++ b/res/sl.json
@@ -67,5 +67,5 @@
"upgrade_to_aai_no_button": "Ne, naredi nov račun",
"upgrade_to_aai_yes_button": "Da, nadgradi na AAI",
"about": "O aplikaciji",
- "about_html" : "<h3>Naziv operacije</h3><p>Učenje programiranja s samodejno generiranimi namigi.</p><hr><h3>Kratek opis operacije</h3><p>Razvita je bila e-storitev in mobilna aplikacija za inteligentni sistem za poučevanje programiranja. Samostojno učenje programiranja prek reševanja programerskih nalog smo nadgradili z ekspertnim modulom, ki opozarja na napake in samodejno generira namige, in modulom za testiranje programov (uporabnikovih rešitev) s samodejno generiranimi testnimi primeri. Poleg tega je bil razvit modul za povezavo z mobilnimi roboti, ki bo omogočil poganjanje programov na le-teh.</p><hr><h3>Upravičenci</h3><p>Univerza v Ljubljani (Fakulteta za računalništvo in informatiko, Laboratorij za umetno inteligenco)</p><div class=\"about-logos\"><div style=\"width: 29%;\"><img src=\"res/fri_logo.png\"></div><div class=\"vertical-line\"></div><div style=\"width: 29%;\"><img src=\"res/ai_lab_logo.png\"></div></div><hr><h3>Stroški operacije</h3><p>X EUR od tega Y EUR iz javnih virov financiranja (85% Evropska unija, 15% Ministrstvo za izobraževanje, znanost in šport).</p><hr><h3>Datum operacije</h3><p>Operacija je potekala od 3.11.2014 do 30.9.2015.</p><hr><h3>Kontaktna oseba</h3><p>dr. Aleksander Sadikov, vodja projekta.</p><p>Operacijo delno financira Evropska unija iz Evropskega sklada za regionalni razvoj ter Ministrstvo za izobraževanje, znanost in šport. Operacija se izvaja v okviru Operativnega programa krepitve regionalnih razvojnih potencialov v obdobju 2007-2013, razvojne prioritete: gospodarska razvojna infrastruktura; prednostne usmeritve: Informacijska družba.</p><div class=\"about-logos\"><div style=\"width: 45%;\"><img src=\"res/nalozba_v_vaso_prihodnost.png\" style=\"max-height: 80%;max-width: 80%;\"></div><div class=\"vertical-line\"></div><div style=\"width: 45%;\"><img src=\"res/MIZS_slo.png\" style=\"max-height: 60%;max-width: 60%;\"></div></div><hr><h3>Mobilna aplikacija - minimalne zahteve</h3><p>Android: verzija 3.1, iOS: verzija 5, Windows Phone: verzija 8.</p><hr><p>Razvoj aplikacije: Guru d.o.o. Oblikovanje: LONI DBS d.o.o.</p>"
+ "about_html" : "<h3>Naziv operacije</h3><p>Učenje programiranja s samodejno generiranimi namigi.</p><hr><h3>Kratek opis operacije</h3><p>Razvita je bila e-storitev in mobilna aplikacija za inteligentni sistem za poučevanje programiranja. Samostojno učenje programiranja prek reševanja programerskih nalog smo nadgradili z ekspertnim modulom, ki opozarja na napake in samodejno generira namige in modulom za testiranje programov (uporabnikovih rešitev) s samodejno generiranimi testnimi primeri. Poleg tega je bil razvit modul za povezavo z mobilnimi roboti, ki bo omogočil poganjanje programov na le-teh.</p><hr><h3>Upravičenci</h3><p>Univerza v Ljubljani (Fakulteta za računalništvo in informatiko, Laboratorij za umetno inteligenco)</p><div class=\"about-logos\"><div style=\"width: 29%;\"><img src=\"res/fri_logo.png\"></div><div class=\"vertical-line\"></div><div style=\"width: 29%;\"><img src=\"res/ai_lab_logo.png\"></div></div><hr><h3>Stroški operacije</h3><p>69.996 EUR (85% Evropska unija, 15% Ministrstvo za izobraževanje, znanost in šport).</p><p>Operacijo delno financira Evropska unija iz Evropskega sklada za regionalni razvoj ter Ministrstvo za izobraževanje, znanost in šport. Operacija se izvaja v okviru Operativnega programa krepitve regionalnih razvojnih potencialov v obdobju 2007-2013, razvojne prioritete: gospodarska razvojna infrastruktura; prednostne usmeritve: Informacijska družba.</p><div class=\"about-logos\"><div style=\"width: 45%;\"><img src=\"res/nalozba_v_vaso_prihodnost.png\" style=\"max-height: 80%;max-width: 80%;\"></div><div class=\"vertical-line\"></div><div style=\"width: 45%;\"><img src=\"res/MIZS_slo.png\" style=\"max-height: 60%;max-width: 60%;\"></div></div><hr><h3>Datum operacije</h3><p>Operacija je potekala od 3.11.2014 do 30.9.2015.</p><hr><h3>Kontaktna oseba</h3><p>dr. Aleksander Sadikov, vodja projekta.</p><hr><h3>Mobilna aplikacija - minimalne zahteve</h3><p>Android: verzija 3.1, iOS: verzija 5, Windows Phone: verzija 8.</p><hr><p>Razvoj aplikacije: Guru d.o.o.</p>"
}