Commit f4473d5c by Arturo Montejo Ráez

merge conflict fixed

parents 632b8f4f 8f1ecc7d
Showing with 456 additions and 218 deletions
...@@ -21,6 +21,7 @@ android { ...@@ -21,6 +21,7 @@ android {
resValue "bool", "ssl_connect", "true" resValue "bool", "ssl_connect", "true"
resValue "bool", "force_img_download", "false" resValue "bool", "force_img_download", "false"
resValue "integer", "netservice_timing", "5" resValue "integer", "netservice_timing", "5"
resValue "integer", "netservice_force_restfull_synchro", "0"
} }
debug { debug {
resValue "string", "server", "https://dev.yottacode.com" resValue "string", "server", "https://dev.yottacode.com"
...@@ -28,6 +29,7 @@ android { ...@@ -28,6 +29,7 @@ android {
resValue "bool", "ssl_connect", "false" resValue "bool", "ssl_connect", "false"
resValue "bool", "force_img_download", "false" resValue "bool", "force_img_download", "false"
resValue "integer", "netservice_timing", "5" resValue "integer", "netservice_timing", "5"
resValue "integer", "netservice_force_restfull_synchro", "0"
} }
} }
} }
......
...@@ -41,7 +41,7 @@ public class RestapiWrapper { ...@@ -41,7 +41,7 @@ public class RestapiWrapper {
private static final String SERVER_ERROR="error"; private static final String SERVER_ERROR="error";
// String constant for logs // String constant for logs
private final String LOG_TAG = this.getClass().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) {
this.server=server; this.server=server;
...@@ -123,7 +123,7 @@ public class RestapiWrapper { ...@@ -123,7 +123,7 @@ public class RestapiWrapper {
return false; return false;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
Log.i(com.yottacode.net.RestapiWrapper.class.getName(), "ping failed at"+ping_op); Log.i(LOG_TAG, "ping failed at"+ping_op);
//error_listener.error(e); //error_listener.error(e);
} }
return pingResult; return pingResult;
...@@ -137,7 +137,7 @@ public class RestapiWrapper { ...@@ -137,7 +137,7 @@ public class RestapiWrapper {
BufferedReader br = new BufferedReader(new InputStreamReader(responseCode == HttpsURLConnection.HTTP_OK BufferedReader br = new BufferedReader(new InputStreamReader(responseCode == HttpsURLConnection.HTTP_OK
? urlConnection.getInputStream() ? urlConnection.getInputStream()
: urlConnection.getErrorStream())); : urlConnection.getErrorStream()));
// Log.i(com.yottacode.net.RestapiWrapper.class.getName(), "starting to read server answer for"+urlConnection.getURL().toString()); // Log.i(LOG_TAG, "starting to read server answer for"+urlConnection.getURL().toString());
while ((line=br.readLine()) != null) { while ((line=br.readLine()) != null) {
response.append(line); response.append(line);
} }
...@@ -145,7 +145,7 @@ public class RestapiWrapper { ...@@ -145,7 +145,7 @@ public class RestapiWrapper {
if (Character.isAlphabetic(response.charAt(0))) if (Character.isAlphabetic(response.charAt(0)))
response.append('\'').insert(0,'\''); response.append('\'').insert(0,'\'');
Log.i(com.yottacode.net.RestapiWrapper.class.getName(), "Raw server answer: " + response); Log.i(LOG_TAG, "Raw server answer: " + response);
try { try {
JSONresponse = new JSONObject("{ "+SERVER_RESULT+": " + response + (responseCode == HttpsURLConnection.HTTP_OK JSONresponse = new JSONObject("{ "+SERVER_RESULT+": " + response + (responseCode == HttpsURLConnection.HTTP_OK
? "}" ? "}"
...@@ -154,7 +154,7 @@ public class RestapiWrapper { ...@@ -154,7 +154,7 @@ public class RestapiWrapper {
JSONresponse = null; JSONresponse = null;
Log.e(RestapiWrapper.class.getCanonicalName(),e.getMessage()); Log.e(RestapiWrapper.class.getCanonicalName(),e.getMessage());
} }
Log.i(com.yottacode.net.RestapiWrapper.class.getName(), "server answer: " + JSONresponse.toString()); Log.i(LOG_TAG, "server answer: " + JSONresponse.toString());
return JSONresponse; return JSONresponse;
} }
...@@ -252,7 +252,7 @@ public class RestapiWrapper { ...@@ -252,7 +252,7 @@ public class RestapiWrapper {
protected HttpAsyncTaskParams doInBackground(HttpAsyncTaskParams... params) { protected HttpAsyncTaskParams doInBackground(HttpAsyncTaskParams... params) {
JSONObject jresult=null; JSONObject jresult=null;
try { try {
Log.i(com.yottacode.net.RestapiWrapper.class.getName(), " Asking to the server for " + params[0].url+" params:"+params[0].url_params +" JSON?"+params[0].json_params); Log.i(LOG_TAG, " Asking to the server for " + params[0].url+" params:"+params[0].url_params +" JSON?"+params[0].json_params);
jresult = params[0].request_method.equalsIgnoreCase("GET") jresult = params[0].request_method.equalsIgnoreCase("GET")
? GET(params[0].url, params[0].url_params) ? GET(params[0].url, params[0].url_params)
: POST(params[0].url, params[0].request_method, params[0].url_params, params[0].json_params); : POST(params[0].url, params[0].request_method, params[0].url_params, params[0].json_params);
...@@ -260,11 +260,11 @@ public class RestapiWrapper { ...@@ -260,11 +260,11 @@ public class RestapiWrapper {
if (jresult.has(SERVER_ERROR)) if (jresult.has(SERVER_ERROR))
params[0].error= new HTTPException(params[0].result+" (err code "+jresult.getString(SERVER_ERROR)+")", jresult.getInt(SERVER_ERROR)); params[0].error= new HTTPException(params[0].result+" (err code "+jresult.getString(SERVER_ERROR)+")", jresult.getInt(SERVER_ERROR));
} catch (IOException e) { } catch (IOException e) {
Log.e(com.yottacode.net.RestapiWrapper.class.getName(), "Error: '" + e.getLocalizedMessage() + "' when asking for " + params[0].url); Log.e(LOG_TAG, "Error: '" + e.getLocalizedMessage() + "' when asking for " + params[0].url);
params[0].result=null; params[0].result=null;
params[0].error=new HTTPException(e.getMessage(),-1); params[0].error=new HTTPException(e.getMessage(),-1);
} catch (JSONException e) { } catch (JSONException e) {
Log.e(com.yottacode.net.RestapiWrapper.class.getName(), "Error: '" + e.getLocalizedMessage() + Log.e(LOG_TAG, "Error: '" + e.getLocalizedMessage() +
"' when parsing " + jresult==null ? "null json result" : jresult.toString()); "' when parsing " + jresult==null ? "null json result" : jresult.toString());
params[0].result=null; params[0].result=null;
params[0].error=new HTTPException(e.getMessage(),-1); params[0].error=new HTTPException(e.getMessage(),-1);
......
...@@ -2,25 +2,17 @@ package com.yottacode.net; ...@@ -2,25 +2,17 @@ package com.yottacode.net;
import android.util.Log; import android.util.Log;
import com.github.nkzawa.emitter.Emitter;
import com.github.nkzawa.socketio.client.Ack; import com.github.nkzawa.socketio.client.Ack;
import com.github.nkzawa.socketio.client.IO; import com.github.nkzawa.socketio.client.IO;
import com.github.nkzawa.socketio.client.Socket; import com.github.nkzawa.socketio.client.Socket;
import com.github.nkzawa.emitter.Emitter;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import java.security.SecureRandom;
/** /**
...@@ -74,7 +66,14 @@ public class SailsSocketsIO { ...@@ -74,7 +66,14 @@ public class SailsSocketsIO {
Log.d(this.getClass().getName(), " Listening:"+message); Log.d(this.getClass().getName(), " Listening:"+message);
socket.on(message, listener); socket.on(message, listener);
} }
/**
* Unregisters a connection listener to a given message
* @param message
*/
public void unregisterMessage(String message) {
Log.d(this.getClass().getName(), " Unlistening:"+message);
socket.off(message);
}
public SailsSocketsIO(String sails_socket_io_url, String ptransport, Emitter.Listener connectListener, Emitter.Listener errorListener) { public SailsSocketsIO(String sails_socket_io_url, String ptransport, Emitter.Listener connectListener, Emitter.Listener errorListener) {
...@@ -114,11 +113,13 @@ public class SailsSocketsIO { ...@@ -114,11 +113,13 @@ public class SailsSocketsIO {
JSONObject obj=new JSONObject().put("url", msg).put("data", params); JSONObject obj=new JSONObject().put("url", msg).put("data", params);
Log.d(this.getClass().getName(), "Emitted messsage:" + obj); Log.i(this.getClass().getName(), "Emitted messsage:" + obj);
socket.emit(this.EMIT_METHOD, obj, ack); socket.emit(this.EMIT_METHOD, obj, ack);
} }
public void destroy() { public void destroy() {
this.socket.disconnect(); if (this.socket.connected()) {
this.socket.off(); this.socket.off();
this.socket.disconnect();
}
} }
} }
...@@ -36,6 +36,8 @@ import java.util.Vector; ...@@ -36,6 +36,8 @@ import java.util.Vector;
public class Device extends SQLiteOpenHelper { public class Device extends SQLiteOpenHelper {
Context context; Context context;
final static class PARAMS { final static class PARAMS {
static String keyword="key"; static String keyword="key";
static String deviceID="deviceID"; static String deviceID="deviceID";
...@@ -444,5 +446,4 @@ public class Device extends SQLiteOpenHelper { ...@@ -444,5 +446,4 @@ public class Device extends SQLiteOpenHelper {
@Override @Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
} }
} }
...@@ -19,7 +19,8 @@ import org.json.JSONObject; ...@@ -19,7 +19,8 @@ import org.json.JSONObject;
* @author Fernando Martinez Santiago * @author Fernando Martinez Santiago
* @version 1.0 * @version 1.0
*/ */
public class Picto extends Img { public class
Picto extends Img {
public final static class JSON_ATTTRS { public final static class JSON_ATTTRS {
......
...@@ -50,6 +50,7 @@ public class ServerLogin { ...@@ -50,6 +50,7 @@ public class ServerLogin {
PCBcontext.getPcbdb().user_online(true); PCBcontext.getPcbdb().user_online(true);
PCBcontext.getRestapiWrapper().setToken(result.getString(TAG_TOKEN)); PCBcontext.getRestapiWrapper().setToken(result.getString(TAG_TOKEN));
PCBcontext.getVocabulary().synchronize(); PCBcontext.getVocabulary().synchronize();
PCBcontext.getRoom().connect();
} }
listener.result(result); listener.result(result);
}catch (JSONException e) { }catch (JSONException e) {
......
...@@ -35,7 +35,7 @@ public class Room { ...@@ -35,7 +35,7 @@ public class Room {
public Room( ) { public Room( ) {
Log.i(this.getClass().getName(), "Entering room"); Log.i(this.getClass().getName(), "Entering room");
listeners=new Hashtable<>(); listeners=new Hashtable<>();
reconnect(); connect();
} }
private JSONObject common_data(String action, JSONObject attributes) throws JSONException { private JSONObject common_data(String action, JSONObject attributes) throws JSONException {
...@@ -67,10 +67,9 @@ public class Room { ...@@ -67,10 +67,9 @@ public class Room {
/** /**
* Reconnect to the room. It is useful if the server connection is lost for a time * Reconnect to the room. It is useful if the server connection is lost for a time
*/ */
public void reconnect() { public void connect() {
final String transport="polling"; final String transport="polling";
exit(); exit();
this.socket=new SailsSocketsIO(PCBcontext.getRestapiWrapper().getServer(), transport, new Emitter.Listener() { this.socket=new SailsSocketsIO(PCBcontext.getRestapiWrapper().getServer(), transport, new Emitter.Listener() {
@Override @Override
public void call(Object... args) { public void call(Object... args) {
...@@ -83,6 +82,7 @@ public class Room { ...@@ -83,6 +82,7 @@ public class Room {
@Override @Override
public void call(Object... args) { public void call(Object... args) {
Log.e(this.getClass().getName(), "IO sockects error: "+args[0]); Log.e(this.getClass().getName(), "IO sockects error: "+args[0]);
for (StackTraceElement element: Thread.currentThread().getStackTrace() ) Log.e(this.getClass().getName(), "IO sockect error detail: "+element.getClassName()+"."+element.getMethodName());
inRoom=false; inRoom=false;
PCBcontext.getNetService().setOffline(new SocketIOException(args[0].toString())); PCBcontext.getNetService().setOffline(new SocketIOException(args[0].toString()));
} }
...@@ -108,9 +108,16 @@ public class Room { ...@@ -108,9 +108,16 @@ public class Room {
Log.e(this.getClass().getCanonicalName(), "subscribe room failed:"+e.getMessage()); Log.e(this.getClass().getCanonicalName(), "subscribe room failed:"+e.getMessage());
} }
} }
void unlisten() {
for (String msg: this.listeners.keySet()) {
Log.i(this.getClass().getName(), "Unlistening to "+msg);
this.socket.unregisterMessage(msg);
}
}
void unsubscribe() { void unsubscribe() {
try { try {
UnsubscribeAction action = new UnsubscribeAction(); UnsubscribeAction action = new UnsubscribeAction();
this.emit(action); this.emit(action);
}catch (Exception e) { }catch (Exception e) {
...@@ -120,13 +127,16 @@ public class Room { ...@@ -120,13 +127,16 @@ public class Room {
public void exit() { public void exit() {
if (this.socket!=null) { if (this.socket!=null) {
Log.i(this.getClass().getName(), "Leaving room"); Log.i(this.getClass().getName(), "Leaving room");
unlisten();
unsubscribe(); unsubscribe();
this.socket.destroy(); this.socket.destroy();
this.socket=null; this.socket=null;
} }
} }
public void finalize() throws java.lang.Throwable { public void finalize() throws java.lang.Throwable {
super.finalize(); super.finalize();
Log.i(this.getClass().getName(), "Discarding room");
exit(); exit();
} }
......
...@@ -33,7 +33,7 @@ public class StudentTalk implements Emitter.Listener { ...@@ -33,7 +33,7 @@ public class StudentTalk implements Emitter.Listener {
@Override @Override
public void call(Object... args) { public void call(Object... args) {
if (PCBcontext.getPcbdb()!=null)
try { try {
JSONObject msg = ((JSONObject) args[0]).getJSONObject("student"); JSONObject msg = ((JSONObject) args[0]).getJSONObject("student");
Log.i(this.getClass().getName(), "raw Received message " +msg.toString()); Log.i(this.getClass().getName(), "raw Received message " +msg.toString());
......
...@@ -17,7 +17,7 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -17,7 +17,7 @@ public class VocabularyTalk implements Emitter.Listener {
private static final String URL ="vocabulary"; private static final String URL ="vocabulary";
private Room room; private Room room;
private final String LOG_TAG=this.getClass().getName();
iVocabularyListener listeners[]; iVocabularyListener listeners[];
public VocabularyTalk(Room room, iVocabularyListener listeners[]) { public VocabularyTalk(Room room, iVocabularyListener listeners[]) {
...@@ -40,7 +40,7 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -40,7 +40,7 @@ public class VocabularyTalk implements Emitter.Listener {
JSONObject msg = (JSONObject) args[0]; JSONObject msg = (JSONObject) args[0];
try { try {
Log.i(this.getClass().getName(), "raw Received message " +msg.toString()); Log.i(LOG_TAG, "raw Received message " +msg.toString());
String action = msg.getString(param_action).toLowerCase(); String action = msg.getString(param_action).toLowerCase();
JSONObject stu_picto= msg.getJSONObject(param_attributes).getJSONObject(param_stu_picto); JSONObject stu_picto= msg.getJSONObject(param_attributes).getJSONObject(param_stu_picto);
JSONObject attrs_stu_picto = stu_picto.optJSONObject(param_attributes); JSONObject attrs_stu_picto = stu_picto.optJSONObject(param_attributes);
...@@ -48,7 +48,7 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -48,7 +48,7 @@ public class VocabularyTalk implements Emitter.Listener {
int picto_id = picto_stupicto.getInt(param_picto_id); int picto_id = picto_stupicto.getInt(param_picto_id);
int picto_cat = attrs_stu_picto!=null ? attrs_stu_picto.optInt(param_picto_cat, Picto.NO_CATEGORY) : 0; int picto_cat = attrs_stu_picto!=null ? attrs_stu_picto.optInt(param_picto_cat, Picto.NO_CATEGORY) : 0;
Log.i(this.getClass().getName(), "Received message '" + action + Log.i(LOG_TAG, "Received message '" + action +
"' 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
...@@ -57,7 +57,7 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -57,7 +57,7 @@ public class VocabularyTalk implements Emitter.Listener {
, picto_cat, picto_id, stu_picto); , picto_cat, picto_id, stu_picto);
} catch (JSONException e) { } catch (JSONException e) {
Log.e(this.getClass().getCanonicalName(), e.getClass().getCanonicalName() + "--" + e); Log.e(LOG_TAG, e.getClass().getCanonicalName() + "--" + e);
} }
} }
......
...@@ -26,7 +26,7 @@ public final class PCBcontext { ...@@ -26,7 +26,7 @@ public final class PCBcontext {
private static Vocabulary vocabulary; private static Vocabulary vocabulary;
private static ActionLog actionLog; private static ActionLog actionLog;
private static boolean init=false; private static boolean init=false;
private static StudentTalk studentTalk;
/** /**
...@@ -45,8 +45,8 @@ public final class PCBcontext { ...@@ -45,8 +45,8 @@ public final class PCBcontext {
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");
} else { } else {
Log.e(PCBcontext.class.getClass().getCanonicalName(), "Init method was previously" + Log.e(PCBcontext.class.getCanonicalName(), "Init method was previously " +
"invoked! Please, check your code"); " invoked! Please, check your code");
} }
} }
...@@ -70,12 +70,12 @@ public final class PCBcontext { ...@@ -70,12 +70,12 @@ public final class PCBcontext {
actionLog = new ActionLog(); actionLog = new ActionLog();
vocabulary = new Vocabulary(listener); vocabulary = new Vocabulary(listener);
getNetService().notifyStatus(); getNetService().notifyStatus();
if (getNetService().online()) new StudentTalk(room, new StudentTalk.iStudentListener[] {new StudentTalk.iStudentListener() { studentTalk=new StudentTalk(room, new StudentTalk.iStudentListener[] {new StudentTalk.iStudentListener() {
@Override @Override
public void change(User updatedStudent) { public void change(User updatedStudent) {
PCBcontext.getDevice().insertUser(updatedStudent); PCBcontext.getDevice().insertUser(updatedStudent);
if (updatedStudent.is_picto_size_big()!=getPcbdb().getCurrentUser().is_picto_size_big()) if (updatedStudent.is_picto_size_big()!=getPcbdb().getCurrentUser().is_picto_size_big() || updatedStudent.has_categories()!=getPcbdb().getCurrentUser().has_categories())
PCBcontext.getNetService().getNetServiceDevice().restart_app(true); PCBcontext.getNetService().restart_app(true);
else { else {
PCBcontext.getPcbdb().setCurrentUser(updatedStudent); PCBcontext.getPcbdb().setCurrentUser(updatedStudent);
PCBcontext.getNetService().getNetServiceDevice().updateUserConfig(updatedStudent); PCBcontext.getNetService().getNetServiceDevice().updateUserConfig(updatedStudent);
...@@ -88,8 +88,8 @@ public final class PCBcontext { ...@@ -88,8 +88,8 @@ public final class PCBcontext {
public static void unset_user() { public static void unset_user() {
Log.i(PCBcontext.class.getCanonicalName(), "User unset. Student " + getPcbdb().getCurrentUser().get_name_stu()); Log.i(PCBcontext.class.getCanonicalName(), "User unset. Student " + getPcbdb().getCurrentUser().get_name_stu());
pcbdb = null;
if (room!=null) room.exit(); if (room!=null) room.exit();
pcbdb = null;
room = null; room = null;
vocabulary = null; vocabulary = null;
getNetService().notifyStatus(); getNetService().notifyStatus();
...@@ -145,6 +145,15 @@ public final class PCBcontext { ...@@ -145,6 +145,15 @@ public final class PCBcontext {
return device; return device;
} }
public static StudentTalk getStudentTalk() {
if (studentTalk == null) {
throw new java.lang.NullPointerException("studentTalk is null. PCBcontext.init must be" +
"invoked previously");
}
return studentTalk;
}
/** /**
* @return PCBDB * @return PCBDB
* @TODO complete documentation * @TODO complete documentation
......
...@@ -54,7 +54,7 @@ public class TTSHelper { ...@@ -54,7 +54,7 @@ public class TTSHelper {
Set<Voice> voices = this.ttobj.getVoices(); Set<Voice> voices = this.ttobj.getVoices();
if (voices!=null) if (voices!=null)
for (Voice avoice : voices) { Log.i(context.getApplicationInfo().processName,"Voice "+avoice+" available"); for (Voice avoice : voices) { //Log.i(context.getApplicationInfo().processName,"Voice "+avoice+" available");
if (avoice.getName().equalsIgnoreCase(voice)) { if (avoice.getName().equalsIgnoreCase(voice)) {
this.ttobj.setVoice(avoice); this.ttobj.setVoice(avoice);
this.voice_ok=true; this.voice_ok=true;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<string name="loginErrorTxt">Login</string> <string name="loginErrorTxt">Login</string>
<string name="loginErrorMsg">Invalid user or password. Please, try it again.</string> <string name="loginErrorMsg">Invalid user or password. Please, try it again.</string>
<string name="loginNoLicenseMsg">Not valid user license. Please, contact with Yotta.</string> <string name="loginNoLicenseMsg">Not valid user license. Please, contact with Yotta.</string>
<string name="loginExpiredLicenseMsg">User license was expired on</string>
<string name="userInetErrorMsg">Unknown new user name because Internet conection is not available</string> <string name="userInetErrorMsg">Unknown new user name because Internet conection is not available</string>
<string name="userLoadingTxt">Loading</string> <string name="userLoadingTxt">Loading</string>
<string name="userLoadingMsg">Loading students. Please wait.</string> <string name="userLoadingMsg">Loading students. Please wait.</string>
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
<string name="loginTitle">¿Quién eres?</string> <string name="loginTitle">¿Quién eres?</string>
<string name="loginErrorTxt">Login</string> <string name="loginErrorTxt">Login</string>
<string name="loginErrorMsg">El usuario no existe o la contraseña indicada no es correcta. Inténtelo de nuevo.</string> <string name="loginErrorMsg">El usuario no existe o la contraseña indicada no es correcta. Inténtelo de nuevo.</string>
<string name="loginNoLicenseMsg">El usuario no tiene una licencia válida. Contacte con Yotta para adquirir una.</string> <string name="loginNoLicenseMsg">La licencia del usuario expiró con fecha. Contacte con Yotta para adquirir una.</string>
<string name="loginExpiredLicenseMsg">La licencia del usuario expiró con fecha</string>
<string name="imguserLoadingMsg">Cargando imágenes de los alumnos. Por favor espere.</string> <string name="imguserLoadingMsg">Cargando imágenes de los alumnos. Por favor espere.</string>
<string name="imguserLoadingErrMsg">Imagen con formato no válido.</string> <string name="imguserLoadingErrMsg">Imagen con formato no válido.</string>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<string name="loginErrorTxt">Login</string> <string name="loginErrorTxt">Login</string>
<string name="loginErrorMsg">El usuario no existe o la contraseña indicada no es correcta. Inténtelo de nuevo.</string> <string name="loginErrorMsg">El usuario no existe o la contraseña indicada no es correcta. Inténtelo de nuevo.</string>
<string name="loginNoLicenseMsg">El usuario no tiene una licencia válida. Contacte con Yotta para adquirir una.</string> <string name="loginNoLicenseMsg">El usuario no tiene una licencia válida. Contacte con Yotta para adquirir una.</string>
<string name="loginExpiredLicenseMsg">La licencia del usuario expiró con fecha</string>
<string name="userInetErrorMsg">Este usuario requiere conexión a internet para ser validado</string> <string name="userInetErrorMsg">Este usuario requiere conexión a internet para ser validado</string>
<string name="userLoadingTxt">Cargando</string> <string name="userLoadingTxt">Cargando</string>
<string name="userLoadingMsg">Cargando alumnos. Por favor espere.</string> <string name="userLoadingMsg">Cargando alumnos. Por favor espere.</string>
......
...@@ -66,14 +66,6 @@ ...@@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/assets" type="java-test-resource" />
...@@ -82,6 +74,14 @@ ...@@ -82,6 +74,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<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/animated-vector-drawable/24.2.1/jars" />
......
...@@ -112,7 +112,7 @@ public class LoginActivity extends FragmentActivity { ...@@ -112,7 +112,7 @@ public class LoginActivity extends FragmentActivity {
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
Log.i(LOG_TAG,"Closing app"); Log.i(LOG_TAG,"Closing Login window");
PCBcontext.getNetService().closeNotifyStatus(); PCBcontext.getNetService().closeNotifyStatus();
} }
} }
...@@ -62,7 +62,6 @@ import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet; ...@@ -62,7 +62,6 @@ import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
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.pictogram.tts.TTSHelper; import com.yottacode.pictogram.tts.TTSHelper;
import com.yottacode.tools.GUITools;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -122,7 +121,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -122,7 +121,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
private boolean feedback_read; private boolean feedback_read;
private boolean feedback_highlight; private boolean feedback_highlight;
private boolean deleting; private boolean deleting;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -140,6 +138,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -140,6 +138,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
return; return;
} }
this.vocabulary = PCBcontext.getVocabulary(); this.vocabulary = PCBcontext.getVocabulary();
this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() { this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() {
@Override @Override
...@@ -218,11 +217,13 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -218,11 +217,13 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
this.tapeGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { this.tapeGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.i(PictogramActivity.class.getCanonicalName(), " Deleting item " + position + "-"+id+"(" + PictogramActivity.this.tapeAdapter.getItem(position).get_translation() + ")"); if (!deleting) {
Log.i(PictogramActivity.class.getCanonicalName(), " Deleting item " + position + "-" + id + "(" + PictogramActivity.this.tapeAdapter.getItem(position).get_translation() + ")");
animateImageView(view,position); animateImageView(view, position);
PictogramActivity.this.tapeAdapter.notifyDataSetChanged(); PictogramActivity.this.tapeAdapter.notifyDataSetChanged();
PCBcontext.getActionLog().log(new TalkAction(TalkAction.DELETE, PictogramActivity.this.tapeAdapter.getItem(position))); PCBcontext.getActionLog().log(new TalkAction(TalkAction.DELETE, PictogramActivity.this.tapeAdapter.getItem(position)));
}
}}); }});
((NetServiceTablet) PCBcontext.getNetService().getNetServiceDevice()).setPictogramActivity(this); ((NetServiceTablet) PCBcontext.getNetService().getNetServiceDevice()).setPictogramActivity(this);
...@@ -1126,27 +1127,48 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1126,27 +1127,48 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
@Override @Override
public boolean dispatchTouchEvent(MotionEvent event) { public boolean dispatchTouchEvent(MotionEvent event) {
if (PCBcontext.getPcbdb()!=null && PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) int in=0,out=0;
Intent nextActivity=null;
Intent intent =getIntent();
boolean student_view=intent.getBooleanExtra("student_view",false);
if (PCBcontext.getPcbdb()!=null && (PCBcontext.getPcbdb().getCurrentUser().is_supervisor() || student_view)) {
switch (event.getAction()) { switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
firstTouchX = event.getX(); firstTouchX = event.getX();
break; break;
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_UP:
if (firstTouchX > event.getX()+100) { if (event.getX() > firstTouchX + 100) { //izquierda a derecha
if (!PCBcontext.getNetService().online()) if (!student_view) {
GUITools.show_alert(this,R.string.pictogram_offline); PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(User.NO_SUPERVISOR);
else { nextActivity = intent;
Intent sessionActivity = new Intent(this, SessionActivity.class); } else {
sessionActivity.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(PCBcontext.getDevice().getLastSupId());
startActivity(sessionActivity); nextActivity = new Intent(this, SessionActivity.class);
overridePendingTransition(R.anim.leftin, R.anim.leftout);
} }
in = R.anim.rightin;
out = R.anim.rightout;
overridePendingTransition(R.anim.leftin, R.anim.leftout);
} else if (firstTouchX > event.getX() + 100) { //derecha a izquierda
if (!student_view) {
nextActivity = new Intent(this, SessionActivity.class);
} else {
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(PCBcontext.getDevice().getLastSupId());
nextActivity = intent;
}
in = R.anim.leftin;
out = R.anim.leftout;
}
if (nextActivity != null) {
intent.putExtra("student_view", !PCBcontext.getPcbdb().getCurrentUser().is_supervisor());
finish();
startActivity(nextActivity);
overridePendingTransition(in, out);
} }
break; break;
case MotionEvent.ACTION_UP:
firstTouchX = -1;
} }
}
return super.dispatchTouchEvent(event); return super.dispatchTouchEvent(event);
} }
......
...@@ -55,7 +55,7 @@ public class SerialActivity extends Activity { ...@@ -55,7 +55,7 @@ public class SerialActivity extends Activity {
String username = intent.getStringExtra("switch_usr"); String username = intent.getStringExtra("switch_usr");
String password = intent.getStringExtra("switch_pwd"); String password = intent.getStringExtra("switch_pwd");
if (username==null) { if (username==null || password==null) {
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
username = settings.getString("username", ""); username = settings.getString("username", "");
password = settings.getString("password", ""); password = settings.getString("password", "");
...@@ -119,7 +119,7 @@ public class SerialActivity extends Activity { ...@@ -119,7 +119,7 @@ public class SerialActivity extends Activity {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit(); SharedPreferences.Editor editor = settings.edit();
editor.putString("username", stuUsers.elementAt(position).get_name_stu()); editor.putString("username", stuUsers.elementAt(position).get_nickname_stu());
editor.putString("password", stuUsers.elementAt(position).get_pwd_stu()); editor.putString("password", stuUsers.elementAt(position).get_pwd_stu());
editor.commit(); editor.commit();
new UserLogin().login(stuUsers.elementAt(position).get_nickname_stu(), new UserLogin().login(stuUsers.elementAt(position).get_nickname_stu(),
...@@ -131,8 +131,9 @@ public class SerialActivity extends Activity { ...@@ -131,8 +131,9 @@ public class SerialActivity extends Activity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Log.e(this.getClass().getCanonicalName(),"Creating serial activity"); Log.i(this.getClass().getCanonicalName(),"Creating serial activity");
PCBcontext.init(this, new NetServiceTablet()); if (!PCBcontext.init())
PCBcontext.init(this, new NetServiceTablet());
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_serial); setContentView(R.layout.activity_serial);
...@@ -170,7 +171,7 @@ public class SerialActivity extends Activity { ...@@ -170,7 +171,7 @@ public class SerialActivity extends Activity {
@Override @Override
public void onStart() { public void onStart() {
Vector<User> users; Vector<User> users;
Log.e(this.getClass().getCanonicalName(),"Starting serial activity"); Log.i(this.getClass().getCanonicalName(),"Starting serial activity (direct login:"+!getIntent().getBooleanExtra("resetPrevUser", true)+")");
if (!PCBcontext.init()) PCBcontext.init(this, new NetServiceTablet()); if (!PCBcontext.init()) PCBcontext.init(this, new NetServiceTablet());
String default_user[] = loginUserPolicy(); String default_user[] = loginUserPolicy();
String username = default_user[0]; String username = default_user[0];
......
package com.yottacode.pictogram.tabletlibrary.gui.session; package com.yottacode.pictogram.tabletlibrary.gui.session;
import android.app.Activity; import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
...@@ -14,6 +15,7 @@ import android.widget.AdapterView; ...@@ -14,6 +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.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;
...@@ -114,13 +116,17 @@ public class ListInstructionsFragment extends Fragment{ ...@@ -114,13 +116,17 @@ public class ListInstructionsFragment extends Fragment{
} }
private void checkStudent() { private void checkStudent() {
SessionWrapper.validateStudent(new SessionWrapper.iValidateStudent() { SessionWrapper.validateStudent(new SessionWrapper.iValidateStudent() {
void close() {
ListInstructionsFragment.this.getActivity().finish();
startActivity(new Intent(getActivity(), PictogramActivity.class));
}
@Override @Override
public void validLicense(boolean valid_license) { public void validLicense(boolean valid_license, String sexpiration) {
if (!valid_license) { if (!valid_license) {
GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.loginNoLicenseMsg, getString(R.string.server), new GUITools.iOKListener() { GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.loginExpiredLicenseMsg, sexpiration, new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
ListInstructionsFragment.this.getActivity().finish(); close();
} }
}); });
} }
...@@ -131,7 +137,7 @@ public class ListInstructionsFragment extends Fragment{ ...@@ -131,7 +137,7 @@ public class ListInstructionsFragment extends Fragment{
GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.session_notclosed, getString(R.string.server), new GUITools.iOKListener() { GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.session_notclosed, getString(R.string.server), new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
ListInstructionsFragment.this.getActivity().finish(); close();
} }
}); });
} }
...@@ -142,7 +148,7 @@ public class ListInstructionsFragment extends Fragment{ ...@@ -142,7 +148,7 @@ public class ListInstructionsFragment extends Fragment{
GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.session_error, message,new GUITools.iOKListener() { GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.session_error, message,new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
ListInstructionsFragment.this.getActivity().finish(); close();
} }
}); });
} }
......
...@@ -17,6 +17,7 @@ import android.widget.TextView; ...@@ -17,6 +17,7 @@ import android.widget.TextView;
import android.widget.ToggleButton; import android.widget.ToggleButton;
import com.yottacode.pictogram.dao.User; import com.yottacode.pictogram.dao.User;
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.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper; import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper;
...@@ -36,6 +37,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -36,6 +37,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
private int currentInstruction; private int currentInstruction;
private int id_session; private int id_session;
private Hashtable<Integer,Integer> msgs=new Hashtable<>(20); private Hashtable<Integer,Integer> msgs=new Hashtable<>(20);
private NetService.iNetServiceStatus listenerStatus;
float firstTouchX=-1; float firstTouchX=-1;
...@@ -188,6 +190,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -188,6 +190,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
}); });
} }
}); });
} }
@Override @Override
...@@ -197,7 +200,34 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -197,7 +200,34 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
set_fragment_sesion(); set_fragment_sesion();
else set_fragment_method(); else set_fragment_method();
this.listenerStatus = new NetService.iNetServiceStatus() {
boolean m_updated=true;
@Override
public void notifyStatus(final boolean updated) {
runOnUiThread(new Runnable() {
public void run() {
if (!updated && m_updated) {
m_updated=false;
GUITools.show_alert(SessionActivity.this, R.string.session_noinet);
addLogMsg(getString(R.string.session_noinet));
} else
if (updated && !m_updated) {
m_updated=true;
GUITools.show_alert(SessionActivity.this, R.string.session_inetok);
addLogMsg(getString(R.string.session_inetok));
}
}
});
} }
};
PCBcontext.getNetService().addListener(listenerStatus);
}
@Override
protected void onStop() {
super.onStop();
PCBcontext.getNetService().removeListener(listenerStatus);
}
@Override @Override
public void instruction_selected(int instruction, String instruction_name) { public void instruction_selected(int instruction, String instruction_name) {
...@@ -216,22 +246,32 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -216,22 +246,32 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
@Override @Override
public boolean dispatchTouchEvent(MotionEvent event) { public boolean dispatchTouchEvent(MotionEvent event) {
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) int in=0,out=0;
switch (event.getAction()) { Intent nextActivity=null;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
firstTouchX = event.getX(); firstTouchX = event.getX();
break; break;
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_UP:
if (event.getX()> firstTouchX+100) { //izquierda->derecha
if (firstTouchX> event.getX()+100) { nextActivity=new Intent(this,PictogramActivity.class);
Intent pictogramActivity = new Intent(this, PictogramActivity.class); nextActivity.putExtra("student_view", false);
startActivity(pictogramActivity); in=R.anim.rightin;
overridePendingTransition(R.anim.leftin, R.anim.leftout); out=R.anim.rightout;
}
else if (firstTouchX > event.getX()+100) { //derecha->izquierda
nextActivity=new Intent(this,PictogramActivity.class);
nextActivity.putExtra("student_view", true);
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(User.NO_SUPERVISOR);
in=R.anim.leftin;
out=R.anim.leftout;
}
if (nextActivity!=null) {
startActivity(nextActivity);
overridePendingTransition(in, out);
} }
break; break;
case MotionEvent.ACTION_UP: }
firstTouchX = 100000;
}
return super.dispatchTouchEvent(event); return super.dispatchTouchEvent(event);
} }
...@@ -289,6 +329,10 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -289,6 +329,10 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
findViewById(R.id.sessionTopbarMethodName).setVisibility(View.INVISIBLE); findViewById(R.id.sessionTopbarMethodName).setVisibility(View.INVISIBLE);
findViewById(R.id.sessionTopbarInstructionName).setVisibility(View.INVISIBLE); findViewById(R.id.sessionTopbarInstructionName).setVisibility(View.INVISIBLE);
} }
void close() {
finish();
startActivity(new Intent(SessionActivity.this, PictogramActivity.class));
}
private void set_fragment(boolean isChecked) { private void set_fragment(boolean isChecked) {
if (isChecked) { if (isChecked) {
...@@ -306,7 +350,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -306,7 +350,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
GUITools.show_alert(SessionActivity.this, R.string.session_error, "error " + error, new GUITools.iOKListener() { GUITools.show_alert(SessionActivity.this, R.string.session_error, "error " + error, new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
finish(); close();
} }
}); });
} }
...@@ -319,7 +363,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -319,7 +363,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
GUITools.show_alert(SessionActivity.this, R.string.session_closed_ok, end, new GUITools.iOKListener() { GUITools.show_alert(SessionActivity.this, R.string.session_closed_ok, end, new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
finish(); close();
} }
}); });
...@@ -330,7 +374,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -330,7 +374,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
GUITools.show_alert(SessionActivity.this, R.string.session_error, getString(R.string.server) + "(error " + error + ")", new GUITools.iOKListener() { GUITools.show_alert(SessionActivity.this, R.string.session_error, getString(R.string.server) + "(error " + error + ")", new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
finish(); close();
} }
}); });
} }
......
...@@ -83,6 +83,10 @@ public class NetServiceTablet implements NetService.iNetServiceDevice { ...@@ -83,6 +83,10 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
serialActivity = new Intent(PCBcontext.getContext(), serialClass); serialActivity = new Intent(PCBcontext.getContext(), serialClass);
} }
serialActivity.putExtra("resetPrevUser", !direct_login); serialActivity.putExtra("resetPrevUser", !direct_login);
if (direct_login) {
serialActivity.putExtra("switch_usr",PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ? PCBcontext.getPcbdb().getCurrentUser().get_email_sup() : PCBcontext.getPcbdb().getCurrentUser().get_nickname_stu());
serialActivity.putExtra("switch_pwd",PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ? PCBcontext.getPcbdb().getCurrentUser().get_pwd_sup() : PCBcontext.getPcbdb().getCurrentUser().get_pwd_stu());
}
PCBcontext.getContext().startActivity(serialActivity); PCBcontext.getContext().startActivity(serialActivity);
} }
......
...@@ -30,7 +30,7 @@ public class SessionWrapper { ...@@ -30,7 +30,7 @@ public class SessionWrapper {
public interface iValidateStudent { public interface iValidateStudent {
void lastTryOpen(boolean is_open); void lastTryOpen(boolean is_open);
void validLicense(boolean valid); void validLicense(boolean valid, String sexpiration);
void error(String msg); void error(String msg);
} }
...@@ -148,15 +148,16 @@ public class SessionWrapper { ...@@ -148,15 +148,16 @@ public class SessionWrapper {
try { try {
boolean valid_license; boolean valid_license;
String license = result.getString("license"); String license = result.getString("license");
String sexpiration=null;
if (license.equals("null")) valid_license = false; if (license.equals("null")) valid_license = false;
else { else {
JSONObject jlicense = new JSONObject(license); JSONObject jlicense = new JSONObject(license);
String sexpiration = jlicense.getString("expiration_ts"); sexpiration = jlicense.getString("expiration_ts");
sexpiration = sexpiration.substring(0, sexpiration.indexOf('T')); sexpiration = sexpiration.substring(0, sexpiration.indexOf('T'));
Date dexpiration = new java.text.SimpleDateFormat("yyyy-mm-dd").parse(sexpiration); Date dexpiration = new java.text.SimpleDateFormat("yyyy-MM-dd").parse(sexpiration);
valid_license = dexpiration.after(new Date()); valid_license = dexpiration.after(new Date());
} }
listener.validLicense(valid_license); listener.validLicense(valid_license,sexpiration);
JSONArray lastInstruction = result.getJSONArray("lastInstruction"); JSONArray lastInstruction = result.getJSONArray("lastInstruction");
...@@ -168,7 +169,7 @@ public class SessionWrapper { ...@@ -168,7 +169,7 @@ public class SessionWrapper {
} }
@Override @Override
public void error(RestapiWrapper.HTTPException e) { public void error(RestapiWrapper.HTTPException e) {
Log.e(this.getClass().getCanonicalName(),"Raw error from server when login:"+e.getMessage()+" (error "+e.getCode()+")"); Log.e(this.getClass().getCanonicalName(),"Raw error from server when getting student info:"+e.getMessage()+" (error "+e.getCode()+")");
listener.error("Internet error: "+e.getMessage()); listener.error("Internet error: "+e.getMessage());
} }
}); });
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
android:shareInterpolator="false"> android:shareInterpolator="false">
<translate <translate
android:duration="500" android:duration="500"
android:fromXDelta="100%p" android:fromXDelta="-100%p"
android:toXDelta="0" android:toXDelta="0"
android:interpolator="@android:anim/linear_interpolator" /> android:interpolator="@android:anim/linear_interpolator" />
</set> </set>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<translate <translate
android:duration="500" android:duration="500"
android:fromXDelta="0%" android:fromXDelta="0%"
android:toXDelta="-100%" android:toXDelta="100%"
android:fromYDelta="0%" android:fromYDelta="0%"
android:toYDelta="0%" android:toYDelta="0%"
android:interpolator="@android:anim/linear_interpolator" /> android:interpolator="@android:anim/linear_interpolator" />
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
<string name="session_closed_ok">Session upload ok</string> <string name="session_closed_ok">Session upload ok</string>
<string name="session_closed_fail">Session not uploaded. Please, try it from</string> <string name="session_closed_fail">Session not uploaded. Please, try it from</string>
<string name="session_pause_error">Pause session failed</string> <string name="session_pause_error">Pause session failed</string>
<string name="session_noinet">No server conexion. Internet conexion is available?</string>
<string name="session_inetok">Server conexion ok</string>
<string name="session_log_startingsession">iniciando sesión</string> <string name="session_log_startingsession">iniciando sesión</string>
<string name="session_log_startsession">sesión iniciada</string> <string name="session_log_startsession">sesión iniciada</string>
<string name="session_log_closingsession">cerrando sesión</string> <string name="session_log_closingsession">cerrando sesión</string>
......
...@@ -11,10 +11,12 @@ ...@@ -11,10 +11,12 @@
<string name="session_noinstructions">Alumno sin ninguna instrucción asignada. Por favor, asigne al menos una instrucción al alumno desde Pictogram Web</string> <string name="session_noinstructions">Alumno sin ninguna instrucción asignada. Por favor, asigne al menos una instrucción al alumno desde Pictogram Web</string>
<string name="session_loading">Desargando instrucciones</string> <string name="session_loading">Desargando instrucciones</string>
<string name="session_empty">Este alumno no tiene ningún método asignado. Por favor asigne un método a este alumno en</string> <string name="session_empty">Este alumno no tiene ningún método asignado. Por favor asigne un método a este alumno en</string>
<string name="session_notclosed">Este alumno tiene una sesión abierta. Por favor cierre la sesión desde Pictogram Tablet en</string> <string name="session_notclosed">Este alumno tiene una sesión abierta. Por favor cierre la sesión desde Pictogram Web en</string>
<string name="session_closed_ok">Sesión grabada correctamente. Hora</string> <string name="session_closed_ok">Sesión grabada correctamente. Hora</string>
<string name="session_closed_fail">Sesión no cerrada. Por favor cierre la sesión en el panel de control de Pictogram Tablet</string> <string name="session_closed_fail">Sesión no cerrada. Por favor cierre la sesión en el panel de control de Pictogram Tablet</string>
<string name="session_pause_error">Error pausando la sesión</string> <string name="session_pause_error">Error pausando la sesión</string>
<string name="session_noinet">No hay conexión con el servidor. Por favor, asegúrese que tiene conexión a Internet</string>
<string name="session_inetok">Conexión con el servidor restablecida</string>
<string name="session_log_startingsession">iniciando sesión</string> <string name="session_log_startingsession">iniciando sesión</string>
<string name="session_log_closingsession">cerrando sesión</string> <string name="session_log_closingsession">cerrando sesión</string>
<string name="session_log_startsession">sesión iniciada</string> <string name="session_log_startsession">sesión iniciada</string>
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
<string name="session_noinstructions">Student without any instrucction assigment</string> <string name="session_noinstructions">Student without any instrucction assigment</string>
<string name="session_loading">Desargando instrucciones</string> <string name="session_loading">Desargando instrucciones</string>
<string name="session_empty">Este alumno no tiene ningún método asignado. Por favor asigne un método a este alumno en</string> <string name="session_empty">Este alumno no tiene ningún método asignado. Por favor asigne un método a este alumno en</string>
<string name="session_notclosed">Este alumno tiene una sesión abierta. Por favor cierre la sesión en el panel de control de Pictogram Tablet</string> <string name="session_notclosed">Este alumno tiene una sesión abierta. Por favor cierre la sesión en el panel de control de Pictogram Web</string>
<string name="session_closed_ok">Sesión grabada correctamente</string> <string name="session_closed_ok">Sesión grabada correctamente</string>
<string name="session_closed_fail">Sesión no cerrada. Por favor intente cerrarla desde</string> <string name="session_closed_fail">Sesión no cerrada. Por favor intente cerrarla desde</string>
<string name="session_pause_error">Error pausando la sesión</string> <string name="session_pause_error">Error pausando la sesión</string>
<string name="session_noinet">No hay conexión con el servidor. Por favor, asegúrese que tiene conexión a Internet</string>
<string name="session_inetok">Conexión con el servidor restablecida</string>
<string name="session_log_startingsession">iniciando sesión</string> <string name="session_log_startingsession">iniciando sesión</string>
<string name="session_log_closingsession">cerrando sesión</string> <string name="session_log_closingsession">cerrando sesión</string>
<string name="session_log_startsession">sesión iniciada</string> <string name="session_log_startsession">sesión iniciada</string>
......
...@@ -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/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" />
...@@ -89,6 +81,14 @@ ...@@ -89,6 +81,14 @@
<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/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" />
......
...@@ -43,13 +43,6 @@ ...@@ -43,13 +43,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/DefaultFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/DefaultFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/assets" type="java-test-resource" />
...@@ -58,6 +51,13 @@ ...@@ -58,6 +51,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/DefaultFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/DefaultFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/assets" type="java-resource" />
...@@ -66,14 +66,6 @@ ...@@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/assets" type="java-test-resource" />
...@@ -82,6 +74,14 @@ ...@@ -82,6 +74,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
...@@ -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/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" />
...@@ -122,9 +114,15 @@ ...@@ -122,9 +114,15 @@
<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/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<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/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
<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/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<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-base/9.2.1/jars" />
...@@ -133,13 +131,11 @@ ...@@ -133,13 +131,11 @@
<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.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/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" />
......
...@@ -66,14 +66,6 @@ ...@@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/assets" type="java-test-resource" />
...@@ -82,6 +74,14 @@ ...@@ -82,6 +74,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
...@@ -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/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" />
...@@ -122,6 +114,14 @@ ...@@ -122,6 +114,14 @@
<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/assets" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
......
...@@ -59,6 +59,7 @@ mostradas más adelante hacen todo el trabajo, basta con ejecutar [./install.sh] ...@@ -59,6 +59,7 @@ mostradas más adelante hacen todo el trabajo, basta con ejecutar [./install.sh]
### Opción B (desarrollo en local) ### Opción B (desarrollo en local)
0. Comprobar que VT-x (virtualización) está habilitada en la BIOS y tenemos IP estática.
1. Instalar [virtualbox][1] y [vagrant][2] (version >1.5 para este último). 1. Instalar [virtualbox][1] y [vagrant][2] (version >1.5 para este último).
2. Ejecutar `vagrant up` desde este directorio. 2. Ejecutar `vagrant up` desde este directorio.
......
...@@ -161,8 +161,6 @@ CREATE TABLE IF NOT EXISTS `picto` ( ...@@ -161,8 +161,6 @@ CREATE TABLE IF NOT EXISTS `picto` (
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)
......
...@@ -293,7 +293,7 @@ module.exports = { ...@@ -293,7 +293,7 @@ module.exports = {
sails.log.debug("Uploading picto with FileName: " + pictoFileName); sails.log.debug("Uploading picto with FileName: " + pictoFileName);
req.file('file').upload({ req.file('file').upload({
maxBytes: 1000000, maxBytes: 1048576,
dirname: pictoDirectory, dirname: pictoDirectory,
saveAs: pictoFileName saveAs: pictoFileName
}, function whenDone(err, uploadedFiles) { }, function whenDone(err, uploadedFiles) {
......
...@@ -171,7 +171,7 @@ module.exports = { ...@@ -171,7 +171,7 @@ module.exports = {
License.activate(params.license_number, created.id, function(err, license) { License.activate(params.license_number, created.id, function(err, license) {
if (err) if (err)
return res.serverError(err); return res.serverError(err);
created = created.toObject(); created = created.toJSON();
created.license = license.toObject(); created.license = license.toObject();
return res.ok(created); return res.ok(created);
}); });
...@@ -270,7 +270,7 @@ module.exports = { ...@@ -270,7 +270,7 @@ module.exports = {
}) })
.catch(function (err) { .catch(function (err) {
res.notFound(); res.notFound(err);
}); });
}, },
...@@ -1007,18 +1007,19 @@ module.exports = { ...@@ -1007,18 +1007,19 @@ module.exports = {
newAvatarFileName = sails.config.pictogram.paths.getStudentAvatarFileName(student.id); newAvatarFileName = sails.config.pictogram.paths.getStudentAvatarFileName(student.id);
req.file('file').upload({ req.file('file').upload({
maxBytes: 1000000, maxBytes: 1048576,
dirname: newAvatarDirectory, dirname: newAvatarDirectory,
saveAs: newAvatarFileName saveAs: newAvatarFileName
}, function whenDone(error, uploadedFiles) { }, function whenDone(error, uploadedFiles) {
if (error || (uploadedFiles.length === 0)) { if (error || (uploadedFiles.length === 0)) {
throw new Error("upload failed"); return res.badRequest("Upload failed");
} }
try { try {
newAvatarFileDescriptor = uploadedFiles[0].fd; newAvatarFileDescriptor = uploadedFiles[0].fd;
if (student.pic !== sails.config.pictogram.paths.defaultAvatarFileName) { if (student.pic !== sails.config.pictogram.paths.defaultAvatarFileName) {
fs.unlinkSync(path.join(newAvatarDirectory, student.pic)); if (fs.existsSync(path.join(newAvatarDirectory, student.pic)))
fs.unlinkSync(path.join(newAvatarDirectory, student.pic));
} }
student.pic = newAvatarFileName; student.pic = newAvatarFileName;
...@@ -1028,9 +1029,9 @@ module.exports = { ...@@ -1028,9 +1029,9 @@ module.exports = {
} }
res.ok({file: {name: student.pic}}); res.ok({file: {name: student.pic}});
}); });
} catch (updateAvatarError) { } catch (err) {
fs.unlinkSync(newAvatarFileDescriptor); fs.unlinkSync(newAvatarFileDescriptor);
res.serverError("Error when updating profile image in server"); res.serverError("Error when updating profile image in server: " + err);
} }
}); });
}) })
......
...@@ -530,19 +530,20 @@ module.exports = { ...@@ -530,19 +530,20 @@ module.exports = {
sails.log.debug("Saving file to " + newAvatarDirectory + "/" + newAvatarFileName); sails.log.debug("Saving file to " + newAvatarDirectory + "/" + newAvatarFileName);
req.file('file').upload({ req.file('file').upload({
maxBytes: 1000000, maxBytes: 1048576,
dirname: newAvatarDirectory, dirname: newAvatarDirectory,
saveAs: newAvatarFileName saveAs: newAvatarFileName
}, function whenDone(error, uploadedFiles) { }, function whenDone(error, uploadedFiles) {
if (error || (uploadedFiles.length === 0)) { if (error || (uploadedFiles.length === 0)) {
throw new Error("upload failed"); return res.badRequest("Upload failed");
} }
try { try {
newAvatarFileDescriptor = uploadedFiles[0].fd; newAvatarFileDescriptor = uploadedFiles[0].fd;
if (supervisor.pic !== sails.config.pictogram.paths.defaultAvatarFileName) { if (supervisor.pic !== sails.config.pictogram.paths.defaultAvatarFileName) {
sails.log.debug("removing old profile image"); sails.log.debug("removing old profile image");
fs.unlinkSync(path.join(newAvatarDirectory, supervisor.pic)); if (fs.existsSync(path.join(newAvatarDirectory, supervisor.pic)))
fs.unlinkSync(path.join(newAvatarDirectory, supervisor.pic));
} }
supervisor.pic = newAvatarFileName; supervisor.pic = newAvatarFileName;
......
...@@ -176,7 +176,6 @@ module.exports = { ...@@ -176,7 +176,6 @@ module.exports = {
}, },
legend: false, legend: false,
legend_size: 'normal', legend_size: 'normal',
pic: "defaultAvatar.jpg",
size: 'large', size: 'large',
picto_background: '#0000ff', picto_background: '#0000ff',
tape_background: '#00ffff', tape_background: '#00ffff',
...@@ -202,9 +201,6 @@ module.exports = { ...@@ -202,9 +201,6 @@ module.exports = {
} }
}); });
} }
if (typeof validAttributes.pic !== 'string') {
delete validAttributes.pic;
}
if (typeof validAttributes.input_selection !== 'object') { if (typeof validAttributes.input_selection !== 'object') {
delete validAttributes.input_selection; delete validAttributes.input_selection;
} else { } else {
...@@ -245,7 +241,7 @@ module.exports = { ...@@ -245,7 +241,7 @@ module.exports = {
beforeCreate: function (attrs, next) { beforeCreate: function (attrs, next) {
attrs.attributes = Student.getValidAttributes(attrs.attributes); attrs.attributes = Student.getValidAttributes(attrs.attributes);
attrs.password = bcrypt.hashSync(attrs.password, bcrypt.genSaltSync()); attrs.password = bcrypt.hashSync(attrs.password, bcrypt.genSaltSync());
attrs.pic = sails.config.pictogram.urls.getStudentAvatarUrl(); attrs.pic = sails.config.pictogram.paths.defaultAvatarFileName;
next(); next();
}, },
...@@ -519,7 +515,9 @@ module.exports = { ...@@ -519,7 +515,9 @@ module.exports = {
username: Math.floor((Math.random() * 100000000) + 1) + "_" + student.username, username: Math.floor((Math.random() * 100000000) + 1) + "_" + student.username,
id_off: null id_off: null
}) })
.then((updated) => {cb()}) .then((updated) => {
License.destroy({id_stu: id_stu}).exec(cb);
})
.catch((err) => {cb(err)}); .catch((err) => {cb(err)});
}); });
} }
......
...@@ -235,7 +235,7 @@ module.exports = { ...@@ -235,7 +235,7 @@ module.exports = {
async.eachSeries(stuSups, function(stuSup, next_cb) { async.eachSeries(stuSups, function(stuSup, next_cb) {
// Filter logically deleted students // Filter logically deleted students
if (stuSup.student.office == null) if (stuSup.student.office == null)
next_cb(); return next_cb();
// set current method and instruction if any // set current method and instruction if any
Student.findOne(stuSup.student.id) Student.findOne(stuSup.student.id)
......
...@@ -29,7 +29,7 @@ module.exports = function notFound (data, options) { ...@@ -29,7 +29,7 @@ module.exports = function notFound (data, options) {
// Log error to console // Log error to console
if (data !== undefined) { if (data !== undefined) {
sails.log.verbose('Sending 404 ("Not Found") response: \n',data); sails.log.verbose('Sending 404 ("Not Found") response: \n', JSON.stringify(data));
} }
else sails.log.verbose('Sending 404 ("Not Found") response'); else sails.log.verbose('Sending 404 ("Not Found") response');
......
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
"error_only_support_images": "Only images are supported (JPG, PNG or GIF files)", "error_only_support_images": "Only images are supported (JPG, PNG or GIF files)",
"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_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",
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,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_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",
"February": "Febrero", "February": "Febrero",
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</ul> </ul>
<!-- The content --> <!-- The content -->
<div ui-view></div> <div ui-view id="main-content"></div>
</div> </div>
<!-- Fin de container --> <!-- Fin de container -->
......
...@@ -63,9 +63,14 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl( ...@@ -63,9 +63,14 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
ngToast.success({ content: $translate.instant('student_updated') }); ngToast.success({ content: $translate.instant('student_updated') });
$scope.studentData.pic = '/upload/studentAvatar/' + data.file.name; $scope.studentData.pic = '/upload/studentAvatar/' + data.file.name;
$scope.spin_disabled = true; $scope.spin_disabled = true;
})
.error(function (err) {
ngToast.danger({content: $translate.instant('error_on_upload')});
$scope.spin_disabled = true;
}); });
} else { } else {
ngToast.danger({ content: $translate.instant('error_only_support_images') }); ngToast.danger({ content: $translate.instant('error_only_support_images') });
$scope.spin_disabled = true;
} }
} }
}; };
...@@ -139,9 +144,9 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl( ...@@ -139,9 +144,9 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
}) })
.error(function (err) { .error(function (err) {
console.log(err); console.log(err);
if (err.message && err.message.search('nvalid license')) if (err.message && err.message.search('nvalid license') > 0)
ngToast.danger({ content: $translate.instant('license_invalid') }); ngToast.danger({ content: $translate.instant('license_invalid') });
else if (err.message && err.message.search('in use')) else if (err.message && err.message.search('in use') > 0)
ngToast.danger({ content: $translate.instant('license_already_activated') }); ngToast.danger({ content: $translate.instant('license_already_activated') });
else else
ngToast.danger({ content: $translate.instant('student_not_updated') }); ngToast.danger({ content: $translate.instant('student_not_updated') });
......
...@@ -153,7 +153,17 @@ ...@@ -153,7 +153,17 @@
}"/> }"/>
<div <div
class="picto_options" class="picto_options"
ng-if="studentPicto !== emptyStudentPicto"> ng-if="studentPicto == emptyStudentPicto">
<a
ng-click="open_add(rowIndex, colIndex)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a>
</div>
<div
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y != '0'">
<a ng-click="view_picto(studentPicto)" class="picto_ok" > <a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i <i
ng-class="{ ng-class="{
...@@ -164,6 +174,41 @@ ...@@ -164,6 +174,41 @@
aria-hidden="true" aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}"></i> title="{{ studentPicto.attributes.status | translate}}"></i>
</a> </a>
<a
ng-click=""
class="picto_cat_edit">
<i class="glyphicon glyphicon-picture" aria-hidden="true"></i>
</a>
</div>
<div
class="picto_options"
ng-if="studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y == '0'">
<a
ng-click="delete_picto(studentPicto)"
class="picto_remove"
title="{{ 'delete' | translate}}">
<i class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></i>
</a>
<a ng-click="view_picto(studentPicto)" class="picto_ok" >
<i ng-class="{
color_green: studentPicto.attributes.status == 'invisible',
color_black: studentPicto.attributes.status == 'enabled'
}"
class="glyphicon glyphicon-eye-open"
aria-hidden="true"
title="{{ studentPicto.attributes.status | translate}}">
</i>
</a>
<a
class="picto_tags"
ng-click="open_tags(studentPicto)">
<i class="glyphicon glyphicon-tags" aria-hidden="true"></i>
</a>
<a
class="picto_config"
ng-click="open_config(studentPicto)">
<i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
</a>
</div> </div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
......
...@@ -62,10 +62,12 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl( ...@@ -62,10 +62,12 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
$scope.spin_disabled = true; $scope.spin_disabled = true;
}) })
.error(function (err) { .error(function (err) {
console.log("ERROR while uploading image: " + err); ngToast.danger({content: $translate.instant('error_on_upload')});
$scope.spin_disabled = true;
}); });
} else { } else {
ngToast.danger({ content: $translate.instant('error_only_support_images') }); ngToast.danger({ content: $translate.instant('error_only_support_images') });
$scope.spin_disabled = true;
} }
} }
}; };
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<header-supervisor></header-supervisor> <header-supervisor></header-supervisor>
<!-- The content --> <!-- The content -->
<div ui-view></div> <div ui-view id="main-content"></div>
</div> </div>
<!-- Fin de container --> <!-- Fin de container -->
<!-- Footer Translate --> <!-- Footer Translate -->
<footer-translate></footer-translate> <footer-translate></footer-translate>
\ No newline at end of file
...@@ -115,7 +115,6 @@ div.footer-space { ...@@ -115,7 +115,6 @@ div.footer-space {
width: 100%; width: 100%;
clear: both; clear: both;
} }
div.languages{ div.languages{
position: absolute; position: absolute;
bottom: 0; bottom: 0;
...@@ -131,6 +130,9 @@ div.languages{ ...@@ -131,6 +130,9 @@ div.languages{
position: absolute; position: absolute;
margin-top: -10px; margin-top: -10px;
} }
div#main-content {
padding-bottom: 67px;
}
/* Botones de operacioens en listados de gabinetes y supervisores (admin) */ /* Botones de operacioens en listados de gabinetes y supervisores (admin) */
.ops a{ .ops a{
...@@ -468,6 +470,8 @@ textarea.editable{ ...@@ -468,6 +470,8 @@ textarea.editable{
.picto .picto_options .picto_minus{ position: absolute; top: 2px; right: 2px; } .picto .picto_options .picto_minus{ position: absolute; top: 2px; right: 2px; }
.picto .picto_options .picto_cat_edit{ position: absolute; top: 2px; left: 2px; }
/* Picto legend */ /* Picto legend */
.picto-legend-normal { .picto-legend-normal {
position: absolute; position: absolute;
......
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