Commit e345e84a by Pablo Molina

Fixed #409, pérdida de contraseña al actualizar estudiante

Se ha añadido una comprobación tanto en el cliente como en el servidor para comprobar si el valor introducido como contraseña tiene un valor verdadero (no vacío).

Además se han corregido los tests asociados a este error y se han actualizado los datos de ejemplo de la base de datos CAJA.
parent 25d6599b
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
echo "-- Running pictogram server" echo "-- Running pictogram server"
if [ -e "src/app.js" ]; then if [ -e "src/app.js" ]; then
cd src && forever start app.js cd src && npm start
elif [ -e "/vagrant/src/app.js" ]; then 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 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 else
echo "-- app.js not found, cannot run pictogram server" echo "-- app.js not found, cannot run pictogram server"
exit exit
......
...@@ -388,7 +388,7 @@ CREATE TABLE IF NOT EXISTS `supervisor` ( ...@@ -388,7 +388,7 @@ CREATE TABLE IF NOT EXISTS `supervisor` (
`name` varchar(40) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`surname` varchar(60) COLLATE utf8_unicode_ci NOT NULL, `surname` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`gender` char(1) 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, `address` varchar(180) COLLATE utf8_unicode_ci DEFAULT NULL,
`country` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, `country` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(80) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
......
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00"; SET time_zone = "+00:00";
-- SET foreign_key_checks = 0;
-- Datos de prueba `pictodb`
--
SET foreign_key_checks=0;
-- --
-- Vaciado de tablas (opcional, se puede comentar) -- Oficina
-- --
-- TRUNCATE supervisor; INSERT INTO `office` (
-- TRUNCATE student; `name`,
-- TRUNCATE stu_sup; `address`,
-- TRUNCATE office; `country`,
-- TRUNCATE stu_picto; `contact_person`,
`email`,
-- `phone1`,
-- Volcado de datos para la tabla `office` `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'
);
-- --
-- Alta de gabinete CAJA -- Supervisores
-- --
INSERT INTO `office` (`name`, `address`, `country`, `contact_person`, `email`, `phone1`, `lang`) VALUES
('Comunicación Aumentativa JAén (CAJA)', INSERT INTO `supervisor` (
'Paraje Las Lagunillas, Ed A3, primera plata, 23071. Jaén', `name`,
'ES', `surname`,
'Fernando Martínez Santiago', `gender`,
'dofer@ujaen.es', `address`,
'+34 953 21 28 88', `email`,
'es-es') `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'
);
-- --
-- Alta de gabinete CAJA -- Tutores
-- --
-- CAJA INSERT INTO `supervisor` (
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`) `name`,
(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)'); `surname`,
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`) `gender`,
(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)'); `address`,
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`) `country`,
(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)'); `email`,
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`) `phone`,
(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)'); `lang`,
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `email`, `phone`, `lang`, `password`, `active`, `id_off`) `password`,
(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)'); `active`
) VALUES (
-- 'Don Fernando',
-- Tutores CAJA 'Padre Fernandito',
-- 'M',
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES 'C/ Mayor, 13. Jaén',
('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); 'ES',
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES 'donfernando@gmail.com',
('Don Arturo', 'Padre Arturito', 'M','Avda. Andalucía 1. Jaén','ES', 'donarturo@gmail.com', NULL, 'es-es', '$2a$04$V2ods9MMmOFvdLTaHJqk3ejKEYdf28gvfDhaBkOSLCFJOC02TweFK', true); '+34 232 232 232',
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES 'es-es',
('Don Miguel', 'Padre Miguelito', 'F', 'C/ Calatrava, 13. Córdoba', 'ES', 'donmiguel@gmail.com', NULL, 'es-es', '$2a$04$1UCak614LKz6WpDBtOblQeqFF41tOMy6ERMnP2OuGVZffe8Yi0mJq', true); '$2a$04$DMOX/cZ4h6cNJW9VlCou7O266q4YDYuS6p0QzP.gBHd08.QnFQWD.',
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES 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); ), (
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES 'Don Arturo',
('Doña Alfonsa', 'Madre Alfonsita', 'F', 'C/ Calatrava, 13. Córdoba', 'ES', 'doñaalfonsa@gmail.com', NULL, 'es-es', '$2a$04$ALDmQ1oRhRZKUEi1b0eK1ehQmSZiFkhzx48ZBwER0J4vakvlYc5VS', true); 'Padre Arturito',
INSERT INTO `supervisor` (`name`, `surname`, `gender`, `address`, `country`, `email`, `phone`, `lang`, `password`, `active`) VALUES 'M',
('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); 'Avda. Andalucía 1. Jaén',
'ES',
'donarturo@gmail.com',
-- NULL,
-- Actualización de `office` con el id del supervisor admin 'es-es',
-- '$2a$04$V2ods9MMmOFvdLTaHJqk3ejKEYdf28gvfDhaBkOSLCFJOC02TweFK',
UPDATE office SET admin=(SELECT id FROM supervisor where name='Fernando' and surname='Martínez Santiago') WHERE name='Comunicación Aumentativa JAén (CAJA)'; 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
);
-- --
-- Supervisores de CAJA -- Actualización de `office` con el id del supervisor admin
-- --
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 office
UPDATE supervisor SET pic='http://wwwdi.ujaen.es/sites/default/files/magc_0.jpg?1244537764' WHERE name='Miguel Ángel' and surname='García Cumbreras'; SET admin=(SELECT id FROM supervisor where email='dofer@ujaen.es')
UPDATE supervisor SET pic='http://wwwdi.ujaen.es/sites/default/files/foto_informal.jpg?1403609246' WHERE name='Alfonso' and surname='Ureña López'; WHERE email='dofer@ujaen.es';
UPDATE supervisor SET pic='http://wwwdi.ujaen.es/sites/default/files/magc_0.jpg?1244537764' WHERE name='Jesús' and surname='Navarro Moreno';
-- --
-- CAJA Students -- 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`,
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES `password`,
('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" }]}') `name`,
; `surname`,
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES `birthdate`,
('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" }]}') `gender`,
; `country`,
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES `pic`,
('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" }]}') `notes`,
; `lang`,
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES `attributes`
('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" }]}') ) VALUES (
; 'faf0001',
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES '$2a$10$oy98CXG9YWbjATOESXelDu8HVjDHFPVpX5kmfdQSbkNC965Z2zPkC',
('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" }]}') 'Fernandito',
; 'Alumno Fernando',
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES '2009-12-10',
('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" }]}') 'M',
; 'ES',
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES 'test_caja_juan.jpg',
('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" }]}') NULL,
; 'es-es',
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES '{"stu-att" : [{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }]}'
('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" }]}') ), (
; 'faf0002',
INSERT INTO `student` (`username`, `password`, `name`, `surname`, `birthdate`, `gender`, `country`, `pic`, `notes`, `lang`, `attributes`) VALUES '$2a$10$FOJ2fmJaHyI5sWe1tQojFuhoPpqHSTVPwvHPTpWEftFPI28VdyYNq',
('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" }]}') '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 -- 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='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='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'; 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, ...@@ -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='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'; 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 -- 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='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='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'; UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='Arturo') WHERE student.name='Arturito';
...@@ -155,22 +372,41 @@ UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name=' ...@@ -155,22 +372,41 @@ 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='Jesusito';
UPDATE student SET id_off=(SELECT id_off FROM supervisor WHERE supervisor.name='Jesús') WHERE student.name='Jesusita'; 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; 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 -- CAJA Core vocabulary
-- --
INSERT INTO stu_picto(id_stu,id_pic,attributes)
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), SELECT S.id,P.id_pic, concat('{"id_cat":', if (id_cat_pic is null, 'null',id_cat_pic),
',"coord_x":',coord_x, ',"coord_x":',coord_x,
',"coord_y":',coord_y, ',"coord_y":',coord_y,
',"status":"invisible"', ',"status":"invisible"',
',"highlight":false', ',"highlight":false',
',"color":', if (color is null, 'null',concat('"',color,'"')), ',"color":', if (color is null, 'null',concat('"',color,'"')),
'}') as attributes '}') as attributes
FROM student S, picto_core_cat P FROM student S, picto_core_cat P
WHERE S.id_off =(SELECT id from office where name='Comunicación Aumentativa JAén (CAJA)'); 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; SET foreign_key_checks=1;
...@@ -255,6 +255,11 @@ module.exports = { ...@@ -255,6 +255,11 @@ module.exports = {
return res.json(500, { return res.json(500, {
error: "No student found" error: "No student found"
}); });
if (!req.body.password) {
delete req.body.password;
}
// copy attributes // copy attributes
for (k in req.body) stu[k] = req.body[k]; for (k in req.body) stu[k] = req.body[k];
stu.save(function (stuSaveError, saved) { stu.save(function (stuSaveError, saved) {
......
...@@ -16,7 +16,10 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl( ...@@ -16,7 +16,10 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
// For tab navigation (here too, if the user refresh the page...) // For tab navigation (here too, if the user refresh the page...)
$scope.nav.tab = 'setup'; $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) { $scope.onFileSelect = function ($files) {
var i; var i;
var file; var file;
...@@ -57,46 +60,58 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl( ...@@ -57,46 +60,58 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
} }
}; };
// Open calendar /**
$scope.open_calendar = function ($event) { * Opens the calendar for selecting student's birthdate.
$event.preventDefault(); * Prevents the propagation of the click event.
$event.stopPropagation(); * @param {event} Click event
*/
$scope.openCalendar = function (event) {
event.stopPropagation();
$scope.opened = true; $scope.opened = true;
}; };
// Save personal info updated /**
$scope.update_student = function () { * Sends the student new information to the server.
// Validate password match * If any password has been entered in the form, both password and password_confirm must match,
if ($scope.formUser.password_confirm && * otherwise the password field is ignored.
!$scope.formUser.password_confirm.length && */
$scope.formUser.password !== $scope.formUser.password_confirm) { $scope.updateStudent = function () {
$translate('password_match').then(function (translation) { var password;
ngToast.danger({ content: translation });
});
return;
}
// password not changed (don't send it to DB) if ($scope.formUser.password_confirm || $scope.formUser.password) {
if ($scope.formUser.password_confirm && if ($scope.formUser.password_confirm === $scope.formUser.password) {
!$scope.formUser.password_confirm.length) { password = $scope.formUser.password;
delete $scope.formUser.password; } else {
delete $scope.formUser.password_confirm; $translate('password_match').then(function (translation) {
ngToast.danger({ content: translation });
});
return;
}
} }
$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) { .success(function (data) {
$translate('student_updated').then(function (translation) { $translate('student_updated').then(function (translation) {
ngToast.success({ content: translation }); ngToast.success({ content: translation });
}); });
$scope.formUser.birthdate = data.birthdate;
$scope.studentData.surname = data.surname; $scope.formUser.country = data.country;
$scope.studentData.birthdate = data.birthdate; $scope.formUser.gender = data.gender;
$scope.studentData.country = data.country; $scope.formUser.lang = data.lang;
$scope.studentData.pic = data.pic; $scope.formUser.name = data.name;
$scope.studentData.gender = data.gender; $scope.formUser.notes = data.notes;
$scope.studentData.lang = data.lang; $scope.formUser.surname = data.surname;
$scope.studentData.notes = data.notes; $scope.formUser.username = data.username;
}) })
.error(function () { .error(function () {
$translate.danger('student_not_updated', function (translation) { $translate.danger('student_not_updated', function (translation) {
...@@ -105,13 +120,16 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl( ...@@ -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 // Find tutor by email
$http.get(config.backend + '/sup/email/' + $scope.email_sup) $http.get(config.backend + '/sup/email/' + $scope.email_sup)
.success(function (data) { .success(function (data) {
if (data.length > 0) { if (data) {
$scope.supToAdd = data[0]; $scope.supToAdd = data;
$scope.showmessagesupfound = true; $scope.showmessagesupfound = true;
$scope.showmessagesupnotfound = false; $scope.showmessagesupnotfound = false;
} else { } else {
...@@ -188,8 +206,8 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl( ...@@ -188,8 +206,8 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
$http.get(config.backend + '/sup/email/' + $scope.email_tutor) $http.get(config.backend + '/sup/email/' + $scope.email_tutor)
.success(function (data) { .success(function (data) {
// If it found the length is > 0 // If it found the length is > 0
if (data.length > 0) { if (data) {
$scope.tutorToAdd = data[0]; $scope.tutorToAdd = data;
// Show message for validate // Show message for validate
$scope.showmessagetutorfound = true; $scope.showmessagetutorfound = true;
$scope.showmessagetutornotfound = false; $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="panel-body"> <div class="row">
<div class="row"> <!-- Parte izquierda: Datos personales -->
<!-- Parte izquierda: Datos personales --> <div class="col-md-6">
<div class="col-md-6"> <div id="student_personal_edit">
<div id="student_personal_edit"> <form role="form" ng-submit="updateStudent()">
<form role="form" ng-submit="update_student()"> <!-- Cambiar imagen de perfil -->
<div class="form-group">
<!-- Cambiar imagen de perfil --> <h4><span class="glyphicon glyphicon-picture" aria-hidden="true"></span> {{ 'change_picture' | translate }}: </h4>
<div class="form-group"> <!-- Input oculto para cargar la redimensión de la imagen (awesome-cropper) -->
<h4><span class="glyphicon glyphicon-picture" aria-hidden="true"></span> {{ 'change_picture' | translate }}: </h4> <input type="file" ng-file-select="onFileSelect($files)" ng-model="picFile" accept="image/*">
<!-- Input oculto para cargar la redimensión de la imagen (awesome-cropper) -->
<input type="file" ng-file-select="onFileSelect($files)" ng-model="picFile" accept="image/*">
</div>
<!-- Preview -->
<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>
</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>
<!-- Fin de datos personales del alumno -->
<fieldset>
<legend translate>notes</legend>
<div class="form-group">
<textarea class="form-control" name="student_notes" id="student_notes" ng-model="formUser.notes" rows="5"></textarea>
</div>
</fieldset>
<fieldset>
<legend translate>language</legend>
<div class="form-group">
<select class="form-control" name="supervisor_language" id="supervisor_language" ng-model="formUser.lang">
<option value="es-es">Español</option>
<option value="en-gb">English</option>
</select>
</div>
</fieldset>
<div class="form-group text-center">
<button type="submit" class="btn btn-primary" translate>save</button>
</div>
</form>
</div> </div>
<!-- Fin de student_personal_edit -->
</div>
<!-- Parte derecha: Tutores y dispositivos --> <!-- Preview -->
<div class="col-md-6"> <img class="thumbnail preview" ng-src="{{studentData.pic}}" />
<!-- Fin Cambiar imagen de perfil -->
<!-- Supervisores (terapeutas) del alumno --> <fieldset>
<div id="student_sups"> <legend translate>account</legend>
<h4 translate>supervisors</h4> <div class="form-group">
<!-- Buscador de supervisores --> <input type="username" class="form-control" id="setup_username" placeholder="{{ 'username' | translate }}" required ng-model="formUser.username" readonly/>
<p> </div>
<form role="search" ng-submit="search_sup()"> <div class="form-group">
<div class="input-group"> <input type="password" class="form-control" id="setup_password1" placeholder="{{ 'password_new_type' | translate }}" ng-model="formUser.password" />
<input type="email" class="form-control" placeholder="{{ 'search_sup_email' | translate }}" name="email_sup" id="email_sup" ng-model="email_sup" required> </div>
<div class="input-group-btn"> <div class="form-group">
<button class="btn btn-default" type="submit"> <input type="password" class="form-control" id="setup_password2" placeholder="{{ 'password_confirm' | translate }}" ng-model="formUser.password_confirm" />
<span class="glyphicon glyphicon-search"></span> </div>
</button> <legend translate>personal_data</legend>
</div> <div class="form-group">
</div> <input type="text" class="form-control" id="student_personal_edit_name" placeholder="{{ 'name' | translate }}" ng-model="formUser.name" required />
</form> </div>
</p> <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="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>
<!-- Alert and success messages for supervisor found --> <fieldset>
<div ng-show="{{ 'showmessagesupfound' }}" class="alert alert-info"> <legend translate>notes</legend>
<!-- Imagen de perfil del tutor --> <div class="form-group">
<img ng-src="{{supToAdd.pic}}" class="profile" alt="" title="" /> {{ supToAdd.name }} {{ supToAdd.surname }} <textarea class="form-control" name="student_notes" id="student_notes" ng-model="formUser.notes" rows="5"></textarea>
<a class="btn btn-default btn-lg pull-right" role="button" ng-click="add_sup()" translate>add</a> </div>
</fieldset>
<fieldset>
<legend translate>language</legend>
<div class="form-group">
<select class="form-control" name="supervisor_language" id="supervisor_language" ng-model="formUser.lang">
<option value="es-es">Español</option>
<option value="en-gb">English</option>
</select>
</div> </div>
<!-- Fin de buscador de supervisores --> </fieldset>
<!-- Supervisores asignados --> <div class="form-group text-center">
<ul class="list-group" id="user_sups"> <button type="submit" class="btn btn-primary" translate>save</button>
<li class="list-group-item" ng-repeat="sup in studentSupervisors">
<!-- Imagen de perfil del supervisor -->
<img ng-src="{{sup.pic}}" class="profile" alt="" title="" />
{{sup.name}} {{sup.surname}}
<a ng-click="delete_sup(sup.id)" class="delete_sup" title="{{ 'unlink' | translate}}">
<span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span>
</a>
</li>
</ul>
<!-- Fin de Supervisores asignados -->
</div> </div>
<!-- Fin de id student-sups --> </form>
</div>
<!-- Tutores (Padres) --> <!-- Fin de student_personal_edit -->
<div id="student_tutors"> </div>
<h4>{{ 'tutors' | translate }}</h4>
<!-- Buscador de tutores -->
<p>
<form role="search" ng-submit="search_tutor()">
<div class="input-group">
<input type="email" class="form-control" placeholder="{{ 'search_tutor_email' | translate }}" name="email_tutor" id="email_tutor" ng-model="email_tutor" required>
<div class="input-group-btn">
<button class="btn btn-default" type="submit">
<span class="glyphicon glyphicon-search"></span>
</button>
</div>
</div>
</form>
</p>
<!-- Alert and success messages for tutor found --> <!-- Parte derecha: Tutores y dispositivos -->
<div ng-show="{{ 'showmessagetutorfound' }}" class="alert alert-info"> <div class="col-md-6">
<!-- Imagen de perfil del tutor --> <!-- Supervisores (terapeutas) del alumno -->
<img ng-src="{{tutorToAdd.pic}}" class="profile" alt="" title="" /> {{ tutorToAdd.name }} {{ tutorToAdd.surname }} <div id="student_sups">
<a class="btn btn-default btn-sm pull-right" role="button" ng-click="add_tutor()" translate>add</a> <h4 translate>supervisors</h4>
<!-- Buscador de supervisores -->
<p>
<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">
<button class="btn btn-default" type="submit">
<span class="glyphicon glyphicon-search"></span>
</button>
</div>
</div> </div>
<!-- Fin de buscador de tutores --> </form>
</p>
<!-- Tutores asignados -->
<ul class="list-group" id="user_tutors"> <!-- Alert and success messages for supervisor found -->
<li class="list-group-item" ng-repeat="tutor in studentTutors"> <div ng-show="{{ 'showmessagesupfound' }}" class="alert alert-info">
<!-- Imagen de perfil del tutor --> <!-- Imagen de perfil del tutor -->
<img ng-src="{{tutor.pic}}" class="profile" alt="" title="" /> <img ng-src="{{supToAdd.pic}}" class="profile" alt="" title="" /> {{ supToAdd.name }} {{ supToAdd.surname }}
{{tutor.name}} {{tutor.surname}} <a class="btn btn-default btn-lg pull-right" role="button" ng-click="add_sup()" translate>add</a>
<a ng-click="delete_tutor(tutor.id)" class="delete_tutor" title="{{ 'unlink' | translate}}">
<span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span>
</a>
</li>
</ul>
<!-- Fin de Tutores asignados -->
<!-- Info message -->
<div class="alert alert-info">{{ 'supervisor_note' | translate }}</div>
</div>
<!-- Fin de id student-tutors -->
</div> </div>
<!-- Fin de buscador de supervisores -->
<!-- Supervisores asignados -->
<ul class="list-group" id="user_sups">
<li class="list-group-item" ng-repeat="sup in studentSupervisors">
<!-- Imagen de perfil del supervisor -->
<img ng-src="{{sup.pic}}" class="profile" alt="" title="" />
{{sup.name}} {{sup.surname}}
<a ng-click="delete_sup(sup.id)" class="delete_sup" title="{{ 'unlink' | translate}}">
<span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span>
</a>
</li>
</ul>
<!-- Fin de Supervisores asignados -->
</div> </div>
<!-- Fin de row --> <!-- Fin de id student-sups -->
<!-- Parte de abajo: Configuración de los dispositivos --> <!-- Tutores (Padres) -->
<div> <div id="student_tutors">
<div class="page-header"> <h4>{{ 'tutors' | translate }}</h4>
<h2 translate>device_setup</h2> <!-- Buscador de tutores -->
<p>
<form role="search" ng-submit="search_tutor()">
<div class="input-group">
<input type="email" class="form-control" placeholder="{{ 'search_tutor_email' | translate }}" name="email_tutor" id="email_tutor" ng-model="email_tutor" required>
<div class="input-group-btn">
<button class="btn btn-default" type="submit">
<span class="glyphicon glyphicon-search"></span>
</button>
</div>
</div>
</form>
</p>
<!-- 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 }}
<a class="btn btn-default btn-sm pull-right" role="button" ng-click="add_tutor()" translate>add</a>
</div> </div>
<!-- Fin de buscador de tutores -->
<!-- Tutores asignados -->
<ul class="list-group" id="user_tutors">
<li class="list-group-item" ng-repeat="tutor in studentTutors">
<!-- Imagen de perfil del tutor -->
<img ng-src="{{tutor.pic}}" class="profile" alt="" title="" />
{{tutor.name}} {{tutor.surname}}
<a ng-click="delete_tutor(tutor.id)" class="delete_tutor" title="{{ 'unlink' | translate}}">
<span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span>
</a>
</li>
</ul>
<!-- Fin de Tutores asignados -->
<!-- Info message -->
<div class="alert alert-info">{{ 'supervisor_note' | translate }}</div>
</div>
<!-- Fin de id student-tutors -->
</div>
</div>
<!-- Fin de row -->
<!-- Alert and success messages --> <!-- Parte de abajo: Configuración de los dispositivos -->
<div ng-show="{{ 'showmessageattributes' }}" class="alert" ng-class="alertattributes">{{ messageattributes | translate }}</div> <div>
<div class="page-header">
<form role="form"> <h2 translate>device_setup</h2>
<div class="row"> </div>
<!-- Pictogramas -->
<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()" />
</label>
</div>
<h4>{{ 'size' | translate }}:</h4>
<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>
<div class="btn-group">
<label class="btn btn-default" ng-model="studentData.attributes.legend" btn-radio="'yes'" ng-change="update_attributes()">{{ 'show' | translate }}</label>
<label class="btn btn-default" ng-model="studentData.attributes.legend" btn-radio="'no'" ng-change="update_attributes()">{{ 'hide' | translate }}</label>
</div>
<div id="legend_size" ng-show="studentData.attributes.legend == 'yes'">
{{ '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> <!-- Alert and success messages -->
<div class="btn-group"> <div ng-show="{{ 'showmessageattributes' }}" class="alert" ng-class="alertattributes">{{ messageattributes | translate }}</div>
<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> <form role="form">
<div class="row">
<!-- Pictogramas -->
<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()" />
</label>
</div> </div>
<div class="col-md-6"> <h4>{{ 'size' | translate }}:</h4>
<!-- Colocación en cinta de frase --> <div class="btn-group">
<fieldset> <label class="btn btn-default" ng-model="studentData.attributes.pictogram_size" btn-radio="'normal'" ng-change="update_attributes()">{{ 'normal' | translate }}</label>
<legend translate>phrase_tape</legend> <label class="btn btn-default" ng-model="studentData.attributes.pictogram_size" btn-radio="'large'"ng-change="update_attributes()">{{ 'large' | translate }}</label>
</div>
<div class="input-group">
<label>{{ 'background' | translate }}:
<input id="phrase_background" type="color" ng-model="studentData.attributes.phrase_background" ng-mouseleave="update_attributes()" />
</label>
</div>
<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>
<h4>{{ 'feedback_picto' | translate }}:</h4>
<div class="btn-group">
<label class="btn btn-success" ng-model="studentData.attributes.input_feedback.vibration" btn-checkbox ng-change="update_attributes()">{{ 'vibration' | translate }}</label>
<label class="btn btn-success" ng-model="studentData.attributes.input_feedback.click" btn-checkbox ng-change="update_attributes()">{{ 'click' | translate }}</label>
<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> <h4>{{ 'legend' | translate }}:</h4>
<div class="btn-group">
<label class="btn btn-default" ng-model="studentData.attributes.legend" btn-radio="'yes'" ng-change="update_attributes()">{{ 'show' | translate }}</label>
<label class="btn btn-default" ng-model="studentData.attributes.legend" btn-radio="'no'" ng-change="update_attributes()">{{ 'hide' | translate }}</label>
</div>
<!-- Ajustes de voz --> <div id="legend_size" ng-show="studentData.attributes.legend == 'yes'">
<fieldset> {{ 'legend_size' | translate }}: {{ studentData.attributes.legendsize }}%
<legend translate>sound_setup</legend> <input type="range" min="10" max="90" step="10" ng-model="studentData.attributes.legendsize" ng-change="update_attributes()">
</div>
</fieldset>
</div>
<h4>{{ 'enable_sound_for' | translate }}:</h4> <div class="col-md-6">
<div class="btn-group"> <!-- Colocación en cinta de frase -->
<!-- <fieldset>
<label class="btn btn-primary" ng-model="studentData.attributes.tts_options.picto" btn-checkbox ng-change="update_attributes()">{{ 'pictogram' | translate }}</label> <legend translate>phrase_tape</legend>
--> <div class="input-group">
<label class="btn btn-primary" ng-model="studentData.attributes.tts_options.phrase" btn-checkbox ng-change="update_attributes()">{{ 'phrase' | translate }}</label> <label>{{ 'background' | translate }}:
</div> <input id="phrase_background" type="color" ng-model="studentData.attributes.phrase_background" ng-mouseleave="update_attributes()" />
<!-- </label>
<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> </div>
<!-- Fin de col -->
</div>
<!-- Fin de row -->
</form> <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="'drag'" ng-change="update_attributes()">{{ 'drag' | translate }}</label>
</div>
<h4>{{ 'feedback_picto' | translate }}:</h4>
<div class="btn-group">
<label class="btn btn-success" ng-model="studentData.attributes.input_feedback.vibration" btn-checkbox ng-change="update_attributes()">{{ 'vibration' | translate }}</label>
<label class="btn btn-success" ng-model="studentData.attributes.input_feedback.click" btn-checkbox ng-change="update_attributes()">{{ 'click' | translate }}</label>
<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.phrase" btn-checkbox ng-change="update_attributes()">{{ 'phrase' | translate }}</label>
</div>
</fieldset>
</div>
<!-- Fin de col -->
</div> </div>
<!-- Fin de Configuración de los dispositivos --> <!-- Fin de row -->
</div> </form>
<!-- Fin de panel body -->
</div> </div>
<!-- Fin de panel --> <!-- Fin de Configuración de los dispositivos -->
</div>
<!-- Fin de panel body -->
</div>
<!-- Fin de panel -->
...@@ -31,8 +31,7 @@ ...@@ -31,8 +31,7 @@
"winston": "~1.0.0" "winston": "~1.0.0"
}, },
"scripts": { "scripts": {
"start": "node app.js", "start": "forever start app.js",
"debug": "node debug app.js",
"test": "mocha test/test-helper.js test/**/*-spec.js", "test": "mocha test/test-helper.js test/**/*-spec.js",
"test:watch": "npm run test -- --reporter min --watch" "test:watch": "npm run test -- --reporter min --watch"
}, },
...@@ -41,7 +40,7 @@ ...@@ -41,7 +40,7 @@
"type": "git", "type": "git",
"url": "http://scm.ujaen.es/softuno/pictogram.git" "url": "http://scm.ujaen.es/softuno/pictogram.git"
}, },
"author": "emblanco, amontejo", "author": "Yottacode",
"license": "", "license": "",
"devDependencies": { "devDependencies": {
"chai": "^3.5.0", "chai": "^3.5.0",
......
describe('Action API', function () { describe('Action API', function () {
it('POST /action', function (done) { it('POST /action');
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 /actions'); it('POST /actions');
}); });
...@@ -5,7 +5,7 @@ describe('Student API', function () { ...@@ -5,7 +5,7 @@ describe('Student API', function () {
delete studentAgentData.iat; delete studentAgentData.iat;
delete studentAgentData.isStudent; delete studentAgentData.isStudent;
delete studentAgentData.password; delete studentAgentData.password;
studentAgentData.current_method = 'Test method'; studentAgentData.current_method = 'Test Method';
studentAgentData.current_instruction = 'Test Instruction'; studentAgentData.current_instruction = 'Test Instruction';
supervisorAgent 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