Commit cdb09a12 by Arturo Montejo Ráez

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

parents 946f9cb1 2b97af66
Showing with 1311 additions and 495 deletions
...@@ -11,6 +11,8 @@ mocha-report.xml ...@@ -11,6 +11,8 @@ mocha-report.xml
########## ##########
sails/upload sails/upload
sails/symbolstx* sails/symbolstx*
sails/arasaac*
sails/arasaac
sails/src/assets/symbolstx* sails/src/assets/symbolstx*
sails/src/assets/upload sails/src/assets/upload
sails/upload.tgz sails/upload.tgz
......
...@@ -5,7 +5,7 @@ buildscript { ...@@ -5,7 +5,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
......
...@@ -11,15 +11,16 @@ android { ...@@ -11,15 +11,16 @@ android {
versionName "1.0" versionName "1.0"
resValue "string", "db_name", "PCB.db" resValue "string", "db_name", "PCB.db"
resValue "integer", "db_version", "4" resValue "integer", "db_version", "4"
resValue "string", "app_version", "1.0" resValue "string", "app_version", "1.1"
resValue "string", "core_vocabulary", "core_vocabulary" resValue "string", "core_vocabulary", "core_vocabulary"
resValue "string", "apk", "to_be_set_in_subproject" resValue "string", "apk", "to_be_set_in_subproject"
resValue "string", "VersionManagerClass", "to_be_set_in_subproject"
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "server", "https://pictogram.yottacode.com" resValue "string", "server", "https:/pre.yottacode.com"
resValue "bool", "force_db_create", "false" resValue "bool", "force_db_create", "false"
resValue "bool", "ssl_connect", "true" resValue "bool", "ssl_connect", "true"
resValue "bool", "force_img_download", "false" resValue "bool", "force_img_download", "false"
......
...@@ -246,6 +246,15 @@ public class Picto extends Img { ...@@ -246,6 +246,15 @@ public class Picto extends Img {
return false; return false;
} }
} }
public void set_visible(boolean visible) {
try {
this.attributes.put(JSON_ATTTRS.STATUS, visible ? JSON_ATTTR_STATUS_VALUES.ENABLED : JSON_ATTTR_STATUS_VALUES.INVISIBLE);
} catch (JSONException e) {
Log.e(LOG_TAG,e.getMessage());
}
}
/** /**
* *
* @return the highlight property of a picto * @return the highlight property of a picto
...@@ -277,10 +286,10 @@ public class Picto extends Img { ...@@ -277,10 +286,10 @@ public class Picto extends Img {
public String get_legend() { public String get_legend() {
String legend; String legend;
try { try {
legend=this.attributes.getString(JSON_ATTTRS.LEGEND); legend=this.attributes.has(JSON_ATTTRS.LEGEND) ? this.attributes.getString(JSON_ATTTRS.LEGEND) : JSON_ATTTR_LEGEND_VALUES.NONE;
} catch (JSONException e) { } catch (JSONException e) {
legend=JSON_ATTTR_LEGEND_VALUES.NONE; // By default legend=JSON_ATTTR_LEGEND_VALUES.NONE; // By default
Log.e(LOG_TAG," Error getting legend:"+e.getMessage()); Log.e(LOG_TAG," Error getting legend:"+e.getMessage()+ "attributes: "+this.attributes.toString());
} }
return legend.equalsIgnoreCase("null") ? JSON_ATTTR_LEGEND_VALUES.NONE : legend; return legend.equalsIgnoreCase("null") ? JSON_ATTTR_LEGEND_VALUES.NONE : legend;
} }
......
...@@ -269,7 +269,7 @@ public class User { ...@@ -269,7 +269,7 @@ public class User {
/** /**
* *
* @return input feedback of the student configuration (default: "vibration") * @return delivery method
*/ */
public JSON_STUDENT_ATTTRS.delivery delivery() { public JSON_STUDENT_ATTTRS.delivery delivery() {
JSON_STUDENT_ATTTRS.delivery delivery; JSON_STUDENT_ATTTRS.delivery delivery;
......
...@@ -269,6 +269,7 @@ public class UserLogin { ...@@ -269,6 +269,7 @@ public class UserLogin {
} }
public void login(String username, String password, Activity activity, Class PictogramActivity, Class LoginActivity) { public void login(String username, String password, Activity activity, Class PictogramActivity, Class LoginActivity) {
if (PCBcontext.is_user_logged()) PCBcontext.unset_user();
boolean online= RestapiWrapper.ping(activity.getResources().getString(R.string.server), "server/ping"); boolean online= RestapiWrapper.ping(activity.getResources().getString(R.string.server), "server/ping");
if (isSupervisorLoginPattern(username)) if (isSupervisorLoginPattern(username))
manageSupervisorLogin(username,password,online, activity, PictogramActivity, LoginActivity); manageSupervisorLogin(username,password,online, activity, PictogramActivity, LoginActivity);
......
package com.yottacode.pictogram.net; package com.yottacode.pictogram.net;
import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent;
import android.widget.TextView;
import com.yottacode.net.RestapiWrapper; import com.yottacode.net.RestapiWrapper;
import com.yottacode.pictogram.R; import com.yottacode.pictogram.R;
...@@ -26,8 +19,6 @@ import java.util.Vector; ...@@ -26,8 +19,6 @@ import java.util.Vector;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static android.app.Activity.RESULT_OK;
/** /**
* Background services to be executed every "delay" seconds. Tasks to be executed: * Background services to be executed every "delay" seconds. Tasks to be executed:
...@@ -42,10 +33,10 @@ import static android.app.Activity.RESULT_OK; ...@@ -42,10 +33,10 @@ import static android.app.Activity.RESULT_OK;
public class NetService implements Runnable, RestapiWrapper.iSilentLogin { public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
static final String LOG_TAG=NetService.class.getCanonicalName();
static final String ping_session="server/ping"; static final String ping_session="server/ping";
private boolean updated; private boolean updated;
private final String LOG_TAG=this.getClass().getCanonicalName();
private Vector<iNetServiceStatus> listeners; private Vector<iNetServiceStatus> listeners;
private static final long restfullSynchroTimming=PCBcontext.getContext().getResources().getInteger(R.integer.netservice_force_restfull_synchro)*1000; private static final long restfullSynchroTimming=PCBcontext.getContext().getResources().getInteger(R.integer.netservice_force_restfull_synchro)*1000;
private long lastRestfullSynchro; private long lastRestfullSynchro;
...@@ -138,16 +129,16 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -138,16 +129,16 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
public boolean online() {return updated;} public boolean online() {return updated;}
public void restart_app(boolean direct_login) { public void restart_app(boolean resetPrevLogin) {
for (iNetServiceStatus listener: listeners) for (iNetServiceStatus listener: listeners)
if (listener instanceof iNetServiceDevice) ((iNetServiceDevice)listener).restart_app(direct_login); if (listener instanceof iNetServiceDevice) ((iNetServiceDevice)listener).restart_app(resetPrevLogin);
PCBcontext.unset_user();
} }
/** /**
* ping to the server by using a restapi call. If ok, the call will return the empty set * ping to the server by using a restapi call. If ok, the call will return the empty set
*/ */
Context newVersionContext=null;
@Override @Override
public void run() { public void run() {
try { try {
...@@ -160,14 +151,14 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -160,14 +151,14 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
@Override @Override
public void result(JSONArray result) { public void result(JSONArray result) {
} }
@Override @Override
public void result(JSONObject result) { public void result(JSONObject result) {
try { try {
float version = Float.valueOf(result.getString("version")).floatValue(); final float version = Float.valueOf(result.getString("version")).floatValue();
if (PCBcontext.getActivityContext() != null && version > DeviceHelper.getAppVersion()) {
Log.e(LOG_TAG, "New version is required! from v" + DeviceHelper.getAppVersion() + " to v" + version); if (PCBcontext.getActivityContext() != null && version > DeviceHelper.getAppVersion() && newVersionContext!=PCBcontext.getActivityContext()) {
newVersionAlert(PCBcontext.getActivityContext(), version); newVersionContext=PCBcontext.getActivityContext(); // prevent from showing several times the alert
newVersionAlert(version,PCBcontext.getActivityContext(), version);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "PING JSON ERROR: " + result + " " + e.getMessage()); Log.e(LOG_TAG, "PING JSON ERROR: " + result + " " + e.getMessage());
...@@ -271,38 +262,18 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -271,38 +262,18 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
device=(iNetServiceDevice)listener; device=(iNetServiceDevice)listener;
return device; return device;
} }
static void newVersionAlert(Context contex, final float vnew) { static void newVersionAlert(final float version, final Context context, final float vnew) {
final SpannableString s = new SpannableString(contex.getResources().getString(R.string.server) try {
+ "/" + contex.getResources().getString(R.string.apk)); iVersionManager versionManager = (iVersionManager)Class.forName(context.getResources().getString(R.string.VersionManagerClass)).newInstance();
versionManager.newVersionAlert(version,context,vnew);
final TextView tx1 = new TextView(contex); } catch (InstantiationException e) {
tx1.setText("\t"+contex.getResources().getString(R.string.new_version_detail) + e.printStackTrace();
"\n\t\t"+ s); } catch (IllegalAccessException e) {
tx1.setTextSize(16); e.printStackTrace();
tx1.setAutoLinkMask(RESULT_OK); } catch (ClassNotFoundException e) {
tx1.setMovementMethod(LinkMovementMethod.getInstance()); e.printStackTrace();
}
Linkify.addLinks(s, Linkify.WEB_URLS);
AlertDialog.Builder builder = new AlertDialog.Builder(contex);
builder.setTitle(contex.getResources().getString(R.string.app_name)+": "+contex.getResources().getString(R.string.new_version_title)+" v"+vnew)
.setCancelable(false)
.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
DeviceHelper.setAppVersion(vnew);
}
})
.setView(tx1).setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
return false;
}
}).show();
PCBcontext.setActivityContext(null);
} }
/** /**
* Created by Fernando on 12/08/2016. * Created by Fernando on 12/08/2016.
......
...@@ -28,8 +28,8 @@ public class ServerLogin { ...@@ -28,8 +28,8 @@ public class ServerLogin {
private static void login(String operation, String email, String username, String password, final RestapiWrapper.iRestapiListener listener){ private static void login(String operation, String email, String username, String password, final RestapiWrapper.iRestapiListener listener){
Hashtable<String, String> postDataParams = new Hashtable<String, String>(); Hashtable<String, String> postDataParams = new Hashtable<String, String>();
if (email!=null) postDataParams.put("email", email); if (email!=null) postDataParams.put("email", email);
if (username!=null) postDataParams.put("username", username); if (username!=null) postDataParams.put("username", username);
postDataParams.put("password", password); if (password!=null) postDataParams.put("password", password);
PCBcontext.getRestapiWrapper().ask(operation, postDataParams, "post", new RestapiWrapper.iRestapiListener() { PCBcontext.getRestapiWrapper().ask(operation, postDataParams, "post", new RestapiWrapper.iRestapiListener() {
@Override @Override
public void preExecute() { public void preExecute() {
......
package com.yottacode.pictogram.net;
import android.content.Context;
/**
* Created by Fernando on 10/03/2017.
*/
public interface iVersionManager {
void newVersionAlert(final float version, final Context context, final float vnew);
}
...@@ -22,22 +22,24 @@ import java.util.Set; ...@@ -22,22 +22,24 @@ import java.util.Set;
*/ */
public class TTSHelper { public class TTSHelper {
TextToSpeech ttobj; TextToSpeech ttobj=null;
Voice voice; Voice voice;
boolean voice_ok; boolean voice_ok;
public void createTTS(final Context context, String engine, final Locale locale, final String voice) { public void createTTS(final Context context, String engine, final Locale locale, final String voice) {
this.ttobj = new TextToSpeech(context,new TextToSpeech.OnInitListener() { if (this.ttobj==null) {
public void onInit(int status) { this.ttobj = new TextToSpeech(context, new TextToSpeech.OnInitListener() {
Log.e(this.getClass().getCanonicalName(),"TTS engine "+status); public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) { Log.e(this.getClass().getCanonicalName(), "TTS engine " + status);
ttobj.setLanguage(locale); if (status == TextToSpeech.SUCCESS) {
setVoice(context,voice); ttobj.setLanguage(locale);
} setVoice(context, voice);
}
}}, engine);
}
}, engine);
}
} }
public TTSHelper(Context context, String engine, Locale locale,String voice) { public TTSHelper(Context context, String engine, Locale locale,String voice) {
......
...@@ -16,7 +16,7 @@ public class GUITools { ...@@ -16,7 +16,7 @@ public class GUITools {
public void ok(); public void ok();
} }
public static void show_alert(Context context, int resource_msg, String additional_msg, final iOKListener oklistener) { public static AlertDialog show_alert(Context context, int resource_msg, String additional_msg, final iOKListener oklistener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
String msg = context.getString(resource_msg); String msg = context.getString(resource_msg);
if (additional_msg != null) msg += ": " + additional_msg; if (additional_msg != null) msg += ": " + additional_msg;
...@@ -29,7 +29,9 @@ public class GUITools { ...@@ -29,7 +29,9 @@ public class GUITools {
} }
}); });
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
return alert;
} }
public static void show_alert(Context context, int resource_msg) { public static void show_alert(Context context, int resource_msg) {
......
...@@ -49,9 +49,6 @@ ...@@ -49,9 +49,6 @@
<!--Semantic grammar --> <!--Semantic grammar -->
<string name="loadingGrammar">Please wait, loading vocabulary</string> <string name="loadingGrammar">Please wait, loading vocabulary</string>
<string name="naturalgrammar">SUpO_EN</string>
<string name="pictogrammar">SUpO_PICTOEN</string>
<string name="nogrammar">Warning: unknown language</string>
<!--Upload local img --> <!--Upload local img -->
<string name="enterImgLabel">Enter img label</string> <string name="enterImgLabel">Enter img label</string>
...@@ -68,7 +65,6 @@ ...@@ -68,7 +65,6 @@
<string name="mirror_mode_on">Mirror mode on</string> <string name="mirror_mode_on">Mirror mode on</string>
<string name="new_version_title">New version available</string> <string name="new_version_title">New version available</string>
<string name="new_version_detail">Please, download and install the new version available at</string>
<!--default tts engine and voice--> <!--default tts engine and voice-->
<string name="default_tts_engine">com.google.android.tts</string> <string name="default_tts_engine">com.google.android.tts</string>
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
<string name="action_entrar">Entrar</string> <string name="action_entrar">Entrar</string>
<string name="logout">Cerrar sesión</string> <string name="logout">Cerrar sesión</string>
<string name="loginTitle">¿Quién eres?</string> <string name="loginTitle">¿Quién eres?</string>
<string name="userInetErrorMsg">Este usuario requiere conexión a internet para ser validado</string>
<string name="userLoadingTxt">Cargando</string>
<string name="userLoadingMsg">Cargando alumnos. Por favor espere.</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">La licencia del usuario expiró con fecha. Contacte con Yotta para adquirir una.</string> <string name="loginNoLicenseMsg">La licencia del usuario expiró con fecha. Contacte con Yotta para adquirir una.</string>
...@@ -48,10 +51,6 @@ ...@@ -48,10 +51,6 @@
<!--Semantic grammar --> <!--Semantic grammar -->
<string name="loadingGrammar">Por favor espere, cargando vocabulario</string> <string name="loadingGrammar">Por favor espere, cargando vocabulario</string>
<string name="naturalgrammar">SUpO_ES</string>
<string name="grammar">SUpO_ES</string>
<string name="nogrammar">Advertencia: Lenguaje no soportado</string>
<string name="pictogrammar">SUpO_PICTOES</string>
<!--Upload local img --> <!--Upload local img -->
<string name="enterImgLabel">Introduzca etiqueta de la imagen</string> <string name="enterImgLabel">Introduzca etiqueta de la imagen</string>
...@@ -68,7 +67,7 @@ ...@@ -68,7 +67,7 @@
<string name="mirror_mode_on">Modo espejo activado</string> <string name="mirror_mode_on">Modo espejo activado</string>
<string name="new_version_title">Nueva versión disponible</string> <string name="new_version_title">Nueva versión disponible</string>
<string name="new_version_detail">Por favor descargue e instale la nueva versión disponible en</string>
<!--default tts engine and voice--> <!--default tts engine and voice-->
<string name="default_tts_engine">com.google.android.tts</string> <string name="default_tts_engine">com.google.android.tts</string>
<string name="default_tts_voice_male">es-es-x-ana#male_1-local</string> <string name="default_tts_voice_male">es-es-x-ana#male_1-local</string>
......
...@@ -51,30 +51,15 @@ ...@@ -51,30 +51,15 @@
<!--Semantic grammar --> <!--Semantic grammar -->
<string name="loadingGrammar">Please wait, loading vocabulary</string> <string name="loadingGrammar">Please wait, loading vocabulary</string>
<string name="naturalgrammar">SUpO_EN</string>
<string name="grammar">SUpO_EN</string>
<string name="nogrammar">Warning: unknown language</string>
<string name="pictogrammar">SUpO_PICTOEN</string>
<!--Upload local img --> <!--Upload local img -->
<string name="enterImgLabel">Introduzca etiqueta de la imagen</string> <string name="enterImgLabel">Introduzca etiqueta de la imagen</string>
<string name="notNewCats">No puede añadir nuevas categorias</string> <string name="notNewCats">No puede añadir nuevas categorias</string>
<string name="upload_error">No pudo subirse al servidor. Se intentará más adelante</string> <string name="upload_error">No pudo subirse a Pictogram Web. Se intentará más adelante</string>
<string name="upload_ok">Se subió correctamente al servidor</string> <string name="upload_ok">Se subió correctamente a Pictogram Web</string>
<string name="upload_duplicated">Pictograma ya presente en la colección. Utilice otra imagen</string> <string name="upload_duplicated">Pictograma ya presente en la colección. Utilice otra imagen</string>
<string name="title_activity_img_label">img_label</string>
<!-- Strings related to login -->
<string name="prompt_email">Email</string>
<string name="prompt_password">Password (optional)</string>
<string name="action_sign_in">Sign in or register</string>
<string name="action_sign_in_short">Sign in</string>
<string name="error_invalid_email">This email address is invalid</string>
<string name="error_invalid_password">This password is too short</string>
<string name="error_incorrect_password">This password is incorrect</string>
<string name="error_field_required">This field is required</string>
<string name="permission_rationale">"Contacts permissions are needed for providing email completions."</string>
<!--online/offline status--> <!--online/offline status-->
<string name="pictogram_offline">Compruebe si tiene conexión a Internet. </string> <string name="pictogram_offline">Compruebe si tiene conexión a Internet. </string>
<string name="pictogram_online">Conexión con el servidor establecida. </string> <string name="pictogram_online">Conexión con el servidor establecida. </string>
...@@ -85,7 +70,6 @@ ...@@ -85,7 +70,6 @@
<!--new app version alertbox--> <!--new app version alertbox-->
<string name="new_version_title">Nueva versión disponible</string> <string name="new_version_title">Nueva versión disponible</string>
<string name="new_version_detail">Por favor descargue e instale la nueva versión disponible en</string>
<!--default tts engine and voice--> <!--default tts engine and voice-->
<string name="default_tts_engine">com.google.android.tts</string> <string name="default_tts_engine">com.google.android.tts</string>
......
#Sun Jan 15 10:11:11 CET 2017 #Mon Mar 06 13:23:58 CET 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
...@@ -18,8 +18,9 @@ android { ...@@ -18,8 +18,9 @@ android {
targetSdkVersion 22 targetSdkVersion 22
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
resValue "string","SerialClass","com.yottacode.pictogram.supervisor_tablet.gui.Supervisor_SerialActivity" resValue "bool","NotifyAllwaysVisible","false"
resValue "string","apk","pictograms.apk" resValue "string", "VersionManagerClass", "com.yottacode.pictogram.supervisor_tablet.net.VersionManager"
resValue "string","apk","pictograms.apk"
// signingConfig signingConfigs.config // signingConfig signingConfigs.config
} }
productFlavors { productFlavors {
...@@ -28,11 +29,11 @@ android { ...@@ -28,11 +29,11 @@ android {
resValue "bool", "ssl_connect", "false" resValue "bool", "ssl_connect", "false"
} }
DevFlavor { DevFlavor {
resValue "string", "server", "https://dev.yottacode.com" resValue "string", "server", "https://dev.pictogramweb.com"
resValue "bool", "ssl_connect", "false" resValue "bool", "ssl_connect", "false"
} }
PreFlavor { PreFlavor {
resValue "string", "server", "https://pre.yottacode.com" resValue "string", "server", "https://apk.pictogramweb.com"
resValue "bool", "ssl_connect", "true" resValue "bool", "ssl_connect", "true"
} }
LocalFlavor { LocalFlavor {
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yottacode.pictogram.supervisor_tablet"> package="com.yottacode.pictogram.supervisor_tablet">
<!-- The app has the permission to receive the RECEIVE_BOOT_COMPLETED broadcast -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- For kiosk mode --> <!-- For kiosk mode -->
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- For the service that restarts the app when another app go to foreground --> <!-- For the service that restarts the app when another app go to foreground -->
...@@ -20,6 +19,7 @@ ...@@ -20,6 +19,7 @@
<uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.READ_CALL_LOG" /> <uses-permission android:name="android.permission.READ_CALL_LOG" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name=".gui.Supervisor_SerialActivity" android:name="com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity"
android:label="@string/title_activity_serial" android:label="@string/title_activity_serial"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
......
package com.yottacode.pictogram.supervisor_tablet.gui;
import android.app.Activity;
import com.yottacode.pictogram.supervisor_tablet.R;
import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.tools.GUITools;
/**
* Created by Fernando on 21/11/2016.
*/
public final class Supervisor_SerialActivity extends SerialActivity {
@Override
protected boolean is_legal_user(String user_name, Activity activity) {
boolean legal_user=com.yottacode.pictogram.dao.UserLogin.isSupervisorLoginPattern(user_name);
if (!legal_user)
GUITools.show_alert(activity, R.string.ilegal_user, user_name);
return legal_user;
}
}
package com.yottacode.pictogram.supervisor_tablet.net;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.view.KeyEvent;
import android.widget.TextView;
import com.yottacode.pictogram.dao.DeviceHelper;
import com.yottacode.pictogram.net.iVersionManager;
import com.yottacode.pictogram.supervisor_tablet.R;
import com.yottacode.pictogram.tools.PCBcontext;
import static android.app.Activity.RESULT_OK;
/**
* Created by Fernando on 10/03/2017.
*/
public class VersionManager implements iVersionManager {
static final String LOG_TAG=VersionManager.class.getCanonicalName();
public void newVersionAlert(final float version, final Context context, final float vnew) {
final SpannableString s = new SpannableString(context.getResources().getString(R.string.server)
+ "/" + context.getResources().getString(com.yottacode.pictogram.R.string.apk));
final TextView tx1 = new TextView(context);
tx1.setText("\t"+context.getResources().getString(R.string.new_version_detail) +
"\n\t\t"+ s);
tx1.setTextSize(16);
tx1.setAutoLinkMask(RESULT_OK);
tx1.setMovementMethod(LinkMovementMethod.getInstance());
Linkify.addLinks(s, Linkify.WEB_URLS);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(context.getResources().getString(R.string.app_name)+": "+context.getResources().getString(R.string.new_version_title)+" v"+vnew)
.setCancelable(false)
.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
DeviceHelper.setAppVersion(vnew);
}
})
.setView(tx1).setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
return false;
}
}).show();
PCBcontext.setActivityContext(null);
}
}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Pictogram Tablet Supervisor</string> <string name="app_name">Pictogram Tablet Supervisor</string>
<string name="ilegal_user">There is not any supervisor named</string> <string name="new_version_detail">Please, go to Google Play to download the new version </string>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Pictogram Tablet Supervisor</string> <string name="app_name">Pictogram Tablet Supervisor</string>
<string name="ilegal_user"> No existe ningún supervisor </string> <string name="new_version_detail">Por favor, descargue la nueva versión en Google Play </string>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Pictogram Tablet Supervisor</string> <string name="app_name">Pictogram Tablet Supervisor</string>
<string name="ilegal_user">There is not any supervisor named</string> <string name="new_version_detail">Please, go to Google Play to download the new version </string>
</resources> </resources>
...@@ -8,7 +8,7 @@ android { ...@@ -8,7 +8,7 @@ android {
targetSdkVersion 22 targetSdkVersion 22
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
resValue "string", "SerialClass", "com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity" resValue "bool","NotifyAllwaysVisible","false"
resValue "integer", "rows", "5" resValue "integer", "rows", "5"
resValue "integer", "columns", "10" resValue "integer", "columns", "10"
resValue "integer", "rows_big", "4" resValue "integer", "rows_big", "4"
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yottacode.pictogram.tabletlibrary"> package="com.yottacode.pictogram.tabletlibrary">
<application <application
android:allowBackup="true" android:allowBackup="true"
android:label="@string/app_name" android:label="@string/app_name"
......
...@@ -16,10 +16,13 @@ import android.widget.ImageView; ...@@ -16,10 +16,13 @@ import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User; import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import java.util.Vector;
import static android.graphics.Color.argb; import static android.graphics.Color.argb;
/** /**
...@@ -27,9 +30,10 @@ import static android.graphics.Color.argb; ...@@ -27,9 +30,10 @@ import static android.graphics.Color.argb;
*/ */
public class PictoAnimation { public class PictoAnimation {
private final String LOG_TAG = this.getClass().getCanonicalName();
public void animateTapeView(final int position, final ViewGroup view) { private final static String LOG_TAG = PictoAnimation.class.getCanonicalName();
public void animateTapeView(final PictogramActivity activity,final int position, final ViewGroup view) {
final GridView gridview = (GridView) view.getChildAt(1); final GridView gridview = (GridView) view.getChildAt(1);
final TapeAdapter tapeAdapter=(TapeAdapter)gridview.getAdapter(); final TapeAdapter tapeAdapter=(TapeAdapter)gridview.getAdapter();
...@@ -62,19 +66,21 @@ public class PictoAnimation { ...@@ -62,19 +66,21 @@ public class PictoAnimation {
} }
@Override @Override
public void onAnimationEnd(Animator animation) { Log.e(LOG_TAG,"animating"+position); public void onAnimationEnd(Animator animation) {
v.setColorFilter(0); v.setColorFilter(0);
v.setBackgroundColor(ContextCompat.getColor(PCBcontext.getContext(), R.color.picto_default_background)); v.setBackgroundColor(ContextCompat.getColor(PCBcontext.getContext(), R.color.picto_default_background));
if (position < (tapeAdapter.getCount() - 1)) if (position < (tapeAdapter.getCount() - 1))
animateTapeView(position + 1, view); animateTapeView(activity,position + 1, view);
else { else {
((Activity)view.getContext()).runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (tapeAdapter.play()) if (tapeAdapter.play())
tapeAdapter.endPlay(); tapeAdapter.endPlay();
} }
}); });
activity.pictoMainGridAdapter.allPictosInGrid();
activity.pictoCategoryGridAdapter.allPictosInGrid();
} }
} }
...@@ -116,7 +122,27 @@ public class PictoAnimation { ...@@ -116,7 +122,27 @@ public class PictoAnimation {
} }
}); });
moveAnim.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (up) activity.ttsButton.setImageAlpha(255);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
moveAnim.setDuration(500); moveAnim.setDuration(500);
moveAnim.start(); moveAnim.start();
} }
...@@ -166,6 +192,7 @@ public class PictoAnimation { ...@@ -166,6 +192,7 @@ public class PictoAnimation {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
activity.tapeAdapter.deleteItem(position); activity.tapeAdapter.deleteItem(position);
activity.tapeAdapter.notifyDataSetChanged(); activity.tapeAdapter.notifyDataSetChanged();
if (t1.getVisibility()==View.VISIBLE) t1.setAlpha(1); if (t1.getVisibility()==View.VISIBLE) t1.setAlpha(1);
...@@ -194,4 +221,129 @@ public class PictoAnimation { ...@@ -194,4 +221,129 @@ public class PictoAnimation {
colorAnim.start(); colorAnim.start();
} }
public static void animateOnGridView(final RelativeLayout layout) {
final PictogramActivity activity=(PictogramActivity)PCBcontext.getActivityContext();
if (activity.inserting) return;
FrameLayout borderlayout=(FrameLayout)layout.getChildAt(0);
final ImageView v=(ImageView)borderlayout.getChildAt(0);
final TextView t1=(TextView)borderlayout.getChildAt(1);
final TextView t2=(TextView)borderlayout.getChildAt(2);
final ValueAnimator colorAnim = ObjectAnimator.ofFloat(0f, 1f) ;
colorAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float mul = (Float) animation.getAnimatedValue();
if (t2.getVisibility()==View.VISIBLE) {
t2.setAlpha(mul);
v.setImageAlpha(0);
}
else {
v.setImageAlpha((int)(mul*255f));
if (t1.getVisibility() == View.VISIBLE) t1.setAlpha(mul);
}
}
});
colorAnim.addListener(new ValueAnimator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
colorAnim.setDuration(250);
colorAnim.start();
}
public static void animateOutGridView(final PictoGridAdapter pictoGridAdapter, final Picto picto, RelativeLayout layout, final Vector<Picto> pictoLinkedList_inTape) {
final PictogramActivity activity=(PictogramActivity)PCBcontext.getActivityContext();
if (activity.inserting) return;
FrameLayout borderlayout=(FrameLayout)layout.getChildAt(0);
final ImageView v=(ImageView)borderlayout.getChildAt(0);
final TextView t1=(TextView)borderlayout.getChildAt(1);
final TextView t2=(TextView)borderlayout.getChildAt(2);
final int orange = ContextCompat.getColor(PCBcontext.getContext(),R.color.picto_default_background);
final ValueAnimator colorAnim = ObjectAnimator.ofFloat(0f, 1f) ;
colorAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float mul = (Float) animation.getAnimatedValue();
if (t2.getVisibility()==View.VISIBLE) {
t2.setAlpha(1-mul);
mul=1;
}
int alphaOrange = PictoAnimation.adjustAlpha(orange, mul);
v.setColorFilter(alphaOrange, PorterDuff.Mode.SRC_ATOP);
v.setBackgroundColor(alphaOrange);
v.setPadding(0,0,0,0);
if (mul == 0.0) {
v.setColorFilter(0);
}
if (t1.getVisibility()==View.VISIBLE) t1.setAlpha(1-mul);
}
});
colorAnim.addListener(new ValueAnimator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
if (t2.getVisibility()==View.VISIBLE) v.setBackgroundColor(0);
activity.inserting=true;
}
@Override
public void onAnimationEnd(Animator animation) {
pictoLinkedList_inTape.add(picto);
pictoGridAdapter.notifyDataSetChanged();
if (t1.getVisibility()==View.VISIBLE) t1.setAlpha(1);
if (t2.getVisibility()==View.VISIBLE) t2.setAlpha(1);
v.setColorFilter(0);
v.setBackgroundColor(ContextCompat.getColor(PCBcontext.getContext(), R.color.picto_default_background));
activity.inserting=false;
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
colorAnim.setDuration(200);
colorAnim.start();
}
} }
...@@ -3,19 +3,25 @@ package com.yottacode.pictogram.tabletlibrary.gui.communicator; ...@@ -3,19 +3,25 @@ package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.RelativeLayout;
import com.yottacode.pictogram.dao.Picto; import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Vector;
public class PictoGridAdapter extends ArrayAdapter { public class PictoGridAdapter extends ArrayAdapter {
private LinkedList<Picto> pictoLinkedList; private LinkedList<Picto> pictoLinkedList;
private final String LOG_TAG = this.getClass().getSimpleName(); private final String LOG_TAG = this.getClass().getSimpleName();
private Vector<Picto> pictoLinkedList_inTape;
private Vector<Picto> pictoLinkedList_inGrid;
public PictoGridAdapter(LinkedList<Picto> pictoLinkedList){ public PictoGridAdapter(LinkedList<Picto> pictoLinkedList){
super(PCBcontext.getContext(), PictoItemViewGenerator.LAYOUT, pictoLinkedList); super(PCBcontext.getContext(), PictoItemViewGenerator.LAYOUT, pictoLinkedList);
this.pictoLinkedList = pictoLinkedList; this.pictoLinkedList = pictoLinkedList;
pictoLinkedList_inTape=new Vector<>(5);
pictoLinkedList_inGrid=new Vector<>(5);
} }
@Override @Override
...@@ -33,17 +39,54 @@ public class PictoGridAdapter extends ArrayAdapter { ...@@ -33,17 +39,54 @@ public class PictoGridAdapter extends ArrayAdapter {
return 0; return 0;
} }
public void deleteAll() {
this.pictoLinkedList.clear();
}
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
return PictoItemViewGenerator.getPictoView( Picto picto=this.pictoLinkedList.get(position);
this.pictoLinkedList.get(position), int igrid=this.pictoLinkedList_inGrid.indexOf(picto);
convertView, int itape = this.pictoLinkedList_inTape.indexOf(picto);
parent
); if (itape >= 0)
picto.set_visible(false);
if (igrid>=0)
picto.set_visible(true);
View view = PictoItemViewGenerator.getPictoView(
picto,
convertView,
parent
);
if (igrid>=0) {
this.pictoLinkedList_inGrid.remove(igrid);
if (itape>=0) pictoLinkedList_inTape.remove(itape);
PictoAnimation.animateOnGridView((RelativeLayout)view);
}
return view;
}
public void pictoInTape(View view, Picto p) {
PictoAnimation.animateOutGridView(this,p, (RelativeLayout)view, pictoLinkedList_inTape);
}
public void pictoInGrid(Picto p) {
pictoLinkedList_inGrid.add(p);
notifyDataSetChanged();
}
public boolean pictoInThisCategory (Picto picto) {
return pictoLinkedList_inTape.contains(picto);
}
public void allPictosInGrid() {
for (Picto picto: pictoLinkedList_inTape) {
pictoLinkedList_inGrid.add(picto);
}
notifyDataSetChanged();
} }
} }
...@@ -18,6 +18,7 @@ import java.util.LinkedList; ...@@ -18,6 +18,7 @@ import java.util.LinkedList;
public class TapeAdapter extends BaseAdapter { public class TapeAdapter extends BaseAdapter {
private static final String LOG_TAG = TapeAdapter.class.getName();
//private Context mContext; //private Context mContext;
private LinkedList<Picto> pictoLinkedList; private LinkedList<Picto> pictoLinkedList;
private boolean play = false; private boolean play = false;
...@@ -45,24 +46,31 @@ public class TapeAdapter extends BaseAdapter { ...@@ -45,24 +46,31 @@ public class TapeAdapter extends BaseAdapter {
} }
// AÑADIR ITEM AL ADAPTADOR // AÑADIR ITEM AL ADAPTADOR
public void addItem(Picto p) { public int addItem(Picto p) {
pictoLinkedList.add(p); pictoLinkedList.add(new Picto(p));
return pictoLinkedList.size()-1;
} }
// ELIMINAR ITEM DEL ADAPTADOR // ELIMINAR ITEM DEL ADAPTADOR
public void deleteItem(int position) { public void deleteItem(int position) {
pictoLinkedList.remove(position); try {
pictoLinkedList.remove(position);
}catch(IndexOutOfBoundsException e) {
Log.e(LOG_TAG,"Error deleting item from tape adapter:"+e.getMessage());
}
} }
// ELIMINAR el último ITEM DEL ADAPTADOR // ELIMINAR el último ITEM DEL ADAPTADOR
public void deleteLastView() { public Picto deleteLastView() {
Picto picto=null;
// Controlar excepcion al intentar eliminar el último cuando no hay elementos // Controlar excepcion al intentar eliminar el último cuando no hay elementos
try { try {
pictoLinkedList.removeLast(); picto=pictoLinkedList.removeLast();
} catch (ArrayIndexOutOfBoundsException exception) { } catch (ArrayIndexOutOfBoundsException exception) {
Log.e("Excepción", "ArrayIndexOutOfBounds: " + exception.getMessage()); Log.e("Excepción", "ArrayIndexOutOfBounds: " + exception.getMessage());
} }
return picto;
} }
// ELIMINAR TODOS LOS ITEMS DEL ADAPTADOR // ELIMINAR TODOS LOS ITEMS DEL ADAPTADOR
...@@ -74,7 +82,6 @@ public class TapeAdapter extends BaseAdapter { ...@@ -74,7 +82,6 @@ public class TapeAdapter extends BaseAdapter {
public void clear() { public void clear() {
pictoLinkedList.clear(); pictoLinkedList.clear();
notifyDataSetChanged(); notifyDataSetChanged();
} }
// DEVUELVE TODOS LOS ELEMENTOS // DEVUELVE TODOS LOS ELEMENTOS
public LinkedList<Picto> getAll() { public LinkedList<Picto> getAll() {
......
...@@ -2,6 +2,10 @@ package com.yottacode.pictogram.tabletlibrary.gui.login; ...@@ -2,6 +2,10 @@ package com.yottacode.pictogram.tabletlibrary.gui.login;
import android.app.Activity; import android.app.Activity;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.provider.ContactsContract;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -10,6 +14,7 @@ import android.widget.ImageView; ...@@ -10,6 +14,7 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tools.PCBcontext;
import java.util.Vector; import java.util.Vector;
...@@ -19,6 +24,7 @@ import java.util.Vector; ...@@ -19,6 +24,7 @@ import java.util.Vector;
*/ */
public class CustomList extends ArrayAdapter<String>{ public class CustomList extends ArrayAdapter<String>{
private boolean color;
private final Activity context; private final Activity context;
private final String[] name_surname; private final String[] name_surname;
private final Vector<Bitmap> images; private final Vector<Bitmap> images;
...@@ -34,6 +40,7 @@ public class CustomList extends ArrayAdapter<String>{ ...@@ -34,6 +40,7 @@ public class CustomList extends ArrayAdapter<String>{
this.context = context; this.context = context;
this.name_surname = name_surname; this.name_surname = name_surname;
this.images = images; this.images = images;
this.color = true;
} }
/** /**
...@@ -51,9 +58,27 @@ public class CustomList extends ArrayAdapter<String>{ ...@@ -51,9 +58,27 @@ public class CustomList extends ArrayAdapter<String>{
ImageView imageView = (ImageView) rowView.findViewById(R.id.loginStudentPhoto); ImageView imageView = (ImageView) rowView.findViewById(R.id.loginStudentPhoto);
txtTitle.setText(name_surname[position]); txtTitle.setText(name_surname[position]);
ImageView fondo = (ImageView) rowView.findViewById(R.id.fondo);
//if(color){
// color = false;
// rowView.setBackgroundColor(ContextCompat.getColor(context, R.color.VerdeApp));
// txtTitle.setTextColor(ContextCompat.getColor(context, R.color.BlancoApp));
// fondo.setBackgroundResource(R.drawable.round_design_photo_green);
//}else{
// color = true;
rowView.setBackgroundColor(ContextCompat.getColor(context, R.color.BlancoApp));
txtTitle.setTextColor(ContextCompat.getColor(context, R.color.VerdeApp));
fondo.setBackgroundResource(R.drawable.round_design_photo_white);
//}
//imageView.setImageResource(R.drawable.user); //imageView.setImageResource(R.drawable.user);
if (images.size()>0) imageView.setImageBitmap(images.elementAt(position)); if (images.size()>0){
else imageView.setImageResource(R.drawable.anonymous_student); imageView.setImageBitmap(images.elementAt(position));
}else{
imageView.setImageResource(R.drawable.anonymous_student);
}
return rowView; return rowView;
} }
} }
...@@ -42,8 +42,10 @@ public class CustomListLogin extends ArrayAdapter<User>{ ...@@ -42,8 +42,10 @@ public class CustomListLogin extends ArrayAdapter<User>{
ImageView imageView = (ImageView) rowView.findViewById(R.id.photo); ImageView imageView = (ImageView) rowView.findViewById(R.id.photo);
ImageView fondo = (ImageView) rowView.findViewById(R.id.fondoFotoLogin);
try { try {
Bitmap photo=getItem(position).is_supervisor() ? getItem(position).get_bitmap_sup(getContext()) : getItem(position).get_bitmap_stu(getContext()); Bitmap photo=getItem(position).is_supervisor() ? getItem(position).get_bitmap_sup(getContext()) : getItem(position).get_bitmap_stu(getContext());
fondo.setImageResource(R.drawable.round_design_photo_white);
if (photo!=null) imageView.setImageBitmap(photo); if (photo!=null) imageView.setImageBitmap(photo);
else imageView.setImageResource(R.drawable.anonymous_student); else imageView.setImageResource(R.drawable.anonymous_student);
} catch (IOException e) { } catch (IOException e) {
......
...@@ -40,7 +40,6 @@ public class LoginActivity extends FragmentActivity { ...@@ -40,7 +40,6 @@ public class LoginActivity extends FragmentActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(com.yottacode.pictogram.tabletlibrary.R.layout.activity_login); setContentView(com.yottacode.pictogram.tabletlibrary.R.layout.activity_login);
...@@ -51,14 +50,7 @@ public class LoginActivity extends FragmentActivity { ...@@ -51,14 +50,7 @@ public class LoginActivity extends FragmentActivity {
logoutButton.setOnClickListener(new View.OnClickListener() { logoutButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Class serialClass; Intent serialActivity = new Intent(getBaseContext(), com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
try {
serialClass=Class.forName(getString(R.string.SerialClass));
} catch (ClassNotFoundException e) {
Log.e(this.getClass().getCanonicalName(),"S:"+getString(R.string.SerialClass));
serialClass=SerialActivity.class;
}
Intent serialActivity = new Intent(getBaseContext(), serialClass);
serialActivity.putExtra("resetPrevUser", true); serialActivity.putExtra("resetPrevUser", true);
startActivity(serialActivity); startActivity(serialActivity);
} }
......
...@@ -25,14 +25,7 @@ public class MainActivity extends Activity { ...@@ -25,14 +25,7 @@ public class MainActivity extends Activity {
// For deactivating the lock screen (just before setContentView) // For deactivating the lock screen (just before setContentView)
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
Class serialClass; Intent serialActivity = new Intent(this, com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
try {
serialClass=Class.forName(getString(R.string.SerialClass));
} catch (ClassNotFoundException e) {
Log.e(this.getClass().getCanonicalName(),"S:"+getString(R.string.SerialClass));
serialClass=SerialActivity.class;
}
Intent serialActivity = new Intent(this, serialClass);
serialActivity.putExtra("resetPrevUser", false); serialActivity.putExtra("resetPrevUser", false);
startActivity(serialActivity); startActivity(serialActivity);
} }
......
...@@ -43,8 +43,6 @@ public class SerialActivity extends Activity { ...@@ -43,8 +43,6 @@ public class SerialActivity extends Activity {
LinearLayout stuList; LinearLayout stuList;
LinearLayout supList; LinearLayout supList;
protected boolean is_legal_user(String user_name, Activity activity) {return true;}
/** /**
* Return the default user+pwd when login.The policy is * Return the default user+pwd when login.The policy is
* 1. switch user * 1. switch user
...@@ -155,24 +153,25 @@ public class SerialActivity extends Activity { ...@@ -155,24 +153,25 @@ public class SerialActivity extends Activity {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
String username = mSerialViewMail.getText().toString(); String username = mSerialViewMail.getText().toString();
if (is_legal_user(username,SerialActivity.this)) {
String password = mSerialViewPass.getText().toString(); String password = mSerialViewPass.getText().toString();
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", username); editor.putString("username", username);
editor.putString("password", password); editor.putString("password", password);
editor.commit(); editor.commit();
if (!username.equals("") && !password.equals("")) if (!username.equals("") && !password.equals(""))
new UserLogin().login(username, password, SerialActivity.this, PictogramActivity.class, LoginActivity.class); new UserLogin().login(username, password, SerialActivity.this, PictogramActivity.class, LoginActivity.class);
}
} }
}); });
} }
@Override @Override
public void onStart() { public void onStart() {
Vector<User> users; Vector<User> users;
Log.i(this.getClass().getCanonicalName(),"Starting serial activity (direct login:"+!getIntent().getBooleanExtra("resetPrevUser", true)+")"); Log.i(this.getClass().getCanonicalName(),"Starting serial activity (Reset Prev user:"+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];
...@@ -182,7 +181,6 @@ public class SerialActivity extends Activity { ...@@ -182,7 +181,6 @@ public class SerialActivity extends Activity {
mSerialViewMail.setText(username); mSerialViewMail.setText(username);
mSerialViewPass.setText(password); mSerialViewPass.setText(password);
if (!username.equals("") && !password.equals("") && !getIntent().getBooleanExtra("resetPrevUser", true)) if (!username.equals("") && !password.equals("") && !getIntent().getBooleanExtra("resetPrevUser", true))
new UserLogin().login(username, password, SerialActivity.this, PictogramActivity.class, LoginActivity.class); new UserLogin().login(username, password, SerialActivity.this, PictogramActivity.class, LoginActivity.class);
...@@ -197,5 +195,10 @@ public class SerialActivity extends Activity { ...@@ -197,5 +195,10 @@ public class SerialActivity extends Activity {
} }
} }
@Override
public void onResume() {
super.onResume();
PCBcontext.setActivityContext(this);
}
} }
...@@ -13,7 +13,6 @@ import com.yottacode.pictogram.dao.User; ...@@ -13,7 +13,6 @@ import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.NetService; import com.yottacode.pictogram.net.NetService;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity; import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
/** /**
...@@ -31,36 +30,40 @@ public class NetServiceTablet implements NetService.iNetServiceDevice { ...@@ -31,36 +30,40 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
public void build() { public void build() {
this.builder = new NotificationCompat.Builder(PCBcontext.getContext()).setAutoCancel(true).setOngoing(true); this.builder = new NotificationCompat.Builder(PCBcontext.getContext()).setAutoCancel(true).setOngoing(PCBcontext.getContext().getResources().getBoolean(R.bool.NotifyAllwaysVisible));
Intent resultIntent = new Intent(PCBcontext.getContext(), PictogramActivity.class); Intent resultIntent = new Intent(PCBcontext.getContext(), PictogramActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(PCBcontext.getContext()); TaskStackBuilder stackBuilder = TaskStackBuilder.create(PCBcontext.getContext());
stackBuilder.addParentStack(PictogramActivity.class); stackBuilder.addParentStack(PictogramActivity.class);
stackBuilder.addNextIntent(resultIntent); stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = if (PCBcontext.getContext().getResources().getBoolean(R.bool.NotifyAllwaysVisible)){
stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent resultPendingIntent =
builder.setContentIntent(resultPendingIntent); stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(resultPendingIntent);
}
} }
public void notifyStatus(boolean updated) { public void notifyStatus(boolean updated) {
String user=""; String user="";
if (PCBcontext.getPcbdb()!=null) { if (PCBcontext.getPcbdb()!=null ) {
user=PCBcontext.getPcbdb().getCurrentUser().get_name_stu()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_stu(); user=PCBcontext.getPcbdb().getCurrentUser().get_name_stu()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_stu();
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor())
user += " (" + PCBcontext.getPcbdb().getCurrentUser().get_name_sup() + ")"; user += " (" + PCBcontext.getPcbdb().getCurrentUser().get_name_sup() + ")";
} }
if (updated) if (PCBcontext.getActivityContext()!=null) {
builder.setSmallIcon(R.drawable.application_online) if (updated)
builder.setSmallIcon(R.drawable.application_online)
.setContentTitle(PCBcontext.getContext().getResources().getString(R.string.pictogram_online)) .setContentTitle(PCBcontext.getContext().getResources().getString(R.string.pictogram_online))
.setContentText(user); .setContentText(user);
else else
builder.setSmallIcon(R.drawable.application_offline) builder.setSmallIcon(R.drawable.application_offline)
.setContentTitle(PCBcontext.getContext().getResources().getString(R.string.pictogram_offline)) .setContentTitle(PCBcontext.getContext().getResources().getString(R.string.pictogram_offline))
.setContentText(user); .setContentText(user);
NotificationManager mNotificationManager = NotificationManager mNotificationManager =
(NotificationManager) PCBcontext.getContext().getSystemService(PCBcontext.getContext().NOTIFICATION_SERVICE); (NotificationManager) PCBcontext.getContext().getSystemService(PCBcontext.getContext().NOTIFICATION_SERVICE);
mNotificationManager.notify(notifyID, builder.build()); mNotificationManager.notify(notifyID, builder.build());
}
} }
public void closeNotifyStatus(){ public void closeNotifyStatus(){
NotificationManager mNotificationManager = NotificationManager mNotificationManager =
...@@ -75,34 +78,21 @@ public class NetServiceTablet implements NetService.iNetServiceDevice { ...@@ -75,34 +78,21 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
Log.i(LOG_TAG,"App restarting"); Log.i(LOG_TAG,"App restarting");
Context context=activity.getBaseContext(); Context context=activity.getBaseContext();
Class serialClass; Class serialClass;
try { Intent serialActivity = new Intent(context, com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
serialClass=Class.forName(context.getString(R.string.SerialClass));
} catch (ClassNotFoundException e) {
Log.e(LOG_TAG,"S:"+PCBcontext.getContext().getString(R.string.SerialClass));
serialClass=SerialActivity.class;
}
Intent serialActivity = new Intent(context, serialClass);
serialActivity.putExtra("resetPrevUser", false); serialActivity.putExtra("resetPrevUser", false);
serialActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); serialActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(serialActivity); context.startActivity(serialActivity);
activity.finish(); activity.finish();
} }
public void restart_app(boolean direct_login) { public void restart_app(boolean resetPrevUser) {
Log.i(LOG_TAG,"App restarting"); Log.e(LOG_TAG,"App restarting, reset last login:"+resetPrevUser);
Context context=PCBcontext.getContext(); Context context=PCBcontext.getActivityContext();
Class serialClass; Intent serialActivity = new Intent(context, com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
try { serialActivity.putExtra("resetPrevUser", resetPrevUser);
serialClass=Class.forName(PCBcontext.getContext().getString(R.string.SerialClass));
} catch (ClassNotFoundException e) {
Log.e(LOG_TAG,"S:"+PCBcontext.getContext().getString(R.string.SerialClass));
serialClass=SerialActivity.class;
}
Intent serialActivity = new Intent(context, serialClass);
serialActivity.putExtra("resetPrevUser", direct_login);
context.startActivity(serialActivity); context.startActivity(serialActivity);
} }
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- main color -->
<item
android:bottom="2dp"
android:left="2dp"
android:right="2dp">
<shape>
<solid android:color="@color/BlancoApp" />
</shape>
</item>
<item>
<selector >
<item android:state_enabled="true"
android:state_focused="true">
<shape>
<stroke
android:width="2dp"
android:color="@color/VerdeApp"/>
</shape>
</item>
<item android:state_enabled="true">
<shape>
<stroke
android:width="2dp"
android:color="@color/gray"/>
</shape>
</item>
</selector>
</item>
<!-- draw another block to cut-off the left and right bars -->
<item android:bottom="5.0dp">
<shape>
<solid android:color="@color/BlancoApp" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#AfD260"/>
<stroke android:width="3dip" android:color="#EEEEEE" />
<corners android:radius="10dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#EEEEEE"/>
<stroke android:width="3dip" android:color="#AFD260" />
<corners android:radius="10dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>
...@@ -6,62 +6,64 @@ ...@@ -6,62 +6,64 @@
tools:context="com.yottacode.pictogram.tabletlibrary.gui.login.LoginActivity"> tools:context="com.yottacode.pictogram.tabletlibrary.gui.login.LoginActivity">
<RelativeLayout <RelativeLayout
android:id="@+id/loginTopbarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="70dp"
android:layout_margin="8dp" android:background="@color/VerdeApp"
android:layout_marginLeft="16dp" android:paddingBottom="5dp"
android:layout_marginTop="8dp" android:paddingLeft="5dp"
android:layout_marginRight="16dp" android:paddingRight="5dp"
android:layout_marginBottom="0dp" android:paddingTop="5dp">
android:id="@+id/loginTopbarLayout">
<ImageView <ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:id="@+id/loginTopbarSupervisorPhoto" android:id="@+id/loginTopbarSupervisorPhoto"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="left" android:layout_gravity="left"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:background="@color/accent_material_dark" android:background="@color/accent_material_dark"
android:scaleType="centerCrop" /> android:scaleType="centerCrop"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" />
<LinearLayout <LinearLayout
android:orientation="vertical" android:id="@+id/loginTopbarSupervisorNameLayout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/loginTopbarSupervisorNameLayout" android:layout_centerVertical="true"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/loginTopbarSupervisorPhoto" android:layout_toEndOf="@+id/loginTopbarSupervisorPhoto"
android:gravity="center_vertical"> android:gravity="center_vertical"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/loginTopbarSupervisorFullName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="" android:text=""
android:id="@+id/loginTopbarSupervisorFullName" /> android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/BlancoApp" />
<TextView <TextView
android:id="@+id/loginTopbarSupervisorUserName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="" android:text=""
android:id="@+id/loginTopbarSupervisorUserName" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/abc_secondary_text_material_light" /> android:textColor="@color/BlancoApp" />
</LinearLayout> </LinearLayout>
<Button <Button
style="?android:attr/buttonStyleSmall" android:id="@+id/loginTopbarLogout"
style="@android:style/TextAppearance.Material.Button"
android:textColor="@color/BlancoApp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/logout"
android:id="@+id/loginTopbarLogout"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:enabled="false" /> android:enabled="false"
android:text="@string/logout" />
</RelativeLayout> </RelativeLayout>
...@@ -77,27 +79,18 @@ ...@@ -77,27 +79,18 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_below="@+id/loginTopbarLayout"> android:layout_below="@+id/loginTopbarLayout"
android:paddingTop="10dp">
<fragment <fragment
android:id="@+id/loginStudentGrid"
class="com.yottacode.pictogram.tabletlibrary.gui.login.StudentFragmentGrid"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
class="com.yottacode.pictogram.tabletlibrary.gui.login.StudentFragmentGrid" android:layout_gravity="top"
android:id="@+id/loginStudentGrid"
android:layout_gravity="center"
tools:layout="@layout/fragment_new_student" /> tools:layout="@layout/fragment_new_student" />
</FrameLayout> </FrameLayout>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/imageView4"
android:background="@drawable/pictogram_logo"
android:layout_marginRight="30dp"
android:layout_below="@+id/view"
android:layout_alignEnd="@+id/loginTopbarLayout"
android:layout_marginTop="320dp" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" android:orientation="horizontal"
......
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" android:orientation="horizontal"
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="0dp" android:layout_marginBottom="0dp"
android:background="@color/VerdeApp"
android:id="@+id/sessionTopbarLayout"> android:id="@+id/sessionTopbarLayout">
<ImageView <ImageView
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="normal|bold" android:textStyle="normal|bold"
android:textAlignment="center" android:textAlignment="center"
android:background="@color/common_google_signin_btn_text_light_disabled" /> android:background="@color/VerdeApp" />
<ListView <ListView
android:id="@+id/methodsListView" android:id="@+id/methodsListView"
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
<TextView <TextView
android:text="@string/session_instruction" android:text="@string/session_instruction"
android:background="@color/VerdeApp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="normal|bold" android:textStyle="normal|bold"
android:background="@color/common_google_signin_btn_text_light_disabled"
android:textAlignment="center" /> android:textAlignment="center" />
<ListView <ListView
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android" <GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loginStudentGridView" android:id="@+id/loginStudentGridView"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:numColumns="auto_fit" android:numColumns="5"
android:gravity="center_vertical|center|center_horizontal" android:stackFromBottom="false" />
android:stackFromBottom="false"
android:padding="32dp"
android:horizontalSpacing="16dp"
android:verticalSpacing="16dp" />
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"> android:gravity="center_vertical|center_horizontal">
<ImageView
android:id="@+id/loginStudentPhoto" <LinearLayout
android:layout_width="128dp" android:layout_width="wrap_content"
android:layout_height="128dp" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" /> android:layout_gravity="center"
android:layout_marginBottom="50dp"
android:layout_marginTop="50dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<ImageView
android:id="@+id/fondo"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignBottom="@+id/loginStudentName"
android:layout_centerHorizontal="false"
android:layout_gravity="center"
android:background="@drawable/round_design_photo_green" />
<ImageView
android:id="@+id/loginStudentPhoto"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignWithParentIfMissing="true"
android:layout_centerHorizontal="false"
android:layout_centerVertical="true"
android:layout_gravity="center" />
</FrameLayout>
<TextView <TextView
android:id="@+id/loginStudentName" android:id="@+id/loginStudentName"
android:layout_width="128dp" android:layout_width="150dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/loginStudentPhoto" android:layout_below="@+id/loginStudentPhoto"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:paddingTop="8dp" android:layout_gravity="center"
android:paddingBottom="8dp" android:textAlignment="center"
android:gravity="center" /> android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
\ No newline at end of file </LinearLayout>
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
> android:layout_gravity="center"
android:layout_marginBottom="5dp"
<TextView android:layout_marginTop="5dp"
android:text="Nombre" android:background="@color/BlancoApp"
android:layout_height="wrap_content" android:orientation="vertical">
android:id="@+id/label_name"
android:layout_weight="0.15" <LinearLayout
android:textSize="18sp" android:layout_width="276dp"
android:textColor="@android:color/black" android:layout_height="match_parent"
android:layout_alignTop="@+id/photo" android:layout_gravity="left"
android:layout_toEndOf="@+id/photo" android:layout_marginBottom="5dp"
android:layout_width="wrap_content" android:layout_marginTop="5dp"
android:layout_marginStart="15dp" /> android:orientation="horizontal">
<TextView <FrameLayout
android:text="Apellidos" android:layout_width="50dp"
android:layout_width="wrap_content" android:layout_height="50dp">
android:layout_height="wrap_content"
android:id="@+id/label_surname" <ImageView
android:textSize="18sp" android:id="@+id/fondoFotoLogin"
android:textAlignment="textStart" android:layout_width="50dp"
android:textColor="@android:color/black" android:layout_height="50dp"
android:layout_alignBottom="@+id/photo" android:layout_gravity="center"
android:layout_toEndOf="@+id/photo" app:srcCompat="@drawable/round_design_photo_white" />
android:layout_marginStart="15dp" />
<ImageView
<ImageView android:id="@+id/photo"
app:srcCompat="@drawable/anonymous_student" android:layout_width="40dp"
android:id="@+id/photo" android:layout_height="40dp"
android:layout_weight="0.15" android:layout_alignParentStart="true"
android:layout_width="80dp" android:layout_alignParentTop="true"
android:layout_height="80dp" android:layout_gravity="center"
android:layout_alignParentTop="true" android:layout_weight="1"
android:layout_alignParentStart="true" /> app:srcCompat="@drawable/anonymous_student" />
</RelativeLayout> </FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/label_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/photo"
android:layout_marginStart="15dp"
android:layout_toEndOf="@+id/photo"
android:layout_weight="0.15"
android:text="Nombre"
android:textColor="@color/VerdeApp"
android:textSize="18sp" />
<TextView
android:id="@+id/label_surname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/photo"
android:layout_marginStart="15dp"
android:layout_toEndOf="@+id/photo"
android:layout_weight="0.15"
android:text="Apellidos"
android:textAlignment="textStart"
android:textColor="@color/VerdeApp"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<resources> <resources>
<string name="app_name">com.yottacode.pictogram.Tablet</string> <string name="app_name">com.yottacode.pictogram.Tablet</string>
<string name="alumnos">Students</string>
<string name="supervisores">Supervisors</string>
<item name="maxInTape" type="integer">8</item> <item name="maxInTape" type="integer">8</item>
<item name="maxInTape_big" type="integer">6</item> <item name="maxInTape_big" type="integer">6</item>
...@@ -36,13 +38,13 @@ ...@@ -36,13 +38,13 @@
<string name="session_eval_discarded">discarded</string> <string name="session_eval_discarded">discarded</string>
<string name="crop">Crop</string> <string name="crop">Crop</string>
<string name="titleCropper">Edit Picto</string> <string name="titleCropper">Edit Picto</string>
<string name="croppedImageDesc">Preview</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="accept">Accept</string>
<string name="legendText">Legend</string> <string name="legendText">Legend</string>
<string name="dialogCamera">Take a Picture</string>
<string name="dialogGallery">Pick from Gallery</string> <!-- Cropper -->
<string name="dialogTitle">Choose Method</string> <string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string>
<string name="dialogCancel">Cancel</string> <string name="uploadingImage">Subiendo imagen al servidor</string>
</resources> </resources>
<resources> <resources>
<string name="app_name">com.yottacode.pictogram.Tablet</string> <string name="app_name">com.yottacode.pictogram.Tablet</string>
<string name="alumnos">Estrudiantes</string>
<string name="supervisores">Supervisores</string>
<item name="maxInTape" type="integer">8</item> <item name="maxInTape" type="integer">8</item>
<item name="maxInTape_big" type="integer">6</item> <item name="maxInTape_big" type="integer">6</item>
...@@ -9,7 +11,7 @@ ...@@ -9,7 +11,7 @@
<string name="session_header">Seleccion de método e instrucción</string> <string name="session_header">Seleccion de método e instrucción</string>
<string name="session_error">Error de conexión</string> <string name="session_error">Error de conexión</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_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">Descargando 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 Web 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>
...@@ -37,10 +39,12 @@ ...@@ -37,10 +39,12 @@
<string name="crop">Recortar</string> <string name="crop">Recortar</string>
<string name="titleCropper">Nuevo Pictograma</string> <string name="titleCropper">Nuevo Pictograma</string>
<string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string> <string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string>
<!-- Cropper -->
<string name="legendText">Leyenda:</string> <string name="legendText">Leyenda:</string>
<string name="dialogCamera">Hacer Foto</string>
<string name="dialogGallery">Seleccionar de Galería</string>
<string name="dialogTitle">Seleccionar Método</string>
<string name="dialogCancel">Cancelar</string>
<string name="uploadingImage">Subiendo imagen al servidor</string> <string name="uploadingImage">Subiendo imagen al servidor</string>
</resources> </resources>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<color name="black">#FF000000</color> <color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
<color name="gray_blue">#FF78909C</color> <color name="gray_blue">#FF78909C</color>
<color name="blue_light">#FF40C4FF</color> <color name="blue_light">#40c4ff</color>
<color name="gray">#FF727272</color> <color name="gray">#FF727272</color>
...@@ -14,5 +14,7 @@ ...@@ -14,5 +14,7 @@
<color name="guideline">@color/white_translucent</color> <color name="guideline">@color/white_translucent</color>
<color name="corner">@android:color/white</color> <color name="corner">@android:color/white</color>
<color name="surrounding_area">@color/black_translucent</color> <color name="surrounding_area">@color/black_translucent</color>
<color name="VerdeApp">#6a8e1a</color>
<color name="BlancoApp">#eeeeee</color>
</resources> </resources>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<string name="session_header">Select method and instruction</string> <string name="session_header">Select method and instruction</string>
<string name="session_error">Server Error </string> <string name="session_error">Server Error </string>
<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">Descargando 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 Web</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>
...@@ -38,27 +38,12 @@ ...@@ -38,27 +38,12 @@
<string name="session_eval_discarded">inválido</string> <string name="session_eval_discarded">inválido</string>
<!-- Dialog for add new picto -->
<string name="dialogTitle">Seleccionar método</string>
<string name="dialogCamera">Hacer Foto</string>
<string name="dialogGallery">Seleccionar de Galería</string>
<string name="dialogCancel">Cancelar</string>
<!-- Cropper --> <!-- Cropper -->
<string name="legendText">Leyenda:</string> <string name="legendText">Leyenda:</string>
<string name="fixedAspectRatio">fixedAspectRatio =\u0020</string>
<string name="aspectRatioXHeader">aspectRatioX =\u0020</string>
<string name="aspectRatioYHeader">aspectRatioY =\u0020</string>
<string name="showGuidelines">showGuidelines =\u0020</string>
<string name="crop">Recortar</string> <string name="crop">Recortar</string>
<string name="titleCropper">Nuevo Pictograma</string> <string name="titleCropper">Nuevo Pictograma</string>
<string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string> <string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string>
<string name="uploadingImage">Subiendo imagen al servidor</string> <string name="uploadingImage">Subiendo imagen al servidor</string>
<string-array name="showGuidelinesArray">
<item>Off</item>
<item>On Touch</item>
<item>On</item>
</string-array>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources xmlns:android="http://schemas.android.com/tools">
<style name="sessionBtn"> <style name="sessionBtn">
<item name="android:layout_height">64dp</item> <item name="android:layout_height">64dp</item>
<item name="android:layout_width">64dp</item> <item name="android:layout_width">64dp</item>
......
...@@ -18,8 +18,9 @@ android { ...@@ -18,8 +18,9 @@ android {
targetSdkVersion 22 targetSdkVersion 22
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
resValue "string","SerialClass","com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity" resValue "bool","NotifyAllwaysVisible","true"
resValue "string","apk","pictogram.apk" resValue "string","apk","pictogram.apk"
resValue "string", "VersionManagerClass", "com.yottacode.pictogram.yotta_tablet.net.com.yottacode.pictogram.yotta_tablet.net.VersionManager"
// signingConfig signingConfigs.config // signingConfig signingConfigs.config
} }
productFlavors { productFlavors {
...@@ -28,12 +29,14 @@ android { ...@@ -28,12 +29,14 @@ android {
resValue "bool", "ssl_connect", "false" resValue "bool", "ssl_connect", "false"
} }
DevFlavor { DevFlavor {
resValue "string", "server", "https://dev.yottacode.com" resValue "string", "server", "https://dev.pictogramweb.com"
resValue "bool", "ssl_connect", "false" resValue "bool", "ssl_connect", "false"
resValue "string","apk","pictogram_dev.apk"
} }
PreFlavor { PreFlavor {
resValue "string", "server", "https://pre.yottacode.com" resValue "string", "server", "https://apk.pictogramweb.com"
resValue "bool", "ssl_connect", "true" resValue "bool", "ssl_connect", "true"
resValue "string","apk","pictogram.apk"
} }
LocalFlavor { LocalFlavor {
resValue "string", "server", "http://192.168.1.35:1337" resValue "string", "server", "http://192.168.1.35:1337"
......
package com.yottacode.pictogram.yotta_tablet.kiosk; package com.yottacode.pictogram.yotta_tablet.kiosk;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.NotificationManager;
import android.app.Service; import android.app.Service;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
...@@ -39,6 +40,9 @@ public class KioskService extends Service { ...@@ -39,6 +40,9 @@ public class KioskService extends Service {
public void onDestroy() { public void onDestroy() {
Log.i(TAG, "Stopping service 'KioskService'"); Log.i(TAG, "Stopping service 'KioskService'");
running =false; running =false;
NotificationManager mNotificationManager =
(NotificationManager)this.getBaseContext().getSystemService(this.getBaseContext().NOTIFICATION_SERVICE);
mNotificationManager.cancel(666);
super.onDestroy(); super.onDestroy();
} }
......
package com.yottacode.pictogram.yotta_tablet.net.com.yottacode.pictogram.yotta_tablet.net;
import android.app.DownloadManager;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Environment;
import com.yottacode.pictogram.dao.DeviceHelper;
import com.yottacode.pictogram.net.iVersionManager;
import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.pictogram.yotta_tablet.R;
import com.yottacode.tools.GUITools;
import java.io.File;
/**
* Created by Fernando on 10/03/2017.
*/
public class VersionManager implements iVersionManager {
static final String LOG_TAG=VersionManager.class.getCanonicalName();
public void newVersionAlert(final float version, final Context context, final float vnew) {
GUITools.show_alert(
PCBcontext.getActivityContext(), R.string.new_version_title,
PCBcontext.getContext().getResources().getString(R.string.new_version_detail)+" v" + version, new GUITools.iOKListener() {
@Override
public void ok() {
downloadNewVersion(version,PCBcontext.getActivityContext(), version);
}
});
}
private void downloadNewVersion(final float version, final Context context, final float vnew) {
final ProgressDialog progressDialog=ProgressDialog.show(context, context.getString(R.string.userLoadingTxt),context.getString(R.string.new_version_downloading));
progressDialog.show();
String destination = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/";
String fileName = context.getResources().getString(com.yottacode.pictogram.R.string.apk);
String apkurl=context.getResources().getString(com.yottacode.pictogram.R.string.server)
+ "/" + fileName;
destination += fileName;
final Uri uri = Uri.parse("file://" + destination);
//Delete update file if exists
File file = new File(destination);
if (file.exists())
file.delete();
//set downloadmanager
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(apkurl));
request.setDescription(context.getString(R.string.new_version_detail));
request.setTitle(context.getString(com.yottacode.pictogram.R.string.app_name));
//set destination
request.setDestinationUri(uri);
// get download service and enqueue file
final DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
final long downloadId = manager.enqueue(request);
//register receiver for when .apk download is compete
context.registerReceiver(new BroadcastReceiver() {
public void onReceive(Context ctxt, Intent intent) {
progressDialog.dismiss();
Intent install = new Intent(Intent.ACTION_VIEW);
install.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
install.setDataAndType(uri,
manager.getMimeTypeForDownloadedFile(downloadId));
context.startActivity(install);
context.unregisterReceiver(this);
DeviceHelper.setAppVersion(version);
}
}
, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}
}
...@@ -2,5 +2,8 @@ ...@@ -2,5 +2,8 @@
<resources> <resources>
<string name="app_name">Pictogram Tablet</string> <string name="app_name">Pictogram Tablet</string>
<string name="ilegal_user">There is not any supervisor named</string> <string name="ilegal_user">There is not any supervisor named</string>
<string name="new_version_detail">Pulse OK para proceder con la instalación</string>
<string name="new_version_downloading">Please wait, downloading new version </string>
</resources> </resources>
...@@ -2,5 +2,8 @@ ...@@ -2,5 +2,8 @@
<resources> <resources>
<string name="app_name">Pictogram Tablet</string> <string name="app_name">Pictogram Tablet</string>
<string name="ilegal_user"> No existe ningún supervisor </string> <string name="ilegal_user"> No existe ningún supervisor </string>
<string name="new_version_detail">Pulse OK para proceder con la instalación</string>
<string name="new_version_downloading">Por favor espere, descargando nueva versión </string>
</resources> </resources>
...@@ -2,4 +2,7 @@ ...@@ -2,4 +2,7 @@
<resources> <resources>
<string name="app_name">Pictogram Tablet</string> <string name="app_name">Pictogram Tablet</string>
<string name="ilegal_user">There is not any supervisor named</string> <string name="ilegal_user">There is not any supervisor named</string>
<string name="new_version_detail">Pulse OK para proceder con la instalación</string>
<string name="new_version_downloading">Por favor espere, descargando nueva versión </string>
</resources> </resources>
...@@ -21,7 +21,7 @@ mostradas más adelante hacen todo el trabajo, basta con ejecutar [./install.sh] ...@@ -21,7 +21,7 @@ mostradas más adelante hacen todo el trabajo, basta con ejecutar [./install.sh]
3. Descargar Pictogram del repositorio e iniciar instalación 3. Descargar Pictogram del repositorio e iniciar instalación
``` ```
$ git clone http://scm.ujaen.es/softuno/pictogram.git $ git clone http://gitlab.ujaen.es/yotta/pictogram.git
$ cd pictogram/sails $ cd pictogram/sails
$ sudo ./install.sh $ sudo ./install.sh
``` ```
......
#!/bin/bash #!/bin/bash
#
# - Encoding and locale for virtual machine
# - Build-essentials and g++
# - Ansible install
# - Run ansible playbook
#
# keymap and system encoding # keymap and system encoding
echo "-- Configuring encoding and locale" echo "-- Configuring encoding and locale"
sudo localectl set-keymap es sudo localectl set-keymap es
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8 export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales
echo "-- Installing build-essentials and g++" echo "-- Installing build-essentials and g++"
sudo apt-get update sudo apt-get update -y
sudo apt-get install build-essential g++ sudo apt-get install -y build-essential g++
# installing ansible # installing ansible
echo "-- Installing ansible" echo "-- Installing ansible"
......
#!/bin/bash #!/bin/bash
#
# Install core pictos (symbolstx and upload)
#
cd /vagrant/ cd /vagrant/
echo "--Descargando coleccion de pictogramas" echo "--Descargando coleccion de pictogramas"
......
-- MySQL dump 10.13 Distrib 5.7.13, for Linux (x86_64)
--
-- Host: localhost Database: pictodbclean
-- ------------------------------------------------------
-- Server version 5.7.13
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `pictocat`
--
DROP TABLE IF EXISTS `pictocat`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pictocat` (
`id` int(11) NOT NULL,
`id_supercat` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Identifies a category, which, itself, may belong to another category';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pictocat`
--
LOCK TABLES `pictocat` WRITE;
/*!40000 ALTER TABLE `pictocat` DISABLE KEYS */;
INSERT INTO `pictocat` VALUES (1,0),(2,1),(3,1),(4,0),(5,0),(6,1),(7,0),(8,1),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,16),(18,16),(19,0),(20,0),(21,16),(22,0),(23,22),(24,16),(25,16),(26,0),(27,0),(28,0),(29,0),(30,29),(31,29),(32,29),(33,0),(34,0),(35,22),(36,0),(37,5),(38,0),(39,0),(40,12),(41,15),(42,0),(43,0),(44,0),(45,9),(46,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,53),(55,53),(56,53),(57,53),(58,53),(59,53),(60,53),(61,53),(62,53),(63,53),(64,53),(65,51),(66,20),(67,0),(68,0),(69,0),(70,0),(71,0),(72,20),(73,0),(74,0),(75,0),(76,71),(77,20),(78,51),(79,0),(80,0),(81,5),(82,22),(83,0),(84,0),(85,84),(86,84),(87,51),(88,0),(89,20),(90,0),(91,51),(92,80),(93,0),(94,0),(95,0),(96,0),(97,0),(98,97),(99,97),(100,80),(101,69),(102,51),(103,51),(104,0),(105,51),(106,69),(107,69),(108,0),(109,69),(110,69),(111,69),(112,69),(113,69),(114,0),(115,71),(116,0),(117,0),(118,0),(119,0),(120,0),(121,0),(122,0);
/*!40000 ALTER TABLE `pictocat` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-01-17 9:48:07
--
-- Creacion y volcado de datos para la tabla `pictocattree`
--
source /vagrant/roles/database/files/pictocat_tree_populate.sql
source /vagrant/roles/database/files/catexp.sql
...@@ -48,17 +48,14 @@ COMMENT="This table registers and action performed by a user at a given time, al ...@@ -48,17 +48,14 @@ COMMENT="This table registers and action performed by a user at a given time, al
-- --
-- Estructura de tabla para la tabla `catexp` -- Estructura de tabla para la tabla `catexp`
-- --
CREATE TABLE IF NOT EXISTS `catexp`( CREATE TABLE `catexp` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`id_cat` int(11) NOT NULL, `id_cat` int(11) NOT NULL,
`lang` char(5), `lang` char(5) DEFAULT NULL,
`exp` varchar(30) NOT NULL, `exp` varchar(30) NOT NULL,
PRIMARY KEY(`id`), PRIMARY KEY (`id`),
UNIQUE(exp,lang), UNIQUE KEY `exp` (`exp`,`lang`)
CHECK (lang IN ('es-es','en-gb','en-us')) ) ENGINE=InnoDB AUTO_INCREMENT=27958 DEFAULT CHARSET=utf8 COMMENT='Stores the expressions available in several languages for a given category (id_cat)';
)
COMMENT="Stores the expressions available in several languages for a given category (id_cat)";
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
...@@ -201,9 +198,9 @@ COMMENT="Stablish access rights to pictos"; ...@@ -201,9 +198,9 @@ COMMENT="Stablish access rights to pictos";
CREATE TABLE IF NOT EXISTS `pictocat`( CREATE TABLE IF NOT EXISTS `pictocat`(
`id` int(11) PRIMARY KEY, `id` int(11) PRIMARY KEY,
`id_supercat` int(11) `id_supercat` int(11) DEFAULT NULL
) )
COMMENT="Identifies a category, which, itself, may belong to another category"; ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT="Identifies a category, which, itself, may belong to another category";
-- -------------------------------------------------------- -- --------------------------------------------------------
......
...@@ -24,14 +24,6 @@ ...@@ -24,14 +24,6 @@
state: import state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/symbolstix.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/symbolstix.sql"
- name: Imports symbolstix categories
mysql_db:
login_user: "{{ database_user }}"
login_password: "{{ database_user_passwd }}"
name: "{{ database_name }}"
state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/pictocat.sql"
- name: Imports application essential data - name: Imports application essential data
mysql_db: mysql_db:
login_user: "{{ database_user }}" login_user: "{{ database_user }}"
......
...@@ -169,6 +169,7 @@ module.exports = function roomsHook (sails) { ...@@ -169,6 +169,7 @@ module.exports = function roomsHook (sails) {
*/ */
disconnect: function(socket) { disconnect: function(socket) {
var rooms = socketRooms[sails.sockets.getId(socket)]; var rooms = socketRooms[sails.sockets.getId(socket)];
if(!rooms) return;
for (var i = 0; i < rooms.length; i++) for (var i = 0; i < rooms.length; i++)
sails.hooks.rooms.unsubscribeFromRoom(rooms[i].room, socket); sails.hooks.rooms.unsubscribeFromRoom(rooms[i].room, socket);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "angular-pictogram", "name": "angular-pictogram",
"description": "Client side dashboard in AngularJS", "description": "Client side dashboard in AngularJS",
"version": "0.0.0", "version": "0.0.0",
"homepage": "http://scm.ujaen.es/softuno/pictogram.git", "homepage": "http://gitlab.ujaen.es/yotta/pictogram.git",
"license": "Private", "license": "Private",
"private": true, "private": true,
"dependencies": { "dependencies": {
......
<html>
<head>
<meta charset="utf-8">
<title>Pictogram Web</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="css/main.css">
<link rel="icon" href="img/logo_pictogram.png" type='image/png'>
</head>
<body>
<div class="header-image">
<div class="row">
<div class="col-md-12 text-center">
<img ng-src="img/logo_pictogram.png" alt="Pictogram" title="Pictogram" src="img/logo_pictogram.png">
</div>
</div>
</div>
<div id="es">
<div class="container vertical-center">
<div class="row">
<div class="col-md-12 text-center">
<br>
<h1>Navegador no compatible con Pictogram <i class="fa fa-frown-o" aria-hidden="true"></i></h1>
<br>
<h4>Le recomendamos utilizar la última versión de <a href="https://www.google.com/chrome/" target="_blank">Google Chrome</a> o <a href="https://www.mozilla.org/firefox/new/" target="_blank">Mozilla Firefox</a>.</h4>
</div>
</div>
</div>
<div class="languages">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="languages-margin text-muted text-center">Si los problemas persisten, contacte con <a href="mailto:soporte@yottacode.com" translate="" class="ng-scope">atención al cliente</a>.</div>
</div>
</div>
</div>
</div>
</div>
<div id="en">
<div class="container vertical-center">
<div class="row">
<div class="col-md-12 text-center">
<br>
<h1>Browser not compatible with Pictogram <i class="fa fa-frown-o" aria-hidden="true"></i></h1>
<br>
<h4>We recommend using the latest version of <a href="https://www.google.com/chrome/" target="_blank">Google Chrome</a> or <a href="https://www.mozilla.org/firefox/new/" target="_blank">Mozilla Firefox</a>.</h4>
</div>
</div>
</div>
<div class="languages">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="languages-margin text-muted text-center">If problems persist, contact with <a href="mailto:soporte@yottacode.com" translate="" class="ng-scope">customer support</a>.</div>
</div>
</div>
</div>
</div>
</div>
<script>
/* SIMPLY DOCUMENT TRANSLATION */
// Browser default language
var lang = (navigator.language || navigator.userLanguage).split("-")[0];
// If language not available, set english as default
if(lang != "en" && lang != "es"){
lang = "en";
}
// Show div acording to language
document.getElementById('en').style.display = (lang=='en')? 'inline' : 'none';
document.getElementById('es').style.display = (lang=='es')? 'inline' : 'none';
</script>
</body>
</html>
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
"admin_panel": "Admin panel", "admin_panel": "Admin panel",
"alert": "Alert", "alert": "Alert",
"all": "All", "all": "All",
"all_methods": "All methods",
"animation": "Animation", "animation": "Animation",
"apply":"Apply", "apply":"Apply",
"annual": "Annual", "annual": "Annual",
...@@ -33,6 +34,8 @@ ...@@ -33,6 +34,8 @@
"attributes_updated": "Changes saved", "attributes_updated": "Changes saved",
"attributes_updating": "Saving...", "attributes_updating": "Saving...",
"August": "August", "August": "August",
"average_time_between_pictos": "Average time between pictograms",
"average_time_per_try": "Average time per try",
"background": "Background", "background": "Background",
"beep": "Beep", "beep": "Beep",
"birthdate": "Birthdate", "birthdate": "Birthdate",
...@@ -73,6 +76,7 @@ ...@@ -73,6 +76,7 @@
"crop_image": "Crop image", "crop_image": "Crop image",
"data_no_saved": "Data can't be saved", "data_no_saved": "Data can't be saved",
"data_saved": "Data saved", "data_saved": "Data saved",
"date_error": "Filter date to must be greater than since",
"day_format": "yyyy/MM/dd", "day_format": "yyyy/MM/dd",
"days": "Days", "days": "Days",
"days_from_first_session": "days from first session", "days_from_first_session": "days from first session",
...@@ -120,6 +124,7 @@ ...@@ -120,6 +124,7 @@
"error_on_update": "Error on update", "error_on_update": "Error on update",
"error_loading_pictos": "Error loading pictos information", "error_loading_pictos": "Error loading pictos information",
"error_general": "An error has been produced", "error_general": "An error has been produced",
"error_rate": "Error rate",
"expand_navigation": "Expand navigation", "expand_navigation": "Expand navigation",
"expand_navigation": "Expand navigation", "expand_navigation": "Expand navigation",
"expression": "Expression", "expression": "Expression",
...@@ -235,6 +240,7 @@ ...@@ -235,6 +240,7 @@
"office_updated": "Office updated", "office_updated": "Office updated",
"offices": "Offices", "offices": "Offices",
"options": "Options", "options": "Options",
"or": "or",
"own_instructions": "Own method templates", "own_instructions": "Own method templates",
"own_labels": "Your labels", "own_labels": "Your labels",
"own_pictos": "Your pictograms", "own_pictos": "Your pictograms",
...@@ -250,12 +256,15 @@ ...@@ -250,12 +256,15 @@
"password_type": "Password", "password_type": "Password",
"pause": "Pause", "pause": "Pause",
"pause_session": "Pause session", "pause_session": "Pause session",
"percent": "Percent",
"personal_data": "Personal data", "personal_data": "Personal data",
"personal_data": "Personal data", "personal_data": "Personal data",
"phone": "Phone number", "phone": "Phone number",
"phone": "Phone", "phone": "Phone",
"phrase": "Phrase", "phrase": "Phrase",
"phrase_size": "Phrase average size",
"phrase_tape": "Phrase tape", "phrase_tape": "Phrase tape",
"phrase_build_time": "Average phrase build time",
"picto_added": "Picto successfully added", "picto_added": "Picto successfully added",
"picto_behavior": "Behavior of a pictogram when it is selected (without phrase tape)", "picto_behavior": "Behavior of a pictogram when it is selected (without phrase tape)",
"picto_labels": "Pictogram labels", "picto_labels": "Pictogram labels",
...@@ -365,6 +374,7 @@ ...@@ -365,6 +374,7 @@
"title": "Title", "title": "Title",
"totals": "Totals", "totals": "Totals",
"to_add": "To add", "to_add": "To add",
"tpl_date_frame": "de {{ begin | date:'dd-MM-yyyy' }} a {{ end | date:'dd-MM-yyyy' }}",
"tpl_day": "{{ day | date:'yyyy-MM-dd' }}", "tpl_day": "{{ day | date:'yyyy-MM-dd' }}",
"tpl_hours_frame": "from {{ begin | date:'HH:mm:ss' }} to {{ end | date:'HH:mm:ss' }}", "tpl_hours_frame": "from {{ begin | date:'HH:mm:ss' }} to {{ end | date:'HH:mm:ss' }}",
"tries": "Tries", "tries": "Tries",
...@@ -397,6 +407,10 @@ ...@@ -397,6 +407,10 @@
"vibration": "Vibration", "vibration": "Vibration",
"view": "View", "view": "View",
"voice": "Voice", "voice": "Voice",
"vocabulary": "Vocabulary",
"vocabulary_size": "Vocabulary size",
"warning": "Warning",
"warning_browser_incompatible": "Your browser may not be compatible with Pictogram Web. We recommend using the latest version of",
"warning_last_session_bad": "Last session was interrupted. Please, you must evaluate last tries and press 'close seesion' button", "warning_last_session_bad": "Last session was interrupted. Please, you must evaluate last tries and press 'close seesion' button",
"warning_no_pictos_found": "No pictograms found with specified keyword", "warning_no_pictos_found": "No pictograms found with specified keyword",
"warning_no_tablet_online":"No Pictogran Tablet online detected", "warning_no_tablet_online":"No Pictogran Tablet online detected",
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
"admin_panel": "Panel de administración", "admin_panel": "Panel de administración",
"alert": "Alerta", "alert": "Alerta",
"all": "Todos", "all": "Todos",
"all_methods": "Todos los métodos",
"animation": "Animación", "animation": "Animación",
"apply":"Aplicar", "apply":"Aplicar",
"annual": "Anual", "annual": "Anual",
...@@ -33,6 +34,8 @@ ...@@ -33,6 +34,8 @@
"attributes_updated": "Cambios guardados", "attributes_updated": "Cambios guardados",
"attributes_updating": "Guardando...", "attributes_updating": "Guardando...",
"August": "Agosto", "August": "Agosto",
"average_time_between_pictos": "Tiempo medio entre pictogramas",
"average_time_per_try": "Tiempo medio por intento",
"background": "Fondo", "background": "Fondo",
"beep": "Pitido", "beep": "Pitido",
"birthdate": "Fecha de nacimiento", "birthdate": "Fecha de nacimiento",
...@@ -73,6 +76,7 @@ ...@@ -73,6 +76,7 @@
"crop_image": "Recortar imagen", "crop_image": "Recortar imagen",
"data_no_saved": "Los datos no se han podido guardar", "data_no_saved": "Los datos no se han podido guardar",
"data_saved": "Datos guardados", "data_saved": "Datos guardados",
"date_error": "La fecha 'desde' debe ser menor que la fecha 'hasta'",
"day_format": "dd/MM/yyyy", "day_format": "dd/MM/yyyy",
"days": "Días", "days": "Días",
"days_from_first_session": "días desde la primera sesión", "days_from_first_session": "días desde la primera sesión",
...@@ -123,6 +127,7 @@ ...@@ -123,6 +127,7 @@
"error_on_upload": "Error al subir la imagen. Compruebe que el archivo no supera 1MB de tamaño.", "error_on_upload": "Error al subir la imagen. Compruebe que el archivo no supera 1MB de tamaño.",
"error_loading_pictos": "Error cargando información de los pictos", "error_loading_pictos": "Error cargando información de los pictos",
"error_general": "Se ha producido un error", "error_general": "Se ha producido un error",
"error_rate": "Tasa de error",
"February": "Febrero", "February": "Febrero",
"feedback_picto": "Efecto de selección", "feedback_picto": "Efecto de selección",
"filter": "Filtrar", "filter": "Filtrar",
...@@ -235,6 +240,7 @@ ...@@ -235,6 +240,7 @@
"office_updated": "Gabinete actualizado", "office_updated": "Gabinete actualizado",
"offices": "Gabinetes", "offices": "Gabinetes",
"options": "Opciones", "options": "Opciones",
"or": "o",
"own_instructions": "Plantillas de métodos propias", "own_instructions": "Plantillas de métodos propias",
"own_labels": "Etiquetas propias", "own_labels": "Etiquetas propias",
"own_pictos": "Pictogramas propios", "own_pictos": "Pictogramas propios",
...@@ -249,12 +255,15 @@ ...@@ -249,12 +255,15 @@
"password_short": "La contraseña es muy corta, debe tener al menos una longitud de {{minlength}} caracteres", "password_short": "La contraseña es muy corta, debe tener al menos una longitud de {{minlength}} caracteres",
"pause": "Pausar", "pause": "Pausar",
"pause_session": "Pausar sesión", "pause_session": "Pausar sesión",
"percent": "Porcentaje",
"personal_data": "Datos personales", "personal_data": "Datos personales",
"personal_data": "Datos personales", "personal_data": "Datos personales",
"phone": "Teléfono", "phone": "Teléfono",
"phone": "Teléfono", "phone": "Teléfono",
"phrase": "Frase", "phrase": "Frase",
"phrase_size": "Longitud media de frase",
"phrase_tape": "Cinta de frase", "phrase_tape": "Cinta de frase",
"phrase_build_time": "Tiempo medio construcción",
"picto_added": "Picto añadido correctamente", "picto_added": "Picto añadido correctamente",
"picto_behavior": "Comportamiento de un pictograma al seleccionarlo (sin cinta de frase)", "picto_behavior": "Comportamiento de un pictograma al seleccionarlo (sin cinta de frase)",
"picto_labels": "Etiquetas del pictograma", "picto_labels": "Etiquetas del pictograma",
...@@ -365,6 +374,7 @@ ...@@ -365,6 +374,7 @@
"title": "Título", "title": "Título",
"totals": "Totales", "totals": "Totales",
"to_add": "Para añadir", "to_add": "Para añadir",
"tpl_date_frame": "de {{ begin | date:'dd-MM-yyyy' }} a {{ end | date:'dd-MM-yyyy' }}",
"tpl_day": "{{ day | date:'dd-MM-yyyy' }}", "tpl_day": "{{ day | date:'dd-MM-yyyy' }}",
"tpl_hours_frame": "de {{ begin | date:'HH:mm:ss' }} a {{ end | date:'HH:mm:ss' }}", "tpl_hours_frame": "de {{ begin | date:'HH:mm:ss' }} a {{ end | date:'HH:mm:ss' }}",
"tries": "Ensayos", "tries": "Ensayos",
...@@ -397,6 +407,10 @@ ...@@ -397,6 +407,10 @@
"vibration": "Vibración", "vibration": "Vibración",
"view": "Vista", "view": "Vista",
"voice": "Voz", "voice": "Voz",
"vocabulary": "Vocabulario",
"vocabulary_size": "Tamaño del vocabulario",
"warning": "Advertencia",
"warning_browser_incompatible": "Su navegador podría ser incompatible con Pictogram Web. Le recomendamos utilizar la última versión de",
"warning_last_session_bad": "La última sesión no se cerró correctamente. Por favor, evalúe los ensayos y pulse 'cerrar sesión' ", "warning_last_session_bad": "La última sesión no se cerró correctamente. Por favor, evalúe los ensayos y pulse 'cerrar sesión' ",
"warning_no_pictos_found": "No se encontraron pictogramas con las palabras introducidas", "warning_no_pictos_found": "No se encontraron pictogramas con las palabras introducidas",
"warning_no_tablet_online":"No se detectó ningún usuario de Pictogram Tablet online", "warning_no_tablet_online":"No se detectó ningún usuario de Pictogram Tablet online",
......
// Return client browser. ex: $scope.clientBrowser == [ "Firefox", "51"]
var clientBrowser = (function(){
var ua= navigator.userAgent, tem,
M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE '+(tem[1] || '');
}
if(M[1]=== 'Chrome'){
tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
return M.join(' ');
})().split(" ");
// Return if client browser valid or not
var validBrowser = false;
//Browser filter
if(clientBrowser[0] == "Firefox" && parseInt(clientBrowser[1]) >= 35 )
validBrowser = true;
if(clientBrowser[0] == "Chrome" && parseInt(clientBrowser[1]) >= 45 )
validBrowser = true;
if(clientBrowser[0] == "Opera" && parseInt(clientBrowser[1]) >= 35 )
validBrowser = true;
if(clientBrowser[0] == "Edge" )
validBrowser = true;
// Redirect to view
if(!validBrowser) window.location = "browserNotCompatible.html";
<!-- Office image -->
<div class="row"> <div class="row">
<div class="col-md-12 text-center"> <div class="col-md-12 text-center">
<!-- Logo Pictogram <!-- Logo Pictogram
...@@ -11,56 +12,67 @@ ...@@ -11,56 +12,67 @@
</p> </p>
</div> </div>
</div> </div>
<div class="row"> <!--/. Office image -->
<!-- Rejilla 3 elementos de igual ancho --> <!-- Main row -->
<div class="col-md-2">&nbsp;</div> <div class="row">
<div class="col-md-4">
<div id="login">
<!-- Formulario -->
<!-- LoginCtrl controls here, see app.js -->
<form name="loginForm" ng-submit="login()" novalidate>
<div class="form-group"> <!-- Form column and offset -->
<label translate>email</label>: <div class="col-md-4 col-md-offset-2">
<input type="email" class="form-control" id="login_email" placeholder="{{ 'your_email' | translate}}" required ng-model="credentials.email" /> <div id="login">
</div> <!-- Formulario -->
<div class="form-group"> <!-- LoginCtrl controls here, see app.js -->
<label translate>password</label>: <form name="loginForm" ng-submit="login()" novalidate>
<input type="password" class="form-control" id="login_password" placeholder="{{ 'your_password' | translate}}" required ng-model="credentials.password" /> <!-- Email -->
<div class="form-group">
<label translate>email</label>:
<input type="email" class="form-control" id="login_email" placeholder="{{ 'your_email' | translate}}" required ng-model="credentials.email" />
</div>
<!-- Password -->
<div class="form-group">
<label translate>password</label>:
<input type="password" class="form-control" id="login_password" placeholder="{{ 'your_password' | translate}}" required ng-model="credentials.password" />
</div>
<!-- Remember -->
<div class="checkbox">
<label>
<input type="checkbox" id="login_savepassword" ng-model="credentials.savepassword" />{{ 'remember' | translate }}
</label>
</div>
<div class="row">
<div class="col-md-12">
<!-- Login -->
<div class="pull-left">
<button type="submit" class="btn btn-primary" translate>login</button>
</div> </div>
<div class="checkbox"> <!-- Spinner -->
<label> <div class="pull-left">
<input type="checkbox" id="login_savepassword" ng-model="credentials.savepassword" />{{ 'remember' | translate }} <i ng-class="{'fa fa-spinner fa-spin fa-2x fa-fw margin-bottom': true, 'spin_disabled': !submitted}"></i>
</label>
</div> </div>
<div class="row"> <!-- Create account -->
<div class="col-md-12"> <div class="pull-right margin-top7">
<div class="pull-left"> <a href="/app/#/signin" translate>create_an_account</a>
<button type="submit" class="btn btn-primary" translate>login</button>
</div>
<div class="pull-left">
<i ng-class="{'fa fa-spinner fa-spin fa-2x fa-fw margin-bottom': true, 'spin_disabled': !submitted}"></i>
</div>
<div class="pull-right margin-top7">
<a href="/app/#/signin" translate>create_an_account</a>
</div>
</div>
</div>
<div class="text-center margin-top15">
<br/>
<a href="/app/#/changepass" translate>password_forgotten</a>
</div> </div>
</form> </div>
</div> </div>
<!-- Fin login --> <!-- Remember password -->
</div> <div class="text-center margin-top15">
<div class="col-md-4"> <br>
<img src="img/login.png" alt="Pictogram" title="Pictogram" /> <a href="/app/#/changepass" translate>password_forgotten</a>
</div> </div>
<div class="col-md-2">&nbsp;</div> </form>
</div> </div>
<!-- Fin de row --> <!--/. login -->
</div>
<!--/. form column -->
<!-- Image column -->
<div class="col-md-4">
<img src="img/login.png" alt="Pictogram" title="Pictogram" />
</div>
<!--/. image column -->
</div>
<!--/. main row -->
<footer-translate></footer-translate> <footer-translate></footer-translate>
...@@ -322,7 +322,9 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -322,7 +322,9 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Returned data from the modal window // Returned data from the modal window
modalInstance.result.then(function (pictoId) { modalInstance.result.then(function (pictoId) {
// Send the picto to the server if(!pictoId)
return;
$http.put(config.backend + '/stu/' + $scope.studentData.id + '/cat', { $http.put(config.backend + '/stu/' + $scope.studentData.id + '/cat', {
prev_id_stu_pic: picto_cat.id, prev_id_stu_pic: picto_cat.id,
new_id_pic: pictoId new_id_pic: pictoId
......
...@@ -965,19 +965,19 @@ input[type=range]:focus::-ms-fill-upper { ...@@ -965,19 +965,19 @@ input[type=range]:focus::-ms-fill-upper {
} }
.numberCircle { .numberCircle {
border-radius: 50%; border-radius: 50%;
behavior: url(PIE.htc); /* remove if you don't care about IE8 */ behavior: url(PIE.htc); /* remove if you don't care about IE8 */
width: 36px; width: 36px;
height: 36px; height: 36px;
padding: 8px; padding: 8px;
background: #fff; background: #fff;
border: 2px solid #3071a9; border: 2px solid #3071a9;
color: #3071a9; color: #3071a9;
text-align: center; text-align: center;
font: 32px Arial, sans-serif; font: 32px Arial, sans-serif;
} }
/* /*
...@@ -995,10 +995,10 @@ input[type=range]:focus::-ms-fill-upper { ...@@ -995,10 +995,10 @@ input[type=range]:focus::-ms-fill-upper {
ng-file-upload and ngImgCrop ng-file-upload and ngImgCrop
*/ */
.cropArea { .cropArea {
background: #E4E4E4; background: #E4E4E4;
overflow: hidden; overflow: hidden;
width:500px; width:500px;
height:350px; height:350px;
} }
form .progress { form .progress {
line-height: 15px; line-height: 15px;
...@@ -1020,3 +1020,32 @@ form .progress { ...@@ -1020,3 +1020,32 @@ form .progress {
width: 0; width: 0;
height: 0; height: 0;
} }
.method-opt{
font-weight: 600;
}
.header-image {
width: 100%;
background-color: #f8f8f8;
padding-top: 20px;
padding-bottom: 20px;
border-bottom: 1px solid #e7e7e7;
}
@media print {
#reportsTitle{
display: inherit;
}
#filter{
display: none;
}
#filter-info{
display: none;
}
#inform-content-date{
display: none;
}
.languages{
display: none;
}
}
...@@ -5,7 +5,7 @@ var ASSETS_PATH = path.join(__dirname, '..', 'assets'); ...@@ -5,7 +5,7 @@ var ASSETS_PATH = path.join(__dirname, '..', 'assets');
var UPLOAD_PATH = path.join(__dirname, '..', '..', 'upload'); var UPLOAD_PATH = path.join(__dirname, '..', '..', 'upload');
module.exports.pictogram = { module.exports.pictogram = {
version: "1.0", // actual version of the server, to be checked by the client version: "1.1", // actual version of the server, to be checked by the client
admin: { admin: {
email: 'amontejo@ujaen.es', email: 'amontejo@ujaen.es',
password: '$2a$06$flEEOc15SerMeYWARrN9w.KSpJuM.jDsaTgrtD0ESzbxKHPl0f/zq' //y00ttaa!! password: '$2a$06$flEEOc15SerMeYWARrN9w.KSpJuM.jDsaTgrtD0ESzbxKHPl0f/zq' //y00ttaa!!
......
...@@ -468,7 +468,7 @@ function sqlTypeCast(attr) { ...@@ -468,7 +468,7 @@ function sqlTypeCast(attr) {
break; break;
case 'datetime': case 'datetime':
expandedType = 'DATETIME'; expandedType = 'DATETIME(3)';
break; break;
case 'time': case 'time':
...@@ -499,7 +499,8 @@ function toSqlDate(date) { ...@@ -499,7 +499,8 @@ function toSqlDate(date) {
('00' + date.getDate()).slice(-2) + ' ' + ('00' + date.getDate()).slice(-2) + ' ' +
('00' + date.getHours()).slice(-2) + ':' + ('00' + date.getHours()).slice(-2) + ':' +
('00' + date.getMinutes()).slice(-2) + ':' + ('00' + date.getMinutes()).slice(-2) + ':' +
('00' + date.getSeconds()).slice(-2); ('00' + date.getSeconds()).slice(-2) + '.' +
('00' + date.getMilliseconds()).slice(-3);
return date; return date;
} }
......
...@@ -242,7 +242,8 @@ utils.toSqlDate = function toSqlDate(date) { ...@@ -242,7 +242,8 @@ utils.toSqlDate = function toSqlDate(date) {
('00' + date.getDate()).slice(-2) + ' ' + ('00' + date.getDate()).slice(-2) + ' ' +
('00' + date.getHours()).slice(-2) + ':' + ('00' + date.getHours()).slice(-2) + ':' +
('00' + date.getMinutes()).slice(-2) + ':' + ('00' + date.getMinutes()).slice(-2) + ':' +
('00' + date.getSeconds()).slice(-2); ('00' + date.getSeconds()).slice(-2) + "." +
('00' + date.getMilliseconds()).slice(-3);
return date; return date;
}; };
Files contained here are intented to overwrite dependencies code, because of a enhacement or a bug not included in official distributions and done by us.
/**
* Utility Functions
*/
// Dependencies
var mysql = require('mysql');
var _ = require('lodash');
var url = require('url');
// Module Exports
var utils = module.exports = {};
/**
* Parse URL string from config
*
* Parse URL string into connection config parameters
*/
utils.parseUrl = function (config) {
if(!_.isString(config.url)) {
return config;
}
var obj = url.parse(config.url);
config.host = obj.hostname || config.host;
config.port = obj.port || config.port;
if(_.isString(obj.pathname)) {
config.database = obj.pathname.split('/')[1] || config.database;
}
if(_.isString(obj.auth)) {
config.user = obj.auth.split(':')[0] || config.user;
config.password = obj.auth.split(':')[1] || config.password;
}
return config;
};
/**
* Prepare values
*
* Transform a JS date to SQL date and functions
* to strings.
*/
utils.prepareValue = function(value) {
if(_.isUndefined(value) || value === null) {
return value;
}
// Cast functions to strings
if (_.isFunction(value)) {
value = value.toString();
}
// Store Arrays and Objects as strings
if (_.isArray(value) || value.constructor && value.constructor.name === 'Object') {
try {
value = JSON.stringify(value);
} catch (e) {
// just keep the value and let the db handle an error
value = value;
}
}
// Cast dates to SQL
if (_.isDate(value)) {
value = utils.toSqlDate(value);
}
return mysql.escape(value);
};
/**
* Builds a Select statement determining if Aggeregate options are needed.
*/
utils.buildSelectStatement = function(criteria, table, schemaDefs) {
var query = '';
if(criteria.groupBy || criteria.sum || criteria.average || criteria.min || criteria.max) {
query = 'SELECT ';
// Append groupBy columns to select statement
if(criteria.groupBy) {
if(_.isArray(criteria.groupBy)) {
_.each(criteria.groupBy, function(opt){
query += opt + ', ';
});
} else {
query += criteria.groupBy + ', ';
}
}
// Handle SUM
if (criteria.sum) {
if(_.isArray(criteria.sum)) {
_.each(criteria.sum, function(opt){
query += 'SUM(' + opt + ') AS ' + opt + ', ';
});
} else {
query += 'SUM(' + criteria.sum + ') AS ' + criteria.sum + ', ';
}
}
// Handle AVG (casting to float to fix percision with trailing zeros)
if (criteria.average) {
if(_.isArray(criteria.average)) {
_.each(criteria.average, function(opt){
query += 'AVG(' + opt + ') AS ' + opt + ', ';
});
} else {
query += 'AVG(' + criteria.average + ') AS ' + criteria.average + ', ';
}
}
// Handle MAX
if (criteria.max) {
if(_.isArray(criteria.max)) {
_.each(criteria.max, function(opt){
query += 'MAX(' + opt + ') AS ' + opt + ', ';
});
} else {
query += 'MAX(' + criteria.max + ') AS ' + criteria.max + ', ';
}
}
// Handle MIN
if (criteria.min) {
if(_.isArray(criteria.min)) {
_.each(criteria.min, function(opt){
query += 'MIN(' + opt + ') AS ' + opt + ', ';
});
} else {
query += 'MIN(' + criteria.min + ') AS ' + criteria.min + ', ';
}
}
// trim trailing comma
query = query.slice(0, -2) + ' ';
// Add FROM clause
return query += 'FROM `' + table + '` ';
}
/**
* If no aggregate options lets just build a normal query
*/
// Add all keys to the select statement for this table
query += 'SELECT ';
var selectKeys = [],
joinSelectKeys = [];
if ( !schemaDefs[table] ) {
throw new Error('Schema definition missing for table: `'+table+'`');
}
_.each(schemaDefs[table], function(schemaDef, key) {
selectKeys.push({ table: table, key: key });
});
// Check for joins
if(criteria.joins || criteria.join) {
var joins = criteria.joins || criteria.join;
_.each(joins, function(join) {
if(!join.select) {
return;
}
_.each(_.keys(schemaDefs[join.child.toLowerCase()]), function(key) {
var _join = _.cloneDeep(join);
_join.key = key;
joinSelectKeys.push(_join);
});
// Remove the foreign key for this join from the selectKeys array
selectKeys = selectKeys.filter(function(select) {
var keep = true;
if(select.key === join.parentKey && join.removeParentKey) {
keep = false;
}
return keep;
});
});
}
// Add all the columns to be selected that are not joins
_.each(selectKeys, function(select) {
query += '`' + select.table + '`.`' + select.key + '`, ';
});
// Add all the columns from the joined tables
_.each(joinSelectKeys, function(select) {
// Create an alias by prepending the child table with the alias of the join
var alias = select.alias.toLowerCase() + '_' + select.child.toLowerCase();
// If this is a belongs_to relationship, keep the foreign key name from the AS part
// of the query. This will result in a selected column like: "user"."id" AS "user_id__id"
if(select.model) {
return query += mysql.escapeId(alias) + '.' + mysql.escapeId(select.key) + ' AS ' +
mysql.escapeId(select.parentKey + '__' + select.key) + ', ';
}
// If a junctionTable is used, the child value should be used in the AS part of the
// select query.
if(select.junctionTable) {
return query += mysql.escapeId(alias) + '.' + mysql.escapeId(select.key) + ' AS ' +
mysql.escapeId(select.alias + '__' + select.key) + ', ';
}
// Else if a hasMany attribute is being selected, use the alias plus the child
return query += mysql.escapeId(alias) + '.' + mysql.escapeId(select.key) + ' AS ' +
mysql.escapeId(select.alias + '__' + select.key) + ', ';
});
// Remove the last comma
query = query.slice(0, -2) + ' FROM `' + table + '` ';
return query;
};
utils.toSqlDate = function toSqlDate(date) {
date = date.getFullYear() + '-' +
('00' + (date.getMonth()+1)).slice(-2) + '-' +
('00' + date.getDate()).slice(-2) + ' ' +
('00' + date.getHours()).slice(-2) + ':' +
('00' + date.getMinutes()).slice(-2) + ':' +
('00' + date.getSeconds()).slice(-2) + "." +
('00' + date.getMilliseconds()).slice(-3);
return date;
};
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"main": "app.js", "main": "app.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "http://scm.ujaen.es/softuno/pictogram.git" "url": "http://gitlab.ujaen.es/yotta/pictogram.git"
}, },
"author": "Yottacode", "author": "Yottacode",
"license": "", "license": "",
......
...@@ -3,6 +3,7 @@ module.exports = function (grunt) { ...@@ -3,6 +3,7 @@ module.exports = function (grunt) {
var jsLibs = [ var jsLibs = [
// JQuery is added because ng-file-upload produces errors if not // JQuery is added because ng-file-upload produces errors if not
'assets/app/bower_components/jquery/dist/jquery.min.js', 'assets/app/bower_components/jquery/dist/jquery.min.js',
'assets/scripts/check_browser.js',
'assets/app/bower_components/angular/angular.js', 'assets/app/bower_components/angular/angular.js',
'assets/app/bower_components/angular-bootstrap/ui-bootstrap.min.js', 'assets/app/bower_components/angular-bootstrap/ui-bootstrap.min.js',
'assets/app/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js', 'assets/app/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
......
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