diff --git a/controllers/feedback/index.js b/controllers/feedback/index.js
new file mode 100644
index 0000000..422bb2e
--- /dev/null
+++ b/controllers/feedback/index.js
@@ -0,0 +1,9 @@
+module.exports.index = function(req, res) {
+ res.setHeader('Content-Type', 'text/html');
+
+ res.render('index.jade', res.locals, function(err, result) {
+ console.log(err);
+ res.send(result);
+ });
+};
+
diff --git a/controllers/feedback/urls.js b/controllers/feedback/urls.js
new file mode 100644
index 0000000..29e3416
--- /dev/null
+++ b/controllers/feedback/urls.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/feedback': 'index',
+};
diff --git a/controllers/feedback/views/index.jade b/controllers/feedback/views/index.jade
new file mode 100644
index 0000000..8e5edb3
--- /dev/null
+++ b/controllers/feedback/views/index.jade
@@ -0,0 +1,24 @@
+extends ../../../views/base.jade
+
+mixin question(id, qu)
+ label(for="#{id}") #{qu}
+ input.form-control(name="answer#{id}", type="text", placeholder="Answer")
+
+block extrahead
+ link(rel="stylesheet", href="/static/css/feedback.css")
+
+block content
+ form.form-signin(method="POST", action='/feedback-target')
+ h2 Please give us your feedback
+
+ +question(1, "Did you have trouble to find the coins without the recommendations ?")
+ +question(2, "Did the recommendations helped you to find the coins ?")
+ +question(3, "Did the recommendations helped you to browser the scene ?")
+ +question(4, "Do you think recommendations can be helpful ?")
+ +question(5, "Which recommendation style do you prefer and why ?")
+
+ //-label(for='input1') Did you have trouble to find the coins during the first step ?
+ //-input#input1.form-control(name="input1", type="text", placeholder='Id')
+
+ button.btn.btn-lg.btn-primary.btn-block(type='submit') Submit
+
diff --git a/controllers/prototype/dbrequests.js b/controllers/prototype/dbrequests.js
index f5833c3..7a8df74 100644
--- a/controllers/prototype/dbrequests.js
+++ b/controllers/prototype/dbrequests.js
@@ -506,10 +506,11 @@ DBReq.UserCreator.prototype.finish = function() {
* @memberof DBReq
* @constructor
*/
-DBReq.ExpCreator = function(user_id, scene_id, finishAction) {
+DBReq.ExpCreator = function(user_id, scene_id, template, finishAction) {
this.finishAction = finishAction;
this.user_id = user_id;
this.scene_id = scene_id;
+ this.template = template;
// Connect to db
var self = this;
@@ -526,8 +527,8 @@ DBReq.ExpCreator = function(user_id, scene_id, finishAction) {
DBReq.ExpCreator.prototype.execute = function() {
var self = this;
this.client.query(
- "INSERT INTO experiment(user_id, scene_id) VALUES($1,$2);",
- [self.user_id, self.scene_id],
+ "INSERT INTO experiment(user_id, scene_id, template) VALUES($1,$2,$3);",
+ [self.user_id, self.scene_id, self.template],
function(err, result) {
self.client.query("SELECT MAX(id) AS id FROM experiment;", function(err, result) {
self.finalResult = result.rows[0].id;
@@ -776,8 +777,8 @@ DBReq.createUser = function(callback) {
* @param scene_id {Number} id of the scene on which the experiment is
* @param callback {function} callback called on the new experiment id
*/
-DBReq.createExp = function(id, scene_id, callback) {
- new DBReq.ExpCreator(id, scene_id, callback);
+DBReq.createExp = function(id, scene_id, template, callback) {
+ new DBReq.ExpCreator(id, scene_id, template, callback);
};
/**
diff --git a/controllers/prototype/index.js b/controllers/prototype/index.js
index d1e2506..976bc61 100644
--- a/controllers/prototype/index.js
+++ b/controllers/prototype/index.js
@@ -32,6 +32,18 @@ function randomArray() {
return arr;
}
+
+function randomReco() {
+ var recoStyles = [
+ 'prototype_empty.jade',
+ 'prototype_viewports.jade',
+ 'prototype_arrows.jade'
+ ];
+
+ return shuffle(recoStyles);
+
+}
+
module.exports.index = function(req, res) {
res.setHeader('Content-Type', 'text/html');
@@ -51,6 +63,15 @@ var generateSceneNumber = function(req, res) {
return req.session.scenes[req.session.currentSceneIndex];
};
+var generateRecommendationStyle = function(req, res) {
+
+ if (req.session.recos === undefined) {
+ req.session.recos = randomReco();
+ }
+
+ return req.session.recos.shift();
+}
+
var sceneToFunction = function(scene) {
switch (scene) {
case 2:
@@ -65,14 +86,23 @@ var sceneToFunction = function(scene) {
};
var protoHelper = function(template) {
+
return function(req, res) {
+
+ template = generateRecommendationStyle(req, res);
+
+ if (template === undefined) {
+ res.redirect('/feedback');
+ return;
+ }
+
db.tryUser(req.session.user_id, function(id) {
// Get random scene number
var scene = generateSceneNumber(req, res);
res.locals.scene = sceneToFunction(scene);
req.session.user_id = id;
- db.createExp(id, req.session.scenes[req.session.currentSceneIndex], function(id) {
+ db.createExp(id, req.session.scenes[req.session.currentSceneIndex], template, function(id) {
req.session.exp_id = id;
req.session.save();
res.setHeader('Content-Type','text/html');
@@ -87,6 +117,7 @@ var protoHelper = function(template) {
module.exports.arrows = protoHelper('prototype_arrows.jade');
module.exports.viewports = protoHelper('prototype_viewports.jade');
module.exports.reverse = protoHelper('prototype_reverse.jade');
+module.exports.empty = protoHelper('prototype_empty.jade');
module.exports.sponza = function(req, res) {
res.setHeader('Content-Type', 'text/html');
@@ -143,7 +174,7 @@ module.exports.tutorial = function(req, res) {
req.session.user_id = id;
// 1 is the ID of peach scene
- db.createExp(id, 1, function(id) {
+ db.createExp(id, 1, null, function(id) {
req.session.exp_id = id;
req.session.save();
diff --git a/controllers/prototype/urls.js b/controllers/prototype/urls.js
index 242c3d0..62616e1 100644
--- a/controllers/prototype/urls.js
+++ b/controllers/prototype/urls.js
@@ -2,6 +2,7 @@ module.exports = {
'/prototype': 'index',
'/prototype/arrows': 'arrows',
'/prototype/viewports': 'viewports',
+ '/prototype/empty': 'empty',
'/prototype/reverse': 'reverse',
'/prototype/replay': 'replay_index',
'/prototype/replay/:id': 'replay',
diff --git a/controllers/prototype/views/prototype.jade b/controllers/prototype/views/prototype.jade
index 8eb3e28..305182f 100644
--- a/controllers/prototype/views/prototype.jade
+++ b/controllers/prototype/views/prototype.jade
@@ -40,8 +40,10 @@ block content
input#lock(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px'}, checked)
label(for="lock" style={'margin-right':'10px'}) Pointer lock
- input#showarrows(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px'}, checked)
- label(for="showarrows" style={'margin-right':'10px'}) Show arrows
+ input#showarrows(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px', 'display':'none'}, checked)
+ label(for="showarrows" style={'margin-right':'10px', 'display': 'none'}) Show arrows
+
+ block lastbutton
//-input#recommendation(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px'})
//-label(for="recommendation" style={'margin-right':'10px'}) Fixed prev
diff --git a/controllers/prototype/views/prototype_arrows.jade b/controllers/prototype/views/prototype_arrows.jade
index cb7694d..c4ddb63 100644
--- a/controllers/prototype/views/prototype_arrows.jade
+++ b/controllers/prototype/views/prototype_arrows.jade
@@ -5,6 +5,17 @@ block title
block configjs
script Recommendation = L3D.ArrowRecommendation;
+ script.
+ Coin.onLastCoin = function() {
+ $('#next').show();
+ $('#next').click(function() {
+ window.location = '/prototype/arrows';
+ });
+ };
+
+block lastbutton
+ button#next.btn.btn-success.navbar-btn(style={'margin-right':'10px', 'margin-bottom':'10px', 'display':'none'})
+ span Go to the next step
//-block preciseDescription
p
diff --git a/controllers/prototype/views/prototype_empty.jade b/controllers/prototype/views/prototype_empty.jade
new file mode 100644
index 0000000..9dfdda3
--- /dev/null
+++ b/controllers/prototype/views/prototype_empty.jade
@@ -0,0 +1,25 @@
+extends ./prototype_interactive
+
+block title
+ title #{title} - Prototype - Arrows
+
+block configjs
+ script Recommendation = L3D.EmptyRecommendation;
+ script.
+ Coin.onLastCoin = function() {
+ $('#next').show();
+ $('#next').click(function() {
+ window.location = '/prototype/arrows';
+ });
+ };
+
+block lastbutton
+ button#next.btn.btn-success.navbar-btn(style={'margin-right':'10px', 'margin-bottom':'10px', 'display':'none'})
+ span Go to the next step
+
+//-block preciseDescription
+ p
+ | Recommended views are displayed with a
+ | transparent blue arrow. They disappear when you
+ | come closer to them, and shows the motion between
+ | your current position and the recommendation.
diff --git a/controllers/prototype/views/prototype_viewports.jade b/controllers/prototype/views/prototype_viewports.jade
index 13b35dd..ac5ad60 100644
--- a/controllers/prototype/views/prototype_viewports.jade
+++ b/controllers/prototype/views/prototype_viewports.jade
@@ -5,6 +5,17 @@ block title
block configjs
script Recommendation = L3D.ViewportRecommendation;
+ script.
+ Coin.onLastCoin = function() {
+ $('#next').show();
+ $('#next').click(function() {
+ window.location = '/prototype/arrows';
+ });
+ };
+
+block lastbutton
+ button#next.btn.btn-success.navbar-btn(style={'margin-right':'10px', 'margin-bottom':'10px', 'display':'none'})
+ span Go to the next step
//-block preciseDescription
p
diff --git a/controllers/thankyou/index.js b/controllers/thankyou/index.js
new file mode 100644
index 0000000..422bb2e
--- /dev/null
+++ b/controllers/thankyou/index.js
@@ -0,0 +1,9 @@
+module.exports.index = function(req, res) {
+ res.setHeader('Content-Type', 'text/html');
+
+ res.render('index.jade', res.locals, function(err, result) {
+ console.log(err);
+ res.send(result);
+ });
+};
+
diff --git a/controllers/thankyou/urls.js b/controllers/thankyou/urls.js
new file mode 100644
index 0000000..6a7832a
--- /dev/null
+++ b/controllers/thankyou/urls.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/thankyou': 'index',
+};
diff --git a/controllers/thankyou/views/index.jade b/controllers/thankyou/views/index.jade
new file mode 100644
index 0000000..013254a
--- /dev/null
+++ b/controllers/thankyou/views/index.jade
@@ -0,0 +1,5 @@
+extends ../../../views/base.jade
+
+block content
+ h1 Thank you for everything !
+
diff --git a/js/Makefile b/js/Makefile
index c4fb629..baa041f 100644
--- a/js/Makefile
+++ b/js/Makefile
@@ -29,6 +29,7 @@ L3D:
--js l3d/src/recommendations/ViewportRecommendation.js \
--js l3d/src/recommendations/ArrowRecommendation.js \
--js l3d/src/recommendations/ReverseRecommendation.js \
+ --js l3d/src/recommendations/EmptyRecommendation.js \
--js l3d/src/cameras/ReplayCamera.js \
--js l3d/src/cameras/Camera.js \
--js l3d/src/cameras/FixedCamera.js \
diff --git a/js/l3d/apps/prototype/Coin.js b/js/l3d/apps/prototype/Coin.js
index 3f6b34e..27a74cc 100644
--- a/js/l3d/apps/prototype/Coin.js
+++ b/js/l3d/apps/prototype/Coin.js
@@ -156,6 +156,9 @@ Coin.prototype.get = function() {
Coin.sounds[(Coin.total ++) - 1].play();
if (Coin.total === 9) {
+ if (typeof Coin.onLastCoin === 'function') {
+ Coin.onLastCoin();
+ }
// You got the last coin
var music = document.getElementById('music');
if (music !== null) {
diff --git a/js/l3d/apps/prototype/tutorial/TutorialSteps.js b/js/l3d/apps/prototype/tutorial/TutorialSteps.js
index a962932..ead20c4 100644
--- a/js/l3d/apps/prototype/tutorial/TutorialSteps.js
+++ b/js/l3d/apps/prototype/tutorial/TutorialSteps.js
@@ -111,7 +111,7 @@ var TutorialSteps = function(tutoCamera, scene, coins, onWindowResize, container
justclick:false
},
{
- text: "Congratulations ! You've successfully finished the tutorial !",
+ text: "Congratulations ! You've successfully finished the tutorial ! Click here to start.",
justclick: false
}
];
diff --git a/js/l3d/src/recommendations/EmptyRecommendation.js b/js/l3d/src/recommendations/EmptyRecommendation.js
new file mode 100644
index 0000000..fedfa3b
--- /dev/null
+++ b/js/l3d/src/recommendations/EmptyRecommendation.js
@@ -0,0 +1,20 @@
+L3D.EmptyRecommendation = function() {
+ L3D.BaseRecommendation.apply(this, arguments);
+ this.target = new THREE.Vector3();
+};
+
+L3D.EmptyRecommendation.prototype = Object.create(L3D.BaseRecommendation.prototype);
+L3D.EmptyRecommendation.prototype.constructor = L3D.EmptyRecommendation;
+
+
+L3D.EmptyRecommendation.prototype.raycast = function() {};
+L3D.EmptyRecommendation.prototype.check = function() {};
+L3D.EmptyRecommendation.prototype.initExtremity = function() {};
+L3D.EmptyRecommendation.prototype.updateExtremity = function() {};
+L3D.EmptyRecommendation.prototype.setSize = function() {};
+L3D.EmptyRecommendation.prototype.update = function() {};
+L3D.EmptyRecommendation.prototype.regenerateArrow = function() {};
+L3D.EmptyRecommendation.prototype.look = function() {};
+L3D.EmptyRecommendation.prototype.addToScene = function() {};
+
+
diff --git a/posts/feedback-target/index.js b/posts/feedback-target/index.js
new file mode 100644
index 0000000..b9e6ff5
--- /dev/null
+++ b/posts/feedback-target/index.js
@@ -0,0 +1,25 @@
+var mail = require('../../lib/mail.js');
+var Log = require('../../lib/NodeLog.js');
+
+module.exports.index = function(req, res) {
+
+ var text = '';
+
+ for (var i in req.body) {
+ text += i + ' : ' + req.body[i] + '\n'
+ }
+
+ mail.send({
+ from: req.session.user_id + " <" + req.session.user_id + "@toto.tata>",
+ to: "Thomas ",
+ subject: "By " + req.session.user_id,
+ text: text
+ }, function(err, message) {
+ if (err !== null) {
+ Log.mailerror(err);
+ }
+ });
+
+ res.redirect('/thankyou');
+
+};
diff --git a/posts/feedback-target/urls.js b/posts/feedback-target/urls.js
new file mode 100644
index 0000000..be397c1
--- /dev/null
+++ b/posts/feedback-target/urls.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/feedback-target': 'index'
+};
diff --git a/posts/identification/index.js b/posts/identification/index.js
index 41218db..44749c9 100644
--- a/posts/identification/index.js
+++ b/posts/identification/index.js
@@ -30,7 +30,7 @@ module.exports.index = function(req, res) {
);
});
- res.redirect('/');
+ res.redirect('/prototype/tutorial');
});
} else {
diff --git a/sql/backup.pgsql b/sql/backup.pgsql
index 1025564..47e22f4 100644
--- a/sql/backup.pgsql
+++ b/sql/backup.pgsql
@@ -51,7 +51,8 @@ CREATE TABLE Scene(
CREATE TABLE Experiment(
id SERIAL PRIMARY KEY,
user_id SERIAL REFERENCES Users (id),
- scene_id SERIAL REFERENCES Scene (id)
+ scene_id SERIAL REFERENCES Scene (id),
+ template VARCHAR(30)
);
CREATE TABLE Coin(
diff --git a/static/css/feedback.css b/static/css/feedback.css
new file mode 100644
index 0000000..fe12a47
--- /dev/null
+++ b/static/css/feedback.css
@@ -0,0 +1,38 @@
+body {
+ padding-top: 40px;
+ padding-bottom: 40px;
+ background-color: #eee;
+}
+
+.form-signin {
+ padding: 15px;
+ margin: 0 auto;
+}
+.form-signin .form-signin-heading,
+.form-signin .checkbox {
+ margin-bottom: 10px;
+}
+.form-signin .checkbox {
+ font-weight: normal;
+}
+.form-signin .form-control {
+ position: relative;
+ height: auto;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 10px;
+ font-size: 16px;
+}
+.form-signin .form-control:focus {
+ z-index: 2;
+}
+.form-signin input {
+ margin-bottom: 5px;
+ margin-top: 5px;
+}
+
+.form-signin label {
+ margin-right: 0px;
+ margin-left: 0px;
+}