Commit d9e870b8 by german callejas

Merge branch 'develop' of http://gitlab.ujaen.es/yotta/pictogram into develop

parents 58261938 6fdb9d45
-- Integrity constraints for enrolment management -- Integrity constraints for enrolment management
-- --
DELIMITER ;; DELIMITER $$
DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_MAXENROLMENTS $$
DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_MAXENROLMENTS;;
-- Integrity rule 2: office.current_enrolments updating (adding core) -- Integrity rule 2: office.current_enrolments updating (adding core)
DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_UPDATE_ENROLMENTS;; DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_UPDATE_ENROLMENTS $$
CREATE TRIGGER TRG_NEW_STUDENT_UPDATE_ENROLMENTS CREATE TRIGGER TRG_NEW_STUDENT_UPDATE_ENROLMENTS
AFTER INSERT ON student AFTER INSERT ON student
FOR EACH ROW FOR EACH ROW
thisTrigger: BEGIN thisTrigger: BEGIN
DECLARE LID INT; DECLARE LID INT;
IF ((@TRIGGER_CHECKS = FALSE) IF ((@TRIGGER_CHECKS = FALSE) OR (@TRIGGER_AFTER_INSERT_CHECKS = FALSE)) AND (USER() = 'root@localhost') THEN
OR (@TRIGGER_AFTER_INSERT_CHECKS = FALSE)) LEAVE thisTrigger;
AND (USER() = 'root@localhost')
THEN
LEAVE thisTrigger;
END IF; END IF;
-- Load core collection for student -- Load core collection for student
INSERT INTO grid (id_stu,id_sup,name) VALUES (NEW.id, null, 'new_grid'); CALL student_create_core(null, new.id);
SET LID = LAST_INSERT_ID(); END $$
CALL grid_create_core(LID,new.id);
END;;
DROP PROCEDURE IF EXISTS active_grid_update;; -- Update student active grid
DROP PROCEDURE IF EXISTS active_grid_update $$
CREATE PROCEDURE active_grid_update(IN _id_stu INTEGER) CREATE PROCEDURE active_grid_update(IN _id_stu INTEGER)
BEGIN BEGIN
DECLARE _id_grid INTEGER; DECLARE _id_grid INTEGER;
SELECT id INTO _id_grid FROM grid WHERE id_stu=_id_stu LIMIT 1; SELECT id INTO _id_grid FROM grid WHERE id_stu=_id_stu LIMIT 1;
UPDATE student SET id_active_grid=_id_grid WHERE id=_id_stu; UPDATE student SET id_active_grid=_id_grid WHERE id=_id_stu;
END;; END $$
-- Procedure to add core when new grid is created
DROP PROCEDURE IF EXISTS grid_create_core;; -- Remove old procedure
CREATE PROCEDURE grid_create_core(IN id_grid INTEGER, IN id_stu INTEGER) DROP PROCEDURE IF EXISTS grid_create_core $$
BEGIN
-- Procedure to add core when new student is created
-- Load core collection for student DROP PROCEDURE IF EXISTS student_create_core $$
INSERT INTO stu_picto(id_stu,id_pic,id_grid,attributes) CREATE PROCEDURE student_create_core(IN _id_sup int(11), IN _id_stu int(11))
SELECT id_stu,id_pic,id_grid, concat('{"id_cat":', if (id_cat_pic is null, 'null', id_cat_pic),
',"coord_x":',coord_x, BEGIN
',"coord_y":',coord_y,
',"status":"invisible"', -- Variables
',"highlight":false', DECLARE _id INT;
',"color":', if (color is null, 'null',concat('"',color,'"')), DECLARE _id_pic INT;
'}') as attributes DECLARE _id_cat_pic INT;
FROM picto_core P; DECLARE _coord_x INT;
END;; DECLARE _coord_y INT;
DECLARE _color VARCHAR(9);
DECLARE _grid_name VARCHAR(100);
DECLARE _id_grid INT;
DECLARE _attributes JSON;
DECLARE _num_pictos INT;
DECLARE _lang VARCHAR(5);
DECLARE LID INT;
DECLARE LID2 INT;
DECLARE done INT DEFAULT FALSE;
DECLARE cursor_picto_core CURSOR FOR SELECT id, id_pic, id_cat_pic, coord_x, coord_y, color FROM pictodb.picto_core ORDER BY id_cat_pic IS NULL DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-- Obtiene el texto según el idioma del supervisor
SELECT if(lang = "es-es", 'Con categorías', 'With categories') AS lang INTO _grid_name FROM student WHERE id = _id_stu COLLATE utf8_general_ci;
-- Crea el tablero principal
INSERT INTO grid (name, active, id_stu)
VALUES (_grid_name, 1, _id_stu);
SET LID = LAST_INSERT_ID();
-- Recorre todos los picto_core
OPEN cursor_picto_core;
read_loop: LOOP
FETCH cursor_picto_core INTO _id, _id_pic, _id_cat_pic, _coord_x, _coord_y, _color;
-- Control para la finalizacion del bucle
IF done THEN
LEAVE read_loop;
END IF;
-- Genero el JSON de attributes para el pictograma
SET _attributes = JSON_OBJECT(
'coord_x', _coord_x,
'coord_y', _coord_y,
'status','invisible',
'highlight','false',
'color', _color
);
-- El pictograma pertenece al tablero principal
IF (_id_cat_pic IS NULL) THEN
-- Inserta el pictograma en el tablero principal
INSERT INTO stu_picto (id_stu, id_pic, attributes, id_grid)
VALUES (_id_stu, _id_pic, _attributes, LID);
-- Cuenta para dicho pictograma el numero de pictogramas hijos
SELECT count(*) INTO _num_pictos FROM picto_core WHERE id_cat_pic = _id_pic;
-- Si tiene algun picto apuntandole, se crea un tablero nuevo
IF (_num_pictos > 0) THEN
-- Selecciona el texto para el tablero hijo
SELECT CAST(lang AS CHAR(5)) INTO _lang FROM student WHERE id = _id_stu LIMIT 1;
SELECT `text` INTO _grid_name FROM picto_exp WHERE id_pic = _id_pic AND lang = _lang LIMIT 1;
-- Crea el nuevo tablero hijo
INSERT INTO grid (name, active, id_stu)
VALUES (_grid_name, 0, _id_stu);
SET LID2 = LAST_INSERT_ID();
UPDATE stu_picto SET id_child_grid = LID2 WHERE id_pic = _id_pic AND id_grid = LID;
END IF;
ELSE
-- Inserta los pictogramas correspondientes en el tablero recien creado
SELECT CAST(lang AS CHAR(5)) INTO _lang FROM student WHERE id = _id_stu LIMIT 1;
SELECT `text` INTO _grid_name FROM picto_exp WHERE id_pic = _id_cat_pic AND lang = _lang LIMIT 1;
SELECT id INTO _id_grid FROM grid WHERE name = _grid_name AND id_stu = _id_stu LIMIT 1;
INSERT INTO stu_picto (id_stu, id_pic, attributes, id_grid)
VALUES (_id_stu, _id_pic, _attributes, _id_grid);
END IF;
END LOOP;
CLOSE cursor_picto_core;
END $$
-- Integrity rule 3: office.current_enrolments and supervisor assigments updating. -- Integrity rule 3: office.current_enrolments and supervisor assigments updating.
DROP TRIGGER IF EXISTS TRG_MODIFY_STUDENT_ENROLMENTS;; DROP TRIGGER IF EXISTS TRG_MODIFY_STUDENT_ENROLMENTS $$
DELIMITER; DELIMITER ;
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
"average_time_per_try": "Average time per try", "average_time_per_try": "Average time per try",
"back": "Back", "back": "Back",
"background": "Background", "background": "Background",
"background_color": "Background color",
"background_color_picto": "Background color for selected picto",
"back_to_login": "Back to login", "back_to_login": "Back to login",
"beep": "Beep", "beep": "Beep",
"birthdate": "Birthdate", "birthdate": "Birthdate",
...@@ -79,6 +81,7 @@ ...@@ -79,6 +81,7 @@
"close": "Close", "close": "Close",
"close_session": "Close session", "close_session": "Close session",
"collections": "Collections", "collections": "Collections",
"color_delete": "Delete color",
"confirmation": "Are you sure?", "confirmation": "Are you sure?",
"confirm_unlink_therapist": "Unlik {{ name }} from {{ student }} as therapist?", "confirm_unlink_therapist": "Unlik {{ name }} from {{ student }} as therapist?",
"confirm_unlink_tutor": "Unlik {{ name }} from {{ student }} as tutor?", "confirm_unlink_tutor": "Unlik {{ name }} from {{ student }} as tutor?",
...@@ -166,6 +169,17 @@ ...@@ -166,6 +169,17 @@
"generate": "Generate", "generate": "Generate",
"generate_serial": "Generate serial number", "generate_serial": "Generate serial number",
"global":"Global", "global":"Global",
"grid_active": "Active grid",
"grid_activate": "Activate grid",
"grid_added": "Grid data has been saved",
"grid_already_activated": "Grid already activated",
"grid_already_deleted": "Grid was already deleted",
"grid_create":"Create new grid",
"grid_deleted": "Grid has been deleted",
"grid_duplicated": "Grid has been copied",
"grid_inactive": "Inactive grid",
"grid_options": "Grid options",
"grid_updated": "Grid data updated",
"hide": "Hide", "hide": "Hide",
"highlight": "highlight", "highlight": "highlight",
"highlighted": "Highlighted", "highlighted": "Highlighted",
...@@ -355,20 +369,11 @@ ...@@ -355,20 +369,11 @@
"reports": "Reports", "reports": "Reports",
"request_change_password": "Request change password", "request_change_password": "Request change password",
"resume": "Resume", "resume": "Resume",
"return_to": "Return to",
"role": "Role", "role": "Role",
"room_changed": "A partner is offline. Session paused.", "room_changed": "A partner is offline. Session paused.",
"save": "Save", "save": "Save",
"save_as_template": "Save as template", "save_as_template": "Save as template",
"grid_active": "Active grid",
"grid_activate": "Activate grid",
"grid_added": "Grid data has been saved",
"grid_already_activated": "Grid already activated",
"grid_already_deleted": "Grid was already deleted",
"grid_create":"Create new grid",
"grid_deleted": "Grid has been deleted",
"grid_duplicated": "Grid has been copied",
"grid_inactive": "Inactive grid",
"grid_updated": "Grid data updated",
"search": "Search", "search": "Search",
"search_sup_email": "Search supervisor by email", "search_sup_email": "Search supervisor by email",
"search_tutor_email": "Search tutor by email", "search_tutor_email": "Search tutor by email",
...@@ -397,6 +402,7 @@ ...@@ -397,6 +402,7 @@
"sexo": "Sex", "sexo": "Sex",
"show": "Show", "show": "Show",
"show_all": "Show all", "show_all": "Show all",
"show_grids": "Show grids",
"show_less": "Show less details", "show_less": "Show less details",
"size": "Size", "size": "Size",
"small": "Small", "small": "Small",
......
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
"average_time_per_try": "Tiempo medio por intento", "average_time_per_try": "Tiempo medio por intento",
"back": "Volver", "back": "Volver",
"background": "Fondo", "background": "Fondo",
"background_color": "Color de fondo",
"background_color_picto": "Color de fondo para el pictograma seleccionado",
"back_to_login": "Volver a inicio de sesión", "back_to_login": "Volver a inicio de sesión",
"beep": "Pitido", "beep": "Pitido",
"birthdate": "Fecha de nacimiento", "birthdate": "Fecha de nacimiento",
...@@ -79,6 +81,7 @@ ...@@ -79,6 +81,7 @@
"close": "Cerrar", "close": "Cerrar",
"close_session": "Cerrar sesion", "close_session": "Cerrar sesion",
"collections": "Colecciones", "collections": "Colecciones",
"color_delete": "Eliminar color",
"confirmation": "¿Estás seguro?", "confirmation": "¿Estás seguro?",
"confirm_unlink_student": "¿Desligar {{ name }} de {{ student }}?", "confirm_unlink_student": "¿Desligar {{ name }} de {{ student }}?",
"contact_person": "Persona de contacto", "contact_person": "Persona de contacto",
...@@ -164,7 +167,18 @@ ...@@ -164,7 +167,18 @@
"general_labels": "Generales", "general_labels": "Generales",
"generate": "Generar", "generate": "Generar",
"generate_serial": "Generar número de serie", "generate_serial": "Generar número de serie",
"global":"Global", "global": "Global",
"grid_active": "Tablero activo",
"grid_activate": "Activar tablero",
"grid_added": "Tablero creado correctamente",
"grid_already_activated": "Tablero ya activado",
"grid_already_deleted": "El tablero ya se había eliminado",
"grid_create":"Crear nuevo tablero",
"grid_deleted": "Tablero eliminado",
"grid_duplicated": "Tablero duplicado",
"grid_inactive": "Tablero inactivo",
"grid_options": "Opciones del tablero",
"grid_updated": "Datos del tablero actualizados",
"hide": "Ocultar", "hide": "Ocultar",
"highlight": "Resaltar", "highlight": "Resaltar",
"highlighted": "Resaltado", "highlighted": "Resaltado",
...@@ -353,20 +367,11 @@ ...@@ -353,20 +367,11 @@
"reports": "Informes", "reports": "Informes",
"request_change_password": "Solicitar cambio de contraseña", "request_change_password": "Solicitar cambio de contraseña",
"resume": "Continuar", "resume": "Continuar",
"return_to": "Volver a",
"role": "Rol", "role": "Rol",
"room_changed":"Un participante abandonó la sesión. Sesión en pausa.", "room_changed":"Un participante abandonó la sesión. Sesión en pausa.",
"save": "Guardar", "save": "Guardar",
"save_as_template": "Guardar como plantilla", "save_as_template": "Guardar como plantilla",
"grid_active": "Escena activa",
"grid_activate": "Activar escena",
"grid_added": "Escena creada correctamente",
"grid_already_activated": "Escena ya activada",
"grid_already_deleted": "La escena ya se había eliminado",
"grid_create":"Crear nueva escena",
"grid_deleted": "Escena eliminada",
"grid_duplicated": "Escena duplicada",
"grid_inactive": "Escena inactiva",
"grid_updated": "Datos de la escena actualizados",
"search": "Buscar", "search": "Buscar",
"search_sup_email": "Buscar supervisor por email", "search_sup_email": "Buscar supervisor por email",
"search_tutor_email": "Buscar tutor por email", "search_tutor_email": "Buscar tutor por email",
...@@ -395,6 +400,7 @@ ...@@ -395,6 +400,7 @@
"sexo": "Sexo", "sexo": "Sexo",
"show": "Mostrar", "show": "Mostrar",
"show_all": "Ver todo", "show_all": "Ver todo",
"show_grids": "Ver tableros",
"show_less": "Ver menos detalles", "show_less": "Ver menos detalles",
"size": "Tamaño", "size": "Tamaño",
"small": "Pequeño", "small": "Pequeño",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<!-- Grid header --> <!-- Grid header -->
<div class="col-xs-2 text-center" style="margin-bottom:1em;"> <div class="col-xs-2 text-center" style="margin-bottom:1em;">
<button type="button" class="btn btn-danger btn-grid-back" ng-if="breadcrumbs.length != 0" ng-click="showLastGrid()"> <button type="button" class="btn btn-danger btn-grid-back" ng-if="breadcrumbs.length != 0" ng-click="showLastGrid()">
<i class="fa fa-arrow-circle-left" aria-hidden="true"></i> Volver a <b>{{ breadcrumbs[breadcrumbs.length-1].name }}</b> <i class="fa fa-arrow-circle-left" aria-hidden="true"></i> {{ 'return_to' | translate }} <b>{{ breadcrumbs[breadcrumbs.length-1].name }}</b>
</button> </button>
</div> </div>
</div> </div>
...@@ -122,31 +122,31 @@ ...@@ -122,31 +122,31 @@
<div class="col-xs-2 text-center"> <div class="col-xs-2 text-center">
<label style="margin-bottom:1em;">Opciones del tablero</label> <label style="margin-bottom:1em;">{{ 'grid_options' | translate }}</label>
<div class="form-group row"> <div class="form-group row">
<button type="button" ng-if="!viewingGrid.active" class="btn btn-default" ng-click="viewingGrid.active=true;activate_grid(viewingGrid)" style="min-width:9.5em;">Activar tablero</button> <button type="button" ng-if="!viewingGrid.active" class="btn btn-default" ng-click="viewingGrid.active=true;activate_grid(viewingGrid)" style="min-width:9.5em;">{{ 'grid_activate' | translate }}</button>
<button type="button" ng-if="viewingGrid.active" class="btn btn-success" disabled style="min-width:9.25em;">Tablero activado</button> <button type="button" ng-if="viewingGrid.active" class="btn btn-success" disabled style="min-width:9.25em;">{{ 'grid_active' | translate }}</button>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<button type="button" class="btn btn-default"ng-click="open_grid_color(viewingGrid)" style="min-width:9.25em;">Configuración</button> <button type="button" class="btn btn-default" ng-click="open_grid_color(viewingGrid)" style="min-width:9.25em;">{{ 'setup' | translate }}</button>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<button type="button" class="btn btn-success" ng-click="open_new_grid()" aria-expanded="false"><i class="fa fa-plus" aria-hidden="true"></i></button> <button type="button" class="btn btn-success" ng-click="open_new_grid()" aria-expanded="false"><i class="fa fa-plus" aria-hidden="true"></i></button>
<button type="button" class="btn btn-primary" ng-click="copy_grid()" title="{{ 'duplicate' | translate}}"><i class="fa fa-files-o" aria-hidden="true"></i></button> <button type="button" class="btn btn-primary" ng-click="copy_grid()" title="{{ 'duplicate' | translate }}"><i class="fa fa-files-o" aria-hidden="true"></i></button>
<button type="button" class="btn btn-danger" ng-click="delete_grid(viewingGrid)" title="{{ 'delete' | translate}}"><i class="fa fa-trash" aria-hidden="true"></i></button> <button type="button" class="btn btn-danger" ng-click="delete_grid(viewingGrid)" title="{{ 'delete' | translate }}"><i class="fa fa-trash" aria-hidden="true"></i></button>
</div> </div>
<hr> <hr>
<label style="margin-bottom:1em;">Ver tableros</label> <label style="margin-bottom:1em;">{{ 'show_grids' | translate }}</label>
<div class="form-group row"> <div class="form-group row">
<select ng-model="grid" ng-change="showGrid(grid,false)" style="min-width:9.5em;"> <select ng-model="grid" ng-change="showGrid(grid,false)" style="min-width:9.5em;">
<option value="{{grid.id}}" ng-repeat="grid in gridsList track by $index" ng-selected="grid.active"> <option value="{{grid.id}}" ng-repeat="grid in gridsList track by $index" ng-selected="grid.active">
{{grid.name}} {{ grid.name }}
</option> </option>
</select> </select>
</div> </div>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<button type="button" class="close" ng-click="cancel()"> <button type="button" class="close" ng-click="cancel()">
<span aria-hidden="true">&times;</span><span class="sr-only" translate>close</span> <span aria-hidden="true">&times;</span><span class="sr-only" translate>close</span>
</button> </button>
<h4 class="modal-title" id="myModalLabel" translate>Configuración del tablero</h4> <h4 class="modal-title" id="myModalLabel" translate>{{ 'grid_options' | translate }}</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<label for="favcolor">Color de fondo</label> <label for="favcolor">{{ 'background_color' | translate }}</label>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-3"> <div class="col-xs-3">
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
</div> </div>
<div class="col-xs-3"> <div class="col-xs-3">
<button class="btn btn-danger pull-right" ng-click="(gridColor = '#ffffff')"> <button class="btn btn-danger pull-right" ng-click="(gridColor = '#ffffff')">
<i class="fa fa-eraser" aria-hidden="true"></i> Eliminar color <i class="fa fa-eraser" aria-hidden="true"></i> {{ 'color_delete' | translate }}
</button> </button>
</div> </div>
<div class="col-xs-6"> <div class="col-xs-6">
<div class="alert alert-info" style="margin: 0 auto;" translate> <div class="alert alert-info" style="margin: 0 auto;">
Color de fondo para el pictograma seleccionado {{ 'background_color_picto' | translate }}
</div> </div>
</div> </div>
</div> </div>
...@@ -34,6 +34,6 @@ ...@@ -34,6 +34,6 @@
</div> </div>
<div class="modal-footer text-right"> <div class="modal-footer text-right">
<button class="btn btn-success" ng-click="close(gridColor)">Guardar</button> <button class="btn btn-success" ng-click="close(gridColor)">{{ 'save' | translate }}</button>
</div> </div>
</div> </div>
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