Commit 3921bee5 by Arturo Montejo Ráez

Merge branch 'develop'

parents 9865ef53 2a4d25b3
Showing with 997 additions and 600 deletions
...@@ -5,7 +5,7 @@ buildscript { ...@@ -5,7 +5,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:2.3.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
......
...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
android { android {
compileSdkVersion 21 compileSdkVersion 21
buildToolsVersion "21.1.2" buildToolsVersion '25.0.0'
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
......
...@@ -36,6 +36,7 @@ import javax.net.ssl.HttpsURLConnection; ...@@ -36,6 +36,7 @@ import javax.net.ssl.HttpsURLConnection;
public class RestapiWrapper { public class RestapiWrapper {
String server; String server;
String token; String token;
iSilentLogin silentLogin;
public static final int TIME_OUT=20000; public static final int TIME_OUT=20000;
private static final String SERVER_RESULT="result"; private static final String SERVER_RESULT="result";
private static final String SERVER_ERROR="error"; private static final String SERVER_ERROR="error";
...@@ -43,9 +44,10 @@ public class RestapiWrapper { ...@@ -43,9 +44,10 @@ public class RestapiWrapper {
// String constant for logs // String constant for logs
private final static String LOG_TAG = RestapiWrapper.class.getSimpleName(); // Or .getCanonicalName() private final static String LOG_TAG = RestapiWrapper.class.getSimpleName(); // Or .getCanonicalName()
public RestapiWrapper(String server, String token) { public RestapiWrapper(String server, String token,iSilentLogin silentLogin) {
this.server=server; this.server=server;
this.token=token; this.token=token;
this.silentLogin=silentLogin;
} }
public void setToken(String token) { public void setToken(String token) {
...@@ -275,7 +277,14 @@ public class RestapiWrapper { ...@@ -275,7 +277,14 @@ public class RestapiWrapper {
// onPostExecute displays the results of the AsyncTask. // onPostExecute displays the results of the AsyncTask.
@Override @Override
protected void onPostExecute(HttpAsyncTaskParams params) { protected void onPostExecute(HttpAsyncTaskParams params) {
if (params.error!=null) params.listener.error(params.error); if (params.error!=null) {
if (silentLogin!=null && !silentLogin.isValidToken(params.error, params.result)) {
silentLogin.login();
Log.e(LOG_TAG,"Silent login executed because of invalid token:"+params.error.getMessage());
}
else
params.listener.error(params.error);
}
else { else {
Object jsonResult = params.result; Object jsonResult = params.result;
if (jsonResult instanceof JSONObject) { if (jsonResult instanceof JSONObject) {
...@@ -305,4 +314,11 @@ public class RestapiWrapper { ...@@ -305,4 +314,11 @@ public class RestapiWrapper {
void result(JSONObject result); void result(JSONObject result);
void error(HTTPException e); void error(HTTPException e);
} }
/*
Because of invalid token
*/
public interface iSilentLogin {
void login();
boolean isValidToken(HTTPException error, Object result);
}
} }
...@@ -117,6 +117,18 @@ Picto extends Img { ...@@ -117,6 +117,18 @@ Picto extends Img {
*/ */
public String get_url() {return this.url;} public String get_url() {return this.url;}
/**
*
* @param newTranslation
*/
public void set_translation(String newTranslation){
this.translation = newTranslation;
try {
this.attributes.put(JSON_ATTTRS.EXPRESSION,newTranslation);
} catch (JSONException e) {
e.printStackTrace();
}
}
/** /**
* *
...@@ -353,7 +365,7 @@ Picto extends Img { ...@@ -353,7 +365,7 @@ Picto extends Img {
* modify locally the status of the picto * modify locally the status of the picto
* @return true if current status is enabled. False in other case. * @return true if current status is enabled. False in other case.
*/ */
public boolean alter_status() { /*public boolean alter_status() {
String status=is_enabled() ? JSON_ATTTR_STATUS_VALUES.DISABLED String status=is_enabled() ? JSON_ATTTR_STATUS_VALUES.DISABLED
: is_disabled() ? JSON_ATTTR_STATUS_VALUES.INVISIBLE : is_disabled() ? JSON_ATTTR_STATUS_VALUES.INVISIBLE
: JSON_ATTTR_STATUS_VALUES.ENABLED; : JSON_ATTTR_STATUS_VALUES.ENABLED;
...@@ -371,6 +383,27 @@ Picto extends Img { ...@@ -371,6 +383,27 @@ Picto extends Img {
} }
return is_enabled(); return is_enabled();
} }
*/
/**
* modify locally the status of the picto
* @param status the status that u press on the menu
* @return true if current status is enabled. False in other case.
*/
public boolean alter_status(String status) {
Log.i(this.getClass().getCanonicalName(),"Picto id. "+get_id()+" status enabled/disabled modified to "+is_enabled());
try {
this.attributes.put(JSON_ATTTRS.STATUS, status);
set_local_status(true);
if (!is_local()) {
new PictoUploader(this).uploadState();
PCBcontext.getActionLog().log(new VocabularyAction(VocabularyAction.ALTERATTRS, this));
}
} catch (JSONException e) {
e.printStackTrace();
Log.e(this.getClass().getCanonicalName(),e.getMessage());
}
return is_enabled();
}
/** /**
* *
......
...@@ -266,11 +266,7 @@ public class User { ...@@ -266,11 +266,7 @@ public class User {
* @return input feedback of the student configuration (default: "vibration") * @return input feedback of the student configuration (default: "vibration")
*/ */
public boolean delete_tape_after_delivery() { public boolean delete_tape_after_delivery() {
try { return input_feedback_on(JSON_STUDENT_ATTTRS.DELETE_STRIP);
return this.attributes_stu.getBoolean(JSON_STUDENT_ATTTRS.DELETE_STRIP);
} catch (JSONException e) {
return false;
}
} }
/** /**
......
...@@ -80,12 +80,16 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -80,12 +80,16 @@ public class Vocabulary implements Iterable<Picto> {
} }
break; break;
} }
case update_category:{
Log.i(this.getClass().getCanonicalName(), "Picto category update "+args.toString());
Vocabulary.this.synchronize();
}
case add:{ case add:{
try{ try{
String text= args.getJSONObject("expression").getString("text");
String uri=args.getJSONObject("picto").getString("uri"); String uri=args.getJSONObject("picto").getString("uri");
JSONObject attrs_picto = args.getJSONObject("attributes"); JSONObject attrs_picto = args.getJSONObject("attributes");
String text= attrs_picto.getString("expression");
addPicto(new Picto(picto_id, uri, text, attrs_picto),ImgDownloader.tsource.remote); addPicto(new Picto(picto_id, uri, text, attrs_picto),ImgDownloader.tsource.remote);
...@@ -170,17 +174,18 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -170,17 +174,18 @@ public class Vocabulary implements Iterable<Picto> {
final String jexpression_text = "text"; final String jexpression_text = "text";
Picto[] pictos = new Picto[result.length()]; Picto[] pictos = new Picto[result.length()];
JSONObject picto = null, expression = null, attributes = null; JSONObject picto = null, attributes = null;
String expression;
JSONObject ojpicto=null; JSONObject ojpicto=null;
try { try {
for (int i=0; i < result.length(); i++) { for (int i=0; i < result.length(); i++) {
ojpicto=result.getJSONObject(i); ojpicto=result.getJSONObject(i);
picto = ojpicto.getJSONObject(jpicto); picto = ojpicto.getJSONObject(jpicto);
expression = ojpicto.getJSONObject(jexpression);
attributes = ojpicto.getJSONObject(jattributes); attributes = ojpicto.getJSONObject(jattributes);
expression = attributes.getString(jexpression);
pictos[i] = new Picto(picto.getInt(jid), pictos[i] = new Picto(picto.getInt(jid),
picto.getString(juri), picto.getString(juri),
expression.getString(jexpression_text), expression,
attributes); attributes);
} }
synchronizeImgs(pictos); synchronizeImgs(pictos);
......
...@@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit; ...@@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit;
*/ */
public class NetService implements Runnable { public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
static final String ping_session="server/ping"; static final String ping_session="server/ping";
private boolean updated; private boolean updated;
...@@ -110,6 +110,17 @@ public class NetService implements Runnable { ...@@ -110,6 +110,17 @@ public class NetService implements Runnable {
} }
}); });
} }
@Override
public boolean isValidToken(RestapiWrapper.HTTPException error, Object result) {
try {
return error.getCode()!=401 || (((JSONObject)result).getString("err").equalsIgnoreCase("Invalid token undefined"));
} catch (JSONException e) {
Log.e(LOG_TAG,e.getMessage());
return true;
}
}
public boolean online() {return updated;} public boolean online() {return updated;}
public void restart_app(boolean direct_login) { public void restart_app(boolean direct_login) {
......
...@@ -23,6 +23,7 @@ public class ActionTalk implements Emitter.Listener { ...@@ -23,6 +23,7 @@ public class ActionTalk implements Emitter.Listener {
private Room room; private Room room;
Vector<iActionListener> listeners; Vector<iActionListener> listeners;
private static final String LOG_TAG=ActionTalk.class.getCanonicalName();
public ActionTalk(Room room, iActionListener listener) { public ActionTalk(Room room, iActionListener listener) {
this.room = room; this.room = room;
...@@ -41,13 +42,14 @@ public class ActionTalk implements Emitter.Listener { ...@@ -41,13 +42,14 @@ public class ActionTalk implements Emitter.Listener {
final String param_picto_cat="id_cat"; final String param_picto_cat="id_cat";
final String action_select="select"; final String action_select="select";
final String action_add="add"; final String action_add="add";
final String action_delete="delete";
final String action_show="show"; final String action_show="show";
JSONObject msg = (JSONObject) args[0]; JSONObject msg = (JSONObject) args[0];
try { try {
Log.i(this.getClass().getName(), "Received message (raw): " +msg.toString()+" mirror:"+PCBcontext.getPcbdb().getCurrentUser().is_mirror_on()); Log.i(this.getClass().getName(), "Received message (raw): " +msg.toString()+" mirror:"+PCBcontext.getPcbdb().getCurrentUser().is_mirror_on());
String action = msg.getString(param_action).toLowerCase(); String action = msg.getString(param_action).toLowerCase();
if (action.equals(action_add) || action.equals(action_select) ||action.equals(action_show)) { if (action.equals(action_add) || action.equals(action_select) || action.equals(action_show) || action.equals(action_delete)) {
int picto_id; int picto_id;
int picto_cat; int picto_cat;
boolean mirroing=PCBcontext.getPcbdb().getCurrentUser().is_mirror_on(); boolean mirroing=PCBcontext.getPcbdb().getCurrentUser().is_mirror_on();
...@@ -62,14 +64,16 @@ public class ActionTalk implements Emitter.Listener { ...@@ -62,14 +64,16 @@ public class ActionTalk implements Emitter.Listener {
mirroing|=attrs_stu_picto.has(Picto.JSON_ATTTRS.MIRROR); mirroing|=attrs_stu_picto.has(Picto.JSON_ATTTRS.MIRROR);
} }
if ( mirroing) { if ( mirroing) {
Log.i(this.getClass().getName(), "Received message '" + action + Log.i(LOG_TAG, "Received message '" + action +
"' for picto " + picto_id + " (cat " + picto_cat); "' for picto " + picto_id + " (cat " + picto_cat);
for (iActionListener listener : this.listeners) for (iActionListener listener : this.listeners)
listener.action(action.equals(action_add) listener.action(action.equals(action_add)
? iActionListener.action.add ? iActionListener.action.add
: action.equals(action_select) : action.equals(action_select)
? iActionListener.action.select ? iActionListener.action.select
: iActionListener.action.show : action.equals(action_delete)
? iActionListener.action.delete
: iActionListener.action.show
, picto_cat, picto_id); , picto_cat, picto_id);
} }
} }
...@@ -96,7 +100,7 @@ public class ActionTalk implements Emitter.Listener { ...@@ -96,7 +100,7 @@ public class ActionTalk implements Emitter.Listener {
* @version 1.0 * @version 1.0
*/ */
public interface iActionListener { public interface iActionListener {
enum action {add,select,show} enum action {add,delete,select,show}
void action(action action, int picto_cat, int picto_id); void action(action action, int picto_cat, int picto_id);
} }
} }
...@@ -35,9 +35,11 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -35,9 +35,11 @@ public class VocabularyTalk implements Emitter.Listener {
final String param_picto_id="id"; final String param_picto_id="id";
final String param_picto_cat="id_cat"; final String param_picto_cat="id_cat";
final String action_update="update"; final String action_update="update";
final String action_update_category="update_category";
final String action_add="add"; final String action_add="add";
final String action_delete="delete"; final String action_delete="delete";
JSONObject msg = (JSONObject) args[0]; JSONObject msg = (JSONObject) args[0];
try { try {
Log.i(LOG_TAG, "raw Received message " +msg.toString()); Log.i(LOG_TAG, "raw Received message " +msg.toString());
...@@ -52,8 +54,9 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -52,8 +54,9 @@ public class VocabularyTalk implements Emitter.Listener {
"' for picto " + picto_id + " (cat " + picto_cat + ", picto: " + picto_stupicto); "' for picto " + picto_id + " (cat " + picto_cat + ", picto: " + picto_stupicto);
for (iVocabularyListener listener: this.listeners) for (iVocabularyListener listener: this.listeners)
listener.change(action.equals(action_update) ? iVocabularyListener.action.update listener.change(action.equals(action_update) ? iVocabularyListener.action.update
: action.equals(action_add) ? iVocabularyListener.action.add : action.equals(action_update_category) ? iVocabularyListener.action.update_category
: iVocabularyListener.action.delete : action.equals(action_add) ? iVocabularyListener.action.add
: iVocabularyListener.action.delete
, picto_cat, picto_id, stu_picto); , picto_cat, picto_id, stu_picto);
} catch (JSONException e) { } catch (JSONException e) {
...@@ -68,7 +71,7 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -68,7 +71,7 @@ public class VocabularyTalk implements Emitter.Listener {
* @version 1.0 * @version 1.0
*/ */
public static interface iVocabularyListener { public static interface iVocabularyListener {
public enum action {delete,add,update} public enum action {delete,add, update_category, update}
public void change(action action, int picto_cat, int picto_id, JSONObject args); public void change(action action, int picto_cat, int picto_id, JSONObject args);
} }
} }
...@@ -39,8 +39,8 @@ public final class PCBcontext { ...@@ -39,8 +39,8 @@ public final class PCBcontext {
context = c; context = c;
device = new Device(c, null, 1); device = new Device(c, null, 1);
SSLDummyContext.init(context.getResources().getBoolean(R.bool.ssl_connect)); SSLDummyContext.init(context.getResources().getBoolean(R.bool.ssl_connect));
wrapper = new RestapiWrapper(context.getResources().getString(R.string.server), null);
service = new NetService(context.getResources().getInteger(R.integer.netservice_timing),listener); service = new NetService(context.getResources().getInteger(R.integer.netservice_timing),listener);
wrapper = new RestapiWrapper(context.getResources().getString(R.string.server), null, service);
device.deleteDeprecatedImgs(); device.deleteDeprecatedImgs();
Log.i(PCBcontext.class.getCanonicalName(), "PCB context started. It's required" + Log.i(PCBcontext.class.getCanonicalName(), "PCB context started. It's required" +
"set_user method call"); "set_user method call");
......
...@@ -7,6 +7,7 @@ import android.graphics.Color; ...@@ -7,6 +7,7 @@ import android.graphics.Color;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.BitmapDrawable;
/** /**
* Created by Fernando on 15/03/2016. * Created by Fernando on 15/03/2016.
...@@ -157,4 +158,13 @@ public class BitmapTools { ...@@ -157,4 +158,13 @@ public class BitmapTools {
return this; return this;
} }
public void paint(BitmapDrawable drawable, double factor) {
Canvas canvas = new Canvas(this.bitmap);
int w=(int)(this.bitmap.getWidth()*factor);
int h=(int)(this.bitmap.getHeight()*factor);
canvas.drawBitmap(new BitmapTools(drawable.getBitmap()).resize(w,h).get(),
(int)((this.bitmap.getWidth()-w)/2),(int)((this.bitmap.getHeight()-h)/2),null);
}
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<item name="purple" type="color">#FFAA66CC</item> <item name="purple" type="color">#FFAA66CC</item>
<item name="green" type="color">#FF99CC00</item> <item name="green" type="color">#FF99CC00</item>
<item name="orange" type="color">#FFFFBB33</item> <item name="orange" type="color">#FFFFBB33</item>
<item name="red" type="color">#FFFF4444</item> <item name="red" type="color">#ff4444</item>
<item name="darkblue" type="color">#FF0099CC</item> <item name="darkblue" type="color">#FF0099CC</item>
<item name="darkpurple" type="color">#FF9933CC</item> <item name="darkpurple" type="color">#FF9933CC</item>
<item name="darkgreen" type="color">#669900</item> <item name="darkgreen" type="color">#669900</item>
......
#Mon Aug 29 01:05:09 CEST 2016 #Sun Jan 15 10:11:11 CET 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip
...@@ -11,7 +11,7 @@ android { ...@@ -11,7 +11,7 @@ android {
}*/ }*/
compileSdkVersion 24 compileSdkVersion 24
buildToolsVersion "23.0.2" buildToolsVersion '25.0.0'
defaultConfig { defaultConfig {
applicationId "com.yottacode.supervisor_tablet" applicationId "com.yottacode.supervisor_tablet"
minSdkVersion 21 minSdkVersion 21
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.SplashScreenActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.login.SplashScreenActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape"> android:screenOrientation="landscape">
<intent-filter> <intent-filter>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.MainActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.login.MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
android:label="@string/title_activity_serial" android:label="@string/title_activity_serial"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.LoginActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.login.LoginActivity"
android:exported="true" android:exported="true"
android:label="@string/title_activity_login_activity_fragments" android:label="@string/title_activity_login_activity_fragments"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.PictogramActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity"
android:exported="true" android:exported="true"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
......
...@@ -3,7 +3,7 @@ package com.yottacode.pictogram.supervisor_tablet.gui; ...@@ -3,7 +3,7 @@ package com.yottacode.pictogram.supervisor_tablet.gui;
import android.app.Activity; import android.app.Activity;
import com.yottacode.pictogram.supervisor_tablet.R; import com.yottacode.pictogram.supervisor_tablet.R;
import com.yottacode.pictogram.tabletlibrary.gui.SerialActivity; import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.tools.GUITools; import com.yottacode.tools.GUITools;
/** /**
......
...@@ -2,13 +2,13 @@ apply plugin: 'com.android.library' ...@@ -2,13 +2,13 @@ apply plugin: 'com.android.library'
android { android {
compileSdkVersion 24 compileSdkVersion 24
buildToolsVersion "23.0.2" buildToolsVersion '25.0.0'
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 22 targetSdkVersion 22
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
resValue "string", "SerialClass", "com.yottacode.pictogram.tabletlibrary.gui.SerialActivity" resValue "string", "SerialClass", "com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity"
resValue "integer", "rows", "5" resValue "integer", "rows", "5"
resValue "integer", "columns", "10" resValue "integer", "columns", "10"
resValue "integer", "rows_big", "4" resValue "integer", "rows_big", "4"
......
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
......
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.support.v4.content.ContextCompat;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -183,26 +180,24 @@ public class PictoItemViewGenerator { ...@@ -183,26 +180,24 @@ public class PictoItemViewGenerator {
pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image); pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image);
redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross); redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross);
} }
layoutWrapper.setVisibility(View.GONE);
layoutWrapper.setBackground(null); layoutWrapper.setBackground(null);
layoutWrapper.setAlpha(0.25f); layoutWrapper.setAlpha(PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ? 0.25f : 0);
layout.setBackgroundColor(convertView.getResources() layout.setBackgroundColor(convertView.getResources()
.getColor(R.color.picto_default_background)); .getColor(R.color.picto_default_background));
redCrossImage.setVisibility(View.GONE); redCrossImage.setVisibility(View.GONE);
pictoImage.setScaleX(1.0f); // pictoImage.setVisibility(View.GONE);
pictoImage.setScaleY(1.0f); // layoutWrapper.setVisibility(View.GONE);
pictoImage.setVisibility(View.GONE);
if (picto == null) { if (picto == null) {
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) { pictoImage.setImageBitmap(null);
layoutWrapper.setVisibility(View.VISIBLE); if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) {
layoutWrapper.setBackground(convertView.getResources() layoutWrapper.setBackground(convertView.getResources()
.getDrawable(R.drawable.picto_grid_item_border)); .getDrawable(R.drawable.picto_grid_item_border));
}
}
} else { } else {
if (!picto.is_invisible()) { if (!picto.is_invisible()) {
layoutWrapper.setAlpha(1.00f); layoutWrapper.setAlpha(1.00f);
} }
try { try {
......
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.annotation.TargetApi; import android.annotation.TargetApi;
...@@ -19,15 +19,15 @@ public class TapeAdapter extends BaseAdapter { ...@@ -19,15 +19,15 @@ public class TapeAdapter extends BaseAdapter {
//private Context mContext; //private Context mContext;
private LinkedList<Picto> pictoLinkedList; private LinkedList<Picto> pictoLinkedList;
private boolean play=false; private boolean play = false;
public TapeAdapter(){ public TapeAdapter() {
//mContext = c; //mContext = c;
pictoLinkedList = new LinkedList<Picto>(); // the list begins empty pictoLinkedList = new LinkedList<Picto>(); // the list begins empty
} }
@Override @Override
public int getCount(){ public int getCount() {
return pictoLinkedList.size(); return pictoLinkedList.size();
} }
...@@ -44,37 +44,43 @@ public class TapeAdapter extends BaseAdapter { ...@@ -44,37 +44,43 @@ public class TapeAdapter extends BaseAdapter {
} }
// AÑADIR ITEM AL ADAPTADOR // AÑADIR ITEM AL ADAPTADOR
public void addItem(Picto p){ public void addItem(Picto p) {
pictoLinkedList.add(p); pictoLinkedList.add(p);
} }
// ELIMINAR ITEM DEL ADAPTADOR // ELIMINAR ITEM DEL ADAPTADOR
public void deleteItem(int position){ public void deleteItem(int position) {
pictoLinkedList.remove(position); pictoLinkedList.remove(position);
} }
// ELIMINAR el último ITEM DEL ADAPTADOR // ELIMINAR el último ITEM DEL ADAPTADOR
public void deleteLastView(){ public void deleteLastView() {
// Controlar excepcion al intentar eliminar el último cuando no hay elementos // Controlar excepcion al intentar eliminar el último cuando no hay elementos
try{ try {
pictoLinkedList.removeLast(); pictoLinkedList.removeLast();
}catch(ArrayIndexOutOfBoundsException exception){ } catch (ArrayIndexOutOfBoundsException exception) {
Log.e("Excepción", "ArrayIndexOutOfBounds: " + exception.getMessage()); Log.e("Excepción", "ArrayIndexOutOfBounds: " + exception.getMessage());
} }
} }
// ELIMINAR TODOS LOS ITEMS DEL ADAPTADOR // ELIMINAR TODOS LOS ITEMS DEL ADAPTADOR
public void endPlay(){ public void endPlay() {
if (PCBcontext.getPcbdb().getCurrentUser().delete_tape_after_delivery()) pictoLinkedList.clear(); if (PCBcontext.getPcbdb().getCurrentUser().delete_tape_after_delivery())
play=false; clear();
play = false;
} }
public void clear() {
pictoLinkedList.clear();
}
// DEVUELVE TODOS LOS ELEMENTOS // DEVUELVE TODOS LOS ELEMENTOS
public LinkedList<Picto> getAll(){ return pictoLinkedList; } public LinkedList<Picto> getAll() {
return pictoLinkedList;
}
// Devuelvo la cadena actual como un String // Devuelvo la cadena actual como un String
public String getAllAsString(){ public String getAllAsString() {
String complete = ""; String complete = "";
Iterator<Picto> iterator = pictoLinkedList.iterator(); Iterator<Picto> iterator = pictoLinkedList.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
...@@ -85,19 +91,18 @@ public class TapeAdapter extends BaseAdapter { ...@@ -85,19 +91,18 @@ public class TapeAdapter extends BaseAdapter {
} }
// DEVUELVE último elemento // DEVUELVE último elemento
public Picto getLastItem(){ public Picto getLastItem() {
return pictoLinkedList.getLast(); return pictoLinkedList.getLast();
} }
// Devuelve true o false si tiene o no elementos la lista de pictos // Devuelve true o false si tiene o no elementos la lista de pictos
public boolean hasElements(){ public boolean hasElements() {
return (pictoLinkedList.size() > 0); return (pictoLinkedList.size() > 0);
} }
@Override @Override
public View getView(int position, View convertView, ViewGroup parent){ public View getView(int position, View convertView, ViewGroup parent) {
View pictoView = PictoItemViewGenerator.getPictoView( View pictoView = PictoItemViewGenerator.getPictoView(
this.pictoLinkedList.get(position), this.pictoLinkedList.get(position),
convertView, convertView,
...@@ -107,7 +112,7 @@ public class TapeAdapter extends BaseAdapter { ...@@ -107,7 +112,7 @@ public class TapeAdapter extends BaseAdapter {
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void ttsAllNew(TTSHelper tts) { public void ttsAllNew(TTSHelper tts) {
this.play=true; this.play = true;
String input = getAllAsString(); String input = getAllAsString();
tts.play(input); tts.play(input);
} }
...@@ -115,4 +120,6 @@ public class TapeAdapter extends BaseAdapter { ...@@ -115,4 +120,6 @@ public class TapeAdapter extends BaseAdapter {
public boolean play() { public boolean play() {
return this.play; return this.play;
} }
} }
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
......
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.login;
import android.app.Activity; import android.app.Activity;
import android.graphics.Bitmap; import android.graphics.Bitmap;
......
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.login;
import android.app.Activity; import android.app.Activity;
import android.graphics.Bitmap; import android.graphics.Bitmap;
......
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.login;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Intent; import android.content.Intent;
...@@ -15,6 +15,7 @@ import android.widget.TextView; ...@@ -15,6 +15,7 @@ import android.widget.TextView;
import com.yottacode.pictogram.net.ImgDownloader; import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.pictogram.tools.Img; import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools; import com.yottacode.tools.GUITools;
......
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.login;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
...@@ -10,6 +10,7 @@ import android.view.Window; ...@@ -10,6 +10,7 @@ import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
public class MainActivity extends Activity { public class MainActivity extends Activity {
......
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.login;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
...@@ -20,6 +20,9 @@ import android.widget.ListView; ...@@ -20,6 +20,9 @@ import android.widget.ListView;
import com.yottacode.pictogram.dao.User; import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.dao.UserLogin; import com.yottacode.pictogram.dao.UserLogin;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.login.CustomListLogin;
import com.yottacode.pictogram.tabletlibrary.gui.login.LoginActivity;
import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet; import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
......
package com.yottacode.pictogram.tabletlibrary.gui; package com.yottacode.pictogram.tabletlibrary.gui.login;
import android.app.Fragment; import android.app.Fragment;
import android.app.ProgressDialog; import android.app.ProgressDialog;
...@@ -17,6 +17,7 @@ import com.yottacode.net.RestapiWrapper; ...@@ -17,6 +17,7 @@ import com.yottacode.net.RestapiWrapper;
import com.yottacode.pictogram.dao.User; import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.ImgDownloader; import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tools.Img; import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools; import com.yottacode.tools.GUITools;
...@@ -201,8 +202,8 @@ public class StudentFragmentGrid extends Fragment{ ...@@ -201,8 +202,8 @@ public class StudentFragmentGrid extends Fragment{
private void download_students(int sup_id ) { private void download_students(int sup_id ) {
String token = getActivity().getIntent().getExtras().getString("token"); String token = getActivity().getIntent().getExtras().getString("token");
RestapiWrapper wrapper = new RestapiWrapper( RestapiWrapper wrapper = PCBcontext.getRestapiWrapper();
getActivity().getApplicationContext().getResources().getString(R.string.server), token); wrapper.setToken(token);
String operation = "sup/" + sup_id + "/students"; String operation = "sup/" + sup_id + "/students";
progressDialog= ProgressDialog.show(getActivity(), getString(R.string.userLoadingTxt), progressDialog= ProgressDialog.show(getActivity(), getString(R.string.userLoadingTxt),
getString(R.string.userLoadingTxt), false, false); getString(R.string.userLoadingTxt), false, false);
......
...@@ -15,7 +15,7 @@ import android.widget.AdapterView; ...@@ -15,7 +15,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ListView; import android.widget.ListView;
import com.yottacode.pictogram.tabletlibrary.gui.PictogramActivity; import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper; import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
......
...@@ -14,6 +14,7 @@ import android.view.View; ...@@ -14,6 +14,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
...@@ -28,6 +29,8 @@ import java.util.Vector; ...@@ -28,6 +29,8 @@ import java.util.Vector;
* Created by Fernando on 18/12/2016. * Created by Fernando on 18/12/2016.
*/ */
class PictoAdapter extends BaseAdapter { class PictoAdapter extends BaseAdapter {
private String LOG_TAG=PictoAdapter.class.getCanonicalName();
public void setCurrentMsg(int currentMsg) { public void setCurrentMsg(int currentMsg) {
this.currentMsg = currentMsg; this.currentMsg = currentMsg;
} }
...@@ -36,11 +39,10 @@ class PictoAdapter extends BaseAdapter { ...@@ -36,11 +39,10 @@ class PictoAdapter extends BaseAdapter {
public static class Item { public static class Item {
Bitmap img; Bitmap img;
String secs; String secs;
StringBuilder sentence; String sentence="";
public Item(Bitmap img, String secs) { public Item(Bitmap img, String secs) {
this.img=img; this.img=img;
this.secs=secs; this.secs=secs;
this.sentence=new StringBuilder("");
} }
Bitmap getImg() { Bitmap getImg() {
return img; return img;
...@@ -49,9 +51,9 @@ class PictoAdapter extends BaseAdapter { ...@@ -49,9 +51,9 @@ class PictoAdapter extends BaseAdapter {
return secs; return secs;
} }
public String getMsg() { return sentence.toString();} public String getMsg() { return sentence.toString();}
public void setImg(Bitmap currmsg, String word) { public void setImg(Bitmap currmsg, String word, boolean eval) {
this.img=currmsg; this.img=currmsg;
sentence.append(" "+word); if (eval) sentence=": " +word;
} }
} }
Context context; Context context;
...@@ -103,9 +105,10 @@ public long getItemId(int position) { ...@@ -103,9 +105,10 @@ public long getItemId(int position) {
vi = inflater.inflate(R.layout.session_picto_view, null); vi = inflater.inflate(R.layout.session_picto_view, null);
ImageView picto=(ImageView)vi.findViewById(R.id.session_picto); ImageView picto=(ImageView)vi.findViewById(R.id.session_picto);
picto.setImageBitmap(this.msg.get(position).getImg()); picto.setImageBitmap(this.msg.get(position).getImg());
if (currentMsg== position) if (currentMsg== position) {
vi.setBackgroundColor(Color.LTGRAY); vi.setBackgroundColor(Color.LTGRAY);
else ((ListView)parent).smoothScrollToPosition(position);
}else
vi.setBackgroundColor(Color.TRANSPARENT); vi.setBackgroundColor(Color.TRANSPARENT);
return vi; return vi;
} }
...@@ -116,7 +119,7 @@ public long getItemId(int position) { ...@@ -116,7 +119,7 @@ public long getItemId(int position) {
bmp=set_text(context,bmp,getTimeDiff(new Date().getTime())); bmp=set_text(context,bmp,getTimeDiff(new Date().getTime()));
Bitmap currmsg=combineImages(oldmsg,bmp); Bitmap currmsg=combineImages(oldmsg,bmp);
item.setImg(currmsg,text); item.setImg(currmsg,text,false);
} }
...@@ -128,34 +131,30 @@ public long getItemId(int position) { ...@@ -128,34 +131,30 @@ public long getItemId(int position) {
float height = context.getResources().getDimension(R.dimen.picto_session_height); float height = context.getResources().getDimension(R.dimen.picto_session_height);
bmp=new BitmapTools(bmp).resize((int)width ,(int)height).get(); bmp=new BitmapTools(bmp).resize((int)width ,(int)height).get();
bmp=set_text(context,bmp,getTimeDiff(new Date().getTime())); bmp=set_text(context,bmp,getTimeDiff(new Date().getTime()));
Bitmap currmsg=this.currentMsg==this.msg.size()-1 ? combineImages(oldmsg,bmp) : updateImage(oldmsg,bmp); Bitmap currmsg = position>=this.msg.size()-1 ? combineImages(oldmsg,bmp) : updateImage(oldmsg,bmp);
item.setImg(currmsg,": "+evaluation); item.setImg(currmsg,evaluation,true);
} }
public int newMsg() { public int newMsg() {
Bitmap bmp=BitmapFactory.decodeResource(context.getResources(), if ((msg.size()>0 && msg.get(msg.size()-1).getImg().getWidth()>context.getResources().getDimension(R.dimen.picto_session_width)) || msg.size()==0)
R.drawable.application_online); {
float width =context.getResources().getDimension(R.dimen.picto_session_width); Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
float height = context.getResources().getDimension(R.dimen.picto_session_height); calendar.setTime(new Date()); // assigns calendar to given date
bmp=new BitmapTools(bmp).resize((int)width,(int)height).get(); String time = calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE) + ":" + calendar.get(Calendar.SECOND);
Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance Bitmap bmp = set_trycount(context,this.msg.size()+1);
calendar.setTime(new Date()); // assigns calendar to given date this.currentMsg = this.msg.size();
String time= calendar.get(Calendar.HOUR_OF_DAY)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND); msg.add(new Item(bmp, time));
bmp=set_text(context,bmp,time); }
this.currentMsg = this.msg.size();
msg.add(new Item(bmp, time));
return msg.size()-1; return msg.size()-1;
} }
private Bitmap combineImages(Bitmap c, Bitmap s) { private Bitmap combineImages(Bitmap c, Bitmap s) {
Bitmap cs = null; Bitmap cs = null;
int width, height = 0; int width, height = 0;
width = c.getWidth() + s.getWidth(); width = c.getWidth() + s.getWidth();
height = c.getHeight(); height = c.getHeight();
cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas comboImage = new Canvas(cs); Canvas comboImage = new Canvas(cs);
...@@ -163,31 +162,71 @@ public long getItemId(int position) { ...@@ -163,31 +162,71 @@ public long getItemId(int position) {
comboImage.drawBitmap(c, 0f, 0f, null); comboImage.drawBitmap(c, 0f, 0f, null);
comboImage.drawBitmap(s, c.getWidth(), 0f, null); comboImage.drawBitmap(s, c.getWidth(), 0f, null);
return cs; return cs;
} }
private Bitmap updateImage(Bitmap c, Bitmap s) { private Bitmap updateImage(Bitmap c, Bitmap s) {
Bitmap cs = null; Bitmap cs = null;
int width= c.getWidth(), height= c.getHeight(); int width= c.getWidth(), height= c.getHeight();
int cutwidth=c.getWidth()-s.getWidth(); int cutwidth=c.getWidth()-s.getWidth();
cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas comboImage = new Canvas(cs); Canvas comboImage = new Canvas(cs);
comboImage.drawBitmap(Bitmap.createBitmap(c,0,0,cutwidth,height), 0f, 0f, null); comboImage.drawBitmap(Bitmap.createBitmap(c,0,0,cutwidth,height), 0f, 0f, null);
comboImage.drawBitmap(s, c.getWidth()-s.getWidth(), 0f, null); comboImage.drawBitmap(s, cutwidth, 0f, null);
return cs; return cs;
} }
static void set_date(Context context, Canvas canvas,String time) {
TextView textView2 = new TextView(context);
textView2.layout(0, 20, 100, 100);
textView2.setPadding(0, 0, 0, 0);
textView2.setTextSize(TypedValue.COMPLEX_UNIT_PX, 13);
textView2.setTextColor(Color.BLACK);
textView2.setBackgroundColor(Color.LTGRAY);
textView2.setWidth(100);
textView2.setGravity(Gravity.CENTER_HORIZONTAL);
textView2.setMaxLines(1);
textView2.setText(time);
textView2.setDrawingCacheEnabled(true);
canvas.drawBitmap(textView2.getDrawingCache(), 0, 60, null);
}
static Bitmap set_trycount(Context context,int pos) {
Bitmap param_bitmap = BitmapFactory.decodeResource(context.getResources(),
R.drawable.try_border);
float width = context.getResources().getDimension(R.dimen.picto_session_width);
float height = context.getResources().getDimension(R.dimen.picto_session_height);
Bitmap bmp =Bitmap.createScaledBitmap(param_bitmap, (int)width, (int)height, false);
Canvas canvas = new Canvas(bmp);
TextView textView = new TextView(context);
String texto=(pos<10 ? "0" :"")+new Integer(pos).toString();
textView.layout(0, 0, 100, 100);
textView.setPadding(0, 0, 0, 0);
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, 40);
textView.setTextColor(Color.BLACK);
textView.setBackgroundColor(Color.TRANSPARENT);
textView.setWidth(100);
textView.setGravity(Gravity.LEFT);
textView.setMaxLines(1);
textView.setText(texto);
textView.setDrawingCacheEnabled(true);
canvas.drawBitmap(textView.getDrawingCache(), 10, 10, null);
Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
calendar.setTime(new Date()); // assigns calendar to given date
String time= calendar.get(Calendar.HOUR_OF_DAY)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND);
set_date(context,canvas,time);
return bmp;
}
static Bitmap set_text(Context context,Bitmap param_bitmap,String texto) { static Bitmap set_text(Context context,Bitmap param_bitmap,String texto) {
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
float width = param_bitmap.getWidth(); float width = param_bitmap.getWidth();
float height=param_bitmap.getHeight(); float height=param_bitmap.getHeight();
android.graphics.Bitmap.Config bitmapConfig = param_bitmap.getConfig(); android.graphics.Bitmap.Config bitmapConfig = param_bitmap.getConfig();
if (bitmapConfig == null) { if (bitmapConfig == null) {
bitmapConfig = android.graphics.Bitmap.Config.ARGB_8888; bitmapConfig = android.graphics.Bitmap.Config.ARGB_8888;
} }
...@@ -199,20 +238,7 @@ public long getItemId(int position) { ...@@ -199,20 +238,7 @@ public long getItemId(int position) {
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); //Poner en blanco el bitmap original para dibujar encima canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); //Poner en blanco el bitmap original para dibujar encima
canvas.drawBitmap(bm, 0, 0, paint); canvas.drawBitmap(bm, 0, 0, paint);
TextView textView = new TextView(context); set_date(context,canvas,texto);
textView.layout(0, 20, 100, 100);
textView.setPadding(0, 0, 0, 0);
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, 13);
textView.setTextColor(Color.BLACK);
textView.setBackgroundColor(Color.LTGRAY);
textView.setWidth(100);
textView.setGravity(Gravity.CENTER_HORIZONTAL);
textView.setMaxLines(1);
textView.setText(texto);
textView.setDrawingCacheEnabled(true);
canvas.drawBitmap(textView.getDrawingCache(), 0, 60, null);
return bitmap; return bitmap;
} }
...@@ -223,5 +249,7 @@ public long getItemId(int position) { ...@@ -223,5 +249,7 @@ public long getItemId(int position) {
public String getCurrentMsgText() { public String getCurrentMsgText() {
return this.getItem(currentMsg).getMsg(); return this.getItem(currentMsg).getMsg();
} }
public String getMsgText(int pos) {
return this.getItem(pos).getMsg();
}
} }
...@@ -3,9 +3,10 @@ package com.yottacode.pictogram.tabletlibrary.gui.session; ...@@ -3,9 +3,10 @@ package com.yottacode.pictogram.tabletlibrary.gui.session;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -25,9 +26,8 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe ...@@ -25,9 +26,8 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe
interface iSessionFragment { interface iSessionFragment {
public void newMsg(int msg_pos);
public void selectedMsg(int msg_pos); public void selectedMsg(int msg_pos);
public void play_msg(int msg_pos); public void play_msg();
} }
private iSessionFragment mListener=null; private iSessionFragment mListener=null;
...@@ -39,6 +39,8 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe ...@@ -39,6 +39,8 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe
public SessionFragment() { public SessionFragment() {
super();
} }
...@@ -46,7 +48,9 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe ...@@ -46,7 +48,9 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
adapter_pictomsg=new PictoAdapter(this.getContext());
setRetainInstance(true); setRetainInstance(true);
} }
@Override @Override
...@@ -55,7 +59,7 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe ...@@ -55,7 +59,7 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe
// Inflate the layout for this fragment // Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_session, container, false); View view = inflater.inflate(R.layout.fragment_session, container, false);
list_pictomsg = (ListView) view.findViewById(R.id.session_pictomsg_list); list_pictomsg = (ListView) view.findViewById(R.id.session_pictomsg_list);
adapter_pictomsg=new PictoAdapter(this.getContext());
list_pictomsg.setAdapter(adapter_pictomsg); list_pictomsg.setAdapter(adapter_pictomsg);
list_pictomsg.setOnItemClickListener(new AdapterView.OnItemClickListener() { list_pictomsg.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
...@@ -65,7 +69,6 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe ...@@ -65,7 +69,6 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe
((PictoAdapter)list_pictomsg.getAdapter()).notifyDataSetChanged(); ((PictoAdapter)list_pictomsg.getAdapter()).notifyDataSetChanged();
} }
}); });
mListener.newMsg(this.adapter_pictomsg.getCount());
return view; return view;
} }
...@@ -106,20 +109,28 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe ...@@ -106,20 +109,28 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe
@Override @Override
public void action(action action, int picto_cat, int picto_id) { public void action(action action, int picto_cat, int picto_id) {
if (action==ActionTalk.iActionListener.action.show) { if (action==ActionTalk.iActionListener.action.show) {
if (!paused) { if (!paused) {
mListener.play_msg(this.adapter_pictomsg.getCount()-1); mListener.play_msg();
mListener.newMsg(this.adapter_pictomsg.getCount());
} }
} else try { } else if (action==ActionTalk.iActionListener.action.add
|| action==ActionTalk.iActionListener.action.select
|| action==ActionTalk.iActionListener.action.delete) try {
Picto picto=PCBcontext.getVocabulary().get_picto(picto_cat,picto_id); Picto picto=PCBcontext.getVocabulary().get_picto(picto_cat,picto_id);
Bitmap bmp=picto.get_bitmap(getContext()); Bitmap bmp=picto.get_bitmap(getContext());
if (action==ActionTalk.iActionListener.action.delete) {
if (paused) { bmp = bmp.copy(bmp.getConfig(), true);
new BitmapTools(bmp).paint((BitmapDrawable)getActivity().getResources().getDrawable(R.drawable.disabled_picto,null),1);
} else if (PCBcontext.getVocabulary().get_picto(picto_cat,picto_id).is_category()) {
Log.e("CAT","catcat");
bmp = bmp.copy(bmp.getConfig(), true);
new BitmapTools(bmp).paint((BitmapDrawable)getActivity().getResources().getDrawable(R.drawable.session_category,null),0.5);
}
if (paused) {
bmp=bmp.copy(bmp.getConfig(),true); bmp=bmp.copy(bmp.getConfig(),true);
new BitmapTools(bmp).paintPause(); new BitmapTools(bmp).paintPause();
} }
this.adapter_pictomsg.addItem(bmp,picto.get_translation()); this.adapter_pictomsg.addItem(bmp,picto.get_translation());
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
public void run() { public void run() {
...@@ -162,4 +173,7 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe ...@@ -162,4 +173,7 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe
public int get_last_msg_pos() { public int get_last_msg_pos() {
return adapter_pictomsg.getCount()-1; return adapter_pictomsg.getCount()-1;
} }
public String get_msg_text(int pos) {
return adapter_pictomsg.getMsgText(pos);
}
} }
...@@ -8,8 +8,8 @@ import android.util.Log; ...@@ -8,8 +8,8 @@ import android.util.Log;
import com.yottacode.pictogram.dao.User; import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.NetService; import com.yottacode.pictogram.net.NetService;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.PictogramActivity; import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.SerialActivity; import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
/** /**
......
...@@ -36,7 +36,7 @@ public class SessionWrapper { ...@@ -36,7 +36,7 @@ public class SessionWrapper {
public interface iStartSession { public interface iStartSession {
void started(int id_session); void started(int id_session, int first_try);
void error(String error); void error(String error);
} }
public interface iCloseSession { public interface iCloseSession {
...@@ -85,7 +85,7 @@ public class SessionWrapper { ...@@ -85,7 +85,7 @@ public class SessionWrapper {
@Override @Override
public void result(JSONObject result) { public void result(JSONObject result) {
try { try {
listener.started(result.getInt("id")); listener.started(result.getInt("id"),result.getInt("first_try_id"));
} catch (JSONException e) { } catch (JSONException e) {
listener.error(e.getMessage()); listener.error(e.getMessage());
} }
...@@ -247,10 +247,10 @@ public class SessionWrapper { ...@@ -247,10 +247,10 @@ public class SessionWrapper {
Hashtable<String, String> params=new Hashtable<>(1); Hashtable<String, String> params=new Hashtable<>(1);
try { try {
params.put("json", new JSONObject() params.put("json", new JSONObject()
.put("ws", Integer.valueOf(ws).toString()) .put("ws", Integer.valueOf(ws).toString())
.put("supervisor",Integer.valueOf(PCBcontext.getPcbdb().getCurrentUser().get_id_sup()).toString()) .put("supervisor",Integer.valueOf(PCBcontext.getPcbdb().getCurrentUser().get_id_sup()).toString())
.put("student",Integer.valueOf(PCBcontext.getPcbdb().getCurrentUser().get_id_stu()).toString()) .put("student",Integer.valueOf(PCBcontext.getPcbdb().getCurrentUser().get_id_stu()).toString())
.put("begin",nowAsISO ).toString()); .put("begin",nowAsISO ).toString());
} catch (JSONException e) { } catch (JSONException e) {
Log.e(SessionWrapper.LOG_TAG,e.getMessage()); Log.e(SessionWrapper.LOG_TAG,e.getMessage());
listener.error(e.getMessage()); listener.error(e.getMessage());
...@@ -284,7 +284,8 @@ public class SessionWrapper { ...@@ -284,7 +284,8 @@ public class SessionWrapper {
}); });
} }
public static void evaluateTry(final int try_id, boolean now, String result, final iTryUpdated listener) { public static void evaluateTry(final int try_id, final boolean now, String result, final iTryUpdated listener) {
Hashtable<String, String> params=new Hashtable<>(1); Hashtable<String, String> params=new Hashtable<>(1);
try{ try{
JSONObject jparams=new JSONObject().put("result",result); JSONObject jparams=new JSONObject().put("result",result);
...@@ -295,7 +296,6 @@ public class SessionWrapper { ...@@ -295,7 +296,6 @@ public class SessionWrapper {
e.printStackTrace(); e.printStackTrace();
} }
PCBcontext.getRestapiWrapper().ask("try/"+try_id,params,"put",true, new RestapiWrapper.iRestapiListener() { PCBcontext.getRestapiWrapper().ask("try/"+try_id,params,"put",true, new RestapiWrapper.iRestapiListener() {
@Override @Override
...@@ -305,12 +305,20 @@ public class SessionWrapper { ...@@ -305,12 +305,20 @@ public class SessionWrapper {
@Override @Override
public void result(JSONArray result) { public void result(JSONArray result) {
listener.update(try_id); try {
listener.update(result.getJSONObject(0).getInt("next_try_id"));
} catch (JSONException e) {
listener.error(e.getMessage());
}
} }
@Override @Override
public void result(JSONObject result) { public void result(JSONObject result) {
listener.update(try_id); try {
listener.update(result.getInt("next_try_id"));
} catch (JSONException e) {
listener.error(e.getMessage());
}
} }
@Override @Override
......
...@@ -8,4 +8,3 @@ ...@@ -8,4 +8,3 @@
android:toXDelta="0" android:toXDelta="0"
android:interpolator="@android:anim/linear_interpolator" /> android:interpolator="@android:anim/linear_interpolator" />
</set> </set>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal" android:orientation="horizontal"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.LoginActivity"> tools:context="com.yottacode.pictogram.tabletlibrary.gui.login.LoginActivity">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<fragment <fragment
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
class="com.yottacode.pictogram.tabletlibrary.gui.StudentFragmentGrid" class="com.yottacode.pictogram.tabletlibrary.gui.login.StudentFragmentGrid"
android:id="@+id/loginStudentGrid" android:id="@+id/loginStudentGrid"
android:layout_gravity="center" android:layout_gravity="center"
tools:layout="@layout/fragment_new_student" /> tools:layout="@layout/fragment_new_student" />
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
android:background="#BDBDBD" android:background="#BDBDBD"
android:keepScreenOn="true" android:keepScreenOn="true"
android:id="@+id/pictogramLayout" android:id="@+id/pictogramLayout"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.PictogramActivity" tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity"
android:padding="@dimen/small_padding"> android:padding="@dimen/small_padding">
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) --> <!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
android:background="#BDBDBD" android:background="#BDBDBD"
android:keepScreenOn="true" android:keepScreenOn="true"
android:id="@+id/pictogramLayout" android:id="@+id/pictogramLayout"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.PictogramActivity" tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity"
android:padding="@dimen/small_padding"> android:padding="@dimen/small_padding">
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) --> <!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
......
...@@ -97,8 +97,7 @@ ...@@ -97,8 +97,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:textOff="REC" android:textOff="REC"
android:textOn="REC" android:textOn="REC" />
android:textColorLink="@color/darkgreen" />
</RelativeLayout> </RelativeLayout>
...@@ -143,12 +142,12 @@ ...@@ -143,12 +142,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_gravity="top" android:layout_gravity="top"
android:layout_marginBottom="10dp"> android:layout_marginBottom="10dp">
<LinearLayout <LinearLayout
android:id="@+id/view_session_buttons" android:id="@+id/view_session_buttons"
android:layout_marginTop="20px"
android:layout_below="@+id/view_as2" android:layout_below="@+id/view_as2"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
...@@ -184,38 +183,24 @@ ...@@ -184,38 +183,24 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<ScrollView <ListView
android:id="@+id/SCROLLER_ID" android:id="@+id/session_serverlog"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="fill_parent"
android:scrollbars="vertical"
android:layout_toLeftOf="@+id/imageView3"
android:layout_toRightOf="@+id/view_session_buttons0" android:layout_toRightOf="@+id/view_session_buttons0"
android:layout_below="@+id/view_as2" android:layout_below="@+id/view_as2"
android:layout_alignBottom="@+id/imageView3" android:fillViewport="true"
android:layout_alignTop="@+id/imageView3"
android:fillViewport="true">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ems="12"
android:id="@+id/session_serverlog"
android:layout_weight="1"
android:background="@color/common_google_signin_btn_text_light_disabled" />
</ScrollView>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
app:srcCompat="@drawable/pictogram_logo"
android:id="@+id/imageView3"
android:maxLines = "100"
android:background="@drawable/pictogram_logo"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
android:layout_gravity="right"
android:layout_weight="1" android:layout_weight="1"
android:layout_below="@+id/view_as2" android:transcriptMode="alwaysScroll"
android:layout_alignEnd="@+id/sessionFragmentLayout" android:stackFromBottom="true"
android:layout_marginEnd="21dp" /> android:background="@color/common_google_signin_btn_text_light_disabled"
android:layout_marginBottom="10px"
android:layout_marginEnd="10px"
android:layout_marginRight="10px"
android:layout_marginLeft="50px"
android:layout_marginStart="10px"
android:layout_marginTop="5px" />
</RelativeLayout> </RelativeLayout>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="15dp" android:paddingRight="15dp"
android:orientation="vertical" android:orientation="vertical"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.SplashScreenActivity" > tools:context="com.yottacode.pictogram.tabletlibrary.gui.login.SplashScreenActivity" >
<ImageView <ImageView
android:layout_width="400px" android:layout_width="400px"
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
<ListView <ListView
android:id="@+id/session_pictomsg_list" android:id="@+id/session_pictomsg_list"
android:transcriptMode="alwaysScroll"
android:stackFromBottom="true"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sessionLogEntry"
android:layout_width="wrap_content"
android:layout_height="30px"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
android:gravity="left"
android:paddingLeft="10px" />
...@@ -73,14 +73,6 @@ ...@@ -73,14 +73,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
...@@ -89,72 +81,69 @@ ...@@ -89,72 +81,69 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-compat/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-ui/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-utils/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-fragment/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-media-compat/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/typedefs.txt" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-annotations-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-v4-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-compat-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-media-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-24.2.1" level="project" /> <orderEntry type="library" exported="" name="animated-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-fragment-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-fragment-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-core-ui-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-24.2.1" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" />
<orderEntry type="library" exported="" name="androidasync-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" name="ion-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" /> <orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="android-android-24" level="project" /> <orderEntry type="library" exported="" name="android-android-24" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" /> <orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" /> <orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
<orderEntry type="library" exported="" name="androidasync-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" /> <orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" /> <orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.3.0" level="project" /> <orderEntry type="library" exported="" name="okio-1.3.0" level="project" />
<orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" /> <orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" />
<orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="ion-2.1.9" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
...@@ -3,7 +3,7 @@ apply plugin: 'com.android.application' ...@@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 24 compileSdkVersion 24
buildToolsVersion "23.0.2" buildToolsVersion '25.0.0'
defaultConfig { defaultConfig {
applicationId "com.yottacode.watch" applicationId "com.yottacode.watch"
......
...@@ -106,14 +106,6 @@ ...@@ -106,14 +106,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
...@@ -122,54 +114,68 @@ ...@@ -122,54 +114,68 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-tasks/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.support/wearable/2.0.0-alpha2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="wearable-2.0.0-alpha2" level="project" /> <orderEntry type="library" exported="" name="wearable-2.0.0-alpha2" level="project" />
<orderEntry type="library" exported="" name="support-v4-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-fragment-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="androidasync-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-wearable-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-wearable-9.2.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" /> <orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" /> <orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" /> <orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" name="ion-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" /> <orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="android-android-24" level="project" /> <orderEntry type="library" exported="" name="android-android-24" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" /> <orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" /> <orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
<orderEntry type="library" exported="" name="androidasync-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" /> <orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" /> <orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.3.0" level="project" /> <orderEntry type="library" exported="" name="okio-1.3.0" level="project" />
<orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" /> <orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" />
<orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="ion-2.1.9" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
...@@ -11,14 +11,14 @@ android { ...@@ -11,14 +11,14 @@ android {
}*/ }*/
compileSdkVersion 24 compileSdkVersion 24
buildToolsVersion "23.0.2" buildToolsVersion '25.0.0'
defaultConfig { defaultConfig {
applicationId "com.yottacode.pictogram.yotta_tablet" applicationId "com.yottacode.pictogram.yotta_tablet"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 22 targetSdkVersion 22
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
resValue "string","SerialClass","com.yottacode.pictogram.tabletlibrary.gui.SerialActivity" resValue "string","SerialClass","com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity"
// signingConfig signingConfigs.config // signingConfig signingConfigs.config
} }
productFlavors { productFlavors {
...@@ -34,6 +34,10 @@ android { ...@@ -34,6 +34,10 @@ android {
resValue "string", "server", "https://pre.yottacode.com" resValue "string", "server", "https://pre.yottacode.com"
resValue "bool", "ssl_connect", "true" resValue "bool", "ssl_connect", "true"
} }
LocalFlavor {
resValue "string", "server", "http://192.168.1.36:1337"
resValue "bool", "ssl_connect", "false"
}
} }
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.SplashScreenActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.login.SplashScreenActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape"> android:screenOrientation="landscape">
<intent-filter> <intent-filter>
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.MainActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.login.MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.SerialActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity"
android:label="@string/title_activity_serial" android:label="@string/title_activity_serial"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.LoginActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.login.LoginActivity"
android:exported="true" android:exported="true"
android:label="@string/title_activity_login_activity_fragments" android:label="@string/title_activity_login_activity_fragments"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.PictogramActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity"
android:exported="true" android:exported="true"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
......
...@@ -4,6 +4,8 @@ import android.content.BroadcastReceiver; ...@@ -4,6 +4,8 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import com.yottacode.pictogram.tabletlibrary.gui.login.MainActivity;
/** /**
* Created by emblanco on 13/10/15. * Created by emblanco on 13/10/15.
* *
...@@ -16,7 +18,7 @@ public class BootReceiver extends BroadcastReceiver { ...@@ -16,7 +18,7 @@ public class BootReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Intent myIntent = new Intent(context, com.yottacode.pictogram.tabletlibrary.gui.MainActivity.class); Intent myIntent = new Intent(context, MainActivity.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent); context.startActivity(myIntent);
} }
......
...@@ -88,7 +88,7 @@ public class KioskService extends Service { ...@@ -88,7 +88,7 @@ public class KioskService extends Service {
private void restoreApp() { private void restoreApp() {
// Restart activity // Restart activity
Intent i = new Intent(ctx, com.yottacode.pictogram.tabletlibrary.gui.SerialActivity.class); Intent i = new Intent(ctx, com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(i); ctx.startActivity(i);
} }
......
...@@ -5,13 +5,12 @@ Vagrant.configure(2) do |config| ...@@ -5,13 +5,12 @@ Vagrant.configure(2) do |config|
# "ubuntu/trusty64" for ubuntu environment # "ubuntu/trusty64" for ubuntu environment
# "boxcutter/centos72" for AWS similar environment # "boxcutter/centos72" for AWS similar environment
config.vm.box = "aspyatkin/ubuntu-16.04-server-amd64" config.vm.box = "aspyatkin/ubuntu-16.04-server-amd64"
# Set locale UTF-8
ENV['LC_ALL']="en_US.UTF-8"
config.vm.network "forwarded_port", guest: 1337, host: 1337 config.vm.network "forwarded_port", guest: 1337, host: 1337
config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.network "forwarded_port", guest: 80, host: 8080
config.ssh.insert_key = false config.ssh.insert_key = false
config.vm.provider "virtualbox" do |vb| config.vm.provider "virtualbox" do |vb|
vb.customize ['modifyvm', :id, '--cableconnected1', 'on']
vb.memory = 1024 vb.memory = 1024
end end
......
#!/bin/bash #!/bin/bash
# running pictogram server
echo "-- Running pictogram server" echo "-- Running pictogram server"
if [ -e "src/app.js" ]; then if [ -e "src/app.js" ]; then
cd src && forever start app.js --debug cd src && forever start app.js --debug
......
#!/bin/bash #!/bin/bash
# keymap and system encoding
sudo localectl set-keymap es
export LANG=en_US.UTF-8
# installing ansible
echo "-- Installing ansible" echo "-- Installing ansible"
if [ -e "/usr/bin/apt-get" ]; then if [ -e "/usr/bin/apt-get" ]; then
echo "-- Installing using apt-get" echo "-- Installing using apt-get"
...@@ -16,6 +21,7 @@ else ...@@ -16,6 +21,7 @@ else
exit exit
fi fi
# running ansible
echo "-- Running ansible playbook" echo "-- Running ansible playbook"
function runAnsiblePlaybook { function runAnsiblePlaybook {
echo "-- Running playbook from $(pwd)" echo "-- Running playbook from $(pwd)"
......
...@@ -11,8 +11,8 @@ Los ficheros SQL que importará este rol son los siguientes: ...@@ -11,8 +11,8 @@ Los ficheros SQL que importará este rol son los siguientes:
los datos almacenados por symbolstx. los datos almacenados por symbolstx.
- [pictodb-schema][3] contiene el esquema de la base de datos. - [pictodb-schema][3] contiene el esquema de la base de datos.
- [pictodb-data][4] contiene la información básica que la aplicación necesita para funcionar. Añade información a las tablas `meta_method`, `meta_instruction`, `source`, `picto_core` y `picto_exp`. - [pictodb-data][4] contiene la información básica que la aplicación necesita para funcionar. Añade información a las tablas `meta_method`, `meta_instruction`, `source`, `picto_core` y `picto_exp`.
- [symbolstx-categories][5] añade las categorías de symbolstx en las tablas `pictocat` y `catexp`. - [pitcodb-core][11] y [pictodb-corexp][12] contienen la información del subconjunto de symbolstix que conforma el vocabulario básico de un estudiante recién creado
- [symbolstix-metadata][6] añade traducciones para symbolstx y los pictos (tablas `picto_exp`, `picto_tag` y `picto`). - [symbolstx][11] añade la colección de Symbolstix
- [triggers-enrolments-integrity-constraints][7] añade disparadores para el control de - [triggers-enrolments-integrity-constraints][7] añade disparadores para el control de
integridad de inscripciones. integridad de inscripciones.
- [triggers-sessions-integrity-constraints][8] añade disparadores para el control de integridad - [triggers-sessions-integrity-constraints][8] añade disparadores para el control de integridad
...@@ -20,6 +20,11 @@ Los ficheros SQL que importará este rol son los siguientes: ...@@ -20,6 +20,11 @@ Los ficheros SQL que importará este rol son los siguientes:
- [test-caja][9] contiene datos para el test de CAJA. - [test-caja][9] contiene datos para el test de CAJA.
- [test-autismojaen][10] añade los datos para el test de autismojaen. - [test-autismojaen][10] añade los datos para el test de autismojaen.
Obsoleto:
- [symbolstx-categories][5] añade las categorías de symbolstx en las tablas `pictocat` y `catexp`
- [symbolstix-metadata][6] añade traducciones para symbolstx y los pictos (tablas `picto_exp`, `picto_tag` y `picto`).
[1]: /softuno/pictogram/blob/develop/sails/roles/database/files/init.sql [1]: /softuno/pictogram/blob/develop/sails/roles/database/files/init.sql
[2]: /softuno/pictogram/blob/develop/sails/roles/database/files/init-ignoresymbolstix.sql [2]: /softuno/pictogram/blob/develop/sails/roles/database/files/init-ignoresymbolstix.sql
[3]: /softuno/pictogram/blob/develop/sails/roles/database/files/pictodb-schema.sql [3]: /softuno/pictogram/blob/develop/sails/roles/database/files/pictodb-schema.sql
...@@ -30,3 +35,5 @@ Los ficheros SQL que importará este rol son los siguientes: ...@@ -30,3 +35,5 @@ Los ficheros SQL que importará este rol son los siguientes:
[8]: /softuno/pictogram/blob/develop/sails/roles/database/files/triggers-sessions-integrity-constraints.sql [8]: /softuno/pictogram/blob/develop/sails/roles/database/files/triggers-sessions-integrity-constraints.sql
[9]: /softuno/pictogram/blob/develop/sails/roles/database/files/test-autismojaen.sql [9]: /softuno/pictogram/blob/develop/sails/roles/database/files/test-autismojaen.sql
[10]: /softuno/pictogram/blob/develop/sails/roles/database/files/test-caja.sql [10]: /softuno/pictogram/blob/develop/sails/roles/database/files/test-caja.sql
[11]: /softuno/pictogram/blob/develop/sails/roles/database/files/pictodb-core.sql
[12]: /softuno/pictogram/blob/develop/sails/roles/database/files/pictodb-coreexp.sql
-- MySQL dump 10.13 Distrib 5.7.13, for Linux (x86_64)
--
-- Host: localhost Database: pictodbclean
-- ------------------------------------------------------
-- Server version 5.7.13
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `pictocat`
--
DROP TABLE IF EXISTS `pictocat`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pictocat` (
`id` int(11) NOT NULL,
`id_supercat` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Identifies a category, which, itself, may belong to another category';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pictocat`
--
LOCK TABLES `pictocat` WRITE;
/*!40000 ALTER TABLE `pictocat` DISABLE KEYS */;
INSERT INTO `pictocat` VALUES (1,0),(2,1),(3,1),(4,0),(5,0),(6,1),(7,0),(8,1),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,16),(18,16),(19,0),(20,0),(21,16),(22,0),(23,22),(24,16),(25,16),(26,0),(27,0),(28,0),(29,0),(30,29),(31,29),(32,29),(33,0),(34,0),(35,22),(36,0),(37,5),(38,0),(39,0),(40,12),(41,15),(42,0),(43,0),(44,0),(45,9),(46,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,53),(55,53),(56,53),(57,53),(58,53),(59,53),(60,53),(61,53),(62,53),(63,53),(64,53),(65,51),(66,20),(67,0),(68,0),(69,0),(70,0),(71,0),(72,20),(73,0),(74,0),(75,0),(76,71),(77,20),(78,51),(79,0),(80,0),(81,5),(82,22),(83,0),(84,0),(85,84),(86,84),(87,51),(88,0),(89,20),(90,0),(91,51),(92,80),(93,0),(94,0),(95,0),(96,0),(97,0),(98,97),(99,97),(100,80),(101,69),(102,51),(103,51),(104,0),(105,51),(106,69),(107,69),(108,0),(109,69),(110,69),(111,69),(112,69),(113,69),(114,0),(115,71),(116,0),(117,0),(118,0),(119,0),(120,0),(121,0),(122,0);
/*!40000 ALTER TABLE `pictocat` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-01-17 9:48:07
...@@ -9,7 +9,7 @@ INSERT INTO `picto_core` (`id`, `id_pic`, `id_cat_pic`, `coord_x`, `coord_y`,`co ...@@ -9,7 +9,7 @@ INSERT INTO `picto_core` (`id`, `id_pic`, `id_cat_pic`, `coord_x`, `coord_y`,`co
(2, 4391, NULL, 1, 0, NULL), -- no (2, 4391, NULL, 1, 0, NULL), -- no
(4, 2237, NULL, 2, 0, NULL), -- i want (4, 2237, NULL, 2, 0, NULL), -- i want
(229, 2224, NULL, 3, 0, NULL), -- i have (229, 2224, NULL, 3, 0, NULL), -- i have
(131, 8148,NULL, 0, 1, '#FE9A2E'), -- Places and rooms (131, 8148, NULL, 0, 1, '#FE9A2E'), -- Places and rooms
(134, 7989, 8148, 0, 0, NULL), -- Places.Hospital (134, 7989, 8148, 0, 0, NULL), -- Places.Hospital
(135, 8155, 8148, 0, 1, NULL), -- Places.Playground (135, 8155, 8148, 0, 1, NULL), -- Places.Playground
(136, 8354, 8148, 0, 2, NULL), -- Places.Zoo (136, 8354, 8148, 0, 2, NULL), -- Places.Zoo
...@@ -229,6 +229,3 @@ INSERT INTO `picto_core` (`id`, `id_pic`, `id_cat_pic`, `coord_x`, `coord_y`,`co ...@@ -229,6 +229,3 @@ INSERT INTO `picto_core` (`id`, `id_pic`, `id_cat_pic`, `coord_x`, `coord_y`,`co
(5, 266, 1379, 3, 5, NULL), -- Adverbs and interjections.help (5, 266, 1379, 3, 5, NULL), -- Adverbs and interjections.help
(7, 2179, 1379, 3, 6, NULL), -- Adverbs and interjections.hello (7, 2179, 1379, 3, 6, NULL), -- Adverbs and interjections.hello
(124, 2169,1379, 3, 7, NULL); -- Adverbs and interjections.bye (124, 2169,1379, 3, 7, NULL); -- Adverbs and interjections.bye
...@@ -21,19 +21,33 @@ INSERT INTO `supervisor` (`id`, `name`, `surname`, `gender`, `pic`, `address`, ` ...@@ -21,19 +21,33 @@ INSERT INTO `supervisor` (`id`, `name`, `surname`, `gender`, `pic`, `address`, `
-- --
-- Meta-method -- Meta-method
-- --
INSERT INTO `meta_method` (`id`, `name`, `description`, `id_sup`) VALUES INSERT INTO `meta_method` (`id`, `name`, `description`, `id_sup`, `lang`) VALUES
(1, 'Comunicación Aumentativa y Adaptativa', NULL, NULL); (1, 'Comunicación Aumentativa y Alternativa', NULL, NULL, 'es-es'),
(2, 'Augmentative and Alternative Communication', NULL, NULL, 'en-us'),
(3, 'Augmentative and Alternative Communication', NULL, NULL, 'en-gb');
-- --
-- Meta-instruction -- Meta-instruction
-- --
INSERT INTO `meta_instruction` (`id` ,`name` ,`objective` ,`id_met`) VALUES INSERT INTO `meta_instruction` (`id` ,`name` ,`objective` ,`id_met`, `lang`) VALUES
(NULL , 'Fase 1 - El Intercambio físico', 'En cuanto vea un objeto altamente preferido, el estudiante tomará la imagen del objeto, se acercará hacia el terapeuta y dejará la imagen (fotografía) en la mano del terapeuta.', '1'), (NULL , 'Fase 1 - El Intercambio físico', 'En cuanto vea un objeto altamente preferido, el estudiante tomará la imagen del objeto, se acercará hacia el terapeuta y dejará la imagen (fotografía) en la mano del terapeuta.', '1', 'es-es'),
(NULL , 'Fase 2 - Desarrollando la espontaneidad', 'El estudiante irá a su tablero de comunicación, tomará una fotografía, irá a un adulto y la dejará en su mano.', '1'), (NULL , 'Fase 2 - Desarrollando la espontaneidad', 'El estudiante irá a su tablero de comunicación, tomará una fotografía, irá a un adulto y la dejará en su mano.', '1', 'es-es'),
(NULL , 'Fase 3 - Discriminación de fotografías', 'El estudiante solicitará los objetos deseados yendo al tablero de comunicación, seleccionando la fotografía apropiada y volviendo de nuevo hasta el interlocutor a darle la fotografía.', '1'), (NULL , 'Fase 3 - Discriminación de fotografías', 'El estudiante solicitará los objetos deseados yendo al tablero de comunicación, seleccionando la fotografía apropiada y volviendo de nuevo hasta el interlocutor a darle la fotografía.', '1', 'es-es'),
(NULL , 'Fase 4 - Estructura de la oración', 'El estudiante solicita artículos presentes y no presentes usando una frase de varias palabras yendo al libro.El estudiante toma una fotografía/símbolo de "Yo quiero" y la coloca en una línea de frase (tira de Velcro). Luego, el estudiante toma una imagen de lo que desea, la coloca en la línea de frase, quita toda la tira de Velcro, y la lleva a su interlocutor.', '1'), (NULL , 'Fase 4 - Estructura de la oración', 'El estudiante solicita artículos presentes y no presentes usando una frase de varias palabras yendo al libro.El estudiante toma una fotografía/símbolo de "Yo quiero" y la coloca en una línea de frase (tira de Velcro). Luego, el estudiante toma una imagen de lo que desea, la coloca en la línea de frase, y la lleva a su interlocutor.', '1', 'es-es'),
(NULL , 'Fase 5 - Respondiendo a "¿Qué quieres?"', 'El estudiante puede de manera espontánea solicitar una variedad de objetos y puede responder a la pregunta, "Que quieres?"', '1'), (NULL , 'Fase 5 - Respondiendo a "¿Qué quieres?"', 'El estudiante puede de manera espontánea solicitar una variedad de objetos y puede responder a la pregunta, "Que quieres?"', '1', 'es-es'),
(NULL , 'Fase 6 - Respuesta y comentario espontáneo', 'El estudiante responde apropiadamente a "Qué quieres?", "Qué ves?", "Qué tienes?" y a otras preguntas similares cuando éstas son hechas de manera aleatoria.', '1'); (NULL , 'Fase 6 - Respuesta y comentario espontáneo', 'El estudiante responde apropiadamente a "Qué quieres?", "Qué ves?", "Qué tienes?" y a otras preguntas similares cuando éstas son hechas de manera aleatoria.', '1', 'es-es'),
(NULL , 'Phase 1 - How to Communicate', 'Students learn to exchange single pictures for items or activities they really want. ', '2', 'en-us'),
(NULL , 'Phase 2 - Distance and Persistence', 'Still using single pictures, students learn to generalize this new skill by using it in different places, with different people and across distances. They are also taught to be more persistent communicators.', '2', 'en-us'),
(NULL , 'Phase 3 - Picture Discrimination', 'Students learn to select from two or more pictures to ask for their favorite things. These are placed in the phrase strip of the device where pictures are stored and easily removed for communication.', '2', 'en-us'),
(NULL , 'Phase 4 - Sentence Structure', 'Students learn to construct simple sentences on a detachable sentence strip using an "I want" picture followed by a picture of the item being requested.', '2', 'en-us'),
(NULL , 'Phase 5 - Answering Questions', 'Students learn to use Pictogram to answer the question, "What do you want?".', '2', 'en-us'),
(NULL , 'Phase 6 - Commenting', 'Now students are taught to comment in response to questions such as, "What do you see?", "What do you hear?" and "What is it?". They learn to make up sentences starting with "I see", "I hear", "I feel", "It is a", etc.', '2', 'en-us'),
(NULL , 'Phase 1 - How to Communicate', 'Students learn to exchange single pictures for items or activities they really want. ', '3', 'en-gb'),
(NULL , 'Phase 2 - Distance and Persistence', 'Still using single pictures, students learn to generalize this new skill by using it in different places, with different people and across distances. They are also taught to be more persistent communicators.', '3', 'en-gb'),
(NULL , 'Phase 3 - Picture Discrimination', 'Students learn to select from two or more pictures to ask for their favorite things. These are placed in the phrase strip of the device where pictures are stored and easily removed for communication.', '3', 'en-gb'),
(NULL , 'Phase 4 - Sentence Structure', 'Students learn to construct simple sentences on a detachable sentence strip using an "I want" picture followed by a picture of the item being requested.', '3', 'en-gb'),
(NULL , 'Phase 5 - Answering Questions', 'Students learn to use Pictogram to answer the question, "What do you want?".', '3', 'en-gb'),
(NULL , 'Phase 6 - Commenting', 'Now students are taught to comment in response to questions such as, "What do you see?", "What do you hear?" and "What is it?". They learn to make up sentences starting with "I see", "I hear", "I feel", "It is a", etc.', '3', 'en-gb');
-- --
-- Volcado de datos para la tabla `source` -- Volcado de datos para la tabla `source`
......
...@@ -44,6 +44,20 @@ CREATE TABLE IF NOT EXISTS `action` ( ...@@ -44,6 +44,20 @@ CREATE TABLE IF NOT EXISTS `action` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1
COMMENT="This table registers and action performed by a user at a given time, all information of the action is in JSON format in the 'description' column and the operation performed is one of the possible for the 'type' column. NOTE: timestamps must support fractional seconds, so MySQL versions >= 5.6.4 are required."; COMMENT="This table registers and action performed by a user at a given time, all information of the action is in JSON format in the 'description' column and the operation performed is one of the possible for the 'type' column. NOTE: timestamps must support fractional seconds, so MySQL versions >= 5.6.4 are required.";
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `catexp`
--
CREATE TABLE IF NOT EXISTS `catexp`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_cat` int(11) NOT NULL,
`lang` char(5),
`exp` varchar(30) NOT NULL,
PRIMARY KEY(`id`),
UNIQUE(exp,lang),
CHECK (lang IN ('es-es','en-gb','en-us'))
)
COMMENT="Stores the expressions available in several languages for a given category (id_cat)";
-- -------------------------------------------------------- -- --------------------------------------------------------
...@@ -81,6 +95,8 @@ CREATE TABLE IF NOT EXISTS `instruction` ( ...@@ -81,6 +95,8 @@ CREATE TABLE IF NOT EXISTS `instruction` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1
COMMENT="An instruction is a 'phase' in a method for learning AAC"; COMMENT="An instruction is a 'phase' in a method for learning AAC";
-- CREATE INDEX ix_instruction_begin ON instruction (`begin`);
-- -------------------------------------------------------- -- --------------------------------------------------------
...@@ -94,6 +110,7 @@ CREATE TABLE IF NOT EXISTS `meta_instruction` ( ...@@ -94,6 +110,7 @@ CREATE TABLE IF NOT EXISTS `meta_instruction` (
`name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`objective` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL, `objective` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
`id_met` tinyint(4) NOT NULL, `id_met` tinyint(4) NOT NULL,
`lang` char(5) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1
COMMENT="One in a set of instructions predefined or stored by users. They are related to a metamethod (id_met)"; COMMENT="One in a set of instructions predefined or stored by users. They are related to a metamethod (id_met)";
...@@ -105,9 +122,10 @@ COMMENT="One in a set of instructions predefined or stored by users. They are re ...@@ -105,9 +122,10 @@ COMMENT="One in a set of instructions predefined or stored by users. They are re
CREATE TABLE IF NOT EXISTS `meta_method` ( CREATE TABLE IF NOT EXISTS `meta_method` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT, `id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` varchar(40) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(4096) COLLATE utf8_unicode_ci DEFAULT NULL, `description` varchar(4096) COLLATE utf8_unicode_ci DEFAULT NULL,
`id_sup` INT( 11 ) DEFAULT NULL, `id_sup` INT( 11 ) DEFAULT NULL,
`lang` char(5) COLLATE utf8_unicode_ci NOT NULL,
UNIQUE(name,id_sup), UNIQUE(name,id_sup),
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1
...@@ -158,6 +176,7 @@ CREATE TABLE IF NOT EXISTS `picto` ( ...@@ -158,6 +176,7 @@ CREATE TABLE IF NOT EXISTS `picto` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=104142 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=104142
COMMENT="Main information about a pictogram, either coming from a source like Symbolstix or added by a supervisor. It can belongs to a category (id_cat)"; COMMENT="Main information about a pictogram, either coming from a source like Symbolstix or added by a supervisor. It can belongs to a category (id_cat)";
-- --
-- Estructura de tabla para la tabla `picto_acl` -- Estructura de tabla para la tabla `picto_acl`
-- NOT IN USE (candidate for removal) -- NOT IN USE (candidate for removal)
...@@ -177,6 +196,18 @@ COMMENT="Stablish access rights to pictos"; ...@@ -177,6 +196,18 @@ COMMENT="Stablish access rights to pictos";
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
-- Estructura de tabla para la tabla `pictocat`
--
CREATE TABLE IF NOT EXISTS `pictocat`(
`id` int(11) PRIMARY KEY,
`id_supercat` int(11)
)
COMMENT="Identifies a category, which, itself, may belong to another category";
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `picto_core` -- Estructura de tabla para la tabla `picto_core`
-- --
...@@ -367,6 +398,7 @@ CREATE TABLE IF NOT EXISTS `try` ( ...@@ -367,6 +398,7 @@ CREATE TABLE IF NOT EXISTS `try` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1
COMMENT="This table contains tries information (they belong to a working session)"; COMMENT="This table contains tries information (they belong to a working session)";
-- CREATE INDEX ix_try_begin ON try (`begin`);
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
...@@ -398,6 +430,7 @@ CREATE TABLE IF NOT EXISTS `working_session` ( ...@@ -398,6 +430,7 @@ CREATE TABLE IF NOT EXISTS `working_session` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1
COMMENT="This table stores working session information. Every working session is related to one instruction and one supervisor (and the instruction is related to one method which is related to one student)"; COMMENT="This table stores working session information. Every working session is related to one instruction and one supervisor (and the instruction is related to one method which is related to one student)";
-- CREATE INDEX ix_ws_begin ON working_session (`begin`);
-- --
-- Restricciones para tablas volcadas -- Restricciones para tablas volcadas
-- --
......
This diff could not be displayed because it is too large.
...@@ -34,7 +34,7 @@ thisTrigger: BEGIN ...@@ -34,7 +34,7 @@ thisTrigger: BEGIN
END IF; END IF;
END;; END;;
-- Integrity rule 2: office.current_enrolments updating -- Integrity rule 2: office.current_enrolments updating (adding core)
DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_UPDATE_ENROLMENTS; DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_UPDATE_ENROLMENTS;
CREATE TRIGGER TRG_NEW_STUDENT_UPDATE_ENROLMENTS CREATE TRIGGER TRG_NEW_STUDENT_UPDATE_ENROLMENTS
AFTER INSERT ON student AFTER INSERT ON student
...@@ -55,7 +55,7 @@ thisTrigger: BEGIN ...@@ -55,7 +55,7 @@ thisTrigger: BEGIN
office.id=new.id_off; office.id=new.id_off;
INSERT INTO stu_picto(id_stu,id_pic,attributes) INSERT INTO stu_picto(id_stu,id_pic,attributes)
SELECT new.id,id_pic, concat('{"id_cat":', if (id_cat_pic is null, 'null',id_cat_pic), SELECT new.id,id_pic, concat('{"id_cat":', if (id_cat_pic is null, 'null', id_cat_pic),
',"coord_x":',coord_x, ',"coord_x":',coord_x,
',"coord_y":',coord_y, ',"coord_y":',coord_y,
',"status":"invisible"', ',"status":"invisible"',
......
...@@ -16,16 +16,13 @@ ...@@ -16,16 +16,13 @@
state: import state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/pictodb-schema.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/pictodb-schema.sql"
- name: Imports symbolstx categories and metadata - name: Imports symbolstix pictos
mysql_db: mysql_db:
login_user: "{{ database_user }}" login_user: "{{ database_user }}"
login_password: "{{ database_user_passwd }}" login_password: "{{ database_user_passwd }}"
name: "{{ database_name }}" name: "{{ database_name }}"
state: import state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/symbolstx-{{ item }}.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/symbolstix.sql"
with_items:
- metadata
- categories
- name: Imports application essential data - name: Imports application essential data
mysql_db: mysql_db:
......
...@@ -33,7 +33,7 @@ module.exports = { ...@@ -33,7 +33,7 @@ module.exports = {
res.ok(metaMethods); res.ok(metaMethods);
}) })
.catch(function (err) { .catch(function (err) {
res.serverError(err); res.serverError(err.message);
}); });
}, },
......
...@@ -39,15 +39,15 @@ module.exports = { ...@@ -39,15 +39,15 @@ module.exports = {
.then(function (categories) { .then(function (categories) {
res.ok(categories); res.ok(categories);
}) })
.catch(function () { .catch(function (err) {
res.serverError(); throw err;
}); });
} else { } else {
res.badRequest(); res.badRequest();
} }
}) })
.catch(function () { .catch(function (err) {
res.serverError(); res.serverError(err);
}); });
}, },
...@@ -304,7 +304,7 @@ module.exports = { ...@@ -304,7 +304,7 @@ module.exports = {
Picto.create({ Picto.create({
uri: pictoFileName, uri: pictoFileName,
source: 1, // @TODO check for other sources source: 2, // 1 -> SymbolStix, 2 -> custom
owner: supervisor.id owner: supervisor.id
}) })
.then(picto => { .then(picto => {
......
...@@ -632,6 +632,7 @@ module.exports = { ...@@ -632,6 +632,7 @@ module.exports = {
student: params.id_stu student: params.id_stu
} }
}) })
.sort('ws_begin DESC')
.exec(function (err, ws) { .exec(function (err, ws) {
if (err) { if (err) {
sails.log.debug('Finding student working sessions: ' + err); sails.log.debug('Finding student working sessions: ' + err);
...@@ -785,12 +786,6 @@ module.exports = { ...@@ -785,12 +786,6 @@ module.exports = {
* source: 1 @TODO Other sources * source: 1 @TODO Other sources
* owner: supervisorId or null * owner: supervisorId or null
* }, * },
* expression: {
* id: expressionId,
* lang: 'es-es',
* text: 'Picto Expression',
* picto: pictoId
* },
* attributes: { @see StuPicto.getValidAttributes() } * attributes: { @see StuPicto.getValidAttributes() }
* }, * },
* ... * ...
...@@ -851,7 +846,6 @@ module.exports = { ...@@ -851,7 +846,6 @@ module.exports = {
* student: studentId (speficied as url parameter) * student: studentId (speficied as url parameter)
* picto: { @see Picto model} * picto: { @see Picto model}
* attributes: { @see StuPicto.getValidAttributes() } * attributes: { @see StuPicto.getValidAttributes() }
* expression: { @see Picto model }
* } * }
*/ */
add_picto: function (req, res) { add_picto: function (req, res) {
...@@ -891,12 +885,9 @@ module.exports = { ...@@ -891,12 +885,9 @@ module.exports = {
if (!stuPicto) if (!stuPicto)
throw new Error("stu_picto not created"); throw new Error("stu_picto not created");
sails.log.debug("->>" + JSON.stringify(picto)); sails.log.debug("->>" + JSON.stringify(picto));
return res.ok({ Student.pictoInfo(stuPicto.id, function(err, resp) {
id: stuPicto.id, if (err) throw err;
student: params.id_stu, return res.ok(resp);
attributes: stuPicto.attributes,
picto: picto,
expression: picto.expressions[0]
}); });
}) })
.catch(err => res.serverError("Error adding picto: " + err)); .catch(err => res.serverError("Error adding picto: " + err));
...@@ -928,8 +919,6 @@ module.exports = { ...@@ -928,8 +919,6 @@ module.exports = {
// //
update_picto: function (req, res) { update_picto: function (req, res) {
var params = req.allParams(); var params = req.allParams();
console.log('Updating attributes for picto student ' + JSON.stringify(params));
console.log(JSON.stringify(params));
query = params.id_stuPicto ? { query = params.id_stuPicto ? {
id: params.id_stuPicto id: params.id_stuPicto
...@@ -945,43 +934,98 @@ module.exports = { ...@@ -945,43 +934,98 @@ module.exports = {
if (!updated) if (!updated)
throw new Error ("error on update"); throw new Error ("error on update");
console.log('Updated attributes for picto student:' + JSON.stringify(updated[0])); Student.pictoInfo(updated[0].id, function(err, resp) {
// return res.json(updated[0]); if (err) throw err;
return res.ok({ return res.ok(resp);
id: updated[0].id, // id of stu_picto
attributes: updated[0].attributes, // picto attributes for student
picto: {
id: updated[0].picto // picto information
}
}); });
}) })
.catch(err => { .catch(err => {
return res.serverError('Unable to update picto for student: ' + err); return res.serverError('Unable to update picto for student: ' + err);
}); });
}, },
/*
* Updates the category picto for all pictos in the student collection
* @param {request} req {
* 'id_stu': <student_id>,
* 'prev_id_stu_pic': <ID of previous category entry in stu_picto>,
* 'new_id_pic': <ID of the picto to be the replacement>
* }
* @param {response} res {
* 'id_stu_pic': <id of the new category in stu_picto>,
* 'attributes': <attributes of the new category picto>,
* 'picto': <picto information used as new category>
* }
*
*/
update_category: function (req, res) {
var params = req.allParams();
var attrs = {};
StuPicto.findOne(params.prev_id_stu_pic)
.then((sp) => {
if (!sp) throw new Error ("error on update");
// Get student to get language
Student.findOne(params.id_stu)
.then((s) => {
if (!s) throw new Error("Student not found");
PictoExp.findOne({id_pic: sp.picto, lang: s.lang})
.then((pe) => {
if (!pe) throw new Error ("Expression not found");
// store old picto id to update pictos in category
var old_picto = sp.picto;
if (sp.attributes.expression == undefined || sp.attributes.expression == null)
sp.attributes.expression = pe.text;
sp.picto = params.new_id_pic;
// Save modified stu_picto entry for category
sp.save((err) => {
if (err) throw err;
// Update attributes.id_cat for all pictos
StuPicto.find({id_stu: params.id_stu})
.then(sps => {
for (var i=0; i<sps.length; i++) {
if (sps[i].attributes.id_cat == old_picto) {
sps[i].attributes.id_cat = params.new_id_pic;
sps[i].save();
}
}
Student.pictoInfo(sp.id, function(err, resp) {
if (err) throw err;
return res.ok(resp);
});
})
.catch(err => {throw err});
});
})
.catch(err => {throw err});
})
.catch(err => {throw err})
})
.catch(err => {
return res.serverError('Unable to update category for student: ' + err);
});
},
// update action // update action
// update picto atributes for a studentPicto // update picto atributes for a studentPicto
// //
update_legend: function (req, res) { update_legend: function (req, res) {
var params = req.allParams(); var params = req.allParams();
var query='update stu_picto'+ Student.update_legend(params.id_stu, params.legend_value, function (err) {
' set attributes=json_set(attributes, \'$.legend\',\''+params.legend_value+'\')'+ if (err) {
' where id_stu='+params.id_stu; sails.log.debug(JSON.stringify(err));
console.log('Updating legend for student ' + params.id_stu +" collection to "+ return res.serverError("Error on legend update: ");
params.legend_value+": "+query); }
StuPicto.query(query, function(err, result) {
if (err)
throw new Error ("error on update");
else {
console.log('Updated attributes for picto student:' + params.id_stu);
return res.ok({ return res.ok({
id: params.id_stu, id: params.id_stu,
legend_value: params.legend_value, // picto attributes for student legend_value: params.legend_value, // picto attributes for student
}); });
} })
});
}, },
/** /**
...@@ -1094,8 +1138,6 @@ module.exports = { ...@@ -1094,8 +1138,6 @@ module.exports = {
var roomName = 'studentRoom' + attributes.id_stu; var roomName = 'studentRoom' + attributes.id_stu;
sails.log.debug("Inside vocabulary");
if (req.isSocket) { if (req.isSocket) {
sails.log.debug("Inside vocabulary - isSocket"); sails.log.debug("Inside vocabulary - isSocket");
......
...@@ -130,6 +130,22 @@ module.exports = function eventsHook(sails) { ...@@ -130,6 +130,22 @@ module.exports = function eventsHook(sails) {
attributes: attributes attributes: attributes
} }
}; };
},
/**
* Vocabulary is updated
* @param {action} type of the action
* @param {attributes} attributes of the action (id_stu, stu_picto)
* @return {Object} {name, data}
*/
vocabulary: function (action, attributes) {
return {
name: 'vocabulary',
data: {
action: action,
attributes: attributes
}
};
} }
}; };
}; };
...@@ -12,7 +12,7 @@ module.exports = { ...@@ -12,7 +12,7 @@ module.exports = {
autoPK : false, autoPK : false,
autoCreatedAt : false, autoCreatedAt : false,
autoUpdatedAt : false, autoUpdatedAt : false,
attributes: { attributes: {
id: { id: {
type: "integer", type: "integer",
...@@ -25,6 +25,11 @@ module.exports = { ...@@ -25,6 +25,11 @@ module.exports = {
type: "string", type: "string",
size: 40 size: 40
}, },
lang: {
required: true,
type: "string",
size: 5
},
description: { description: {
type: "string", type: "string",
size: 1024 size: 1024
...@@ -35,10 +40,10 @@ module.exports = { ...@@ -35,10 +40,10 @@ module.exports = {
required: false, required: false,
model: "Supervisor" model: "Supervisor"
}, },
// Relación con MetaInstruction. [1 MetaMethod to N MetaInstruction] // Relación con MetaInstruction. [1 MetaMethod to N MetaInstruction]
metainstructions: { metainstructions: {
collection: "MetaInstruction", collection: "MetaInstruction",
via: "id_met" via: "id_met"
} }
} }
}; };
\ No newline at end of file
...@@ -90,7 +90,6 @@ module.exports = { ...@@ -90,7 +90,6 @@ module.exports = {
color: null, color: null,
expression: null, expression: null,
legend: 'none', legend: 'none',
delete_strip_after_delivery: true
}; };
if (typeof attributes === 'object') { if (typeof attributes === 'object') {
...@@ -129,10 +128,7 @@ module.exports = { ...@@ -129,10 +128,7 @@ module.exports = {
} }
if (!((/^(none|normal|full)$/).test(validAttributes.legend))) { if (!((/^(none|normal|full)$/).test(validAttributes.legend))) {
delete validAttributes.legend; delete validAttributes.legend;
} }
if (typeof validAttributes.delete_strip_after_delivery !== 'boolean') {
delete validAttributes.delete_strip_after_delivery;
}
if (typeof validAttributes.highlight !== 'boolean') { if (typeof validAttributes.highlight !== 'boolean') {
delete validAttributes.highlight; delete validAttributes.highlight;
} }
......
...@@ -378,10 +378,10 @@ module.exports = { ...@@ -378,10 +378,10 @@ module.exports = {
picto.imageFileExists(function(found) { picto.imageFileExists(function(found) {
if (found) { if (found) {
// Now we have everything, so we add the picto to the list // Now we have everything, so we add the picto to the list
stuPicto.attributes.expression = stuPicto.attributes.expression ? stuPicto.attributes.expression : picto.expressions[0].text;
var stuPictoToAdd = { var stuPictoToAdd = {
"id": stuPicto.id, "id": stuPicto.id,
"picto": stuPicto.picto, "picto": stuPicto.picto,
"expression": picto.expressions[0],
"attributes": stuPicto.attributes, "attributes": stuPicto.attributes,
"tags": picto.tags ? picto.tags : [] "tags": picto.tags ? picto.tags : []
}; };
...@@ -430,6 +430,7 @@ module.exports = { ...@@ -430,6 +430,7 @@ module.exports = {
function (instruction, next_ins) { function (instruction, next_ins) {
Instruction.findOne(instruction.id) Instruction.findOne(instruction.id)
.sort('begin DESC')
.populate('workingSessions') .populate('workingSessions')
.then((populated_ins) => { .then((populated_ins) => {
if (!populated_ins || !populated_ins.workingSessions || populated_ins.workingSessions.length == 0) if (!populated_ins || !populated_ins.workingSessions || populated_ins.workingSessions.length == 0)
...@@ -441,6 +442,7 @@ module.exports = { ...@@ -441,6 +442,7 @@ module.exports = {
function(ws, next_ws) { function(ws, next_ws) {
WorkingSession.findOne(ws.id) WorkingSession.findOne(ws.id)
.sort('begin DESC')
.populate('tries') .populate('tries')
.then((populated_ws) => { .then((populated_ws) => {
if (!populated_ws || !populated_ws.tries || populated_ws.tries.length == 0) if (!populated_ws || !populated_ws.tries || populated_ws.tries.length == 0)
...@@ -452,6 +454,7 @@ module.exports = { ...@@ -452,6 +454,7 @@ module.exports = {
function(t, next_t) { function(t, next_t) {
Try.findOne(t.id) Try.findOne(t.id)
.sort('begin DESC')
.populate('actions') .populate('actions')
.then((populated_try) => { .then((populated_try) => {
if (!populated_try || !populated_try.actions || populated_try.actions.length == 0) if (!populated_try || !populated_try.actions || populated_try.actions.length == 0)
...@@ -520,5 +523,52 @@ module.exports = { ...@@ -520,5 +523,52 @@ module.exports = {
}) })
.catch((err) => {cb(err)}); .catch((err) => {cb(err)});
}); });
},
/*
* Updates legend in student pictos
* legend is not updated for categories
*/
update_legend: function(id_stu, legend_value, cb) {
var query='UPDATE stu_picto' +
' SET attributes = json_set(attributes, \'$.legend\',\''+legend_value+'\')' +
' WHERE id_stu=' + id_stu + ' AND ' +
' (json_extract(attributes, \'$.id_cat\') LIKE \'null\' AND ' +
' json_extract(attributes, \'$.coord_y\') = 0 OR ' +
' json_extract(attributes, \'$.id_cat\') NOT LIKE \'null\' AND ' +
' json_extract(attributes, \'$.coord_y\') > 0); '
;
StuPicto.query(query, function(err, result) {
if (err)
cb(err);
else
cb();
});
},
/*
* Returns the information about a picto of a student to be sent in HTTP responses
* This method homogenizes the responses in HTTP requests and Websockets
* @param id_stu_pic {ID} stu_picto record id
* @param cb {function(err, result)} callback function
*/
pictoInfo: function(id_stu_pic, cb) {
StuPicto.findOne(id_stu_pic)
.populate('student')
.populate('picto')
.then(sp => {
PictoExp.findOne({id_pic: sp.picto.id, lang: sp.student.lang})
.then(pe => {
if (typeof sp.attributes.expression == 'undefined' || sp.attributes.expression == null)
sp.attributes.expression = pe.text;
sp.student = sp.student.id;
delete sp.picto.expressions;
cb(null,sp);
})
.catch(err => {throw err});
})
.catch(err => {cb(err, null)});
} }
}; };
/** /**
* Try.js * Try.js
* *
* @description :: TODO: Write a short summary of how this model works and what it represents here. * @description :: TODO: Write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models * @docs :: http://sailsjs.org/#!documentation/models
*/ */
module.exports = {
tableName : 'try',
migrate : 'safe',
schema : true,
autoPK : false,
autoCreatedAt : false,
autoUpdatedAt : false,
module.exports = { attributes: {
tableName : 'try', id: {
migrate : 'safe', type: "integer",
schema : true, autoIncrement: true,
autoPK : false, primaryKey: true,
autoCreatedAt : false, unique: true
autoUpdatedAt : false, },
workingSession: { // FK de WorkingSession. 1 a N
attributes: { columnName: "id_ws",
id: { model: "WorkingSession"
type: "integer", },
autoIncrement: true, actions: {
primaryKey: true, collection: 'Action',
unique: true via: '_try'
}, },
workingSession: { // FK de WorkingSession. 1 a N begin: {
columnName: "id_ws", type: "datetime"
model: "WorkingSession" },
}, end: {
actions: { type: "datetime"
collection: 'Action', },
via: '_try' result: {
}, type: "string",
begin: { enum: ['SUCCESS','SUPERVISED SUCCESS','SPONTANEOUS SUCCESS','FAIL', 'DISCARDED', 'MODEL', 'BROKEN']
type: "datetime" },
}, description: {
end: { type: "string",
type: "datetime" size: 1024
}, }
result: { },
type: "string", afterUpdate: function (attrs, next) {
enum: ['SUCCESS','SUPERVISED SUCCESS','SPONTANEOUS SUCCESS','FAIL', 'DISCARDED', 'MODEL', 'BROKEN'] StuOpenTry.findOne({id_ws: attrs.workingSession}).exec(function(err, stuopentry) {
}, if (err)
description: { throw new Error("Error at"+attrs.workingSession+"("+err+")");
type: "string", if (stuopentry)
size: 1024 attrs.next_try_id=stuopentry.openTry;
} next();
} });
} }
\ No newline at end of file }
...@@ -79,7 +79,17 @@ module.exports = { ...@@ -79,7 +79,17 @@ module.exports = {
next(err); next(err);
}) })
}, },
afterCreate: function (attrs, next) {
// stu_opentry table is updated when a new try is inserted in try table
// (which is, itself, fired by a new session insertion)
// see triggers-sessions-integrity-constraints.sql
StuOpenTry.findOne({id_ws: attrs.id}).exec(function(err, stuopentry) {
if (err || !stuopentry)
throw new Error("No try found at"+attrs.id+"("+err+")");
attrs.first_try_id=stuopentry.openTry;
next();
});
},
// //
// Returns the number of working sessions per year (REPORTS) // Returns the number of working sessions per year (REPORTS)
......
...@@ -14,6 +14,25 @@ ...@@ -14,6 +14,25 @@
module.exports = function serverError (data, options) { module.exports = function serverError (data, options) {
//
// This function avoids converting to JSON circular structures
//
function avoidCircular (object) {
var cache = [];
for (var property in object) {
if (object.hasOwnProperty(property)) {
if (typeof object[property] === 'object' && object[property] !== null) {
if (cache.indexOf(value) !== -1) {
delete object[property];
}
// Store value in our collection
cache.push(value);
}
}
}
return object;
}
// Get access to `req`, `res`, & `sails` // Get access to `req`, `res`, & `sails`
var req = this.req; var req = this.req;
var res = this.res; var res = this.res;
...@@ -30,7 +49,7 @@ module.exports = function serverError (data, options) { ...@@ -30,7 +49,7 @@ module.exports = function serverError (data, options) {
// If the user-agent wants JSON, always respond with JSON // If the user-agent wants JSON, always respond with JSON
if (req.wantsJSON) { if (req.wantsJSON) {
return res.jsonx(data); return res.jsonx(avoidCircular(data));
} }
// If second argument is a string, we take that to mean it refers to a view. // If second argument is a string, we take that to mean it refers to a view.
...@@ -60,7 +79,7 @@ module.exports = function serverError (data, options) { ...@@ -60,7 +79,7 @@ module.exports = function serverError (data, options) {
else { else {
sails.log.warn('res.serverError() :: When attempting to render error page view, an error occured (sending JSON instead). Details: ', err); sails.log.warn('res.serverError() :: When attempting to render error page view, an error occured (sending JSON instead). Details: ', err);
} }
return res.jsonx(data); return res.jsonx(avoidCircular(data));
} }
return res.send(html); return res.send(html);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"license": "Private", "license": "Private",
"private": true, "private": true,
"dependencies": { "dependencies": {
"angular": "1.3.x", "angular": "1.2.x",
"angular-mocks": "1.3.x", "angular-mocks": "1.3.x",
"jquery": "~2.1.1", "jquery": "~2.1.1",
"bootstrap": "~3.1.1", "bootstrap": "~3.1.1",
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
"categories": "Categories", "categories": "Categories",
"category_pictograms": "Category's pictograms", "category_pictograms": "Category's pictograms",
"change_password": "Change password", "change_password": "Change password",
"change_cat_picto": "Change category pictogram",
"change_picture": "Change picture", "change_picture": "Change picture",
"child": "Child", "child": "Child",
"click": "Click", "click": "Click",
...@@ -101,11 +102,12 @@ ...@@ -101,11 +102,12 @@
"error_on_request": "The request has not been processed. Please, check your fields", "error_on_request": "The request has not been processed. Please, check your fields",
"error_on_request_sup_not_found": "Account not found or it has not been activated", "error_on_request_sup_not_found": "Account not found or it has not been activated",
"error_on_upload": "Error on image upload. The maximum allowed size for images is 1 MB.", "error_on_upload": "Error on image upload. The maximum allowed size for images is 1 MB.",
"error_on_update": "Error on update",
"error_loading_pictos": "Error loading pictos information", "error_loading_pictos": "Error loading pictos information",
"error_general": "An error has been produced", "error_general": "An error has been produced",
"expand_navigation": "Expand navigation", "expand_navigation": "Expand navigation",
"expand_navigation": "Expand navigation", "expand_navigation": "Expand navigation",
"expression": "Expression:", "expression": "Expression",
"February": "February", "February": "February",
"feedback_picto": "Selection feedback", "feedback_picto": "Selection feedback",
"filter": "Filter", "filter": "Filter",
...@@ -244,6 +246,7 @@ ...@@ -244,6 +246,7 @@
"profile_picture": "Profile picture", "profile_picture": "Profile picture",
"read_picto": "Read picto", "read_picto": "Read picto",
"register": "Sign in", "register": "Sign in",
"reloading_pictos": "Reloading pictograms",
"remember": "Remember me", "remember": "Remember me",
"reports": "Reports", "reports": "Reports",
"request_change_password": "Request change password", "request_change_password": "Request change password",
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
"categories": "Categorías", "categories": "Categorías",
"category_pictograms": "Pictogramas de la categoría", "category_pictograms": "Pictogramas de la categoría",
"change_password": "Cambiar contraseña", "change_password": "Cambiar contraseña",
"change_cat_picto": "Cambiar pictograma de la categoría",
"change_picture": "Cambiar fotografía", "change_picture": "Cambiar fotografía",
"child": "Niño", "child": "Niño",
"click": "Clic", "click": "Clic",
...@@ -93,7 +94,7 @@ ...@@ -93,7 +94,7 @@
"enormous": "Enorme", "enormous": "Enorme",
"expand_navigation": "Desplegar navegación", "expand_navigation": "Desplegar navegación",
"expand_navigation": "Desplegar navegación", "expand_navigation": "Desplegar navegación",
"expression": "Expresión:", "expression": "Expresión",
"error_adding_picto": "Error al añadir el picto", "error_adding_picto": "Error al añadir el picto",
"error_creating_session": "Error al crear sesión", "error_creating_session": "Error al crear sesión",
"error_deleting_picto": "Error borrando el picto", "error_deleting_picto": "Error borrando el picto",
...@@ -103,6 +104,7 @@ ...@@ -103,6 +104,7 @@
"error_only_support_images": "Sólo se soportan imágenes (ficheros JPG, PNG o GIF)", "error_only_support_images": "Sólo se soportan imágenes (ficheros JPG, PNG o GIF)",
"error_on_request": "Se ha producido un error. Por favor, compruebe los valores introducidos.", "error_on_request": "Se ha producido un error. Por favor, compruebe los valores introducidos.",
"error_on_request_sup_not_found": "La cuenta no existe o no ha sido activada", "error_on_request_sup_not_found": "La cuenta no existe o no ha sido activada",
"error_on_update": "Error al actualizar",
"error_on_upload": "Error al subir la imagen. Compruebe que el archivo no supera 1MB de tamaño.", "error_on_upload": "Error al subir la imagen. Compruebe que el archivo no supera 1MB de tamaño.",
"error_loading_pictos": "Error cargando información de los pictos", "error_loading_pictos": "Error cargando información de los pictos",
"error_general": "Se ha producido un error", "error_general": "Se ha producido un error",
...@@ -245,6 +247,7 @@ ...@@ -245,6 +247,7 @@
"read_picto": "Leer picto", "read_picto": "Leer picto",
"register": "Regístrate", "register": "Regístrate",
"register_button": "Registrar", "register_button": "Registrar",
"reloading_pictos": "Recargando pictogramas",
"remember": "No cerrar sesión", "remember": "No cerrar sesión",
"reports": "Informes", "reports": "Informes",
"request_change_password": "Solicitar cambio de contraseña", "request_change_password": "Solicitar cambio de contraseña",
......
...@@ -57,7 +57,10 @@ ...@@ -57,7 +57,10 @@
<div class="form-group" ng-if="show_change_form"> <div class="form-group" ng-if="show_change_form">
<label>Captcha*</label> <label>Captcha*</label>
<div re-captcha ng-model="captcha_chgpass"></div> <div re-captcha
ng-model="captcha_chgpass"
size="compact"
lang="es"></div>
</div> </div>
<p class="text-center"> <p class="text-center">
......
...@@ -29,12 +29,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -29,12 +29,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
owner: null, owner: null,
tags: null tags: null
}, },
expression: {
id: null,
lang: null,
text: '',
picto: null
},
attributes: { attributes: {
id_cat: null, id_cat: null,
coord_x: null, coord_x: null,
...@@ -52,7 +46,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -52,7 +46,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$scope.selectedCategory = $scope.emptyStudentPicto; $scope.selectedCategory = $scope.emptyStudentPicto;
$scope.studentPictos = {}; $scope.studentPictos = {};
$scope.freeCategoryPictos = null; $scope.freeCategoryPictos = null;
$scope.categories = [];
$scope.loadingPictos = true; $scope.loadingPictos = true;
$scope.isCategory = function (studentPicto) { $scope.isCategory = function (studentPicto) {
...@@ -109,10 +102,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -109,10 +102,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$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();
if ($scope.isCategory(picto)) {
$scope.categories.push(picto);
}
// Categories disabled // Categories disabled
if (typeof freeCategoryPositionX === 'number' && if (typeof freeCategoryPositionX === 'number' &&
typeof freeCategoryPositionY === 'number') { typeof freeCategoryPositionY === 'number') {
...@@ -140,7 +129,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -140,7 +129,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Get user's pictos // Get user's pictos
$http.get(config.backend + '/stu/' + $scope.studentData.id + '/pictos') $http.get(config.backend + '/stu/' + $scope.studentData.id + '/pictos')
.success(function (studentPictos) { .success(function (studentPictos) {
$scope.categories = [];
$scope.showFreeCategory = !$scope.studentData.attributes.categories; $scope.showFreeCategory = !$scope.studentData.attributes.categories;
studentPictos.forEach(placePicto); studentPictos.forEach(placePicto);
...@@ -310,7 +298,54 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -310,7 +298,54 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
}); });
}; };
// Modal window to add pictos //
// Change category's pictogram
//
$scope.change_category = function (picto_cat) {
var modalInstance = $modal.open({
animation: true,
templateUrl: 'modules/student/views/addpicto.html',
controller: 'AddPictoCtrl',
size: 'lg',
resolve: {
student: function () {
return $scope.studentData;
},
supervisor: function () {
return $scope.user;
}
}
});
// Returned data from the modal window
modalInstance.result.then(function (pictoId) {
// Send the picto to the server
$http.put(config.backend + '/stu/' + $scope.studentData.id + '/cat', {
prev_id_stu_pic: picto_cat.id,
new_id_pic: pictoId
})
.success(function (studentPicto) {
console.log(JSON.stringify(studentPicto));
$scope.loadPictos();
// notify
io.socket.post('/stu/vocabulary', {
action: 'update_category',
attributes: {
id_stu: $scope.studentData.id,
stu_picto: studentPicto
}
}, function () {});
})
.error(function () {
ngToast.danger({ content: $translate.instant('error_updating_category') });
});
});
};
//
// Adds a new pictogram
//
$scope.open_add = function (col, row) { $scope.open_add = function (col, row) {
console.log(col + " " +row); console.log(col + " " +row);
var modalInstance = $modal.open({ var modalInstance = $modal.open({
...@@ -342,7 +377,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -342,7 +377,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
} }
}) })
.success(function (studentPicto) { .success(function (studentPicto) {
console.log(studentPicto.attributes); console.log(studentPicto);
placePicto(studentPicto); placePicto(studentPicto);
io.socket.post('/stu/vocabulary', { io.socket.post('/stu/vocabulary', {
...@@ -355,9 +390,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -355,9 +390,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
}) })
.error(function () { .error(function () {
$translate('error_adding_picto').then(function (translation) { ngToast.danger({ content: $translate.instant('error_adding_picto') });
ngToast.danger({ content: translation });
});
}); });
// not needed // not needed
...@@ -407,10 +440,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -407,10 +440,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
} }
} }
}); });
// Returned data from the modal window
modalInstance.result.then(function (exp) {
studentPicto.expression.text = exp;
});
}; };
// Add new listener to the event // Add new listener to the event
......
...@@ -24,12 +24,15 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr ...@@ -24,12 +24,15 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
$http $http
.get(config.backend+'/method/template/' + $scope.user.id) .get(config.backend+'/method/template/' + $scope.user.id)
.success(function(data, status, headers, config) { .success(function(data, status, headers, config) {
for (var i = 0; i < data.length; i++) {
data[i].disabled = data[i].lang != $translate.use();
}
// Add to list // Add to list
$scope.methods_available = data; $scope.methods_available = data;
console.log("Meta Methods charged:"); console.log("Meta Methods charged:");
console.log(JSON.stringify($scope.methods_available)); console.log(JSON.stringify($scope.methods_available));
// Option to add new methods // Option to add new methods
$scope.methods_available.push({ id: 0, name: $translate.instant('new_method') }); $scope.methods_available.push({ id: 0, name: $translate.instant('new_method'), disabled: false });
}) })
.error(function(data, status, headers, config) { .error(function(data, status, headers, config) {
console.log("Error from API: " + data.error); console.log("Error from API: " + data.error);
......
...@@ -3,110 +3,90 @@ ...@@ -3,110 +3,90 @@
// Please note that $modalInstance represents a modal window (instance) dependency. // Please note that $modalInstance represents a modal window (instance) dependency.
// It is not the same as the $modal service used above. // It is not the same as the $modal service used above.
dashboardControllers.controller('PictoConfigCtrl', function ($window, $scope, $modalInstance, $http, config, studentPicto, sup, stu) { dashboardControllers.controller('PictoConfigCtrl', function ($window, $scope, $translate, $modalInstance, $http, config, ngToast, studentPicto, sup, stu) {
// Last parameter passed from collections.js
// Basic data passed from the main window
// Student
$scope.stu = stu;
// Supervisor
$scope.sup = sup;
// Picto // Picto
$scope.studentPicto = studentPicto; $scope.studentPicto = JSON.parse(JSON.stringify(studentPicto));
// Input expression
if ($scope.studentPicto.attributes.expression==undefined || $scope.studentPicto.attributes.expression==null) /*
$scope.studentPicto.attributes.expression=studentPicto.expression.text; * Save changes introduced in dialog window
// Enable or Disable the button 'change' if the supervisor is the owner of the picto */
$scope.isOwner = (studentPicto.picto.owner == sup.id) ? true : false; $scope.save = function () {
// Change expression (if the picto is owned by the supervisor) new Promise(function (resolve, reject) {
$scope.change = function () { if ($scope.studentPicto.attributes.expression != studentPicto.attributes.expression) {
// Update picto expressio because user owns it
// Comprobación del supervisor propietario del picto if (studentPicto.picto.owner == sup.id) {
if(studentPicto.picto.owner == sup.id){ $http
$http .post(config.backend+'/picto/exp',
.post(config.backend+'/picto/exp', { 'picto': studentPicto.picto.id,
{ 'picto': studentPicto.picto.id, 'lang': sup.lang,
'lang': $scope.sup.lang, 'text': $scope.studentPicto.attributes.expression
'text': $scope.studentPicto.expression.text })
.success(function(data, status, headers, config) {
resolve();
})
.error(function(data, status, headers, config) {
reject(data);
});
} else resolve();
} else resolve();
})
.then(function(result) {
return new Promise(function (resolve, reject) {
// Update attributes
$http
.put(config.backend+'/stu/'+ stu.id + '/picto/' + $scope.studentPicto.id,
{
'attributes': $scope.studentPicto.attributes
})
.success(function(data, status, headers, config) {
resolve(data);
}) })
.success(function(data, status, headers, config) { .error(function(data, status, headers, config) {
console.log("Expression changed: " + JSON.stringify(data)+": "+$scope.studentPicto.expression.text); reject(data);
$scope.studentPicto.attributes.expression=$scope.studentPicto.expression.text; });
// Close the modal instance });
//$modalInstance.close($scope.studentPicto.expression.text); })
.then(function(result) {
// Notifcar cambio return new Promise(function (resolve, reject) {
io.socket.post('/stu/vocabulary', { if ($scope.update_all_legend) {
action: 'update', $http
attributes: { .put(config.backend+'/stu/'+ stu.id + '/legend/' + $scope.studentPicto.attributes.legend)
id_stu: $scope.stu.id, .success(function(data, status, headers, config) {
stu_picto: { resolve(result);
id: data.id, })
expression: data.expression, .error(function(data, status, headers, config) {
attributes: $scope.studentPicto.attributes, console.log("Error from API: " + data.error);
picto: { id: data.picto } });
} }
} else
}, function (res) {console.log("Owned vocabulary emited: " + JSON.stringify(res.msg));}); resolve(result);
});
}) })
.error(function(data, status, headers, config) { .then(function(result) {
console.log("Error from API: " + data.error); return new Promise(function (resolve, reject) {
});
}
};
$scope.update_properties = function(){
console.log("Atributos: " + JSON.stringify($scope.studentPicto.attributes));
$http
.put(config.backend+'/stu/'+ $scope.stu.id + '/picto/' + $scope.studentPicto.id,
{
'attributes': $scope.studentPicto.attributes
})
.success(function(data, status, headers, config) {
console.log("Properties updated");
// Close the modal instance
//$modalInstance.close($scope.expression);
// /////////////////////////////////////////////////////////////
// Websocket: Emit vocabulary update action
io.socket.post('/stu/vocabulary', { io.socket.post('/stu/vocabulary', {
action: 'update', action: 'update',
attributes: { attributes: {
id_stu: $scope.stu.id, id_stu: stu.id,
stu_picto: data stu_picto: result
} }
}, },
function(res) { function(res) {});
console.log("Vocabulary emited: " + JSON.stringify(res.msg));
}); studentPicto.attributes = $scope.studentPicto.attributes;
/////////////////////////////////////////////////////////////// $modalInstance.close($scope.studentPicto.attributes.expression);
if ($scope.update_all_legend) {
ngToast.success({ content: $translate.instant('reloading_pictos') });
$window.location.reload();
}
}) })
.error(function(data, status, headers, config) { });
console.log("Error from API: " + data.error);
});
}; };
$scope.update_legend = function(){
console.log("Legend: " + $scope.studentPicto.attributes.legend+" to be modified");
$http
.put(config.backend+'/stu/'+ $scope.stu.id + '/legend/' + $scope.studentPicto.attributes.legend)
.success(function(data, status, headers, config) {
console.log("Legend updated");
// Close the modal instance
$modalInstance.close($scope.expression);
$window.location.reload();
});
};
$scope.close = function () { $scope.close = function () {
// Lo que se devuelve a collection // Lo que se devuelve a collection
$modalInstance.dismiss('cancel'); $modalInstance.dismiss('cancel');
......
...@@ -36,6 +36,9 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr ...@@ -36,6 +36,9 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// //
$scope.methods = []; $scope.methods = [];
// Visibility of the list of stored sessions
$scope.showSessions = false;
// Query to obtain an array of student methods // Query to obtain an array of student methods
$http $http
.get(config.backend+'/stu/'+ $scope.studentData.id +'/methods') .get(config.backend+'/stu/'+ $scope.studentData.id +'/methods')
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
('empty-' + colIndex + '-' + rowIndex) ('empty-' + colIndex + '-' + rowIndex)
}}" }}"
draggable droppable drop="handleDrop" draggable droppable drop="handleDrop"
popover="{{studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression}}" popover="{{studentPicto != emptyStudentPicto ? studentPicto.attributes.expression : ''}}"
popover-trigger="mouseenter" popover-trigger="mouseenter"
ng-init="colIndex = $index" ng-init="colIndex = $index"
ng-repeat="studentPicto in studentPictoRow track by $index"> ng-repeat="studentPicto in studentPictoRow track by $index">
...@@ -41,13 +41,12 @@ ...@@ -41,13 +41,12 @@
<div <div
class="picto-legend-normal" class="picto-legend-normal"
ng-if="studentPicto.attributes.legend == 'normal'"> ng-if="studentPicto.attributes.legend == 'normal'">
{{ studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression }} {{ studentPicto.attributes.expression }}
</div> </div>
<div <div
class="picto-legend-full" class="picto-legend-full"
ng-if="studentPicto.attributes.legend == 'full'"> ng-if="studentPicto.attributes.legend == 'full'">
{{ studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression }} {{ studentPicto.attributes.expression }}
</div> </div>
<!-- /.picto-legend --> <!-- /.picto-legend -->
<img <img
...@@ -121,19 +120,19 @@ ...@@ -121,19 +120,19 @@
class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};" 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-repeat="studentPicto in studentPictoRow track by $index"
ng-init="colIndex = $index" ng-init="colIndex = $index"
popover="{{studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression}}" popover="{{ studentPicto != emptyStudentPicto ? studentPicto.attributes.expression : ''}}"
popover-trigger="mouseenter"> popover-trigger="mouseenter">
<!-- picto-legend --> <!-- picto-legend -->
<div <div
class="picto-legend-normal" class="picto-legend-normal"
ng-if="studentPicto.attributes.legend == 'normal'"> ng-if="studentPicto.attributes.legend == 'normal'">
{{ studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression }} {{ studentPicto.attributes.expression }}
</div> </div>
<div <div
class="picto-legend-full" class="picto-legend-full"
ng-if="studentPicto.attributes.legend == 'full'"> ng-if="studentPicto.attributes.legend == 'full'">
{{ studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression }} {{ studentPicto.attributes.expression }}
</div> </div>
<!-- /.picto-legend --> <!-- /.picto-legend -->
<img <img
...@@ -175,9 +174,13 @@ ...@@ -175,9 +174,13 @@
title="{{ studentPicto.attributes.status | translate}}"></i> title="{{ studentPicto.attributes.status | translate}}"></i>
</a> </a>
<a <a
ng-click="" ng-click="change_category(studentPicto)"
ng-if="studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y != '0'"
class="picto_cat_edit"> class="picto_cat_edit">
<i class="glyphicon glyphicon-picture" aria-hidden="true"></i> <i
class="glyphicon glyphicon-picture" aria-hidden="true"
title="{{ 'change_cat_picto' | translate}}">
</i>
</a> </a>
</div> </div>
<div <div
...@@ -222,7 +225,7 @@ ...@@ -222,7 +225,7 @@
class="picto-grid picto-category-grid" class="picto-grid picto-category-grid"
ng-if="selectedCategory !== emptyStudentPicto && !showFreeCategory" ng-if="selectedCategory !== emptyStudentPicto && !showFreeCategory"
ng-style="{ 'background-color': shadeColor(selectedCategory.attributes.color, 0.3) }"> ng-style="{ 'background-color': shadeColor(selectedCategory.attributes.color, 0.3) }">
<h3 class="picto-category-grid__title">{{ selectedCategory.expression.text }}</h3> <h3 class="picto-category-grid__title">{{ selectedCategory.attributes.expression }}</h3>
<div <div
ng-repeat="studentPictoRow in studentPictos[getCategoryId(selectedCategory)]" ng-repeat="studentPictoRow in studentPictos[getCategoryId(selectedCategory)]"
ng-init="rowIndex = $index" ng-init="rowIndex = $index"
...@@ -236,7 +239,7 @@ ...@@ -236,7 +239,7 @@
('empty-' + colIndex + '-' + rowIndex) ('empty-' + colIndex + '-' + rowIndex)
}}" }}"
draggable droppable drop="handleDrop" draggable droppable drop="handleDrop"
popover="{{studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression}}" popover="{{ studentPicto != emptyStudentPicto ? studentPicto.attributes.expression : '' }}"
popover-trigger="mouseenter" popover-trigger="mouseenter"
ng-repeat="studentPicto in studentPictoRow track by $index" ng-repeat="studentPicto in studentPictoRow track by $index"
ng-init="colIndex = $index"> ng-init="colIndex = $index">
...@@ -244,13 +247,13 @@ ...@@ -244,13 +247,13 @@
<div <div
class="picto-legend-normal" class="picto-legend-normal"
ng-if="studentPicto.attributes.legend == 'normal'"> ng-if="studentPicto.attributes.legend == 'normal'">
{{ studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression }} {{ studentPicto.attributes.expression }}
</div> </div>
<div <div
class="picto-legend-full" class="picto-legend-full"
ng-if="studentPicto.attributes.legend == 'full'"> ng-if="studentPicto.attributes.legend == 'full'">
{{ studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression }} {{ studentPicto.attributes.expression }}
</div> </div>
<!-- /.picto-legend --> <!-- /.picto-legend -->
<img <img
......
...@@ -4,7 +4,14 @@ ...@@ -4,7 +4,14 @@
<div class="panel-body"> <div class="panel-body">
<!-- Select to add new method --> <!-- Select to add new method -->
<div class="form-group"> <div class="form-group">
<select class="form-control" name="method_select" id="method_select" ng-model="method_selected" ng-options="ma.name for ma in methods_available"> <select class="form-control" name="method_select" id="method_select" ng-model="method_selected">
<option ng-repeat="ma in methods_available track by $index"
value="{{ $index }}"
label="{{ ma.name }}"
ng-if="ma.lang == user.lang">
{{ ma.name }}
</option>
<option value="" translate>select_method</option> <option value="" translate>select_method</option>
</select> </select>
...@@ -22,18 +29,19 @@ ...@@ -22,18 +29,19 @@
<!-- Method instructions --> <!-- Method instructions -->
<div class="method_details" ng-repeat="m in methods"> <div class="method_details" ng-repeat="m in methods">
<input type="text" class="editable title" ng-model="m.name " ng-blur="update_method(m)"/> <input type="text" class="editable title" ng-model="m.name " ng-blur="update_method(m)"/>
<div class="options"> <div class="options">
<a ng-click="save_as_template(m)" popover="{{ 'save_as_template' | translate}}" popover-trigger="mouseenter"><span class="text_medium color_black glyphicon glyphicon-floppy-disk" aria-hidden="true"></span></a> <a ng-click="save_as_template(m)" popover="{{ 'save_as_template' | translate}}" popover-trigger="mouseenter"><span class="text_medium color_black glyphicon glyphicon-floppy-disk" aria-hidden="true"></span></a>
<a ng-click="delete_method(m)" popover="{{ 'delete' | translate}}" popover-trigger="mouseenter"><span class="text_medium delete color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a> <a ng-click="delete_method(m)" popover="{{ 'delete' | translate}}" popover-trigger="mouseenter"><span class="text_medium delete color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a>
</div> </div>
<textarea class="editable" ng-model="m.description " placeholder="{{'description' | translate}}" ng-blur="update_method(m)"></textarea> <textarea class="editable" ng-model="m.description " placeholder="{{'description' | translate}}" ng-blur="update_method(m)"></textarea>
<!-- Tabla método --> <!-- Tabla método -->
<table class="table_instructions table"> <table class="table_instructions table">
<tr> <tr>
...@@ -66,12 +74,12 @@ ...@@ -66,12 +74,12 @@
</div> </div>
</td> </td>
<td class="editable_status"> <td class="editable_status">
<span class="pointer text_medium glyphicon" ng-class="{ <span class="pointer text_medium glyphicon" ng-class="{
'color_green': i.status == 'finished', 'color_green': i.status == 'finished',
'glyphicon-check': i.status == 'finished', 'glyphicon-check': i.status == 'finished',
'color_blue': i.status == 'started', 'color_blue': i.status == 'started',
'glyphicon-edit': i.status == 'started', 'glyphicon-edit': i.status == 'started',
'glyphicon-minus': i.status == null 'glyphicon-minus': i.status == null
}" aria-hidden="true" popover="{{(i.status || 'nobegin') | translate}}" popover-trigger="mouseenter" ng-click="change_status(i)"></span> }" aria-hidden="true" popover="{{(i.status || 'nobegin') | translate}}" popover-trigger="mouseenter" ng-click="change_status(i)"></span>
</td> </td>
<td><a confirmed-click="delete_instruction(i);" ng-confirm-click="{{ 'confirmation' | translate}}" class="delete_instruction"><span class="text_medium delete color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a></td> <td><a confirmed-click="delete_instruction(i);" ng-confirm-click="{{ 'confirmation' | translate}}" class="delete_instruction"><span class="text_medium delete color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a></td>
...@@ -91,4 +99,4 @@ ...@@ -91,4 +99,4 @@
</div> </div>
<!-- END .panel-body --> <!-- END .panel-body -->
</div> </div>
<!-- END .panel --> <!-- END .panel -->
\ No newline at end of file
...@@ -6,73 +6,49 @@ ...@@ -6,73 +6,49 @@
<h4 class="modal-title" id="myModalLabel" translate>pictogram_setup</h4> <h4 class="modal-title" id="myModalLabel" translate>pictogram_setup</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<ul class="list-group"> <div class="form-group">
<label translate>expression</label>
<!-- Modificable sólo si es el propietario del picto -->
<div id="add_label" class="input-group">
<span class="input-group-addon glyphicon glyphicon-comment" aria-hidden="true"></span>
<input type="text" class="form-control" ng-model="studentPicto.attributes.expression" />
</div>
</div>
<li class="list-group-item"> <div class="form-group">
<label translate>expression</label> <label translate>legend</label><br/>
<!-- Modificable sólo si es el propietario del picto --> <div class="row">
<form ng-submit="isOwner ? change() : update_properties()"> <div class="col-md-6">
<div id="add_label" class="input-group"> <!-- <div class="checkbox">
<span class="input-group-addon glyphicon glyphicon-comment" aria-hidden="true"></span> <select class="form-control" data-toggle="toggle" ng-model="studentPicto.attributes.legend" ng-change="update_properties()">
<input type="text" class="form-control" ng-if="isOwner" ng-model="studentPicto.expression.text" /> <option value="none" selected>Sin leyenda</option>
<input type="text" class="form-control" ng-if="!isOwner" ng-model="studentPicto.attributes.expression" /> <option value="normal">Leyenda normal</option>
<span class="input-group-btn"> <option value="full">Solo leyenda</option>
<button class="btn btn-success" type="submit" ng-click="close()" translate>save</button> </select>
</span> </div> -->
</div> <input type="radio" ng-model="studentPicto.attributes.legend" value="none">
</form> <span translate>legend_none</span>
</li> <br/>
<input type="radio" ng-model="studentPicto.attributes.legend" value="normal">
<!-- <span translate>legend_normal</span>
<li class="list-group-item"> <br/>
<div class="checkbox"> <input type="radio" ng-model="studentPicto.attributes.legend" value="full">
<label><input data-toggle="toggle" type="checkbox" ng-model="studentPicto.attributes.magnify" ng-change="update_properties()"> Aumentado</label> <span translate>legend_full</span>
</div> </div>
</li> <div class="col-md-6">
--> <input type="checkbox" ng-model="update_all_legend" ng-init="update_all_legend=false">
<span translate>legend_apply_all</span>
<!-- <li class="list-group-item">
<div class="checkbox">
<label><input data-toggle="toggle" type="checkbox" ng-model="studentPicto.attributes.highlight" ng-change="update_properties()" translate> highlighted</label>
</div> </div>
</li> </div>
--> </div>
<li class="list-group-item"> <div class="row">
<div class="row"> <div class="col-md-12">
<div class="col-md-12"> <button class="btn btn-success pull-right" ng-click="save()" translate>save</button>
<label translate>legend</label><br/> <button class="btn btn-secondary margin-right10 pull-right" ng-click="close()" translate>cancel</button>
<!-- <div class="checkbox"> </div>
<select class="form-control" data-toggle="toggle" ng-model="studentPicto.attributes.legend" ng-change="update_properties()"> </div>
<option value="none" selected>Sin leyenda</option> </div>
<option value="normal">Leyenda normal</option>
<option value="full">Solo leyenda</option>
</select>
</div> -->
<input type="radio" ng-model="studentPicto.attributes.legend" value="none" ng-change="update_properties()">
<span translate>legend_none</span>
<br/>
<input type="radio" ng-model="studentPicto.attributes.legend" value="normal" ng-change="update_properties()">
<span translate>legend_normal</span>
<br/>
<input type="radio" ng-model="studentPicto.attributes.legend" value="full" ng-change="update_properties()">
<span translate>legend_full</span>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-8">
<input type="checkbox" ng-model="update_all_legend" ng-init="update_all_legend=false">
<span translate>legend_apply_all</span>
</div>
<div class="col-md-4">
<div class="form-group text-center">
<button type="submit" class="btn btn-primary ng-scope" ng-click="update_all_legend ? update_legend() : close()" translate>apply</button>
</div>
</div>
</div>
</li>
</ul>
</div> </div>
<!-- End modal-body --> <!-- End modal-body -->
</div> </div>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<div class="row" ng-hide="!selectedIns"> <div class="row" ng-hide="!selectedIns">
<p class="session_controls"> <p class="session_controls">
<div class="col-md-4"> <div class="col-md-4">
<a ng-click="startTimer(); new_ws()" ng-disabled="!selectedIns " ng-hide="sessionRunning || studentData.num_peers<2" class="btn btn-success btn-sm" role="button" id="session_new" translate>new_session</a> <a ng-click="startTimer(); new_ws()" ng-disabled="!selectedIns " ng-hide="sessionRunning || studentData.num_peers<2" class="btn btn-success btn-sm" role="button" id="session_new" translate>new_session</a>
<a class="text_large" ng-click="pause_ws(); pauseTimer();" ng-hide="!sessionRunning || paused" id="session_pause" popover="{{ 'pause_session' | translate}}" popover-trigger="mouseenter"> <a class="text_large" ng-click="pause_ws(); pauseTimer();" ng-hide="!sessionRunning || paused" id="session_pause" popover="{{ 'pause_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-pause" aria-hidden="true" title="{{ 'pause_session' | translate }}"></span> <span class="glyphicon glyphicon-pause" aria-hidden="true" title="{{ 'pause_session' | translate }}"></span>
</a> </a>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</a> </a>
</div> </div>
<div class="col-md-2" style="text-align: right"> <div class="col-md-2" style="text-align: right">
<span class="label label-success" style="font-size: 10pt">{{ 'sessions' | translate}} <span class="badge" style="font-size: 10pt">{{wsessions.length}}</span></span> <button ng-click="showSessions = !showSessions" class="btn btn-success btn-sm" style="font-size: 10pt">{{ 'sessions' | translate}} <span class="badge" style="font-size: 10pt">{{wsessions.length}}</span> <span class="glyphicon glyphicon-menu-down" ng-show="!showSessions"></span></button>
</div> </div>
</p> </p>
</div> </div>
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
<button class="btn btn-warning btn-sm" type="button" ng-click="close_ws()" translate>close_session</button> <button class="btn btn-warning btn-sm" type="button" ng-click="close_ws()" translate>close_session</button>
</div> </div>
<div class="list-group"> <div class="list-group" ng-show="showSessions">
<div class="list-group-item" ng-repeat="s in wsessions | orderBy: '-begin' | limitTo: numPerPage:(currentPage-1)*numPerPage"> <div class="list-group-item" ng-repeat="s in wsessions | orderBy: '-begin' | limitTo: numPerPage:(currentPage-1)*numPerPage">
<div ng-show="showLastTry && wsessions.length > 0"> <div ng-show="showLastTry && wsessions.length > 0">
<h4><strong>{{ 'last_session' | translate}}</strong>: {{ studentData.current_method }}, {{ studentData.current_instruction }}</h4> <h4><strong>{{ 'last_session' | translate}}</strong>: {{ studentData.current_method }}, {{ studentData.current_instruction }}</h4>
......
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
dashboardControllers.controller('TranslateController', function($translate, $scope) { dashboardControllers.controller('TranslateController', function($translate, $scope) {
$scope.changeLanguage = function (langKey) { $scope.changeLanguage = function (langKey) {
$translate.use(langKey); $translate.use(langKey);
$scope.user.lang = langKey;
}; };
}); });
\ No newline at end of file
...@@ -47,6 +47,10 @@ ...@@ -47,6 +47,10 @@
padding: 8px; padding: 8px;
} }
.margin-right10{
margin-right: 10px;
}
/* Evitar scrolling horizontal */ /* Evitar scrolling horizontal */
body{ body{
overflow-x: hidden; overflow-x: hidden;
......
...@@ -97,6 +97,7 @@ module.exports.policies = { ...@@ -97,6 +97,7 @@ module.exports.policies = {
update: ['tokenAuth'], update: ['tokenAuth'],
update_picto: ['tokenAuth', 'isSupervisorOfStudent'], update_picto: ['tokenAuth', 'isSupervisorOfStudent'],
update_legend: ['tokenAuth'], update_legend: ['tokenAuth'],
update_category: ['tokenAuth', 'isSupervisorOfStudent'],
login: true, login: true,
create: ['tokenAuth', 'isSupAdmin'], create: ['tokenAuth', 'isSupAdmin'],
upload: ['tokenAuth'], upload: ['tokenAuth'],
......
...@@ -83,6 +83,7 @@ module.exports.routes = { ...@@ -83,6 +83,7 @@ module.exports.routes = {
'PUT /stu/:id_stu/picto/:id_stuPicto': 'StudentController.update_picto', 'PUT /stu/:id_stu/picto/:id_stuPicto': 'StudentController.update_picto',
'PUT /stu/:id_stu/legend/:legend_value': 'StudentController.update_legend', 'PUT /stu/:id_stu/legend/:legend_value': 'StudentController.update_legend',
'PUT /stu/:id_stu/picto': 'StudentController.update_picto', 'PUT /stu/:id_stu/picto': 'StudentController.update_picto',
'PUT /stu/:id_stu/cat': 'StudentController.update_category',
'POST /stu/login': 'StudentController.login', 'POST /stu/login': 'StudentController.login',
'POST /stu': 'StudentController.create', 'POST /stu': 'StudentController.create',
'POST /stu/upload': 'StudentController.upload', 'POST /stu/upload': 'StudentController.upload',
......
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