Commit 9ad212ad by Fernando Martínez Santiago

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

parents 9b6b3c0a 40d276f2
...@@ -78,7 +78,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -78,7 +78,7 @@ public class Vocabulary implements Iterable<Picto> {
modifyAttsPicto(picto_cat, picto_id, args.getJSONObject("attributes")); modifyAttsPicto(picto_cat, picto_id, args.getJSONObject("attributes"));
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
Log.e(LOG_TAG,e.getMessage()); Log.e(LOG_TAG,"Error updating picto:"+e.getMessage());
} }
break; break;
} }
...@@ -457,7 +457,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -457,7 +457,7 @@ public class Vocabulary implements Iterable<Picto> {
}); });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Log.e(Vocabulary.class.getCanonicalName(), e.getMessage()); Log.e(Vocabulary.class.getCanonicalName(), "Error saving picto:"+e.getMessage());
} }
} }
......
...@@ -102,10 +102,10 @@ public class PictoUploader { ...@@ -102,10 +102,10 @@ public class PictoUploader {
boolean success; boolean success;
Response<JsonObject> response=null; Response<JsonObject> response=null;
String [] path = audioFile.getPath().split("\\.");
String extension = path[1];
if (extension != "mp3") String extension = audioFile.getName().substring(audioFile.getName().lastIndexOf('.')+1);
if (!extension.equalsIgnoreCase("mp3"))
throw new UnsupportedEncodingException("Extension "+extension+" is not supported. Only mp3 files"); throw new UnsupportedEncodingException("Extension "+extension+" is not supported. Only mp3 files");
Ion ion = Ion.getDefault(PCBcontext.getContext()); Ion ion = Ion.getDefault(PCBcontext.getContext());
...@@ -114,7 +114,7 @@ public class PictoUploader { ...@@ -114,7 +114,7 @@ public class PictoUploader {
response=ion.with(PCBcontext.getContext()) response=ion.with(PCBcontext.getContext())
.load("POST", PCBcontext.getContext().getResources().getString(R.string.server) + "/picto/upload_sound/"+picto.get_stupicto_id()) .load("POST", PCBcontext.getContext().getResources().getString(R.string.server) + "/picto/upload_sound/"+picto.get_stupicto_id())
.setMultipartParameter("filename", "id_del _sonido") .setMultipartParameter("filename", audioFile.getName())
.setMultipartParameter("extension", "mp3") .setMultipartParameter("extension", "mp3")
.setMultipartParameter("owner", Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_id_sup())) .setMultipartParameter("owner", Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_id_sup()))
.setMultipartParameter("folder", "pictoSound") .setMultipartParameter("folder", "pictoSound")
...@@ -138,7 +138,7 @@ public class PictoUploader { ...@@ -138,7 +138,7 @@ public class PictoUploader {
success=false; success=false;
Log.i(LOG_TAG, "Uploaded Sound failed "); Log.i(LOG_TAG, "Uploaded Sound failed ");
if (response != null) if (response != null)
Log.i(LOG_TAG, "Uploaded Sound failed, headers: " + response.getHeaders()); Log.i(LOG_TAG, "Uploaded Sound failed, headers: " + response.getHeaders().message()+"("+response.getHeaders().code()+")");
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
Log.e(LOG_TAG, "Sound upload error: " + e.getMessage()+ "Code: "+ Log.e(LOG_TAG, "Sound upload error: " + e.getMessage()+ "Code: "+
...@@ -300,14 +300,15 @@ public class PictoUploader { ...@@ -300,14 +300,15 @@ public class PictoUploader {
if (imgUpload_success){ if (imgUpload_success){
if(this.picto.getUriSound() != "" && this.picto.getUriSound() != null ){ //Si el picto tiene audio en local if(this.picto.getUriSound() != "" && this.picto.getUriSound() != null ){ //Si el picto tiene audio en local
Log.i("TAG_PRUEBAS","Hay uri: "+this.picto.getUriSound()+" -Procede a subir archivo"); Log.i(LOG_TAG,"Uploading sound "+this.picto.getUriSound());
File file = new File(picto.getUriSound()); //Obtengo el fichero de audio local File file = new File(picto.getUriSound()); //Obtengo el fichero de audio local
boolean soundUpload_success = uploadSound(file); //Llamo a la subida boolean soundUpload_success = uploadSound(file); //Llamo a la subida
if(soundUpload_success) { if(soundUpload_success) {
Log.i("TAG_PRUEBAS","Se sube sonido hay EXITO"); Log.i(LOG_TAG,"Sound uploaded");
}else { }else {
GUITools.show_alert(PCBcontext.getActivityContext(),Integer.parseInt(R.string.upload_error+"Audio"), PictoUploader.this.picto.get_translation()); Log.e(LOG_TAG, "Uploading sound error");
GUITools.show_alert(PCBcontext.getActivityContext(),R.string.upload_error, PictoUploader.this.picto.get_translation());
} }
} }
if (stupicto_id!=Picto.STUPICTO_NULL) { if (stupicto_id!=Picto.STUPICTO_NULL) {
......
...@@ -26,6 +26,7 @@ import android.view.KeyEvent; ...@@ -26,6 +26,7 @@ import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
...@@ -38,7 +39,6 @@ import android.widget.TextView; ...@@ -38,7 +39,6 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.yottacode.pictogram.dao.Picto; import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular; import com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictoMenu; import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictoMenu;
...@@ -55,7 +55,6 @@ import java.io.IOException; ...@@ -55,7 +55,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Random; import java.util.Random;
import java.util.Vector;
import pl.droidsonroids.gif.GifTextView; import pl.droidsonroids.gif.GifTextView;
...@@ -225,6 +224,7 @@ public class EditPictoActivity extends Activity { ...@@ -225,6 +224,7 @@ public class EditPictoActivity extends Activity {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
setContentView(R.layout.edit_picto_layout); setContentView(R.layout.edit_picto_layout);
//Persmisos para grabar audio //Persmisos para grabar audio
......
/* /*
SET FOREIGN_KEY_CHECKS = 0;
ALTER TABLE stu_picto DROP FOREIGN KEY stu_picto_scene_fk; ALTER TABLE stu_picto DROP FOREIGN KEY stu_picto_scene_fk;
ALTER TABLE stu_picto DROP COLUMN id_scene;
ALTER TABLE stu_picto DROP id_scene; ALTER TABLE stu_picto DROP id_scene;
DROP TABLE scene; DROP TABLE scene;
SET FOREIGN_KEY_CHECKS = 1;
*/ */
DELIMITER $$ DELIMITER $$
...@@ -13,7 +14,8 @@ CREATE PROCEDURE scene_adapt() ...@@ -13,7 +14,8 @@ CREATE PROCEDURE scene_adapt()
BEGIN BEGIN
DECLARE _id_stu INT; DECLARE _id_stu INT;
DECLARE _id_sup INT; DECLARE _id_sup INT;
DECLARE cat_active BOOLEAN; DECLARE _cat_status CHAR(10);
DECLARE _cat_active BOOLEAN;
DECLARE done INT DEFAULT FALSE; DECLARE done INT DEFAULT FALSE;
DECLARE LID INT; DECLARE LID INT;
...@@ -31,14 +33,19 @@ BEGIN ...@@ -31,14 +33,19 @@ BEGIN
LEAVE read_loop; LEAVE read_loop;
END IF; END IF;
SELECT attributes->"$.categories" INTO cat_active FROM student WHERE id = _id_stu; SELECT CAST(attributes->"$.categories" as CHAR(10)) INTO _cat_status FROM student WHERE id = _id_stu;
SET cat_active = 0;
SELECT CONCAT('active: ', cat_active); IF (_cat_status LIKE '%on%') THEN
SELECT CONCAT('active: ', NOT cat_active); SET _cat_active = 1;
/*SELECT CONCAT('active: ', _cat_active);*/
ELSE
SET _cat_active = 0;
/*SELECT CONCAT('active: ', NOT _cat_active);*/
END IF;
/* FIRST SCENE, ACTIVE, WITH CATEGORIES */ /* FIRST SCENE, ACTIVE, WITH CATEGORIES*/
INSERT INTO `scene` (name, active, categories, id_stu) INSERT INTO `scene` (name, active, categories, id_stu)
VALUES ('with_categories', cat_active, 1, _id_stu); VALUES ('with_categories', _cat_active, 1, _id_stu);
SET LID = LAST_INSERT_ID(); SET LID = LAST_INSERT_ID();
...@@ -48,9 +55,9 @@ BEGIN ...@@ -48,9 +55,9 @@ BEGIN
AND attributes->"$.free_category_coord_x" IS NULL AND attributes->"$.free_category_coord_x" IS NULL
AND attributes->"$.free_category_coord_y" IS NULL; AND attributes->"$.free_category_coord_y" IS NULL;
/* SECOND SCENE, NOT ACTIVE, NO CATEGORIES */ /* SECOND SCENE, NOT ACTIVE, NO CATEGORIES*/
INSERT INTO `scene` (name, active, categories, id_sup, id_stu) INSERT INTO `scene` (name, active, categories, id_sup, id_stu)
VALUES ('no_categories', NOT cat_active, 0, _id_sup, _id_stu); VALUES ('no_categories', NOT _cat_active, 0, _id_sup, _id_stu);
SET LID = LAST_INSERT_ID(); SET LID = LAST_INSERT_ID();
......
...@@ -190,7 +190,7 @@ INSERT IGNORE INTO `student` ( ...@@ -190,7 +190,7 @@ INSERT IGNORE INTO `student` (
NULL, NULL,
'es-es', 'es-es',
(SELECT id from office WHERE email='belen.perez@autismojaen.es'), (SELECT id from office WHERE email='belen.perez@autismojaen.es'),
'{"stu-att":[{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}]}' '{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}'
), ( ), (
'alumno2', 'alumno2',
'$2a$10$RUv25u.C/waYE4xxbfTWTe/IBNQfIFFP5dKPTJsqYznbkS3QCvqq2', '$2a$10$RUv25u.C/waYE4xxbfTWTe/IBNQfIFFP5dKPTJsqYznbkS3QCvqq2',
...@@ -203,7 +203,7 @@ INSERT IGNORE INTO `student` ( ...@@ -203,7 +203,7 @@ INSERT IGNORE INTO `student` (
NULL, NULL,
'es-es', 'es-es',
(SELECT id from office WHERE email='belen.perez@autismojaen.es'), (SELECT id from office WHERE email='belen.perez@autismojaen.es'),
'{"stu-att":[{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}]}' '{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}'
), ( ), (
'alumno3', 'alumno3',
'$2a$10$Ei9E2Pz8sJ4aojbMPsdfZ.xz.LrWG4op1koC4LwCxHr.A0MgeP4m6', '$2a$10$Ei9E2Pz8sJ4aojbMPsdfZ.xz.LrWG4op1koC4LwCxHr.A0MgeP4m6',
...@@ -216,7 +216,7 @@ INSERT IGNORE INTO `student` ( ...@@ -216,7 +216,7 @@ INSERT IGNORE INTO `student` (
NULL, NULL,
'es-es', 'es-es',
(SELECT id from office WHERE email='belen.perez@autismojaen.es'), (SELECT id from office WHERE email='belen.perez@autismojaen.es'),
'{"stu-att":[{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}]}' '{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}'
-- 'manuel', -- 'manuel',
-- '$2a$06$SaAswfsdqGpSo/bE.Cks8.CJnpqHGjixdRLGGpdOHWVFJR2w0fTaS', -- '$2a$06$SaAswfsdqGpSo/bE.Cks8.CJnpqHGjixdRLGGpdOHWVFJR2w0fTaS',
...@@ -229,7 +229,7 @@ INSERT IGNORE INTO `student` ( ...@@ -229,7 +229,7 @@ INSERT IGNORE INTO `student` (
-- NULL, -- NULL,
-- 'es-es', -- 'es-es',
-- (SELECT id from office WHERE email='belen.perez@autismojaen.es'), -- (SELECT id from office WHERE email='belen.perez@autismojaen.es'),
-- '{"stu-att":[{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}]}' -- '{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}'
-- ), ( -- ), (
-- 'jose', -- 'jose',
-- '$2a$06$WtRXXLwFrEdDzB7r0r54RuY5A9wX3aysUIM8AHAGPpfVxhbNISBIa', -- '$2a$06$WtRXXLwFrEdDzB7r0r54RuY5A9wX3aysUIM8AHAGPpfVxhbNISBIa',
...@@ -242,7 +242,7 @@ INSERT IGNORE INTO `student` ( ...@@ -242,7 +242,7 @@ INSERT IGNORE INTO `student` (
-- NULL, -- NULL,
-- 'es-es', -- 'es-es',
-- (SELECT id from office WHERE email='belen.perez@autismojaen.es'), -- (SELECT id from office WHERE email='belen.perez@autismojaen.es'),
-- '{"stu-att":[{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}]}' -- '{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}'
-- ), ( -- ), (
-- 'carmen', -- 'carmen',
-- '$2a$06$2c4zNE1Bkc24AXiXATbn8OfgkM/r9DJzUfnJ8qHrDUxBkMQd8rUIG', -- '$2a$06$2c4zNE1Bkc24AXiXATbn8OfgkM/r9DJzUfnJ8qHrDUxBkMQd8rUIG',
...@@ -255,7 +255,7 @@ INSERT IGNORE INTO `student` ( ...@@ -255,7 +255,7 @@ INSERT IGNORE INTO `student` (
-- NULL, -- NULL,
-- 'es-es', -- 'es-es',
-- (SELECT id from office WHERE email='belen.perez@autismojaen.es'), -- (SELECT id from office WHERE email='belen.perez@autismojaen.es'),
-- '{"stu-att":[{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}]}' -- '{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}'
); );
-- --
......
...@@ -223,7 +223,7 @@ INSERT INTO `student` ( ...@@ -223,7 +223,7 @@ INSERT INTO `student` (
'test_caja_juan.jpg', 'test_caja_juan.jpg',
NULL, NULL,
'es-es', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }'
), ( ), (
'faf0002', 'faf0002',
'$2a$10$FOJ2fmJaHyI5sWe1tQojFuhoPpqHSTVPwvHPTpWEftFPI28VdyYNq', '$2a$10$FOJ2fmJaHyI5sWe1tQojFuhoPpqHSTVPwvHPTpWEftFPI28VdyYNq',
...@@ -235,7 +235,7 @@ INSERT INTO `student` ( ...@@ -235,7 +235,7 @@ INSERT INTO `student` (
'test_caja_kate.jpg', 'test_caja_kate.jpg',
NULL, NULL,
'en-gb', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }'
), ( ), (
'mam0001', 'mam0001',
'$2a$10$zygC/WviDviyZQsMsNqK8.tSUI4Qr/dLlLrw0i5kR1bbN4SeU5ACq', '$2a$10$zygC/WviDviyZQsMsNqK8.tSUI4Qr/dLlLrw0i5kR1bbN4SeU5ACq',
...@@ -247,7 +247,7 @@ INSERT INTO `student` ( ...@@ -247,7 +247,7 @@ INSERT INTO `student` (
'test_caja_carlos.jpg', 'test_caja_carlos.jpg',
NULL, NULL,
'es-es', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }'
), ( ), (
'mam0002', 'mam0002',
'$2a$10$xbyNUhf9rqhdXDBrvUSiOuJIzUVOyyz9ToQMCByFThiiiPwO0PWgK', '$2a$10$xbyNUhf9rqhdXDBrvUSiOuJIzUVOyyz9ToQMCByFThiiiPwO0PWgK',
...@@ -259,7 +259,7 @@ INSERT INTO `student` ( ...@@ -259,7 +259,7 @@ INSERT INTO `student` (
'test_caja_rocio.jpg', 'test_caja_rocio.jpg',
NULL, NULL,
'es-es', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }'
), ( ), (
'aaa0001', 'aaa0001',
'$2a$10$koWKIn42UNSi1N67akxjpOuJNwpXJ/vOe6biD2xkjrUz6dr3g.Wa.', '$2a$10$koWKIn42UNSi1N67akxjpOuJNwpXJ/vOe6biD2xkjrUz6dr3g.Wa.',
...@@ -271,7 +271,7 @@ INSERT INTO `student` ( ...@@ -271,7 +271,7 @@ INSERT INTO `student` (
'test_caja_samuel.jpg', 'test_caja_samuel.jpg',
NULL, NULL,
'es-es', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "es" }'
), ( ), (
'aaa0002', 'aaa0002',
'$2a$10$ffAjZjWN0UKja0JO7ko6qup4x2phbY3VpC66TmpMnGdWUutBFeWY2', '$2a$10$ffAjZjWN0UKja0JO7ko6qup4x2phbY3VpC66TmpMnGdWUutBFeWY2',
...@@ -283,7 +283,7 @@ INSERT INTO `student` ( ...@@ -283,7 +283,7 @@ INSERT INTO `student` (
'test_caja_adela.jpg', 'test_caja_adela.jpg',
NULL, NULL,
'es-es', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }'
), ( ), (
'aaa0003', 'aaa0003',
'$2a$10$glc5A6vyPve5.4407Vdkau5CHF3GOpA0Uo6rxMDdIopIWTJK0nBse', '$2a$10$glc5A6vyPve5.4407Vdkau5CHF3GOpA0Uo6rxMDdIopIWTJK0nBse',
...@@ -295,7 +295,7 @@ INSERT INTO `student` ( ...@@ -295,7 +295,7 @@ INSERT INTO `student` (
'test_caja_adela.jpg', 'test_caja_adela.jpg',
NULL, NULL,
'es-es', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }'
), ( ), (
'aaa0004', 'aaa0004',
'$2a$10$tezK07jq5ZMdQbCboubEBeHiXWJisZPAbgN301n5kRLXkq8xOlb4O', '$2a$10$tezK07jq5ZMdQbCboubEBeHiXWJisZPAbgN301n5kRLXkq8xOlb4O',
...@@ -307,7 +307,7 @@ INSERT INTO `student` ( ...@@ -307,7 +307,7 @@ INSERT INTO `student` (
'test_caja_juan.jpg', 'test_caja_juan.jpg',
NULL, NULL,
'es-es', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }'
), ( ), (
'jaj0001', 'jaj0001',
'$2a$10$UQYGXOOE8mxxOjvgo8cjwOpsv5jCtRXpMTLpbD3TzMBiUIv3hXlnO', '$2a$10$UQYGXOOE8mxxOjvgo8cjwOpsv5jCtRXpMTLpbD3TzMBiUIv3hXlnO',
...@@ -319,7 +319,7 @@ INSERT INTO `student` ( ...@@ -319,7 +319,7 @@ INSERT INTO `student` (
'test_caja_adela.jpg', 'test_caja_adela.jpg',
NULL, NULL,
'es-es', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }'
), ( ), (
'jaj0002', 'jaj0002',
'$2a$10$tVy3Wfu35l4B6bFpnjJCE.ckjncq6YCKMGW4B9abesbiFVeyGu2Dy', '$2a$10$tVy3Wfu35l4B6bFpnjJCE.ckjncq6YCKMGW4B9abesbiFVeyGu2Dy',
...@@ -331,7 +331,7 @@ INSERT INTO `student` ( ...@@ -331,7 +331,7 @@ INSERT INTO `student` (
'test_caja_samuel.jpg', 'test_caja_samuel.jpg',
NULL, NULL,
'es-es', '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" }]}' '{ "categories" : "on", "input feedback" : [ "vibration", "tts" ], "input selection" : "click", "pictogram size" : "medium", "tts engine" : "IVONA Text-to-Speech HQ", "tts voice": "en" }'
); );
-- --
......
...@@ -74,7 +74,7 @@ INSERT IGNORE INTO `student` ( ...@@ -74,7 +74,7 @@ INSERT IGNORE INTO `student` (
NULL, NULL,
'es-es', 'es-es',
(SELECT id from office WHERE email='centrodestrezas@gmail.com'), (SELECT id from office WHERE email='centrodestrezas@gmail.com'),
'{"stu-att":[{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}]}' '{"categories":"on","input feedback":["vibration","tts"],"input selection":"click","pictogram size":"medium"}'
); );
INSERT IGNORE INTO `stu_picto` ( INSERT IGNORE INTO `stu_picto` (
......
...@@ -58,6 +58,14 @@ ...@@ -58,6 +58,14 @@
target: "{{ server_path }}/{{ database_files_relative_path }}/test-{{ item }}.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/test-{{ item }}.sql"
with_items: "{{ database_tests }}" with_items: "{{ database_tests }}"
- name: Create scenes for existing stu_picto
mysql_db:
login_user: "{{ database_user }}"
login_password: "{{ database_user_passwd }}"
name: "{{ database_name }}"
state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/scene_adapt.sql"
- name: Creates triggers - name: Creates triggers
mysql_db: mysql_db:
login_user: "{{ database_user }}" login_user: "{{ database_user }}"
......
...@@ -44,14 +44,29 @@ module.exports = { ...@@ -44,14 +44,29 @@ module.exports = {
delete scene.categories;//To avoid update these fields delete scene.categories;//To avoid update these fields
delete scene.supervisor; delete scene.supervisor;
delete scene.student; delete scene.student;
scene.name = req.param('name') || instruction.name; scene.name = req.param('name') || scene.name;
scene.active = req.param('active') || instruction.active; scene.active = req.param('active') || scene.active;
scene.save(function (error) { scene.save(function (error) {
if (error) { if (error) {
res.serverError(); res.serverError();
} else { } else {
res.ok(scene); res.ok(scene);
} }
if(scene.active){
Student.findOne({id:scene.student})
.then(student => {
student.attributes.categories=scene.categories;
delete student.password;
student.save(function(error){
if(error){
res.serverError("Error saving student data");
}
else{
return res.ok(scene);
}
})
});
}
}); });
}) })
.catch(function () { .catch(function () {
...@@ -100,6 +115,74 @@ module.exports = { ...@@ -100,6 +115,74 @@ module.exports = {
}).catch(function (err){ }).catch(function (err){
return res.serverError("Error finding scene "+err); return res.serverError("Error finding scene "+err);
}); });
} },
/**
* Copies a scene with its stu_pictos
* @param {request} req {} (id of source scene)
*/
duplicate: function(req,res){
Scene.findOne({id:req.params.id})
.populate('stuPictos').then(function(scene){
Scene.create({
name: scene.name,
active: false,
categories: scene.categories,
supervisor: scene.supervisor,
student: scene.student
}).then(scene=>{
async.forEach(scene.stuPictos, function (stuPicto, cb) {
StuPicto.create({
student: stuPicto.student,
picto: stuPicto.picto,
scene: scene.id,
attributes: stuPicto.attributes
}).catch(function (err){
console.log("Error creating stu_picto "+err.details);
sails.log.error(err.details);
});
},
function (err) { // function called when loop is done
if (err) {
console.log(err.details);
sails.log.error(err.details);
return res.json({
'error': err.details
});
} else
return res.ok(scene);
});
}).catch(function (err){
return res.serverError("Error creating scene: " + err);
});
});
},
//
// Logs a scene action and broadcast to anyone subscribed to this student
scene: function (req, res) {
var action = req.param('action');
var scene = req.param('scene');
var roomName = 'studentRoom' + scene.student;
if (req.isSocket) {
sails.log.debug("Inside scene - isSocket");
// Send to all sockets subscribed to this room except the own socket that sends the message
// Parameters: room, action, data to send, socket to avoid sending (the socket that send this)
sails.sockets.broadcast(roomName, 'scene', {
"action": action,
"scene": scene
}, req.socket);
res.json({
msg: "Action " + action + " in scene " + scene.id + " from student " + scene.student
});
}
},
}; };
...@@ -892,8 +892,9 @@ module.exports = { ...@@ -892,8 +892,9 @@ module.exports = {
/** /**
* Add an existing picto to the student's collection * Add an existing picto to the student's collection
* @param {request} req (with id_stu and id_picto as url parameters) * @param {request} req (with id_scene,id_stu and id_picto as url parameters)
* { * {
* id_scene,
* id_stu, * id_stu,
* id_picto, * id_picto,
* attributes: { @see StuPicto.getValidAttributes() } * attributes: { @see StuPicto.getValidAttributes() }
...@@ -928,7 +929,7 @@ module.exports = { ...@@ -928,7 +929,7 @@ module.exports = {
add_picto: function (req, res) { add_picto: function (req, res) {
var params = req.allParams(); var params = req.allParams();
StuPicto.find({id_pic: params.id_picto, id_stu: params.id_stu}) StuPicto.find({id_pic: params.id_picto, id_stu: params.id_stu, id_scene:params.id_scene})
.then((entries) => { .then((entries) => {
if (entries && entries.length > 0) { if (entries && entries.length > 0) {
var err = new Error("Picto already in student's vocabulary"); var err = new Error("Picto already in student's vocabulary");
......
...@@ -147,6 +147,22 @@ module.exports = function eventsHook(sails) { ...@@ -147,6 +147,22 @@ module.exports = function eventsHook(sails) {
attributes: attributes attributes: attributes
} }
}; };
},
/**
* Scene is updated
* @param {action} type of the action
* @param {attributes} attributes of the action (id_stu, stu_picto)
* @return {Object} {name, data}
*/
scene: function (action, scene) {
return {
name: 'scene',
data: {
scene: scene,
action: action
}
};
} }
}; };
}; };
...@@ -56,7 +56,6 @@ module.exports = { ...@@ -56,7 +56,6 @@ module.exports = {
pictos: function(id_scene, callback) { pictos: function(id_scene, callback) {
var l = []; var l = [];
var fs = require('fs'); var fs = require('fs');
console.log("metodo pictos scene");
Scene.findOne(id_scene) Scene.findOne(id_scene)
.then((scene) => { .then((scene) => {
if (!scene) if (!scene)
......
...@@ -48,6 +48,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -48,6 +48,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$scope.freeCategoryPictos = null; $scope.freeCategoryPictos = null;
$scope.loadingPictos = true; $scope.loadingPictos = true;
$scope.viewingScene = null; $scope.viewingScene = null;
$scope.scenesList = null;
$scope.isCategory = function (studentPicto) { $scope.isCategory = function (studentPicto) {
return studentPicto.attributes.id_cat === null && return studentPicto.attributes.id_cat === null &&
...@@ -119,27 +120,60 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -119,27 +120,60 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
} }
}; };
// Reload student pictos (back from addpicto) // get active scene
$scope.loadPictos = function () { $scope.showActiveScene = function (scene) {
$scope.loadingPictos = true;
// Fill with grid (if not done before)
$scope.freeCategoryPictos = $scope.freeCategoryPictos || generateGrid(); $scope.freeCategoryPictos = $scope.freeCategoryPictos || generateGrid();
$scope.studentPictos[$scope.getCategoryId($scope.selectedCategory)] = $scope.studentPictos[$scope.getCategoryId($scope.selectedCategory)] =
$scope.studentPictos[$scope.getCategoryId($scope.selectedCategory)] || generateGrid(); $scope.studentPictos[$scope.getCategoryId($scope.selectedCategory)] || generateGrid();
// Get user's pictos
$http.get(config.backend + '/stu/' + $scope.studentData.id + '/activeScene') $http.get(config.backend + '/stu/' + $scope.studentData.id + '/activeScene')
.success(function (activeScene) { .success(function (activeScene) {
$scope.showFreeCategory = !$scope.studentData.attributes.categories; $scope.showFreeCategory = !activeScene.categories;
$scope.viewingScene = activeScene.id; $scope.viewingScene = activeScene;
activeScene.pictos.forEach(placePicto); activeScene.pictos.forEach(placePicto);
//studentPictos.forEach(placePicto); $scope.loadingPictos = false;
//setTimeout(function () { $scope.$apply(); });
})
.error(function () {
$translate('error_loading_scene').then(function (translation) {
ngToast.danger({ content: translation });
});
});
};
// get active scene
$scope.showScene = function (idScene) {
$scope.loadingPictos = true;
$scope.freeCategoryPictos = $scope.freeCategoryPictos || generateGrid();
$scope.studentPictos[$scope.getCategoryId($scope.selectedCategory)] =
$scope.studentPictos[$scope.getCategoryId($scope.selectedCategory)] || generateGrid();
$http.get(config.backend + '/scene/' + idScene)
.success(function (scene) {
$scope.showFreeCategory = !scene.categories;
$scope.viewingScene = scene;
scene.pictos.forEach(placePicto);
$scope.loadingPictos = false; $scope.loadingPictos = false;
setTimeout(function () { $scope.$apply(); }); //setTimeout(function () { $scope.$apply(); });
}) })
.error(function () { .error(function () {
$translate('error_loading_pictos').then(function (translation) { $translate('error_loading_scene').then(function (translation) {
ngToast.danger({ content: translation });
});
});
};
// get active scene
$scope.loadScenesList = function () {
$http.get(config.backend + '/stu/' + $scope.studentData.id +'/scenes')
.success(function (scenes) {
$scope.scenesList = scenes;
//setTimeout(function () { $scope.$apply(); });
})
.error(function () {
$translate('error_loading_scenes').then(function (translation) {
ngToast.danger({ content: translation }); ngToast.danger({ content: translation });
}); });
}); });
...@@ -169,6 +203,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -169,6 +203,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
action: 'delete', action: 'delete',
attributes: { attributes: {
id_stu: $scope.studentData.id, id_stu: $scope.studentData.id,
id_scene: $scope.viewingScene.id,
stu_picto: studentPicto stu_picto: studentPicto
} }
}, function () {}); }, function () {});
...@@ -182,6 +217,92 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -182,6 +217,92 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
}); });
}; };
// Delete student scene, if is not active
//If scene is viewingScene, load activeScene
$scope.delete_scene = function (idScene) {
var active = false;
var viewing = idScene == $scope.viewingScene.id;
for(var i=0; i<$scope.scenesList; i++){
if($scope.scenesList[i].id == idScene){
active=$scope.scenesList[i].active;
}
}
$translate('confirmation').then(t => {
if ($window.confirm(t)) {
if(!active){
$http.delete(config.backend + '/scene/' + idScene)
.success(function () {
io.socket.post('/scene', {
action: 'delete',
data: {id:idScene}
}, function () {});
if(viewing){
$scope.showActiveScene();
}
$scope.loadScenesList();
$translate('scene_deleted').then(function (translation) {
ngToast.success({ content: translation });
});
}).error(function () {
$translate('scene_already_deleted').then(function (translation) {
ngToast.warning({ content: translation });
});
});
}else{
$translate('cant_delete_active_scene').then(function (translation) {
ngToast.warning({ content: translation });
});
}
}
});
};
// Delete student picto
$scope.update_scene = function (scene) {
$http.put(config.backend + '/scene/' + scene.id, {
name: scene.name,
active: scene.active})
.success(function () {
var data= {name: scene.name,
active: scene.active,
categories: scene.categories,
student: scene.student,
supervisor: scene.supervisor};
io.socket.post('/scene', {
action: 'update',
scene: data
}, function () {});
$translate('scene_updated').then(function (translation) {
ngToast.success({ content: translation });
});
}).error(function () {});
};
// Duplicate viewing scene
$scope.copy_scene = function () {
$http.get(config.backend + '/scene/'+$scope.viewingScene.id+'/copy' )
.success(function (newScene) {
io.socket.post('/scene', {
action: 'add',
data: newScene
}, function () {});
$scope.loadScenesList();
$translate('scene_duplicated').then(function (translation) {
ngToast.success({ content: translation });
});
}).error(function () {});
};
$scope.deleteFreePicto = function (studentPicto) { $scope.deleteFreePicto = function (studentPicto) {
$translate('confirmation').then(t => { $translate('confirmation').then(t => {
if ($window.confirm(t)) { if ($window.confirm(t)) {
...@@ -195,6 +316,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -195,6 +316,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
action: 'delete', action: 'delete',
attributes: { attributes: {
id_stu: $scope.studentData.id, id_stu: $scope.studentData.id,
id_scene: $scope.viewingScene.id,
stu_picto: studentPicto stu_picto: studentPicto
} }
}, function () {}); }, function () {});
...@@ -226,6 +348,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -226,6 +348,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
action: 'update', action: 'update',
attributes: { attributes: {
id_stu: $scope.studentData.id, id_stu: $scope.studentData.id,
id_scene: $scope.viewingScene.id,
stu_picto: newStuPicto stu_picto: newStuPicto
} }
}, function () {}); }, function () {});
...@@ -288,6 +411,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -288,6 +411,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
action: 'update', action: 'update',
attributes: { attributes: {
id_stu: $scope.studentData.id, id_stu: $scope.studentData.id,
id_scene: $scope.viewingScene.id,
stu_picto: newStudentPicto stu_picto: newStudentPicto
} }
}, function () { }, function () {
...@@ -333,13 +457,14 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -333,13 +457,14 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
new_id_pic: pictoId new_id_pic: pictoId
}) })
.success(function (studentPicto) { .success(function (studentPicto) {
$scope.loadPictos(); $scope.showScene($scope.viewingScene.id);
// notify // notify
io.socket.post('/stu/vocabulary', { io.socket.post('/stu/vocabulary', {
action: 'update_category', action: 'update_category',
attributes: { attributes: {
id_stu: $scope.studentData.id, id_stu: $scope.studentData.id,
id_scene: $scope.viewingScene.id,
stu_picto: studentPicto stu_picto: studentPicto
} }
}, function () {}); }, function () {});
...@@ -388,7 +513,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -388,7 +513,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
free_category_coord_x: $scope.showFreeCategory ? col : null, free_category_coord_x: $scope.showFreeCategory ? col : null,
free_category_coord_y: $scope.showFreeCategory ? row : null free_category_coord_y: $scope.showFreeCategory ? row : null
}, },
id_scene: $scope.viewingScene id_scene: $scope.viewingScene.id
}) })
.success(function (studentPicto) { .success(function (studentPicto) {
placePicto(studentPicto); placePicto(studentPicto);
...@@ -397,6 +522,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -397,6 +522,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
action: 'add', action: 'add',
attributes: { attributes: {
id_stu: $scope.studentData.id, id_stu: $scope.studentData.id,
id_scene: $scope.viewingScene.id,
stu_picto: studentPicto stu_picto: studentPicto
} }
}, function () {}); }, function () {});
...@@ -408,9 +534,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -408,9 +534,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
else else
ngToast.danger({ content: $translate.instant('error_adding_picto') }); ngToast.danger({ content: $translate.instant('error_adding_picto') });
}); });
// not needed
// $scope.loadPictos();
}); });
}; };
...@@ -462,23 +585,31 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -462,23 +585,31 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Add new listener to the event // Add new listener to the event
io.socket.off('vocabulary'); io.socket.off('vocabulary');
io.socket.on('vocabulary', function (data) { io.socket.on('vocabulary', function (data) {
switch (data.action) { // switch (data.action) {
case 'add': // case 'add':
$scope.loadPictos(); // $scope.loadPictos();
break; // break;
case 'update': // case 'update':
$scope.loadPictos(); // $scope.loadPictos();
break; // break;
case 'delete': // case 'delete':
$scope.loadPictos(); // $scope.loadPictos();
break; // break;
default: // default:
$scope.loadPictos(); // $scope.loadPictos();
break; // break;
// }
if(data.attributes.id_scene == $scope.viewingScene.id){
//Reload scene
$translate('reload_scene').then(function (translation) {
ngToast.success({ content: translation });
});
$scope.showScene(data.attributes.id_scene);
} }
$scope.$apply(); $scope.$apply();
}); });
// Load pictos // Load pictos
$scope.loadPictos(); $scope.showActiveScene();
$scope.loadScenesList();
}); });
<!-- Collection tab--> <!-- Collection tab-->
<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">
<div class="col-md-6"> <div class="col-md-6">
<a class="btn btn-success btn-sm" role="button" ng-click="open()"> <a class="btn btn-success btn-sm" role="button" ng-click="open()">
...@@ -10,60 +10,147 @@ ...@@ -10,60 +10,147 @@
</a> </a>
</div> </div>
</div> </div>
--> -->
<div <div class="col-xs-10"><!-- col-xs-10 -->
id="student_collection" <div id="student_collection"
class="student-collection" class="student-collection"
ng-class="{ 'student-collection-loading': loadingPictos }" ng-class="{ 'student-collection-loading': loadingPictos }"
data-loading="{{ 'loading_pictos' | translate }}"> data-loading="{{ 'loading_pictos' | translate }}">
<!-- No categories grid --> <!-- No categories grid -->
<div
ng-if="showFreeCategory"
class="picto-grid picto-free-grid">
<div <div
ng-repeat="studentPictoRow in freeCategoryPictos" ng-if="showFreeCategory"
ng-init="rowIndex = $index" class="picto-grid picto-free-grid">
class="picto-grid__row">
<div <div
class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};" ng-repeat="studentPictoRow in freeCategoryPictos"
data-row="{{ rowIndex }}" ng-init="rowIndex = $index"
data-column="{{ colIndex }}" class="picto-grid__row">
id="student-picto-{{
studentPicto.id ||
('empty-' + colIndex + '-' + rowIndex)
}}"
draggable droppable drop="handleDrop"
popover="{{studentPicto != emptyStudentPicto ? studentPicto.attributes.expression : ''}}"
popover-trigger="mouseenter"
ng-init="colIndex = $index"
ng-repeat="studentPicto in studentPictoRow track by $index">
<!-- picto-legend -->
<div <div
class="picto-legend-normal" class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};"
ng-if="studentPicto.attributes.legend == 'normal'"> data-row="{{ rowIndex }}"
{{ studentPicto.attributes.expression }} data-column="{{ colIndex }}"
</div> id="student-picto-{{
<div studentPicto.id ||
class="picto-legend-full" ('empty-' + colIndex + '-' + rowIndex)
ng-if="studentPicto.attributes.legend == 'full'"> }}"
{{ studentPicto.attributes.expression }} draggable droppable drop="handleDrop"
popover="{{studentPicto != emptyStudentPicto ? studentPicto.attributes.expression : ''}}"
popover-trigger="mouseenter"
ng-init="colIndex = $index"
ng-repeat="studentPicto in studentPictoRow track by $index">
<!-- picto-legend -->
<div
class="picto-legend-normal"
ng-if="studentPicto.attributes.legend == 'normal'">
{{ studentPicto.attributes.expression }}
</div>
<div
class="picto-legend-full"
ng-if="studentPicto.attributes.legend == 'full'">
{{ studentPicto.attributes.expression }}
</div>
<!-- /.picto-legend -->
<img
src="/app/img/redcross.png"
class="red-cross-visibility disabled"
ng-if="studentPicto.attributes.status == 'disabled'"/>
<img
ng-src="{{studentPicto.picto.uri}}"
class="unselectable"
ng-class="{
'novisible': studentPicto.attributes.status == 'invisible',
'deactivate': studentPicto.attributes.status == 'disabled'
}"
ng-style="{
'background-color': studentPicto.attributes.color || '#ffffff'
}"/>
<div
class="picto_options"
ng-if="studentPicto == emptyStudentPicto">
<a
ng-click="open_add(rowIndex, colIndex)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a>
</div>
<div
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto">
<a
ng-click="deleteFreePicto(studentPicto)"
class="picto_remove"
title="{{ 'delete' | translate}}">
<i class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></i>
</a>
<a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i ng-class="{
color_green: studentPicto.attributes.status == 'invisible',
color_black: studentPicto.attributes.status == 'enabled'
}"
class="glyphicon glyphicon-eye-open"
aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}">
</i>
</a>
<a
class="picto_tags"
ng-click="open_tags(studentPicto)">
<i class="glyphicon glyphicon-tags" aria-hidden="true"></i>
</a>
<a
class="picto_config"
ng-click="open_config(studentPicto)">
<i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
</a>
</div>
</div> </div>
<!-- /.picto-legend --> <div class="clearfix"></div>
<img </div>
src="/app/img/redcross.png" </div>
class="red-cross-visibility disabled" <!-- / No categories grid -->
ng-if="studentPicto.attributes.status == 'disabled'"/> <!-- Main categories grid -->
<img <div
ng-src="{{studentPicto.picto.uri}}" ng-if="!showFreeCategory"
class="unselectable" class="picto-grid picto-main-grid">
ng-class="{ <div
'novisible': studentPicto.attributes.status == 'invisible', ng-repeat="studentPictoRow in studentPictos[getCategoryId(emptyStudentPicto)]"
'deactivate': studentPicto.attributes.status == 'disabled' ng-init="rowIndex = $index"
}" class="picto-grid__row">
ng-style="{
'background-color': studentPicto.attributes.color || '#ffffff'
}"/>
<div <div
class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};"
ng-repeat="studentPicto in studentPictoRow track by $index"
ng-init="colIndex = $index"
popover="{{ studentPicto != emptyStudentPicto ? studentPicto.attributes.expression : ''}}"
popover-trigger="mouseenter">
<!-- picto-legend -->
<div
class="picto-legend-normal"
ng-if="studentPicto.attributes.legend == 'normal'">
{{ studentPicto.attributes.expression }}
</div>
<div
class="picto-legend-full"
ng-if="studentPicto.attributes.legend == 'full'">
{{ studentPicto.attributes.expression }}
</div>
<!-- /.picto-legend -->
<img
src="/app/img/redcross.png"
class="red-cross-visibility disabled"
ng-if="studentPicto.attributes.status == 'disabled'"/>
<img
ng-src="{{studentPicto.picto.uri}}"
class="unselectable"
ng-click="show_category(studentPicto)"
ng-class="{
'novisible': studentPicto.attributes.status == 'invisible',
'deactivate': studentPicto.attributes.status == 'disabled'
}"
ng-style="{
'background-color': studentPicto.attributes.color
}"/>
<div
class="picto_options" class="picto_options"
ng-if="studentPicto == emptyStudentPicto"> ng-if="studentPicto == emptyStudentPicto">
<a <a
...@@ -72,250 +159,197 @@ ...@@ -72,250 +159,197 @@
title="{{ 'add_picto' | translate}}"> title="{{ 'add_picto' | translate}}">
<i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i> <i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a> </a>
</div>
<div
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y != '0'">
<a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i
ng-class="{
color_green: studentPicto.attributes.status == 'invisible',
color_black: studentPicto.attributes.status == 'enabled'
}"
class="glyphicon glyphicon-eye-open"
aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}"></i>
</a>
<a
ng-click="change_category(studentPicto)"
ng-if="studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y != '0'"
class="picto_cat_edit">
<i
class="glyphicon glyphicon-picture" aria-hidden="true"
title="{{ 'change_cat_picto' | translate}}">
</i>
</a>
</div>
<div
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y == '0'">
<a
ng-click="delete_picto(studentPicto)"
class="picto_remove"
title="{{ 'delete' | translate}}">
<i class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></i>
</a>
<a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i ng-class="{
color_green: studentPicto.attributes.status == 'invisible',
color_black: studentPicto.attributes.status == 'enabled'
}"
class="glyphicon glyphicon-eye-open"
aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}">
</i>
</a>
<a
class="picto_tags"
ng-click="open_tags(studentPicto)">
<i class="glyphicon glyphicon-tags" aria-hidden="true"></i>
</a>
<a
class="picto_config"
ng-click="open_config(studentPicto)">
<i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
</a>
</div>
</div> </div>
<div <div class="clearfix"></div>
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto">
<a
ng-click="deleteFreePicto(studentPicto)"
class="picto_remove"
title="{{ 'delete' | translate}}">
<i class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></i>
</a>
<a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i ng-class="{
color_green: studentPicto.attributes.status == 'invisible',
color_black: studentPicto.attributes.status == 'enabled'
}"
class="glyphicon glyphicon-eye-open"
aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}">
</i>
</a>
<a
class="picto_tags"
ng-click="open_tags(studentPicto)">
<i class="glyphicon glyphicon-tags" aria-hidden="true"></i>
</a>
<a
class="picto_config"
ng-click="open_config(studentPicto)">
<i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
</a>
</div>
</div> </div>
<div class="clearfix"></div>
</div> </div>
</div> <!-- / Main categories grid -->
<!-- / No categories grid --> <!-- Category grid -->
<!-- Main categories grid --> <a name="picto-category-grid"/>
<div
ng-if="!showFreeCategory"
class="picto-grid picto-main-grid">
<div <div
ng-repeat="studentPictoRow in studentPictos[getCategoryId(emptyStudentPicto)]" id="picto-category-grid"
ng-init="rowIndex = $index" class="picto-grid picto-category-grid"
class="picto-grid__row"> ng-if="selectedCategory !== emptyStudentPicto && !showFreeCategory"
ng-style="{ 'background-color': shadeColor(selectedCategory.attributes.color, 0.3) }">
<h3 class="picto-category-grid__title">{{ selectedCategory.attributes.expression }}</h3>
<div <div
class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};" ng-repeat="studentPictoRow in studentPictos[getCategoryId(selectedCategory)]"
ng-repeat="studentPicto in studentPictoRow track by $index" ng-init="rowIndex = $index"
ng-init="colIndex = $index" class="picto-grid__row">
popover="{{ studentPicto != emptyStudentPicto ? studentPicto.attributes.expression : ''}}"
popover-trigger="mouseenter">
<!-- picto-legend -->
<div <div
class="picto-legend-normal" class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};"
ng-if="studentPicto.attributes.legend == 'normal'"> data-row="{{ rowIndex }}"
{{ studentPicto.attributes.expression }} data-column="{{ colIndex }}"
id="student-picto-{{
studentPicto.id ||
('empty-' + colIndex + '-' + rowIndex)
}}"
draggable droppable drop="handleDrop"
popover="{{ studentPicto != emptyStudentPicto ? studentPicto.attributes.expression : '' }}"
popover-trigger="mouseenter"
ng-repeat="studentPicto in studentPictoRow track by $index"
ng-init="colIndex = $index">
<!-- picto-legend -->
<div
class="picto-legend-normal"
ng-if="studentPicto.attributes.legend == 'normal'">
{{ studentPicto.attributes.expression }}
</div>
<div
class="picto-legend-full"
ng-if="studentPicto.attributes.legend == 'full'">
{{ studentPicto.attributes.expression }}
</div>
<!-- /.picto-legend -->
<img
src="/app/img/redcross.png"
class="red-cross-visibility disabled"
ng-if="studentPicto.attributes.status == 'disabled'"/>
<img
ng-src="{{studentPicto.picto.uri}}"
class="unselectable"
ng-class="{
'novisible': studentPicto.attributes.status == 'invisible',
'deactivate': studentPicto.attributes.status == 'disabled'
}"
ng-style="{
'background-color': studentPicto.attributes.color || '#ffffff'
}"
/>
<div
class="picto_options"
ng-if="studentPicto == emptyStudentPicto">
<a
ng-click="open_add(rowIndex, colIndex)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a>
</div>
<div
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto">
<a
ng-click="delete_picto(studentPicto)"
class="picto_remove"
title="{{ 'delete' | translate}}">
<i class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></i>
</a>
<a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i ng-class="{
color_green: studentPicto.attributes.status == 'invisible',
color_black: studentPicto.attributes.status == 'enabled'
}"
class="glyphicon glyphicon-eye-open"
aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}">
</i>
</a>
<a
class="picto_tags"
ng-click="open_tags(studentPicto)">
<i class="glyphicon glyphicon-tags" aria-hidden="true"></i>
</a>
<a
class="picto_config"
ng-click="open_config(studentPicto)">
<i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
</a>
</div>
</div> </div>
<div <div class="clearfix"></div>
class="picto-legend-full"
ng-if="studentPicto.attributes.legend == 'full'">
{{ studentPicto.attributes.expression }}
</div>
<!-- /.picto-legend -->
<img
src="/app/img/redcross.png"
class="red-cross-visibility disabled"
ng-if="studentPicto.attributes.status == 'disabled'"/>
<img
ng-src="{{studentPicto.picto.uri}}"
class="unselectable"
ng-click="show_category(studentPicto)"
ng-class="{
'novisible': studentPicto.attributes.status == 'invisible',
'deactivate': studentPicto.attributes.status == 'disabled'
}"
ng-style="{
'background-color': studentPicto.attributes.color
}"/>
<div
class="picto_options"
ng-if="studentPicto == emptyStudentPicto">
<a
ng-click="open_add(rowIndex, colIndex)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a>
</div>
<div
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y != '0'">
<a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i
ng-class="{
color_green: studentPicto.attributes.status == 'invisible',
color_black: studentPicto.attributes.status == 'enabled'
}"
class="glyphicon glyphicon-eye-open"
aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}"></i>
</a>
<a
ng-click="change_category(studentPicto)"
ng-if="studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y != '0'"
class="picto_cat_edit">
<i
class="glyphicon glyphicon-picture" aria-hidden="true"
title="{{ 'change_cat_picto' | translate}}">
</i>
</a>
</div>
<div
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y == '0'">
<a
ng-click="delete_picto(studentPicto)"
class="picto_remove"
title="{{ 'delete' | translate}}">
<i class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></i>
</a>
<a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i ng-class="{
color_green: studentPicto.attributes.status == 'invisible',
color_black: studentPicto.attributes.status == 'enabled'
}"
class="glyphicon glyphicon-eye-open"
aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}">
</i>
</a>
<a
class="picto_tags"
ng-click="open_tags(studentPicto)">
<i class="glyphicon glyphicon-tags" aria-hidden="true"></i>
</a>
<a
class="picto_config"
ng-click="open_config(studentPicto)">
<i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
</a>
</div>
</div> </div>
<div class="clearfix"></div>
</div> </div>
<!-- / Category grid -->
</div> </div>
<!-- / Main categories grid --> </div><!--/. col-xs-10 -->
<!-- Category grid -->
<a name="picto-category-grid"/>
<div
id="picto-category-grid"
class="picto-grid picto-category-grid"
ng-if="selectedCategory !== emptyStudentPicto && !showFreeCategory"
ng-style="{ 'background-color': shadeColor(selectedCategory.attributes.color, 0.3) }">
<h3 class="picto-category-grid__title">{{ selectedCategory.attributes.expression }}</h3>
<div
ng-repeat="studentPictoRow in studentPictos[getCategoryId(selectedCategory)]"
ng-init="rowIndex = $index"
class="picto-grid__row">
<div
class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};"
data-row="{{ rowIndex }}"
data-column="{{ colIndex }}"
id="student-picto-{{
studentPicto.id ||
('empty-' + colIndex + '-' + rowIndex)
}}"
draggable droppable drop="handleDrop"
popover="{{ studentPicto != emptyStudentPicto ? studentPicto.attributes.expression : '' }}"
popover-trigger="mouseenter"
ng-repeat="studentPicto in studentPictoRow track by $index"
ng-init="colIndex = $index">
<!-- picto-legend -->
<div
class="picto-legend-normal"
ng-if="studentPicto.attributes.legend == 'normal'">
{{ studentPicto.attributes.expression }}
</div> <div class="col-xs-2">
<div <div class="text-center">
class="picto-legend-full" <h4>{{ viewingScene.name }}<h4>
ng-if="studentPicto.attributes.legend == 'full'"> <a style="text-decoration:none" popover="Escena ya activada" popover-trigger="mouseenter" ng-if="viewingScene.active"><span class="label label-success"><i class="fa fa-star" aria-hidden="true"></i> Escena activa</span></a>
{{ studentPicto.attributes.expression }} <a style="text-decoration:none" popover="Activar escena" popover-trigger="mouseenter" ng-if="!viewingScene.active" ng-click="viewingScene.active=true;update_scene(viewingScene)"><span class="label label-default"><i class="fa fa-star-o" aria-hidden="true"></i> Escena inactiva</span></a>
</div> </div>
<!-- /.picto-legend -->
<img <hr>
src="/app/img/redcross.png"
class="red-cross-visibility disabled" <div class="list-group">
ng-if="studentPicto.attributes.status == 'disabled'"/> <a class="list-group-item" ng-repeat="scene in scenesList" ng-click="showScene(scene.id)" ng-class="(scene.id == viewingScene.id) ? 'active' : ''">
<img <i class="fa fa-star" aria-hidden="true" ng-if="scene.active"></i> {{ scene.name }}
ng-src="{{studentPicto.picto.uri}}" </a>
class="unselectable" </div>
ng-class="{
'novisible': studentPicto.attributes.status == 'invisible', <hr>
'deactivate': studentPicto.attributes.status == 'disabled'
}" <div class="text-center">
ng-style="{ <div class="btn-group text-left">
'background-color': studentPicto.attributes.color || '#ffffff' <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
}" <i class="fa fa-plus" aria-hidden="true"></i>
/> </button>
<div <ul class="dropdown-menu">
class="picto_options" <li><a href="#">Nueva escena con categorías</a></li>
ng-if="studentPicto == emptyStudentPicto"> <li><a href="#">Nueva escena sin categorías</a></li>
<a </ul>
ng-click="open_add(rowIndex, colIndex)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a>
</div>
<div
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto">
<a
ng-click="delete_picto(studentPicto)"
class="picto_remove"
title="{{ 'delete' | translate}}">
<i class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></i>
</a>
<a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i ng-class="{
color_green: studentPicto.attributes.status == 'invisible',
color_black: studentPicto.attributes.status == 'enabled'
}"
class="glyphicon glyphicon-eye-open"
aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}">
</i>
</a>
<a
class="picto_tags"
ng-click="open_tags(studentPicto)">
<i class="glyphicon glyphicon-tags" aria-hidden="true"></i>
</a>
<a
class="picto_config"
ng-click="open_config(studentPicto)">
<i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
</a>
</div>
</div>
<div class="clearfix"></div>
</div> </div>
<button type="button" class="btn btn-primary"ng-click="copy_scene()"><i class="fa fa-files-o" aria-hidden="true"></i></button>
<button type="button" class="btn btn-danger" ng-click="delete_scene(viewingScene.id)"><i class="fa fa-trash" aria-hidden="true"></i></button>
</div> </div>
<!-- / Category grid -->
</div> </div>
</div> </div>
</div> </div>
...@@ -84,8 +84,10 @@ module.exports.policies = { ...@@ -84,8 +84,10 @@ module.exports.policies = {
create: ['tokenAuth', 'isSupervisorOfStudent'], create: ['tokenAuth', 'isSupervisorOfStudent'],
update: ['tokenAuth', 'isSupervisorOfStudent'], update: ['tokenAuth', 'isSupervisorOfStudent'],
destroy: ['tokenAuth', 'isSupervisorOfStudent'], destroy: ['tokenAuth', 'isSupervisorOfStudent'],
duplicate: ['tokenAuth', 'isSupervisorOfStudent'],
getScene: ['tokenAuth'], getScene: ['tokenAuth'],
getStudentScenes: ['tokenAuth'] getStudentScenes: ['tokenAuth'],
scene: true
}, },
ServerController: { ServerController: {
...@@ -124,7 +126,8 @@ module.exports.policies = { ...@@ -124,7 +126,8 @@ module.exports.policies = {
delete: ['tokenAuth', 'isSupAdmin'], delete: ['tokenAuth', 'isSupAdmin'],
unlink_supervisor: ['tokenAuth', 'isSupAdmin'], unlink_supervisor: ['tokenAuth', 'isSupAdmin'],
delete_picto: ['tokenAuth', 'isSupervisorOfStudent'], delete_picto: ['tokenAuth', 'isSupervisorOfStudent'],
getActiveScene: ['tokenAuth'] getActiveScene: ['tokenAuth'],
getScenes: ['tokenAuth']
}, },
LicenseController: { LicenseController: {
......
...@@ -73,7 +73,11 @@ module.exports.routes = { ...@@ -73,7 +73,11 @@ module.exports.routes = {
'DELETE /picto/:id': 'PictoController.destroy', 'DELETE /picto/:id': 'PictoController.destroy',
'DELETE /picto/:id_sup/tag/:id_tag': 'PictoController.del_tag', 'DELETE /picto/:id_sup/tag/:id_tag': 'PictoController.del_tag',
/// Websocket request for propagating actions add, delete, modify...
'POST /scene': 'SceneController.scene',
'GET /scene/:id': 'SceneController.getScene', 'GET /scene/:id': 'SceneController.getScene',
'GET /scene/:id/copy': 'SceneController.duplicate',
'POST /scene/:id': 'SceneController.create', 'POST /scene/:id': 'SceneController.create',
'PUT /scene/:id': 'SceneController.update', 'PUT /scene/:id': 'SceneController.update',
'DELETE /scene/:id': 'SceneController.destroy', 'DELETE /scene/:id': 'SceneController.destroy',
......
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