Identification
This commit is contained in:
parent
9fba3faaf6
commit
eb79b0bc42
|
@ -477,7 +477,7 @@ DBReq.UserCreator = function(finishAction) {
|
||||||
DBReq.UserCreator.prototype.execute = function() {
|
DBReq.UserCreator.prototype.execute = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.client.query(
|
this.client.query(
|
||||||
"INSERT INTO users(name) VALUES('anonymous'); SELECT currval('users_id_seq');",
|
"INSERT INTO users DEFAULT VALUES; SELECT currval('users_id_seq');",
|
||||||
[],
|
[],
|
||||||
function(err, result) {
|
function(err, result) {
|
||||||
self.finalResult = result.rows[0].currval;
|
self.finalResult = result.rows[0].currval;
|
||||||
|
|
|
@ -207,3 +207,12 @@ module.exports.viewer = function(req, res, next) {
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.userstudy = function(req, res) {
|
||||||
|
res.setHeader('Content-Type', 'text/html');
|
||||||
|
|
||||||
|
res.render('user_study.jade', res.lcals, function(err, result) {
|
||||||
|
res.send(result);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
|
@ -9,5 +9,6 @@ module.exports = {
|
||||||
'/prototype/tutorial': 'tutorial',
|
'/prototype/tutorial': 'tutorial',
|
||||||
'/prototype/sponza': 'sponza',
|
'/prototype/sponza': 'sponza',
|
||||||
'/prototype/coin-creator/:scene': 'clicker',
|
'/prototype/coin-creator/:scene': 'clicker',
|
||||||
'/prototype/coin-viewer/:scene': 'viewer'
|
'/prototype/coin-viewer/:scene': 'viewer',
|
||||||
|
'/user-study': 'userstudy'
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
extends ../../../views/base.jade
|
||||||
|
|
||||||
|
block extrahead
|
||||||
|
link(rel="stylesheet", href="/static/css/signin.css")
|
||||||
|
|
||||||
|
block content
|
||||||
|
form.form-signin(method="POST", action='/identification')
|
||||||
|
h2 Please sign in
|
||||||
|
label(for='inputId').sr-only Id
|
||||||
|
input#inputId.form-control(name="inputId", type="text", placeholder='Id', required, autofocus)
|
||||||
|
label(for='inputAge').sr-only Age
|
||||||
|
input#inputAge.form-control(name="inputAge", type="number", placeholder='Age', min="18", required)
|
||||||
|
|
||||||
|
div(style={'text-align': 'center', 'margin-top':'10px', 'margin-bottom':'10px'})
|
||||||
|
label.radio-inline
|
||||||
|
input(type='radio', name='inputGender', value="male")
|
||||||
|
| Male
|
||||||
|
label.radio-inline
|
||||||
|
input(type='radio', name='inputGender', value="female")
|
||||||
|
| Female
|
||||||
|
|
||||||
|
button.btn.btn-lg.btn-primary.btn-block(type='submit') Sign in
|
|
@ -31,7 +31,6 @@ module.exports = function(parent){
|
||||||
|
|
||||||
for (var key in urls) {
|
for (var key in urls) {
|
||||||
app.get(key, obj[urls[key]]);
|
app.get(key, obj[urls[key]]);
|
||||||
|
|
||||||
Log.debug(' ' + key + ' -> ' + name + '.' + urls[key]);
|
Log.debug(' ' + key + ' -> ' + name + '.' + urls[key]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,9 @@ module.exports = function(parent){
|
||||||
Log.debug(' ' + name + ':');
|
Log.debug(' ' + name + ':');
|
||||||
|
|
||||||
for (var key in urls) {
|
for (var key in urls) {
|
||||||
app.post('/posts' + key, obj[urls[key]]);
|
app.post(key, obj[urls[key]]);
|
||||||
|
|
||||||
Log.debug(' /posts' + key + ' -> posts.' + name + '.' + urls[key]);
|
Log.debug(' ' + key + ' -> ' + name + '.' + urls[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.debug();
|
Log.debug();
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/arrow-clicked': 'index'
|
'/posts/arrow-clicked': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/coin-clicked': 'index'
|
'/posts/coin-clicked': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/coin-id': 'index'
|
'/posts/coin-id': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/coin-info': 'index'
|
'/posts/coin-info': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/fps': 'index'
|
'/posts/fps': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/hovered': 'index'
|
'/posts/hovered': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
var pg = require('pg');
|
||||||
|
var secret = require('../../private');
|
||||||
|
var db = require('../../controllers/prototype/dbrequests.js');
|
||||||
|
var Log = require('../../lib/NodeLog.js');
|
||||||
|
|
||||||
|
module.exports.index = function(req, res) {
|
||||||
|
|
||||||
|
db.tryUser(req.session.user_id, function(id) {
|
||||||
|
req.session.user_id = id;
|
||||||
|
req.session.save();
|
||||||
|
|
||||||
|
pg.connect(secret.url, function(err, client, release) {
|
||||||
|
client.query(
|
||||||
|
"UPDATE Users SET worker_id = $1, age = $2, male = $3 WHERE id = $4;",
|
||||||
|
[req.body.inputId, req.body.inputAge, req.body.inputGender === 'male', req.session.user_id],
|
||||||
|
function(err, result) {
|
||||||
|
if (err !== null)
|
||||||
|
Log.dberror(err + ' in identfication');
|
||||||
|
release();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
res.redirect('/');
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = {
|
||||||
|
'/identification': 'index'
|
||||||
|
};
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/keyboard-event': 'index'
|
'/posts/keyboard-event': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/pointer-locked': 'index'
|
'/posts/pointer-locked': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/previous-next-clicked': 'index'
|
'/posts/previous-next-clicked': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/reset-clicked': 'index'
|
'/posts/reset-clicked': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/switched-lock-option': 'index'
|
'/posts/switched-lock-option': 'index'
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,7 +36,9 @@ CREATE TYPE CAMERA AS(
|
||||||
-- Base tables
|
-- Base tables
|
||||||
CREATE TABLE Users(
|
CREATE TABLE Users(
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
name CHAR(50)
|
worker_id varchar(50),
|
||||||
|
age INTEGER,
|
||||||
|
male BOOLEAN
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE Scene(
|
CREATE TABLE Scene(
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
doctype html
|
||||||
|
html(lang='fr')
|
||||||
|
head
|
||||||
|
meta(charset='utf-8')
|
||||||
|
meta(name='viewport', content='width=device-width, initial-scale=1')
|
||||||
|
link(rel="stylesheet", href="/static/bootstrap/css/bootstrap.css")
|
||||||
|
link(rel="stylesheet", href="/static/css/style.css")
|
||||||
|
link(rel="stylesheet", href="/static/css/syntax.css")
|
||||||
|
block extrahead
|
||||||
|
link(rel="stylesheet", href="http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic")
|
||||||
|
link(rel="icon", type="image/x-icon", href="/favicon.ico")
|
||||||
|
block title
|
||||||
|
title Hello
|
||||||
|
|
||||||
|
body
|
||||||
|
nav#nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
|
||||||
|
.container
|
||||||
|
#navbar.navbar-header
|
||||||
|
button.navbar-toggle(type="button", data-toggle="collapse" data-target=".navbar-collapse")
|
||||||
|
span.sr-only Toggle navigation
|
||||||
|
span.icon-bar
|
||||||
|
span.icon-bar
|
||||||
|
a.navbar-brand(href="#{urls.index}") 3DUI
|
||||||
|
|
||||||
|
block links
|
||||||
|
|
||||||
|
section#main-section.container
|
||||||
|
if alertCookie
|
||||||
|
.alert.alert-warning.alert-dismissible(role="alert", style={'margin-top':'20px'})
|
||||||
|
button.close(type="button", data-dismiss="alert", aria-label="Close")
|
||||||
|
span(aria-hidden="true") ×
|
||||||
|
<strong>Warning</strong> : this website use cookies !
|
||||||
|
|
||||||
|
block content
|
||||||
|
|
||||||
|
script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js")
|
||||||
|
script(src="/static/bootstrap/js/bootstrap.min.js")
|
||||||
|
block js
|
||||||
|
block extrajs
|
||||||
|
|
|
@ -1,33 +1,11 @@
|
||||||
|
extends ./base.jade
|
||||||
|
|
||||||
mixin button_link(href)
|
mixin button_link(href)
|
||||||
form.navbar-form.navbar-left(role="search", action="#{href}", method='GET')
|
form.navbar-form.navbar-left(role="search", action="#{href}", method='GET')
|
||||||
button.btn.btn-default(type="submit")
|
button.btn.btn-default(type="submit")
|
||||||
block
|
block
|
||||||
|
|
||||||
|
block links
|
||||||
doctype html
|
|
||||||
html(lang='fr')
|
|
||||||
head
|
|
||||||
meta(charset='utf-8')
|
|
||||||
meta(name='viewport', content='width=device-width, initial-scale=1')
|
|
||||||
link(rel="stylesheet", href="/static/bootstrap/css/bootstrap.css")
|
|
||||||
link(rel="stylesheet", href="/static/css/style.css")
|
|
||||||
link(rel="stylesheet", href="/static/css/syntax.css")
|
|
||||||
block extrahead
|
|
||||||
link(rel="stylesheet", href="http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic")
|
|
||||||
link(rel="icon", type="image/x-icon", href="/favicon.ico")
|
|
||||||
block title
|
|
||||||
title Hello
|
|
||||||
|
|
||||||
body
|
|
||||||
nav#nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
|
|
||||||
.container
|
|
||||||
#navbar.navbar-header
|
|
||||||
button.navbar-toggle(type="button", data-toggle="collapse" data-target=".navbar-collapse")
|
|
||||||
span.sr-only Toggle navigation
|
|
||||||
span.icon-bar
|
|
||||||
span.icon-bar
|
|
||||||
a.navbar-brand(href="#{urls.index}") 3DUI
|
|
||||||
|
|
||||||
div.navbar-collapse.collapse
|
div.navbar-collapse.collapse
|
||||||
ul.nav.navbar-nav
|
ul.nav.navbar-nav
|
||||||
li
|
li
|
||||||
|
@ -75,17 +53,3 @@ html(lang='fr')
|
||||||
span.glyphicon.glyphicon-envelope(aria-hidden=true)
|
span.glyphicon.glyphicon-envelope(aria-hidden=true)
|
||||||
span(style={'margin-left':'5px'}) Contact
|
span(style={'margin-left':'5px'}) Contact
|
||||||
|
|
||||||
section#main-section.container
|
|
||||||
if alertCookie
|
|
||||||
.alert.alert-warning.alert-dismissible(role="alert", style={'margin-top':'20px'})
|
|
||||||
button.close(type="button", data-dismiss="alert", aria-label="Close")
|
|
||||||
span(aria-hidden="true") ×
|
|
||||||
<strong>Warning</strong> : this website use cookies !
|
|
||||||
|
|
||||||
block content
|
|
||||||
|
|
||||||
script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js")
|
|
||||||
script(src="/static/bootstrap/js/bootstrap.min.js")
|
|
||||||
block js
|
|
||||||
block extrajs
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue