Commit 0e0d6fc1 by Pablo Molina

Merge branch 'issue/409' into 'develop'

Fixed #409
parents 25d6599b e345e84a
......@@ -2,11 +2,11 @@
echo "-- Running pictogram server"
if [ -e "src/app.js" ]; then
cd src && forever start app.js
cd src && npm start
elif [ -e "/vagrant/src/app.js" ]; then
cd /vagrant/src && forever start app.js
cd /vagrant/src && npm start
elif [ -e "/home/vagrant/sync/src/app.js" ]; then
cd /home/vagrant/sync/src && forever start app.js
cd /home/vagrant/sync/src && npm start
else
echo "-- app.js not found, cannot run pictogram server"
exit
......
......@@ -388,7 +388,7 @@ CREATE TABLE IF NOT EXISTS `supervisor` (
`name` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`surname` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`gender` char(1) COLLATE utf8_unicode_ci NOT NULL,
`pic` varchar(255) COLLATE utf8_unicode_ci DEFAULT '/upload/supervisorAvatar/defaultAvatar.jpg',
`pic` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'defaultAvatar.jpg',
`address` varchar(180) COLLATE utf8_unicode_ci DEFAULT NULL,
`country` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
......
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Datos de prueba `pictodb`
--
SET foreign_key_checks=0;
--
-- Vaciado de tablas (opcional, se puede comentar)
--
-- TRUNCATE supervisor;
-- TRUNCATE student;
-- TRUNCATE stu_sup;
-- TRUNCATE office;
-- TRUNCATE stu_picto;
SET foreign_key_checks = 0;
--
-- Volcado de datos para la tabla `office`
-- Oficina
--
--
-- Alta de gabinete CAJA
--
INSERT INTO `office` (`name`, `address`, `country`, `contact_person`, `email`, `phone1`, `lang`) VALUES
('Comunicación Aumentativa JAén (CAJA)',
INSERT INTO `office` (
`name`,
`address`,
`country`,
`contact_person`,
`email`,
`phone1`,
`lang`
) VALUES (
'Comunicación Aumentativa JAén (CAJA)',
'Paraje Las Lagunillas, Ed A3, primera plata, 23071. Jaén',
'ES',
'Fernando Martínez Santiago',
'dofer@ujaen.es',
'+34 953 21 28 88',
'es-es')
;
'ES',
'Fernando Martínez Santiago',
'dofer@ujaen.es',
'+34 953 21 28 88',
'es-es'
);
--
-- Alta de gabinete CAJA
-- Supervisores
--
-- CAJA
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`)
(SELECT 'Fernando','Martínez Santiago', 'M', NULL, 'dofer@ujaen.es', '+34953212888', 'es-es', '$2a$10$Q4jHNlC58.ptfl/5wZeHfOIvpJslJHKOFNZO3bWs4it7TifQPQnEa', true, id from office where name='Comunicación Aumentativa JAén (CAJA)');
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`)
(SELECT 'Miguel Ángel','García Cumbreras', 'M', NULL, 'magc@ujaen.es', '+34953212420', 'es-es', '$2a$04$XQvWUwGTvjR47ChPwd3f6ukx8Zg.7o1N4Kf6P.zqhVtQxVNArOsXi', true, id from office where name='Comunicación Aumentativa JAén (CAJA)');
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`)
(SELECT 'Arturo','Montejo Ráez', 'M', NULL, 'amontejo@ujaen.es', '+34953212882', 'es-es', '$2a$04$yoBXAMSgCVGSIr2pnuIOw.J8UCm8f2XkATu5rqsMJiEmlxBHs5.cO', true, id from office where name='Comunicación Aumentativa JAén (CAJA)');
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`)
(SELECT 'Alfonso','Ureña López', 'M', NULL, 'laurena@ujaen.es', '+34953212895', 'es-es', '$2a$04$zVGHJFafoZa60wo1yBqF/Oi3RXV/qS2cq0/j/W3Dkf4P1ad0e7.iS', true, id from office where name='Comunicación Aumentativa JAén (CAJA)');
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`)
(SELECT 'Jesús','Navarro Moreno', 'M', NULL, 'jnavarro@ujaen.es', '+34953211912', 'es-es', '$2a$04$8O3Jd5j9/nM/KC.b1a8qRevyUwWUx6XGU3Gm754Y/8PpLO2jv.i76', true, id from office where name='Comunicación Aumentativa JAén (CAJA)');
INSERT INTO `supervisor` (
`name`,
`surname`,
`gender`,
`address`,
`email`,
`phone`,
`lang`,
`password`,
`active`,
`id_off`,
`pic`
) VALUES (
'Fernando',
'Martínez Santiago',
'M',
NULL,
'dofer@ujaen.es',
'+34953212888',
'es-es',
'$2a$10$Q4jHNlC58.ptfl/5wZeHfOIvpJslJHKOFNZO3bWs4it7TifQPQnEa',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_dofer.jpg'
), (
'Miguel Ángel',
'García Cumbreras',
'M',
NULL,
'magc@ujaen.es',
'+34953212420',
'es-es',
'$2a$04$XQvWUwGTvjR47ChPwd3f6ukx8Zg.7o1N4Kf6P.zqhVtQxVNArOsXi',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_miguel.jpg'
), (
'Arturo',
'Montejo Ráez',
'M',
NULL,
'amontejo@ujaen.es',
'+34953212882',
'es-es',
'$2a$04$yoBXAMSgCVGSIr2pnuIOw.J8UCm8f2XkATu5rqsMJiEmlxBHs5.cO',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_arturo.jpg'
), (
'Alfonso',
'Ureña López',
'M',
NULL,
'laurena@ujaen.es',
'+34953212895',
'es-es',
'$2a$04$zVGHJFafoZa60wo1yBqF/Oi3RXV/qS2cq0/j/W3Dkf4P1ad0e7.iS',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'test_caja_alfonso.jpg'
), (
'Jesús',
'Navarro Moreno',
'M',
NULL,
'jnavarro@ujaen.es',
'+34953211912',
'es-es',
'$2a$04$8O3Jd5j9/nM/KC.b1a8qRevyUwWUx6XGU3Gm754Y/8PpLO2jv.i76',
true,
(SELECT id from office where email='dofer@ujaen.es'),
'defaultAvatar.jpg'
);
--
-- Tutores CAJA
-- Tutores
--
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES
('Don Fernando', 'Padre Fernandito', 'M','C/ Mayor, 13. Jaén', 'ES', 'donfernando@gmail.com', '+34 232 232 232', 'es-es', '$2a$04$DMOX/cZ4h6cNJW9VlCou7O266q4YDYuS6p0QzP.gBHd08.QnFQWD.', true);
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES
('Don Arturo', 'Padre Arturito', 'M','Avda. Andalucía 1. Jaén','ES', 'donarturo@gmail.com', NULL, 'es-es', '$2a$04$V2ods9MMmOFvdLTaHJqk3ejKEYdf28gvfDhaBkOSLCFJOC02TweFK', true);
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES
('Don Miguel', 'Padre Miguelito', 'F', 'C/ Calatrava, 13. Córdoba', 'ES', 'donmiguel@gmail.com', NULL, 'es-es', '$2a$04$1UCak614LKz6WpDBtOblQeqFF41tOMy6ERMnP2OuGVZffe8Yi0mJq', true);
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES
('Don Afonso', 'Padre Alfonsito', 'M','Avda. Andalucía 1. Jaén','ES', 'donalfonso@gmail.com', NULL, 'es-es', '$2a$04$$2a$04$KktXwe06AJg3vMUEX1E1/esbP.g8f79mtcNGjCsrEDWktmegcML4q', true);
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES
('Doña Alfonsa', 'Madre Alfonsita', 'F', 'C/ Calatrava, 13. Córdoba', 'ES', 'doñaalfonsa@gmail.com', NULL, 'es-es', '$2a$04$ALDmQ1oRhRZKUEi1b0eK1ehQmSZiFkhzx48ZBwER0J4vakvlYc5VS', true);
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES
('Don Jesús', 'Padre Jesusito', 'M','Avda. Andalucía 1. Jaén','ES', 'donjesus@gmail.com', NULL, 'es-es', '$2a$04$Psuu6IMPUj1sbzR.uxq3EOgX1/4dFNmccjkv76LhKp35JzpiCE.fm', true);
INSERT INTO `supervisor` (
`name`,
`surname`,
`gender`,
`address`,
`country`,
`email`,
`phone`,
`lang`,
`password`,
`active`
) VALUES (
'Don Fernando',
'Padre Fernandito',
'M',
'C/ Mayor, 13. Jaén',
'ES',
'donfernando@gmail.com',
'+34 232 232 232',
'es-es',
'$2a$04$DMOX/cZ4h6cNJW9VlCou7O266q4YDYuS6p0QzP.gBHd08.QnFQWD.',
true
), (
'Don Arturo',
'Padre Arturito',
'M',
'Avda. Andalucía 1. Jaén',
'ES',
'donarturo@gmail.com',
NULL,
'es-es',
'$2a$04$V2ods9MMmOFvdLTaHJqk3ejKEYdf28gvfDhaBkOSLCFJOC02TweFK',
true
), (
'Don Miguel',
'Padre Miguelito',
'F',
'C/ Calatrava, 13. Córdoba',
'ES',
'donmiguel@gmail.com',
NULL,
'es-es',
'$2a$04$1UCak614LKz6WpDBtOblQeqFF41tOMy6ERMnP2OuGVZffe8Yi0mJq',
true
), (
'Don Afonso',
'Padre Alfonsito',
'M',
'Avda. Andalucía 1. Jaén',
'ES',
'donalfonso@gmail.com',
NULL,
'es-es',
'$2a$04$$2a$04$KktXwe06AJg3vMUEX1E1/esbP.g8f79mtcNGjCsrEDWktmegcML4q',
true
), (
'Doña Alfonsa',
'Madre Alfonsita',
'F',
'C/ Calatrava, 13. Córdoba',
'ES',
'doñaalfonsa@gmail.com',
NULL,
'es-es',
'$2a$04$ALDmQ1oRhRZKUEi1b0eK1ehQmSZiFkhzx48ZBwER0J4vakvlYc5VS',
true
), (
'Don Jesús',
'Padre Jesusito',
'M',
'Avda. Andalucía 1. Jaén',
'ES',
'donjesus@gmail.com',
NULL,
'es-es',
'$2a$04$Psuu6IMPUj1sbzR.uxq3EOgX1/4dFNmccjkv76LhKp35JzpiCE.fm',
true
);
--
-- Actualización de `office` con el id del supervisor admin
--
UPDATE office SET admin=(SELECT id FROM supervisor where name='Fernando' and surname='Martínez Santiago') WHERE name='Comunicación Aumentativa JAén (CAJA)';
--
-- Supervisores de CAJA
--
UPDATE supervisor SET pic='/upload/supervisors/dofer.jpg' WHERE name='Fernando' and surname='Martínez Santiago';
UPDATE supervisor SET pic='http://wwwdi.ujaen.es/sites/default/files/foto1.jpg?1403259981' WHERE name='Arturo' and surname='Montejo Raéz';
UPDATE supervisor SET pic='http://wwwdi.ujaen.es/sites/default/files/magc_0.jpg?1244537764' WHERE name='Miguel Ángel' and surname='García Cumbreras';
UPDATE supervisor SET pic='http://wwwdi.ujaen.es/sites/default/files/foto_informal.jpg?1403609246' WHERE name='Alfonso' and surname='Ureña López';
UPDATE supervisor SET pic='http://wwwdi.ujaen.es/sites/default/files/magc_0.jpg?1244537764' WHERE name='Jesús' and surname='Navarro Moreno';
UPDATE office
SET admin=(SELECT id FROM supervisor where email='dofer@ujaen.es')
WHERE email='dofer@ujaen.es';
--
-- CAJA Students
--
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('faf0001', '$2a$10$oy98CXG9YWbjATOESXelDu8HVjDHFPVpX5kmfdQSbkNC965Z2zPkC', 'Fernandito', 'Alumno Fernando','2009-12-10','M','ES','/upload/students/juan.jpg',NULL,'es-es', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }]}')
;
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('faf0002', '$2a$10$FOJ2fmJaHyI5sWe1tQojFuhoPpqHSTVPwvHPTpWEftFPI28VdyYNq', 'Fernandita', 'Alumna Fernando','2009-12-10','F','GB','/upload/students/kate.jpg',NULL,'en-gb', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}')
;
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('mam0001', '$2a$10$zygC/WviDviyZQsMsNqK8.tSUI4Qr/dLlLrw0i5kR1bbN4SeU5ACq', 'Miguelín', 'Alumno Miguel','2009-12-10','M','ES','/upload/students/carlos.jpg',NULL,'es-es', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }]}')
;
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('mam0002', '$2a$10$xbyNUhf9rqhdXDBrvUSiOuJIzUVOyyz9ToQMCByFThiiiPwO0PWgK', 'Miguelita', 'Alumna Miguel','2009-12-10','F','ES','/upload/students/rocio.jpg',NULL,'es-es', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}')
;
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('aaa0001', '$2a$10$koWKIn42UNSi1N67akxjpOuJNwpXJ/vOe6biD2xkjrUz6dr3g.Wa.', 'Arturito', 'Alumno Arturo','2009-12-10','M','ES','/upload/students/samuel.jpg',NULL,'es-es', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }]}')
;
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('aaa0002', '$2a$10$ffAjZjWN0UKja0JO7ko6qup4x2phbY3VpC66TmpMnGdWUutBFeWY2', 'Arturita', 'Alumna Arturo','2009-12-10','F','ES','/upload/students/adela.jpg',NULL,'es-es', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}')
;
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('aaa0003', '$2a$10$glc5A6vyPve5.4407Vdkau5CHF3GOpA0Uo6rxMDdIopIWTJK0nBse', 'Alfonsita', 'Alumna Alfonso','2009-12-10','F','ES','/upload/students/adela.jpg',NULL,'es-es', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}')
;
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('aaa0004', '$2a$10$tezK07jq5ZMdQbCboubEBeHiXWJisZPAbgN301n5kRLXkq8xOlb4O', 'Alfonsito', 'Alumno Alfonso','2009-12-10','M','ES','/upload/students/juan.jpg',NULL,'es-es', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}')
;
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('jaj0001', '$2a$10$UQYGXOOE8mxxOjvgo8cjwOpsv5jCtRXpMTLpbD3TzMBiUIv3hXlnO', 'Jesusita', 'Alumna Jesús','2009-12-10','F','ES','/upload/students/adela.jpg',NULL,'es-es', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}')
;
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES
('jaj0002', '$2a$10$tVy3Wfu35l4B6bFpnjJCE.ckjncq6YCKMGW4B9abesbiFVeyGu2Dy', 'Jesusito', 'Alumno Jesús','2009-12-10','M','ES','/upload/students/samuel.jpg',NULL,'es-es', '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}')
;
INSERT INTO `student` (
`username`,
`password`,
`name`,
`surname`,
`birthdate`,
`gender`,
`country`,
`pic`,
`notes`,
`lang`,
`attributes`
) VALUES (
'faf0001',
'$2a$10$oy98CXG9YWbjATOESXelDu8HVjDHFPVpX5kmfdQSbkNC965Z2zPkC',
'Fernandito',
'Alumno Fernando',
'2009-12-10',
'M',
'ES',
'test_caja_juan.jpg',
NULL,
'es-es',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }]}'
), (
'faf0002',
'$2a$10$FOJ2fmJaHyI5sWe1tQojFuhoPpqHSTVPwvHPTpWEftFPI28VdyYNq',
'Fernandita',
'Alumna Fernando',
'2009-12-10',
'F',
'GB',
'test_caja_kate.jpg',
NULL,
'en-gb',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}'
), (
'mam0001',
'$2a$10$zygC/WviDviyZQsMsNqK8.tSUI4Qr/dLlLrw0i5kR1bbN4SeU5ACq',
'Miguelín',
'Alumno Miguel',
'2009-12-10',
'M',
'ES',
'test_caja_carlos.jpg',
NULL,
'es-es',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }]}'
), (
'mam0002',
'$2a$10$xbyNUhf9rqhdXDBrvUSiOuJIzUVOyyz9ToQMCByFThiiiPwO0PWgK',
'Miguelita',
'Alumna Miguel',
'2009-12-10',
'F',
'ES',
'test_caja_rocio.jpg',
NULL,
'es-es',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}'
), (
'aaa0001',
'$2a$10$koWKIn42UNSi1N67akxjpOuJNwpXJ/vOe6biD2xkjrUz6dr3g.Wa.',
'Arturito',
'Alumno Arturo',
'2009-12-10',
'M',
'ES',
'test_caja_samuel.jpg',
NULL,
'es-es',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }]}'
), (
'aaa0002',
'$2a$10$ffAjZjWN0UKja0JO7ko6qup4x2phbY3VpC66TmpMnGdWUutBFeWY2',
'Arturita',
'Alumna Arturo',
'2009-12-10',
'F',
'ES',
'test_caja_adela.jpg',
NULL,
'es-es',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}'
), (
'aaa0003',
'$2a$10$glc5A6vyPve5.4407Vdkau5CHF3GOpA0Uo6rxMDdIopIWTJK0nBse',
'Alfonsita',
'Alumna Alfonso',
'2009-12-10',
'F',
'ES',
'test_caja_adela.jpg',
NULL,
'es-es',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}'
), (
'aaa0004',
'$2a$10$tezK07jq5ZMdQbCboubEBeHiXWJisZPAbgN301n5kRLXkq8xOlb4O',
'Alfonsito',
'Alumno Alfonso',
'2009-12-10',
'M',
'ES',
'test_caja_juan.jpg',
NULL,
'es-es',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}'
), (
'jaj0001',
'$2a$10$UQYGXOOE8mxxOjvgo8cjwOpsv5jCtRXpMTLpbD3TzMBiUIv3hXlnO',
'Jesusita',
'Alumna Jesús',
'2009-12-10',
'F',
'ES',
'test_caja_adela.jpg',
NULL,
'es-es',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}'
), (
'jaj0002',
'$2a$10$tVy3Wfu35l4B6bFpnjJCE.ckjncq6YCKMGW4B9abesbiFVeyGu2Dy',
'Jesusito',
'Alumno Jesús',
'2009-12-10',
'M',
'ES',
'test_caja_samuel.jpg',
NULL,
'es-es',
'{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }]}'
);
--
-- CAJA student-supervisor
--
INSERT INTO `stu_sup`(id_stu,id_sup) SELECT DISTINCT A.id, B.id FROM student A, supervisor B WHERE A.name='Fernandito' and B.name='Fernando';
INSERT INTO `stu_sup`(id_stu,id_sup) SELECT DISTINCT A.id, B.id FROM student A, supervisor B WHERE A.name='Fernandita' and B.name='Fernando';
INSERT INTO `stu_sup`(id_stu,id_sup) SELECT DISTINCT A.id, B.id FROM student A, supervisor B WHERE A.name='Arturito' and B.name='Fernando';
......@@ -140,10 +357,10 @@ INSERT INTO `stu_sup`(id_stu,id_sup) SELECT DISTINCT A.id, B.id FROM student A,
INSERT INTO `stu_sup`(id_stu,id_sup) SELECT DISTINCT A.id, B.id FROM student A, supervisor B WHERE A.name='Alfonsito' and B.name='Don Alfonso';
INSERT INTO `stu_sup`(id_stu,id_sup) SELECT DISTINCT A.id, B.id FROM student A, supervisor B WHERE A.name='Alfonsita' and B.name='Doña Alfonsa';
--
-- Student's CAJA offices
--
UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='Fernando') WHERE student.name='Fernandito';
UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='Miguel Ángel') WHERE student.name='Miguelín';
UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='Arturo') WHERE student.name='Arturito';
......@@ -155,13 +372,12 @@ UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='
UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='Jesús') WHERE student.name='Jesusito';
UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='Jesús') WHERE student.name='Jesusita';
select a.name,b.attributes,text from student a, stu_picto b, picto c, picto_exp d where a.id=b.id_stu and b.id_pic=c.id and c.id=d.id_pic and a.id=23 and a.lang=d.lang;
--
-- CAJA Core vocabulary
--
INSERT INTO stu_picto(id_stu,id_pic,attributes)
SELECT S.id,P.id_pic, concat('{"id_cat":', if (id_cat_pic is null, 'null',id_cat_pic),
',"coord_x":',coord_x,
......@@ -173,4 +389,24 @@ SELECT S.id,P.id_pic, concat('{"id_cat":', if (id_cat_pic is null, 'null',id_cat
FROM student S, picto_core_cat P
WHERE S.id_off =(SELECT id from office where name='Comunicación Aumentativa JAén (CAJA)');
--
-- Test method
--
INSERT INTO meta_method(name) VALUES (
'Test MetaMethod'
);
INSERT INTO method(name, id_stu) VALUES (
'Test Method',
(SELECT id FROM student WHERE username='aaa0002')
);
INSERT INTO instruction(name, id_met) VALUES (
'Test Instruction',
(SELECT id FROM method WHERE name='Test Method')
);
INSERT INTO working_session (id_sup, id_ins) VALUES (
(SELECT id FROM supervisor WHERE email='dofer@ujaen.es'),
(SELECT id FROM instruction WHERE name='Test Instruction')
);
SET foreign_key_checks=1;
......@@ -255,6 +255,11 @@ module.exports = {
return res.json(500, {
error: "No student found"
});
if (!req.body.password) {
delete req.body.password;
}
// copy attributes
for (k in req.body) stu[k] = req.body[k];
stu.save(function (stuSaveError, saved) {
......
......@@ -16,7 +16,10 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
// For tab navigation (here too, if the user refresh the page...)
$scope.nav.tab = 'setup';
// When a picture is selected, launch the request
/**
* Updates the student picture
* @param {Angular file array} $files Image to be uploaded
*/
$scope.onFileSelect = function ($files) {
var i;
var file;
......@@ -57,46 +60,58 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
}
};
// Open calendar
$scope.open_calendar = function ($event) {
$event.preventDefault();
$event.stopPropagation();
/**
* Opens the calendar for selecting student's birthdate.
* Prevents the propagation of the click event.
* @param {event} Click event
*/
$scope.openCalendar = function (event) {
event.stopPropagation();
$scope.opened = true;
};
// Save personal info updated
$scope.update_student = function () {
// Validate password match
if ($scope.formUser.password_confirm &&
!$scope.formUser.password_confirm.length &&
$scope.formUser.password !== $scope.formUser.password_confirm) {
/**
* Sends the student new information to the server.
* If any password has been entered in the form, both password and password_confirm must match,
* otherwise the password field is ignored.
*/
$scope.updateStudent = function () {
var password;
if ($scope.formUser.password_confirm || $scope.formUser.password) {
if ($scope.formUser.password_confirm === $scope.formUser.password) {
password = $scope.formUser.password;
} else {
$translate('password_match').then(function (translation) {
ngToast.danger({ content: translation });
});
return;
}
// password not changed (don't send it to DB)
if ($scope.formUser.password_confirm &&
!$scope.formUser.password_confirm.length) {
delete $scope.formUser.password;
delete $scope.formUser.password_confirm;
}
$http.put(config.backend + '/stu/' + $scope.studentData.id, $scope.formUser)
$http.put(config.backend + '/stu/' + $scope.studentData.id, {
birthdate: $scope.formUser.birthdate,
country: $scope.formUser.country,
gender: $scope.formUser.gender,
lang: $scope.formUser.lang,
name: $scope.formUser.name,
notes: $scope.formUser.notes,
surname: $scope.formUser.surname,
username: $scope.formUser.username,
password: password
})
.success(function (data) {
$translate('student_updated').then(function (translation) {
ngToast.success({ content: translation });
});
$scope.studentData.surname = data.surname;
$scope.studentData.birthdate = data.birthdate;
$scope.studentData.country = data.country;
$scope.studentData.pic = data.pic;
$scope.studentData.gender = data.gender;
$scope.studentData.lang = data.lang;
$scope.studentData.notes = data.notes;
$scope.formUser.birthdate = data.birthdate;
$scope.formUser.country = data.country;
$scope.formUser.gender = data.gender;
$scope.formUser.lang = data.lang;
$scope.formUser.name = data.name;
$scope.formUser.notes = data.notes;
$scope.formUser.surname = data.surname;
$scope.formUser.username = data.username;
})
.error(function () {
$translate.danger('student_not_updated', function (translation) {
......@@ -105,13 +120,16 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
});
};
// Search supervisor by email
$scope.search_sup = function () {
/**
* Get a supervisor by their email and updates the $scope.supToAdd element.
* The email used for search is fetched from $scope.email_sup.
*/
$scope.getSupervisorByEmail = function () {
// Find tutor by email
$http.get(config.backend + '/sup/email/' + $scope.email_sup)
.success(function (data) {
if (data.length > 0) {
$scope.supToAdd = data[0];
if (data) {
$scope.supToAdd = data;
$scope.showmessagesupfound = true;
$scope.showmessagesupnotfound = false;
} else {
......@@ -188,8 +206,8 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
$http.get(config.backend + '/sup/email/' + $scope.email_tutor)
.success(function (data) {
// If it found the length is > 0
if (data.length > 0) {
$scope.tutorToAdd = data[0];
if (data) {
$scope.tutorToAdd = data;
// Show message for validate
$scope.showmessagetutorfound = true;
$scope.showmessagetutornotfound = false;
......
<div class="panel panel-default student_tab_panel">
<div class="panel panel-default student_tab_panel">
<div class="panel-body">
<div class="row">
<!-- Parte izquierda: Datos personales -->
<div class="col-md-6">
<div id="student_personal_edit">
<form role="form" ng-submit="update_student()">
<form role="form" ng-submit="updateStudent()">
<!-- Cambiar imagen de perfil -->
<div class="form-group">
<h4><span class="glyphicon glyphicon-picture" aria-hidden="true"></span> {{ 'change_picture' | translate }}: </h4>
......@@ -18,53 +16,43 @@
<img class="thumbnail preview" ng-src="{{studentData.pic}}" />
<!-- Fin Cambiar imagen de perfil -->
<!-- Datos personales del alumno -->
<fieldset>
<legend translate>account</legend>
<div class="form-group">
<input type="username" class="form-control" id="setup_username" placeholder="{{ 'username' | translate }}" required ng-model="formUser.username" readonly/>
</div>
<div class="form-group">
<input type="password" class="form-control" id="setup_password1" placeholder="{{ 'password_new_type' | translate }}" ng-model="formUser.password" />
</div>
<div class="form-group">
<input type="password" class="form-control" id="setup_password2" placeholder="{{ 'password_confirm' | translate }}" ng-model="formUser.password_confirm" />
</div>
<legend translate>personal_data</legend>
<div class="form-group">
<input type="text" class="form-control" id="student_personal_edit_name" placeholder="{{ 'name' | translate }}" ng-model="formUser.name" required />
</div>
<div class="form-group">
<input type="text" class="form-control" id="student_personal_edit_surname" placeholder="{{ 'surname' | translate }}" ng-model="formUser.surname" required />
</div>
<div class="form-group">
<p class="input-group">
<input type="text" class="form-control" datepicker-popup=" {{ 'day_format' | translate }}" ng-model="formUser.birthdate" placeholder="{{ 'birthdate' | translate }}" is-open="opened" close-text="{{'close' | translate}}" required />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open_calendar($event)"><i class="glyphicon glyphicon-calendar"></i></button>
<button type="button" class="btn btn-default" ng-click="openCalendar($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
</div>
<div class="form-group">
<select class="form-control" name="student_gender" id="student_gender" ng-model="formUser.gender" required>
<option value="F" selected translate>woman</option>
<option value="M" translate>man</option>
</select>
</div>
<div class="form-group">
<input type="text" class="form-control" id="student_country" placeholder="{{ 'country' | translate }}" ng-model="formUser.country" />
</div>
</fieldset>
<!-- Fin de datos personales del alumno -->
<fieldset>
<legend translate>notes</legend>
<div class="form-group">
......@@ -92,13 +80,12 @@
<!-- Parte derecha: Tutores y dispositivos -->
<div class="col-md-6">
<!-- Supervisores (terapeutas) del alumno -->
<div id="student_sups">
<h4 translate>supervisors</h4>
<!-- Buscador de supervisores -->
<p>
<form role="search" ng-submit="search_sup()">
<form role="search" ng-submit="getSupervisorByEmail()">
<div class="input-group">
<input type="email" class="form-control" placeholder="{{ 'search_sup_email' | translate }}" name="email_sup" id="email_sup" ng-model="email_sup" required>
<div class="input-group-btn">
......@@ -153,7 +140,8 @@
<!-- Alert and success messages for tutor found -->
<div ng-show="{{ 'showmessagetutorfound' }}" class="alert alert-info">
<!-- Imagen de perfil del tutor -->
<img ng-src="{{tutorToAdd.pic}}" class="profile" alt="" title="" /> {{ tutorToAdd.name }} {{ tutorToAdd.surname }}
<img ng-src="{{tutorToAdd.pic}}" class="profile" alt="" title="" />
{{ tutorToAdd.name }} {{ tutorToAdd.surname }}
<a class="btn btn-default btn-sm pull-right" role="button" ng-click="add_tutor()" translate>add</a>
</div>
<!-- Fin de buscador de tutores -->
......@@ -194,7 +182,6 @@
<div class="col-md-6">
<fieldset>
<legend translate>pictograms</legend>
<div class="input-group">
<label>{{ 'background' | translate }}:
<input id="picto_background" type="color" ng-model="studentData.attributes.picto_background" ng-mouseleave="update_attributes()" />
......@@ -205,9 +192,6 @@
<div class="btn-group">
<label class="btn btn-default" ng-model="studentData.attributes.pictogram_size" btn-radio="'normal'" ng-change="update_attributes()">{{ 'normal' | translate }}</label>
<label class="btn btn-default" ng-model="studentData.attributes.pictogram_size" btn-radio="'large'"ng-change="update_attributes()">{{ 'large' | translate }}</label>
<!--
<label class="btn btn-default" ng-model="studentData.attributes.pictogram_size" btn-radio="'enormous'" ng-change="update_attributes()">{{ 'enormous' | translate }}</label>
-->
</div>
<h4>{{ 'legend' | translate }}:</h4>
......@@ -220,27 +204,6 @@
{{ 'legend_size' | translate }}: {{ studentData.attributes.legendsize }}%
<input type="range" min="10" max="90" step="10" ng-model="studentData.attributes.legendsize" ng-change="update_attributes()">
</div>
<!--
<h4>{{ 'animation' | translate }}:</h4>
<div class="btn-group">
<label class="btn btn-default" ng-model="studentData.attributes.animation" btn-radio="'yes'" ng-change="update_attributes()">{{ 'yes' | translate }}</label>
<label class="btn btn-default" ng-model="studentData.attributes.animation" btn-radio="'no'" ng-change="update_attributes()">{{ 'no' | translate }}</label>
</div>
<h4>{{ 'categories' | translate }}:</h4>
<div class="btn-group">
<label class="btn btn-default" ng-model="studentData.attributes.categories" btn-radio="'on'" ng-change="update_attributes()">{{ 'show' | translate }}</label>
<label class="btn btn-default" ng-model="studentData.attributes.categories" btn-radio="'off'" ng-change="update_attributes()">{{ 'hide' | translate }}</label>
</div>
<h4>{{ 'picto_behavior' | translate }}:</h4>
<div class="btn-group">
<label class="btn btn-default" ng-model="studentData.attributes.picto_select" btn-radio="'enlarge'" ng-change="update_attributes()">{{ 'enlarge' | translate }}</label>
<label class="btn btn-default" ng-model="studentData.attributes.picto_select" btn-radio="'mark'" ng-change="update_attributes()">{{ 'mark' | translate }}</label>
</div>
-->
</fieldset>
</div>
......@@ -248,7 +211,6 @@
<!-- Colocación en cinta de frase -->
<fieldset>
<legend translate>phrase_tape</legend>
<div class="input-group">
<label>{{ 'background' | translate }}:
<input id="phrase_background" type="color" ng-model="studentData.attributes.phrase_background" ng-mouseleave="update_attributes()" />
......@@ -258,10 +220,6 @@
<h4>{{ 'place_pictos' | translate }}:</h4>
<div class="btn-group">
<label class="btn btn-success" ng-model="studentData.attributes.input_selection" btn-radio="'click'" ng-change="update_attributes()">{{ 'click' | translate }}</label>
<!--
<label class="btn btn-success" ng-model="studentData.attributes.input_selection" btn-radio="'double click'" ng-change="update_attributes()">{{ 'double_click' | translate }}</label>
<label class="btn btn-success" ng-model="studentData.attributes.input_selection" btn-radio="'press'" ng-change="update_attributes()">{{ 'press' | translate }}</label>
-->
<label class="btn btn-success" ng-model="studentData.attributes.input_selection" btn-radio="'drag'" ng-change="update_attributes()">{{ 'drag' | translate }}</label>
</div>
......@@ -272,40 +230,24 @@
<label class="btn btn-success" ng-model="studentData.attributes.input_feedback.read" btn-checkbox ng-change="update_attributes()">{{ 'read_picto' | translate }}</label>
<label class="btn btn-success" ng-model="studentData.attributes.input_feedback.highlight" btn-checkbox ng-change="update_attributes()">{{ 'highlight' | translate }}</label>
</div>
</fieldset>
<!-- Ajustes de voz -->
<fieldset>
<legend translate>sound_setup</legend>
<h4>{{ 'enable_sound_for' | translate }}:</h4>
<div class="btn-group">
<!--
<label class="btn btn-primary" ng-model="studentData.attributes.tts_options.picto" btn-checkbox ng-change="update_attributes()">{{ 'pictogram' | translate }}</label>
-->
<label class="btn btn-primary" ng-model="studentData.attributes.tts_options.phrase" btn-checkbox ng-change="update_attributes()">{{ 'phrase' | translate }}</label>
</div>
<!--
<h4>{{ 'voice' | translate }}:</h4>
<div class="btn-group">
<label class="btn btn-primary" ng-model="studentData.attributes.tts_voice" btn-radio="'child'" ng-change="update_attributes()">{{ 'child' | translate }}</label>
<label class="btn btn-primary" ng-model="studentData.attributes.tts_voice" btn-radio="'man'" ng-change="update_attributes()">{{ 'man' | translate }}</label>
<label class="btn btn-primary" ng-model="studentData.attributes.tts_voice" btn-radio="'woman'" ng-change="update_attributes()">{{ 'woman' | translate }}</label>
</div>
-->
</fieldset>
</div>
<!-- Fin de col -->
</div>
<!-- Fin de row -->
</form>
</div>
<!-- Fin de Configuración de los dispositivos -->
</div>
<!-- Fin de panel body -->
</div>
<!-- Fin de panel -->
</div>
<!-- Fin de panel -->
......@@ -31,8 +31,7 @@
"winston": "~1.0.0"
},
"scripts": {
"start": "node app.js",
"debug": "node debug app.js",
"start": "forever start app.js",
"test": "mocha test/test-helper.js test/**/*-spec.js",
"test:watch": "npm run test -- --reporter min --watch"
},
......@@ -41,7 +40,7 @@
"type": "git",
"url": "http://scm.ujaen.es/softuno/pictogram.git"
},
"author": "emblanco, amontejo",
"author": "Yottacode",
"license": "",
"devDependencies": {
"chai": "^3.5.0",
......
describe('Action API', function () {
it('POST /action', function (done) {
studentAgent.post('/action').send({
student: studentAgent.data.id,
type: 'Add',
supervisor: supervisorAgent.data.id,
description: '{ json description }'
})
.expect(200)
.expect((response) => {
assert.isObject(response.body);
assert.isNumber(response.body.id);
delete response.body.id;
})
.expect({
student: studentAgent.data.id,
type: 'Add',
supervisor: supervisorAgent.data.id,
description: '{ json description }',
})
.end(done);
});
it('POST /action');
it('POST /actions');
});
......@@ -5,7 +5,7 @@ describe('Student API', function () {
delete studentAgentData.iat;
delete studentAgentData.isStudent;
delete studentAgentData.password;
studentAgentData.current_method = 'Test method';
studentAgentData.current_method = 'Test Method';
studentAgentData.current_instruction = 'Test Instruction';
supervisorAgent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment