Commit 2c9a01b0 by Arturo Montejo Ráez

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

parents e1b6287a 252741c0
......@@ -50,6 +50,9 @@ public class Picto extends Img {
public static String EXPRESSION = "expression";
public static String MIRROR = "mirror";
public static String LEGEND = "legend";
public static String URI_SOUND = "uri_sound";
public static String USER_AVATAR = "user_avatar";
public static String ASSOCIATED_PERSON = "associated_person";
}
......@@ -88,7 +91,7 @@ public class Picto extends Img {
Log.e(LOG_TAG,e.getMessage());
}
}
public Picto(int id, String url, String translation, int cat, int row, int column, int freeRow, int freeColumn, int stupicto_id) throws JSONException {
public Picto(int id, String url, String translation, int cat, int row, int column, int freeRow, int freeColumn, int stupicto_id, String uri_sound, String user_avatar, String associated_person) throws JSONException {
this(id, url, new JSONObject()
.put(JSON_ATTTRS.CATEGORY, cat)
.put(JSON_ATTTRS.COLUMN, column)
......@@ -98,7 +101,11 @@ public class Picto extends Img {
.put(JSON_ATTTRS.STATUS, JSON_ATTTR_STATUS_VALUES.ENABLED)
.put(JSON_ATTTRS.LEGEND,JSON_ATTTR_LEGEND_VALUES.NONE)
.put(JSON_ATTTRS.STUPICTO_ID,stupicto_id)
.put(JSON_ATTTRS.EXPRESSION,translation));
.put(JSON_ATTTRS.EXPRESSION,translation)
.put(JSON_ATTTRS.URI_SOUND,uri_sound)
.put(JSON_ATTTRS.USER_AVATAR,user_avatar)
.put(JSON_ATTTRS.ASSOCIATED_PERSON,associated_person)
);
}
public Picto(int id, String url,String translation, String attributes) throws JSONException {
this(id, url, new JSONObject(attributes).put(JSON_ATTTRS.EXPRESSION,translation));
......@@ -106,7 +113,7 @@ public class Picto extends Img {
public Picto(int id, String url, JSONObject attributes) {
super(id,url,Img.VOCABULARY);;
super(id,url,Img.VOCABULARY);
this.attributes = attributes;
try {
if (this.attributes.get(JSON_ATTTRS.CATEGORY)==null)
......@@ -296,6 +303,20 @@ public class Picto extends Img {
/**
*
* @return the associated person of a picto
*/
public String get_associated_person() {
String ass_person = null;
try {
ass_person = this.attributes.getString(JSON_ATTTRS.ASSOCIATED_PERSON);
} catch (JSONException e) {
e.printStackTrace();
}
return ass_person;
}
/**
*
* @return the row of the picto
*/
public int get_row() {
......@@ -341,7 +362,26 @@ public class Picto extends Img {
}
}
/**
*
* @return the uri of associated sound of the picto
*/
public String getUriSound(){
try {
return this.attributes.getString(JSON_ATTTRS.URI_SOUND);
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
/**
*
* @return the associated user avatar of the picto
*/
public String getUserAvatar(){
return this.attributes.optString(JSON_ATTTRS.USER_AVATAR);
}
/**
* A picto is a category iif:
......
......@@ -44,6 +44,7 @@ public class User {
public static String READ="read";
public static String HIGHLIGHT="highlight";
}
private String supervisors;
private Img img_stu;
private String nickname_stu, pwd_stu, name_stu, surname_stu, gender_stu, lang_stu;
private JSONObject attributes_stu;
......@@ -266,7 +267,13 @@ public class User {
}
}
public String get_Supervisors(){
return this.supervisors;
}
public void set_Supervisors(String newSup) {
this.supervisors = newSup;
}
/**
*
* @return delivery method
......
......@@ -301,6 +301,13 @@ public class Vocabulary implements Iterable<Picto> {
return picto;
}
/**
*
* @param pic_cat Category id of the picto
* @param pic_id Id image of the picto
* @description Obtain the id of picto with "picto.get_id()"
* @return
*/
public Picto get_picto(int pic_cat, int pic_id) {
Picto picto=null;
LinkedList<Picto> pictos_cat=this.pictos.get(pic_cat);
......@@ -308,6 +315,7 @@ public class Vocabulary implements Iterable<Picto> {
if (pictos_cat.get(i).get_id()==pic_id) picto=pictos_cat.get(i);
return picto;
}
/**
* It removes de given pic from the user collection
* @param pic_id
......@@ -399,7 +407,7 @@ public class Vocabulary implements Iterable<Picto> {
/*
* It saves locally a new picto obtained from the PCB
*/
public void saveLocalPicto(String url, String exp, int cat, int coord_x, int coord_y, int free_category_coord_x, int free_category_coord_y, final iLocalPicto listener) {
public void saveLocalPicto(String url, String exp, int cat, int coord_x, int coord_y, int free_category_coord_x, int free_category_coord_y,String uri_sound,String user_avatar,String associated_person, final iLocalPicto listener) {
Picto prev_picto=find_picto(cat, coord_x,coord_y); //¿estamos reemplazanddo un picto que ya existe?
......@@ -411,7 +419,7 @@ public class Vocabulary implements Iterable<Picto> {
int id=PCBcontext.getDevice().getNextLocalPictoID();
try {
final Picto picto = new Picto(id, url, exp, cat, coord_x, coord_y, free_category_coord_x, free_category_coord_y, prev_picto!=null ? prev_picto.get_stupicto_id() : Picto.STUPICTO_NULL);
final Picto picto = new Picto(id, url, exp, cat, coord_x, coord_y, free_category_coord_x, free_category_coord_y,prev_picto!=null ? prev_picto.get_stupicto_id() : Picto.STUPICTO_NULL,uri_sound,user_avatar,associated_person);
addPicto(picto, ImgDownloader.tsource.local, new ImgDownloader.iImgDownloaderListener() {
@Override
public void loadComplete() {
......
......@@ -50,7 +50,7 @@ public class PictoUploader {
bmp=img.get_bitmap(PCBcontext.getContext());
Log.i(LOG_TAG, "Uploading Picto img " + img.file_name() + " from " + img.get_type() + "- Size:" + bmp.getWidth() + " " + bmp.getHeight());
/*Log.i(LOG_TAG, "Uploading Picto img " + img.file_name() + " from " + img.get_type() + "- Size:" + bmp.getWidth() + " " + bmp.getHeight());*/
File file = img.file(PCBcontext.getContext());
......
......@@ -26,7 +26,11 @@ import static android.graphics.Color.argb;
public class PictoMenu {
private static final String LOG_TAG = PictoMenu.class.getName();
public static final String ID_PICTO_IMAGE = "id_imagen_picto";
public static final String IS_EDIT = "is_edit";
public static final String PATH = "pathImage";
public static final String IMAGE_PICTO = "imagePicto";
PictogramActivity activity;
//Variables used on the picto menu (only supervisors)
......@@ -50,9 +54,8 @@ public class PictoMenu {
*
* @param row
* @param col
* @param expression
*/
public void createMenuForNewPicto(final int row, final int col, final int cat, final String expression) {
public void createMenuForNewPicto(final int row, final int col, final int cat) {
ll = new RelativeLayout(PCBcontext.getContext());
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
......@@ -75,16 +78,14 @@ public class PictoMenu {
PieMenu.setCenterCircle(new Close());
PieMenu.addMenuEntry(new newPickFromCamera(row,col,cat,expression));
PieMenu.addMenuEntry(new newPickFromGallery(row,col,cat,expression));
PieMenu.addMenuEntry(new newPickFromCamera(row,col,cat/*,expression*/));
PieMenu.addMenuEntry(new newPickFromGallery(row,col,cat/*,expression*/));
ll.addView(PieMenu);
}
public void addPicto(int row, int col, int cat, String expression, int source) {
activity.getIntent().putExtra(Picto.JSON_ATTTRS.EXPRESSION, expression);
public void addPicto(int row, int col, int cat, int source) {
//Enviar al PictogramActivity los datos necesarios para crear el picto despues
if (PCBcontext.getPcbdb().getCurrentUser().has_categories()) {
activity.getIntent().putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
......@@ -95,7 +96,7 @@ public class PictoMenu {
activity.getIntent().putExtra(Picto.JSON_ATTTRS.FREE_COLUMN, col);
}
if (source== 0) { //Pick from camera
if (source == 0) { //Pick from camera
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
activity.startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
} else { //Pick from file
......@@ -107,10 +108,10 @@ public class PictoMenu {
}
public void setPicto(int row, int col, int cat, String expression, Bitmap bitmap){
public void setPicto(int row, int col, int cat, Bitmap bitmap, int id_picto){
Intent intent = new Intent(activity, EditPictoActivity.class);
intent.putExtra(ID_PICTO_IMAGE,id_picto);
intent.putExtra(Picto.JSON_ATTTRS.EXPRESSION, expression);
//Enviar al PictogramActivity los datos necesarios para editar el picto despues
if (PCBcontext.getPcbdb().getCurrentUser().has_categories()) {
intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
......@@ -121,24 +122,11 @@ public class PictoMenu {
intent.putExtra(Picto.JSON_ATTTRS.FREE_COLUMN, col);
}
if(bitmap!=null) {
Point size= GUITools.getScreenSize(activity);
float bWidth = bitmap.getWidth();
float bHeight = bitmap.getHeight();
float factorX=size.x*0.7f/bWidth;
float factorY=size.y*0.7f/bHeight;
float factor= factorY>factorX ? factorX : factorY;
bWidth=bWidth*factor;
bHeight=bHeight*factor;
Bitmap rescaled = Bitmap.createScaledBitmap(bitmap,(int) bWidth, (int) bHeight, true);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
rescaled.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
intent.putExtra(EditPictoActivity.IMAGE_PICTO, byteArray);
}
intent.putExtra("tipo",true);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
intent.putExtra(IMAGE_PICTO, byteArray);
intent.putExtra(IS_EDIT,true);
activity.startActivityForResult(intent,EditPictoActivity.EDIT_PICTO_REQUEST);
}
......@@ -297,67 +285,22 @@ public class PictoMenu {
ll.removeAllViewsInLayout();
try {
setPicto(p.get_row(),p.get_column(),p.get_category(),p.get_translation(),p.get_bitmap(PCBcontext.getContext()));
setPicto(p.get_row(),p.get_column(),p.get_category(),p.get_bitmap(PCBcontext.getContext()),p.get_id());
} catch (IOException e) {
e.printStackTrace();
}
//ll.getChildAt(1).setX(ll.getChildAt(1).getX() + 30);
//children = new ArrayList<>(Arrays.asList(new PickFromCamera(p),new PickFromGallery(p)));
}
public void menuDisabled(){
//ll.getChildAt(1).setX(ll.getChildAt(1).getX() - 30);
}
}
/*public class PickFromCamera implements RadialMenuWidget.RadialMenuEntry
{
Picto p;
public PickFromCamera(Picto picto){
p = picto;
}
public String getName() { return "editText"; }
public String getLabel() { return null; }
public int getIcon() { return R.drawable.camera; }
public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return null; }
public void menuActiviated()
{
ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout();
addPicto(p.get_row(),p.get_column(),p.get_category(),p.get_translation(),0);
}
public void menuDisabled(){}
}
public class PickFromGallery implements RadialMenuWidget.RadialMenuEntry
{
Picto p;
public PickFromGallery(Picto picto){
p = picto;
}
public String getName() { return "editImage"; }
public String getLabel() { return null; }
public int getIcon() { return R.drawable.gallery; }
public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return null; }
public void menuActiviated()
{
ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout();
addPicto(p.get_row(),p.get_column(),p.get_category(),p.get_translation(),1);
}
public void menuDisabled(){}
}*/
public class newPickFromCamera implements RadialMenuWidget.RadialMenuEntry
{
int row,col,cat;
String expression;
public newPickFromCamera(int row, int col,int cat,String expression){
public newPickFromCamera(int row, int col,int cat){
this.row = row;
this.col = col;
this.cat = cat;
this.expression = expression;
}
public String getName() { return ""; }
public String getLabel() { return null; }
......@@ -368,7 +311,7 @@ public class PictoMenu {
ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout();
addPicto(row,col,cat,expression,0);
addPicto(row,col,cat,0);
}
public void menuDisabled(){}
}
......@@ -376,12 +319,10 @@ public class PictoMenu {
public class newPickFromGallery implements RadialMenuWidget.RadialMenuEntry
{
int row,col,cat;
String expression;
public newPickFromGallery(int row, int col,int cat,String expression){
public newPickFromGallery(int row, int col,int cat){
this.row = row;
this.col = col;
this.cat = cat;
this.expression = expression;
}
public String getName() { return ""; }
public String getLabel() { return null; }
......@@ -391,7 +332,7 @@ public class PictoMenu {
{
ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout();
addPicto(row,col,cat,expression,1);
addPicto(row,col,cat,1);
}
public void menuDisabled(){}
}
......
......@@ -869,7 +869,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
if (p == null) {
// No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device si no es categoria
if (getCurrentCategory() != null || !PCBcontext.getPcbdb().getCurrentUser().has_categories()) {
new PictoMenu(PictogramActivity.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), currentCategory.get_id(),null);
new PictoMenu(PictogramActivity.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), currentCategory.get_id());
} else
Toast.makeText(PictogramActivity.this, PictogramActivity.this.getResources().getString(R.string.notNewCats), Toast.LENGTH_SHORT).show();
......@@ -1127,7 +1127,7 @@ protected void showOnlyTape(boolean onlyTape) {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bitmap imagen = null;
Bitmap imagen;
switch(requestCode) {
case CAMERA_PIC_REQUEST: //Captura de foto
if (data != null && resultCode==RESULT_OK) {
......@@ -1149,18 +1149,24 @@ protected void showOnlyTape(boolean onlyTape) {
break;
case EditPictoActivity.EDIT_PICTO_REQUEST:
if (resultCode == RESULT_OK) {
boolean edit = data.getBooleanExtra("tipo",false);
boolean edit = data.getBooleanExtra(PictoMenu.IS_EDIT,false);
int row = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.ROW) : getIntent().getIntExtra(Picto.JSON_ATTTRS.ROW, -1);
int col = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.COLUMN) : getIntent().getIntExtra(Picto.JSON_ATTTRS.COLUMN, -1);
int freeRow = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.FREE_ROW) : getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_ROW, -1);
int freeColumn = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.FREE_COLUMN) : getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_COLUMN, -1);
String uri_sound = edit ? data.getExtras().getString(Picto.JSON_ATTTRS.URI_SOUND) : getIntent().getStringExtra(Picto.JSON_ATTTRS.URI_SOUND);
String associated_person = edit ? data.getExtras().getString(Picto.JSON_ATTTRS.ASSOCIATED_PERSON) : getIntent().getStringExtra(Picto.JSON_ATTTRS.ASSOCIATED_PERSON);
int cat = edit ? data.getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1) : getIntent().getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1);
String path = data.getExtras().getString(EditPictoActivity.PATH);
String path = data.getExtras().getString(PictoMenu.PATH);
String legend = data.getExtras().getString(Picto.JSON_ATTTRS.EXPRESSION);
chooseTextAndSavePicto(path, row, col, freeRow, freeColumn, cat, legend);
Log.i(EditPictoActivity.DEBUG_MESSAGE,"Antes de chooseText...DATOS--> ASS_PERSON: "+associated_person+"..URI_SOUND: "+uri_sound+"..PATH_IMAGE: "+path+"..EXPRESION: "+legend);
//TODO: COGER URI DEL SONIDO,EL USER AVATAR Y LA PERSONA ASOCIADA AL PICTO
chooseTextAndSavePicto(path, row, col, freeRow, freeColumn, cat, legend, uri_sound, null, associated_person);
refresh();
}
break;
......@@ -1172,7 +1178,7 @@ protected void showOnlyTape(boolean onlyTape) {
* función para la edición de un texto asociado a una nueva imagen y guardar el nuevo picto
*/
public void chooseTextAndSavePicto(final String selectedImagePath, final int row, final int col, final int freeRow, final int freeColumn,
final int category, final String legend) {
final int category, final String legend,final String uri_sound,final String user_avatar, String associated_person) {
// Set up the buttons
int cat = category != -1 ? category : Picto.NO_CATEGORY;
......@@ -1186,6 +1192,9 @@ protected void showOnlyTape(boolean onlyTape) {
col,
freeRow,
freeColumn,
uri_sound,
user_avatar,
associated_person,
new iLocalPicto() {
@Override
public void saved(Picto localPicto) {
......@@ -1207,26 +1216,12 @@ protected void showOnlyTape(boolean onlyTape) {
Intent intent = new Intent(this, EditPictoActivity.class);
if(image!=null) {
Point size=GUITools.getScreenSize(this);
float bWidth = image.getWidth();
float bHeight = image.getHeight();
float factorX=size.x*0.7f/bWidth;
float factorY=size.y*0.7f/bHeight;
float factor= factorY>factorX ? factorX : factorY;
bWidth=bWidth*factor;
bHeight=bHeight*factor;
Bitmap rescaled = Bitmap.createScaledBitmap(image,(int) bWidth, (int) bHeight, true);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
intent.putExtra(PictoMenu.IMAGE_PICTO, byteArray);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
rescaled.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
intent.putExtra(EditPictoActivity.IMAGE_PICTO, byteArray);
startActivityForResult(intent, EditPictoActivity.EDIT_PICTO_REQUEST);
intent.putExtra(Picto.JSON_ATTTRS.EXPRESSION, getIntent().getStringExtra(Picto.JSON_ATTTRS.EXPRESSION));
startActivityForResult(intent, EditPictoActivity.EDIT_PICTO_REQUEST);
}
}
}
......@@ -18,6 +18,7 @@ import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.cropper.EditPictoActivity;
import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools;
......@@ -27,6 +28,8 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
/**
......@@ -80,8 +83,10 @@ public class StudentFragmentGrid extends Fragment{
PCBcontext.set_user(currentUser, null, null);
Intent pictogramActivity = new Intent(getActivity(), PictogramActivity.class);
startActivity(pictogramActivity);
} else
} else {
new_user(i);
download_supervisors(PCBcontext.getPcbdb().getCurrentUser().get_id_stu());
}
}
private void new_user(int i) {
......@@ -90,7 +95,7 @@ public class StudentFragmentGrid extends Fragment{
try {
User new_user = new User(
st.getInt(TAG_ID),
st.getString(TAG_USERNAME),
st.getString(TAG_USERNAME),
null,
st.getString(TAG_NAME),
st.getString(TAG_SURNAME),
......@@ -198,6 +203,47 @@ public class StudentFragmentGrid extends Fragment{
downloader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, imgs);
}
private void download_supervisors(int stu_id) {
String token = getActivity().getIntent().getExtras().getString("token");
RestapiWrapper wrapper = PCBcontext.getRestapiWrapper();
wrapper.setToken(token);
String operation = "stu/" + stu_id + "/supervisors";
wrapper.ask(operation, new RestapiWrapper.iRestapiListener() {
@Override
public void error(RestapiWrapper.HTTPException e) {
Log.e(this.getClass().getName(), " Server restapi error: " + e.getLocalizedMessage());
GUITools.show_alert(getActivity(), R.string.loginErrorTxt, getString(R.string.serverError), new GUITools.iOKListener() {
@Override
public void ok() {
PCBcontext.getNetService().restart_app(false);
}
});
}
@Override
public void preExecute() {
}
@Override
public void result(JSONArray supervisors) {
String supervisorsFormat = "";
for (int i=0;i<supervisors.length();i++) {
JSONObject supervisor;
try {
supervisor = supervisors.getJSONObject(i);
supervisorsFormat += supervisor.get("name") +" " + supervisor.get("surname") + "," + supervisor.get("email") + ";";
} catch (JSONException e) {
e.printStackTrace();
}
}
PCBcontext.getPcbdb().getCurrentUser().set_Supervisors(supervisorsFormat);
}
@Override
public void result(JSONObject result) {
}
});
}
private void download_students(int sup_id ) {
String token = getActivity().getIntent().getExtras().getString("token");
......
......@@ -47,4 +47,6 @@
<string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string>
<string name="uploadingImage">Subiendo imagen al servidor</string>
<string name="cancel">Cancel</string>
<string name="drawer_open">Open Menu</string>
<string name="drawer_close">Close Menu</string>
</resources>
......@@ -7,7 +7,7 @@
TIMESTAMP=`date +"%Y%m%d"`
tar zcf /home/ubuntu/backup/${TIMESTAMP}-sails_src.tgz /home/ubuntu/pictogram/sails/src
mysqldump -u root -p'r00...Tt' pictodb |gzip > /ho:::me/ubuntu/backup/${TIMESTAMP}-mysql.sql.gz
mysqldump -u root -p'r00...Tt' pictodb |gzip > /home/ubuntu/backup/${TIMESTAMP}-mysql.sql.gz
git pull
sudo forever stopall
(cd src; sudo forever start app.js)
......@@ -4,7 +4,7 @@ Changes to be performed manually in servers to upgrade
## AngularJS
(already done in dev)
(already done in dev & pre)
- angular-re-captcha has been replaced by angular-recaptcha, so bower has to be run
- reinstall ui-bootstrap
......@@ -13,14 +13,13 @@ Changes to be performed manually in servers to upgrade
## Database
(ToDo in dev)
- add arasaac to source table
`INSERT INTO `source` (`id`, `name`, `description`) VALUES (3, 'Arasaac', 'Arasaac pictograms collection');`
(already done in dev & pre)
- add arasaac to source table
`INSERT INTO `source` (`id`, `name`, `description`) VALUES (3, 'Arasaac', 'Arasaac pictograms collection');`
- alter table supervisor add arasaac license:
`ALTER TABLE supervisor ADD COLUMN arasaac_license BOOLEAN DEFAULT FALSE;`
(already done in dev)
- load arasaac.sql into MySQL
- load pictocat_tree_populate.sql
`source /vagrant/roles/database/files/pictocat_tree_populate.sql;`
......
......@@ -95,24 +95,42 @@ module.exports = {
* @param {request} req {} (with studentId specified as url parameters)
* @param {response} res
* {
* id: 12,
* office: 1234,
* username: 'johnydoe',
* name: 'Johny',
* surname: 'Doe',
* birthdate: '2009-12-10T00:00:00.000Z',
* gender: 'F',
* country: 'ES',
* pic: 'avatar/nice/url.jpg',
* notes: null,
* lang: 'en-en',
* iat: 123512,
* exp: 1231292,
* attributes: { @see Student.getValidAttributes() },
* current_method: 'Do Things', // May be null
* current_instruction: 'Do Stuff', // May be null
* supervision: 0|1|2, // supervision level according to requester 0 -> office admin, 1 -> tutor, 2 -> therapist
* }
"office": 383,
"id": 92,
"username": "jose",
"name": "AAjose",
"surname": "AAjose antonio",
"birthdate": "2009-05-12T00:00:00.000Z",
"gender": "M",
"country": "ES",
"pic": "/upload/studentAvatar/defaultAvatar.jpg",
"notes": "",
"lang": "es-es",
"current_method": "Comunicación Aumentativa y Adaptativa", // May be "no method"
"current_instruction": "Fase 4 - Estructura de la oración", // May be "no instruction"
"supervision": 2 // supervision level according to requester 0 -> office admin, 1 -> tutor, 2 -> therapist, 3 -> student himself
"attributes": { @see Student.getValidAttributes()
"categories": true,
"input_feedback": {
"vibration": true,
"read": false,
"beep": false,
"highlight": false
},
"input_selection": {
"click": true,
"double_click": false,
"long_press": false,
"drag": true
},
"legend": false,
"legend_size": "normal",
"size": "large",
"picto_background": "#0000ff",
"tape_background": "#00ffff",
"delivery": 0
}
}
*/
getInfo: function (req, res) {
Student.findOne({id: req.params.id_stu})
......@@ -144,9 +162,9 @@ module.exports = {
else if (stu_sup && !req.token.office)
student.supervision = 1; // requester is tutor of the studend
else if (stu_sup && req.token.office && student.office == req.token.office.id)
student.supervision = 2; // requester is supervisor of student
else if (req.token.isStudent && req.token.id == student.id)
student.supervision = 3 // requester is the student himself
student.supervision = 2; // requester is supervisor of student
else if (req.token.isStudent && req.token.id == student.id)
student.supervision = 3 // requester is the student himself
if (student.supervision == -1) // should not hace access!!!
return res.forbidden("Access to this student should not be granted to you");
......@@ -966,7 +984,9 @@ module.exports = {
* legend: true/[false],
* legend_size: '[small]/large',
* expression: 'custom expression',
* color: any valid HEX color or [null]
* color: any valid HEX color or [null],
* sound_uri: path to sound file,
* user_avatar: email (supervisor) or username (student) for associated account
* }
* },
* }
......
......@@ -90,6 +90,8 @@ module.exports = {
color: null,
expression: null,
legend: 'none',
uri_sound: null,
user_avatar: null
};
if (typeof attributes === 'object') {
......@@ -128,13 +130,19 @@ module.exports = {
}
if (!((/^(none|normal|full)$/).test(validAttributes.legend))) {
delete validAttributes.legend;
}
}
if (typeof validAttributes.highlight !== 'boolean') {
delete validAttributes.highlight;
}
if (!((/^#([0-9a-f]{3}){1,2}$/i).test(validAttributes.color))) {
delete validAttributes.color;
}
if (typeof validAttributes.sound_uri!== 'string') {
delete validAttributes.sound_uri;
}
if (typeof validAttributes.user_avatar !== 'string') {
delete validAttributes.user_avatar;
}
}
sails.log.verbose('Valid attributes for StuPicto', validAttributes);
return Object.assign({}, defaultAttributes, validAttributes);
......
......@@ -30,6 +30,10 @@
"apply":"Apply",
"annual": "Annual",
"April": "April",
"arasaac_license": "Los símbolos pictográficos utilizados en esta sección son propiedad de CATEDU (http://arasaac.org/) bajo licencia Creative Commons y han sido creados por Sergio Palao.",
"arasaac_license_import": "The pictographic symbols used in this section are the property of CATEDU (http://arasaac.org/) under a Creative Commons license and have been created by Sergio Palau. By importing you accept the ",
"arasaac_license_import2": "terms of use",
"arasaac_license_link": "http://www.arasaac.org/condiciones_uso.php",
"attributes_not_updated": "Changes not saved",
"attributes_updated": "Changes saved",
"attributes_updating": "Saving...",
......@@ -95,6 +99,7 @@
"disclaimer_accept": "I have read and accept <a href='/app/#/disclaimer' target='_blank'>conditions of use</a>",
"disclaimer_p1": "In conformance with Organic Law 15/1999 on Data Protection, Yottacode S.L. informs that it commits to maintaining the secrecy and confidentiality of the personal information received by adopting all the necessary measures to avoid its loss, modification without consent, or unauthorized access in accordance with the Law on Personal Data Protection and its Development Regulation approved by Royal Decree 1720/2007 of December 21. Likewise, the User may exercise, at any given moment, the rights established in Organic Law 15/1999 of December 13 on Personal Data Protection to access, rectify, cancel or oppose the data by notifying Yottacode S.L.",
"disclaimer_p2": "Yottacode S.L. is not responsible for the consequences derived of the use of its products. Yottacode S.L. forbids malicious usage of the Pictogram platform and any access form out from its security policies. Any of these acts may result in legal prosecution.",
"disclaimer_p3": "By using our Services, you are agreeing to allow Yottacode S.L. to use all the data you submit and kept in our servers for analytical and scientific purposes, yet maintaining the privacy of your data.",
"disclaimer_requested": "Conditions of use must be read and accepted",
"double_click": "Double click",
"down": "Down",
......@@ -146,6 +151,7 @@
"highlighted": "Highlighted",
"hours": "hours",
"how_many": "How many?",
"import": "Import",
"inactive_account": "This account has not been activated. Please, follow the link sent to your email address.",
"input_selection": "How to place a pictogram",
"instruction": "Instruction",
......
......@@ -30,6 +30,10 @@
"apply":"Aplicar",
"annual": "Anual",
"April": "Abril",
"arasaac_license": "Los símbolos pictográficos utilizados en esta sección son propiedad de CATEDU (http://arasaac.org/) bajo licencia Creative Commons y han sido creados por Sergio Palao.",
"arasaac_license_import": "Los símbolos pictográficos utilizados en esta sección son propiedad de CATEDU (http://arasaac.org/) bajo licencia Creative Commons y han sido creados por Sergio Palao. Al importarlos acepta las ",
"arasaac_license_import2": "condiciones de uso",
"arasaac_license_link": "http://www.arasaac.org/condiciones_uso.php",
"attributes_not_updated": "Cambios no guardados",
"attributes_updated": "Cambios guardados",
"attributes_updating": "Guardando...",
......@@ -95,6 +99,7 @@
"disclaimer_accept": "He leído y acepto las <a href='/app/#/disclaimer' target='_blank'>condiciones de uso</a>",
"disclaimer_p1": "De conformidad con lo establecido en el Art. 5 de la Ley Orgánica 15/1999 de diciembre de Protección de Datos de Carácter Personal, por el que se regula el derecho de información en la recogida de datos le informamos que los datos de carácter personal que se recogen en este formulario online serán objeto de tratamiento en los ficheros responsabilidad de Yottacode S.L. La finalidad del tratamiento es la de gestionar de forma adecuada la prestación del servicio que nos ha requerido y con fines estadísticos e investigación, y estos datos no serán cedidos a terceros. Asimismo, le informamos de la posibilidad de ejercitar los correspondiente derechos de acceso, rectificación, cancelación y oposición de conformidad con lo establecido en la Ley 15/1999 mediante un escrito a Yottacode S.L. Calle Virgen de la Cabeza 2, 23008, Jaén, incluyendo la fotocopia del DNI del solicitante.",
"disclaimer_p2": "Yottacode S.L. no se hace responsable del uso indebido que de sus productos puedan hacerse, así como de los daños o perjuicidos que pudieran derivarse de los mismos. Los usuarios de la plataforma Pictogram pueden hacer uso libremente de sus funcionalidades, siempre dentro de los límites de acceso establecidos. Un uso inadecuado o que persiga fines maliciosos como el acceso a funciones no autorizadas o la aplicación de técnicas que persigan la ruptura de la seguridad de nuestros sistemas será perseguido legalmente.",
"disclaimer_p3": "Al usar nuestros servicios, acepta permitir a Yottacode S.L. el uso de sus datos con fines estadísticos y científicos, asegurando no obstante la privacidad de sus datos en todo momento.",
"disclaimer_requested": "Las condiciones de uso deben ser leídas y aceptadas",
"double_click": "Doble clic",
"down": "Abajo",
......@@ -146,6 +151,7 @@
"highlighted": "Resaltado",
"hours": "horas",
"how_many": "¿Cuántas?",
"import": "Importar",
"inactive_account": "Esta cuenta no ha sido activada. Por favor, siga el enlace de confirmación enviado a su dirección de correo electrónico.",
"input_selection": "Cómo colocar un pictograma",
"instruction": "Instrucción",
......
......@@ -15,6 +15,7 @@
<h2 translate>disclaimer</h2>
<p translate>disclaimer_p1</p>
<p translate>disclaimer_p2</p>
<p translate>disclaimer_p3</p>
</div>
</div>
......
......@@ -22,7 +22,7 @@
<span class="glyphicon glyphicon-th"></span> SymbolStix
</button>
<button class="btn btn-default" btn-radio="'arasaac'" ng-model="source" ng-click="load_arasaac_pictos()">
<i class="fa fa-th" aria-hidden="true"></i> Arasaac
<i class="fa fa-th" aria-hidden="true"></i> ARASAAC
</button>
<button class="btn btn-default" btn-radio="'ownpictos'" ng-model="source" ng-click="load_own_pictos()">
<span class="glyphicon glyphicon-picture"></span> {{ 'own_pictos' | translate }}
......@@ -76,11 +76,15 @@
<!-- Collections row -->
<div class="row">
<div id="arasaac_agreement" class="col-md-12" ng-show="showArasaacLicense && source == 'arasaac'">
<h2><small>
Los símbolos pictográficos utilizados en esta sección son propiedad de <b>CATEDU</b> (<a href="http://arasaac.org/">Arasaac</a>) bajo licencia Creative Commons y han sido creados por Sergio Palao.
<br>Para usarlos deberá aceptar la licencia de uso haciendo clic sobre el botón importar.</small>
</h2>
<button class="btn btn-primary" ng-click="accept_arasaac()">Importar</button>
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">ARASAAC</h3>
</div>
<div class="panel-body">
<p>{{'arasaac_license_import' | translate}} <a href="{{ 'arasaac_license_link' | translate }}">{{ 'arasaac_license_import2' | translate }}</a>.</p>
<button class="btn btn-primary" ng-click="accept_arasaac()">{{'import' | translate}}</button>
</div>
</div>
</div>
<!-- Collections -->
......@@ -115,8 +119,8 @@
</div><!-- /modal-body -->
<div class="modal-footer">
<div id="arasaac_license" ng-show="source == 'arasaac'">
<p class="small">Los símbolos pictográficos utilizados son propiedad de CATEDU (<a href="http://arasaac.org/">Arasaac</a>) bajo licencia Creative Commons y han sido creados por Sergio Palao</p>
<div class="arasaac_license" ng-show="source == 'arasaac'">
<p><small>{{'arasaac_license' | translate}}</small></p>
</div>
<button class="btn btn-success pull-left" ng-show="source == 'ownpictos'" ngf-select ng-model="picFile" accept="image/*" ngf-change="addOwnPicto()">
<i class="fa fa-folder-open" aria-hidden="true"></i> {{ 'new_img' | translate }}
......
......@@ -12,6 +12,15 @@ dashboardControllers.controller('TranslateController', function(
ngToast,
vcRecaptchaService
) {
// onload, set lang accordingly to stored user settings
if ($window.sessionStorage.user) {
//Session variables update
var obj = JSON.parse($window.sessionStorage.user);
$translate.use(obj.lang);
}
// Changes the language when user click on footer lang
$scope.changeLanguage = function (langKey) {
//Translate update
......@@ -41,7 +50,11 @@ dashboardControllers.controller('TranslateController', function(
}
// Reload captcha according to language (only once instance per page, so id is always 0)
vcRecaptchaService.useLang(0, langKey.substr(0,2)); //TODO: REVISAR reCaptcha Widget ID not exists
try {
vcRecaptchaService.useLang(0, langKey.substr(0,2));
} catch (err) {}
// Reload page
$window.location.reload();
};
});
......@@ -1023,6 +1023,10 @@ form .progress {
.method-opt{
font-weight: 600;
}
.arasaac_license{
text-align: left;
color: #6c6c6c;
}
.header-image {
width: 100%;
......
......@@ -8,6 +8,12 @@ module.exports = function (grunt) {
src: ['modules/**/*.html'],
dest: 'assets/app/',
filter: 'isFile'
},
{
cwd: 'assets/app/bower_components/bootstrap/dist/css/',
src: 'bootstrap.css.map',
dest: 'assets/app/css',
expand: true
}
]
},
......
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