Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
10cf7caf
authored
May 05, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.ujaen.es/yotta/pictogram
into develop
parents
25c043d1
4146cf9d
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
170 additions
and
78 deletions
android/Pictogram/commonlibrary/build.gradle
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Device.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/PCBDBHelper.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/User.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/VocabularyIterator.java
android/Pictogram/commonlibrary/src/main/res/raw/pcbdb_create.sql
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/SerialActivity.java
sails/src/assets/app/i18n/en-gb.json
sails/src/assets/app/i18n/es-es.json
sails/src/assets/scripts/modules/student/views/instructions.html
sails/src/assets/scripts/modules/student/views/setup.html
sails/src/assets/scripts/modules/supervisor/views/instructions.html
sails/src/assets/styles/main.css
android/Pictogram/commonlibrary/build.gradle
View file @
10cf7caf
...
...
@@ -10,7 +10,7 @@ android {
versionCode
1
versionName
"1.0"
resValue
"string"
,
"db_name"
,
"PCB.db"
resValue
"integer"
,
"db_version"
,
"
4
"
resValue
"integer"
,
"db_version"
,
"
7
"
resValue
"string"
,
"app_version"
,
"1.1"
resValue
"string"
,
"core_vocabulary"
,
"core_vocabulary"
resValue
"string"
,
"apk"
,
"to_be_set_in_subproject"
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Device.java
View file @
10cf7caf
...
...
@@ -38,12 +38,13 @@ public class Device extends SQLiteOpenHelper {
private
static
final
String
LOG_TAG
=
SQLiteOpenHelper
.
class
.
getCanonicalName
();
Context
context
;
public
static
final
String
PREFS_NAME
=
"MyPrefsFile"
;
final
static
class
PARAMS
{
static
String
keyword
=
"key"
;
static
String
keyword
=
"key
word
"
;
static
String
stu_id
=
"last__stu_id"
;
static
String
sup_id
=
"last__sup_id"
;
static
String
db_version
=
"db_version"
;
}
/**
...
...
@@ -51,18 +52,14 @@ public class Device extends SQLiteOpenHelper {
*
* @param context the context of the activity
* @param factory null
* @param version 1
*/
public
Device
(
Context
context
,
CursorFactory
factory
,
int
version
)
{
super
(
context
,
DeviceHelper
.
getDBName
(
context
),
factory
,
version
)
;
super
(
context
,
DeviceHelper
.
getDBName
(
context
),
factory
,
context
.
getSharedPreferences
(
PREFS_NAME
,
0
).
getInt
(
PARAMS
.
db_version
,
version
));
this
.
context
=
context
;
if
(
DeviceHelper
.
force_create
(
context
))
{
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Forcing create new Database "
+
DeviceHelper
.
getDBName
(
context
)+
" v."
+
DeviceHelper
.
getDBVersion
(
context
));
context
.
deleteDatabase
(
DeviceHelper
.
getDBName
(
context
));
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Database dropped"
);
}
this
.
context
=
context
;
}
/**
...
...
@@ -70,7 +67,14 @@ public class Device extends SQLiteOpenHelper {
*
*/
private
void
setParam
(
String
param
,
String
value
)
{
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
setParam
(
this
.
getWritableDatabase
(),
param
,
value
);
}
/**
* Set the value of a param.
*
*/
private
void
setParam
(
SQLiteDatabase
db
,
String
param
,
String
value
)
{
db
.
beginTransaction
();
ContentValues
values
=
new
ContentValues
(
2
);
values
.
put
(
"key"
,
param
);
...
...
@@ -88,18 +92,19 @@ public class Device extends SQLiteOpenHelper {
* @return value of key param
*/
public
String
getParamValue
(
String
key
)
{
SQLiteDatabase
db
=
this
.
getReadableDatabase
();
SQLiteDatabase
db
=
this
.
getReadableDatabase
();
String
value
;
Cursor
cursor
=
db
.
query
(
"params"
,
new
String
[]{
"value"
},
"key=?"
,
new
String
[]{
key
},
null
,
null
,
null
,
null
);
if
(
cursor
.
getCount
()
==
0
){
value
=
null
;
Log
.
e
(
this
.
getClass
().
getCanonicalName
()
,
"Error when getting param "
+
key
);
Log
.
e
(
LOG_TAG
,
"Error when getting param "
+
key
);
}
else
{
cursor
.
moveToFirst
();
value
=
cursor
.
getString
(
0
);
}
//db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ
cursor
.
close
();
return
value
;
}
...
...
@@ -337,8 +342,7 @@ public class Device extends SQLiteOpenHelper {
* delete the list of images (students, supervisors, pictograms) which are no longer used
*/
public
void
deleteDeprecatedImgs
()
{
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
Cursor
cursor
=
db
.
query
(
"deprecated_images"
,
null
,
null
,
null
,
null
,
null
,
null
);
Cursor
cursor
=
this
.
getWritableDatabase
().
query
(
"deprecated_images"
,
null
,
null
,
null
,
null
,
null
,
null
);
while
(
cursor
.
moveToNext
())
{
String
type
=
cursor
.
getString
(
1
);
String
folder
=
type
.
equals
(
"stu"
)
?
Img
.
STUDENT
:
type
.
equals
(
"sup"
)
?
Img
.
SUPERVISOR
:
Img
.
VOCABULARY
;
...
...
@@ -347,7 +351,7 @@ public class Device extends SQLiteOpenHelper {
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Image file "
+
cursor
.
getString
(
1
)
+
"."
+
cursor
.
getInt
(
0
)
+
" deleted"
);
}
cursor
.
close
();
db
.
delete
(
"deprecated_images"
,
null
,
null
);
this
.
getWritableDatabase
()
.
delete
(
"deprecated_images"
,
null
,
null
);
//db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ
}
...
...
@@ -356,11 +360,11 @@ public class Device extends SQLiteOpenHelper {
* IMPORTANT: every DDL sentence has to finish with the sequence: ;--
*
* @param database picto.db helper
* @param inputStream the stream where the ddl of picto.db is depicted
* @throws IOException
*/
protected
static
void
executeSQLScript
(
SQLiteDatabase
database
,
InputStream
inputStream
)
protected
void
executeSQLScript
(
SQLiteDatabase
database
)
throws
IOException
{
InputStream
inputStream
=
DeviceHelper
.
getDBScriptStream
(
this
.
context
);
Vector
<
String
>
commands
=
new
Vector
<
String
>(
50
);
BufferedReader
r
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
));
...
...
@@ -377,7 +381,8 @@ public class Device extends SQLiteOpenHelper {
r
.
close
();
for
(
String
sqlStatement
:
commands
)
database
.
execSQL
(
sqlStatement
);
Log
.
i
(
Device
.
class
.
getName
(),
"Database created"
);
setParam
(
database
,
PARAMS
.
db_version
,
Integer
.
toString
(
DeviceHelper
.
getDBVersion
(
context
)));
Log
.
i
(
Device
.
class
.
getName
(),
"Database v."
+
DeviceHelper
.
getDBVersion
(
context
)+
" created!"
);
}
/**
...
...
@@ -415,7 +420,7 @@ public class Device extends SQLiteOpenHelper {
@Override
public
void
onCreate
(
SQLiteDatabase
db
)
throws
RuntimeException
{
try
{
executeSQLScript
(
db
,
DeviceHelper
.
getDBScriptStream
(
this
.
context
)
);
executeSQLScript
(
db
);
Img
.
mkDirs
(
this
.
context
);
copyCoreVocabulary
();
}
catch
(
java
.
io
.
IOException
io
)
{
...
...
@@ -481,7 +486,7 @@ public class Device extends SQLiteOpenHelper {
try
{
Log
.
i
(
LOG_TAG
,
"Upgrading db from "
+
oldVersion
+
" to "
+
newVersion
);
executeSQLScript
(
db
,
DeviceHelper
.
getDBScriptStream
(
this
.
context
)
);
executeSQLScript
(
db
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"Update database ir cached Images error"
,
e
);
}
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/PCBDBHelper.java
View file @
10cf7caf
...
...
@@ -142,6 +142,55 @@ public class PCBDBHelper extends SQLiteOpenHelper {
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
return
db
.
delete
(
"action"
,
null
,
null
);
}
/**
* To insert into scene the data of scene that come from the server (Actually only insert the active scene)
* @param params example JSONObject{
* "supervisor": 23,
* "student": 105,
* "id": 135,
* "name": "sin",
* "active": true,
* "categories": false,
* "pictos": [.....] Pictos of that scene
*/
public
void
setActiveSceneForStudent
(
JSONObject
params
){
try
{
String
sql_scene
=
"INSERT OR REPLACE INTO scene VALUES ("
+
params
.
getInt
(
"id"
)
+
","
+
params
.
getInt
(
"supervisor"
)
+
","
+
params
.
get
(
"student"
)
+
",'"
+
params
.
getString
(
"name"
)
+
"','"
+
params
.
getBoolean
(
"active"
)
+
"','"
+
params
.
getBoolean
(
"categories"
)
+
"')"
;
Log
.
i
(
LOG_TAG
,
"Scene to be inserted: "
+
sql_scene
);
getWritableDatabase
().
execSQL
(
sql_scene
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
LOG_TAG
,
"Error setting active scene:"
+
e
.
getMessage
());
}
Cursor
cursor
=
getReadableDatabase
().
rawQuery
(
"SELECT * FROM scene"
,
null
);
Log
.
i
(
LOG_TAG
,
"tam scen: "
+
cursor
.
getCount
());
cursor
.
close
();
}
/**
* Return the active scene for an student (Actually only find by id_stu cause table scene means activeScene of the student)
* @param id_stu
* @return
*/
public
int
getActiveSceneForStudent
(
int
id_stu
){
SQLiteDatabase
db
=
this
.
getReadableDatabase
();
Cursor
cursor
=
db
.
rawQuery
(
"SELECT id FROM scene WHERE id_stu = "
+
id_stu
,
null
);
cursor
.
moveToFirst
();
if
(
cursor
.
getCount
()
>
0
){
return
cursor
.
getInt
(
0
);
}
return
-
1
;
}
/**
* the collection (set of pictos) of the current student
*
...
...
@@ -150,7 +199,8 @@ public class PCBDBHelper extends SQLiteOpenHelper {
public
Vocabulary
getStudentVocabulary
(
Vocabulary
vocabulary
)
throws
JSONException
{
int
id_stu
=
this
.
getCurrentUser
().
get_id_stu
();
SQLiteDatabase
db
=
this
.
getReadableDatabase
();
Cursor
cursor
=
db
.
query
(
"collection_detail"
,
null
,
"id_stu=?"
,
new
String
[]{
String
.
valueOf
(
id_stu
)},
null
,
null
,
null
,
null
);
Cursor
cursor
=
db
.
rawQuery
(
"SELECT * FROM collection_detail WHERE id_stu = "
+
id_stu
,
null
);
Log
.
i
(
LOG_TAG
,
"Local recovering "
+
cursor
.
getCount
()
+
" pictos for student "
+
id_stu
+
" from local DB"
);
cursor
.
moveToFirst
();
if
(
cursor
.
getCount
()>
0
)
do
{
...
...
@@ -163,9 +213,6 @@ public class PCBDBHelper extends SQLiteOpenHelper {
return
vocabulary
;
}
/**
* Set/update the set of pictos of the current student. Pictos which are no longer used are dropped from the DB
*
...
...
@@ -176,17 +223,18 @@ public class PCBDBHelper extends SQLiteOpenHelper {
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
int
id_stu
=
this
.
getCurrentUser
().
get_id_stu
();
int
seconds1
=
Calendar
.
getInstance
().
get
(
Calendar
.
SECOND
);
Log
.
i
(
"TAG_PRUEBAS"
,
"tamVoc to insert: "
+
vocabulary
.
size
());
db
.
delete
(
"collection"
,
"id_stu="
+
id_stu
,
null
);
int
newsize
=
0
;
ContentValues
values
=
new
ContentValues
(
5
);
ContentValues
values
=
new
ContentValues
(
6
);
values
.
put
(
"id_stu"
,
id_stu
);
db
.
beginTransaction
();
for
(
Picto
picto
:
vocabulary
)
{
//Log.e(LOG_TAG
,"inserting "+picto.get_id()+":"+picto.get_translation()+":"+picto.get_json_attrs());
Log
.
e
(
"TAG_PRUEBAS"
,
"inserting "
+
picto
.
get_id
()+
":"
+
picto
.
get_translation
()+
":"
+
picto
.
get_json_attrs
());
newsize
++;
values
.
put
(
"id_picto"
,
picto
.
get_id
());
values
.
put
(
"id_scene"
,
135
/*getActiveSceneForStudent(id_stu)*/
);
values
.
put
(
"url"
,
picto
.
get_url
());
values
.
put
(
"translation"
,
picto
.
get_translation
());
values
.
put
(
"attributes"
,
picto
.
get_json_attrs
());
...
...
@@ -194,7 +242,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
}
int
seconds2
=
Calendar
.
getInstance
().
get
(
Calendar
.
SECOND
);
Log
.
i
(
LOG_TAG
,
" Local student vocabulary updated, id:"
+
id_stu
+
", cats: "
+
vocabulary
.
size
()
+
" time:"
+
(
seconds2
-
seconds1
)
+
" secs. Size: "
+
newsize
+
" read only?"
+
db
.
isReadOnly
());
//
Log.i(LOG_TAG, " Local student vocabulary updated, id:" + id_stu + ", cats: " + vocabulary.size() + " time:" + (seconds2 - seconds1) + " secs. Size: " + newsize + " read only?" + db.isReadOnly());
db
.
setTransactionSuccessful
();
db
.
endTransaction
();
//db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ
...
...
@@ -212,6 +260,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
ContentValues
values
=
new
ContentValues
(
6
);
values
.
put
(
"id_stu"
,
id_stu
);
values
.
put
(
"id_picto"
,
picto
.
get_id
());
//values.put("id_scene",picto.get_scene());
values
.
put
(
"url"
,
picto
.
get_url
());
values
.
put
(
"translation"
,
picto
.
get_translation
());
values
.
put
(
"attributes"
,
picto
.
get_json_attrs
());
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/User.java
View file @
10cf7caf
...
...
@@ -256,6 +256,16 @@ public class User {
}
/**
* Change the value wich knows if the user has categories or not
*/
public
void
set_has_categories
(
boolean
categories
){
try
{
this
.
attributes_stu
.
put
(
JSON_STUDENT_ATTTRS
.
CATEGORIES
,
true
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
/**
*
* @return input feedback of the student configuration (default: "vibration")
*/
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
View file @
10cf7caf
...
...
@@ -175,7 +175,6 @@ public class Vocabulary implements Iterable<Picto> {
//final String picto_str = "/pictos";
final
String
picto_str
=
"/activeScene"
;
String
operation
=
PCBcontext
.
getPcbdb
().
getCurrentUser
().
get_restapi_operation_stu
()
+
picto_str
;
Log
.
i
(
"TAG_PRUEBAS"
,
"Ruta: "
+
operation
);
PCBcontext
.
getRestapiWrapper
().
ask
(
operation
,
new
RestapiWrapper
.
iRestapiListener
()
{
@Override
public
void
preExecute
()
{
...
...
@@ -190,7 +189,7 @@ public class Vocabulary implements Iterable<Picto> {
@Override
public
void
result
(
JSONObject
result
)
{
if
(
result
!=
null
)
{
Log
.
i
(
"TAG_PRUEBAS"
,
result
.
toString
());
//
Log.i("TAG_PRUEBAS",result.toString());
/* final String jpicto = "picto";
final String jid = "id";
final String juri = "uri";
...
...
@@ -199,8 +198,8 @@ public class Vocabulary implements Iterable<Picto> {
JSONObject
picto
,
attributes
;
JSONObject
stupicto
=
null
;
try
{
PCBcontext
.
getPcbdb
().
getCurrentUser
().
set_has_categories
(
result
.
getBoolean
(
"categories"
));
JSONArray
stu_pictos
=
result
.
getJSONArray
(
"pictos"
);
//Obtengo el JSONArray de los pictos
Log
.
i
(
"TAG_PRUEBAS"
,
stu_pictos
.
toString
());
Picto
[]
pictos
=
new
Picto
[
stu_pictos
.
length
()];
for
(
int
i
=
0
;
i
<
stu_pictos
.
length
();
i
++)
{
...
...
@@ -213,9 +212,11 @@ public class Vocabulary implements Iterable<Picto> {
attributes
);
}
synchronizeImgs
(
pictos
);
if
(
PCBcontext
.
is_user_logged
())
//HASTA AQUI BIEN
if
(
PCBcontext
.
is_user_logged
())
{
PCBcontext
.
getPcbdb
().
setStudentVocabulary
(
Vocabulary
.
this
);
else
PCBcontext
.
getPcbdb
().
setActiveSceneForStudent
(
result
);
//Aqui inserto en scene los datos que llegan de la activa
}
else
Log
.
i
(
this
.
getClass
().
getName
(),
"Downloaded images ended when the user comes to logout"
);
Log
.
i
(
this
.
getClass
().
getName
(),
" Pictos downloaded: "
+
result
.
length
());
}
catch
(
JSONException
e
)
{
...
...
@@ -255,19 +256,20 @@ public class Vocabulary implements Iterable<Picto> {
Vector
<
Img
>
imgs
=
new
Vector
<
Img
>(
updated_collection
.
length
);
this
.
pictos
.
clear
();
for
(
Picto
updated_picto:
updated_collection
)
{
LinkedList
<
Picto
>
pictos_cat
;
Log
.
i
(
"TAG_PRUEBAS"
,
"ID: "
+
updated_picto
.
get_id
());
//Log.i("TAG_PRUEBAS","URL: "+updated_picto.get_url
());
Picto
picto
=
new
Picto
(
updated_picto
.
get_id
(),
updated_picto
.
get_url
(),
updated_picto
.
get_translation
(),
updated_picto
.
get_json_attrs
());
if
(
pictos
.
containsKey
(
picto
.
get_category
()))
{
pictos_cat
=
pictos
.
get
(
picto
.
get_category
());
Log
.
i
(
"TAG_PRUEBAS"
,
"Tiene categoria: "
+
pictos_cat
);
}
else
{
pictos_cat
=
new
LinkedList
<>();
pictos
.
put
(
new
Integer
(
picto
.
get_category
()
),
pictos_cat
);
pictos
.
put
(
picto
.
get_category
(
),
pictos_cat
);
}
pictos_cat
.
add
(
picto
);
imgs
.
add
(
picto
);
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/VocabularyIterator.java
View file @
10cf7caf
...
...
@@ -21,13 +21,13 @@ public class VocabularyIterator implements Iterator<Picto> {
int
location
;
VocabularyIterator
(
Hashtable
<
Integer
,
LinkedList
<
Picto
>>
pictos
)
{
this
.
keys
=
pictos
.
keys
();
if
(
pictos
.
size
()>
1
)
{
if
(
pictos
.
size
()>
=
1
)
{
this
.
pictos
=
pictos
;
this
.
category
=
this
.
keys
.
nextElement
();
}
else
{
this
.
category
=-
1
;
this
.
category
=-
2
;
this
.
pictos
=
new
Hashtable
<>(
1
);
this
.
pictos
.
put
(
this
.
category
,
new
LinkedList
<
Picto
>());
}
...
...
@@ -47,7 +47,8 @@ public class VocabularyIterator implements Iterator<Picto> {
this
.
location
=
0
;
this
.
category
=
this
.
keys
.
nextElement
();
}
picto
=
pictos
.
get
(
category
).
get
(
location
++);
picto
=
pictos
.
get
(
category
).
get
(
location
++);
return
picto
;
}
...
...
android/Pictogram/commonlibrary/src/main/res/raw/pcbdb_create.sql
View file @
10cf7caf
...
...
@@ -5,7 +5,7 @@ DROP TABLE IF EXISTS params
;
--
CREATE
TABLE
params
(
key
TEXT
(
12
)
CHECK
(
key
in
(
'
serial'
,
'deviceID'
,
'last__stu_id'
,
'last__sup_id'
,
'token
'
,
'keyword'
))
UNIQUE
,
key
TEXT
(
12
)
CHECK
(
key
in
(
'
db_version'
,
'last__sup_id'
,
'last__stu_id
'
,
'keyword'
))
UNIQUE
,
value
TEXT
(
40
)
NOT
NULL
)
;
--
...
...
@@ -68,14 +68,28 @@ constraint ck_users UNIQUE(id_stu,id_sup)
)
;
--
DROP
TABLE
IF
EXISTS
scene
;
--
CREATE
TABLE
scene
(
id
INTEGER
PRIMARY
KEY
,
id_sup
INTEGER
NOT
NULL
REFERENCES
supervisor
,
id_stu
INTEGER
NOT
NULL
REFERENCES
student
,
name
TEXT
(
100
)
NOT
NULL
,
active
BOOLEAN
NOT
NULL
,
categories
BOOLEAN
NOT
NULL
)
;
--
DROP
TABLE
IF
EXISTS
collection
;
--
CREATE
TABLE
collection
(
id_stu
INTEGER
NOT
NULL
REFERENCES
student
ON
DELETE
CASCADE
,
id_picto
INTEGER
NOT
NULL
REFERENCES
picto
ON
DELETE
CASCADE
,
id_scene
INTEGER
NOT
NULL
REFERENCES
scene
ON
DELETE
CASCADE
,
attributes
VARCHAR
(
1024
),
constraint
ck_collection
UNIQUE
(
id_stu
,
id_picto
,
attributes
)
constraint
ck_collection
UNIQUE
(
id_stu
,
id_picto
,
id_scene
)
)
;
--
...
...
@@ -143,7 +157,7 @@ DROP VIEW IF EXISTS collection_detail
;
--
CREATE
VIEW
collection_detail
AS
SELECT
id_stu
,
id_picto
,
b
.
url
,
translation
,
attributes
SELECT
id_stu
,
id_picto
,
id_scene
,
b
.
url
,
translation
,
attributes
FROM
collection
a
,
picto
b
WHERE
a
.
id_picto
=
b
.
id
;
--
...
...
@@ -344,6 +358,6 @@ INSTEAD OF INSERT ON collection_detail
FOR
EACH
ROW
BEGIN
INSERT
OR
REPLACE
INTO
picto
VALUES
(
NEW
.
id_picto
,
NEW
.
url
,
NEW
.
translation
);
INSERT
INTO
collection
VALUES
(
NEW
.
id_stu
,
NEW
.
id_picto
,
NEW
.
attributes
);
INSERT
INTO
collection
VALUES
(
NEW
.
id_stu
,
NEW
.
id_picto
,
NEW
.
id_scene
,
NEW
.
attributes
);
END
;
--
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/SerialActivity.java
View file @
10cf7caf
...
...
@@ -18,6 +18,7 @@ import android.widget.LinearLayout;
import
android.widget.ListView
;
import
android.widget.Toast
;
import
com.yottacode.pictogram.dao.Device
;
import
com.yottacode.pictogram.dao.User
;
import
com.yottacode.pictogram.dao.UserLogin
;
import
com.yottacode.pictogram.tabletlibrary.R
;
...
...
@@ -35,7 +36,7 @@ import java.util.Vector;
*/
public
class
SerialActivity
extends
Activity
{
public
static
final
String
PREFS_NAME
=
"MyPrefsFile"
;
// String constant for logs
private
final
String
LOG_TAG
=
this
.
getClass
().
getSimpleName
();
// Or .getCanonicalName()
...
...
@@ -56,7 +57,7 @@ public class SerialActivity extends Activity {
String
password
=
intent
.
getStringExtra
(
"switch_pwd"
);
if
(
username
==
null
||
password
==
null
)
{
SharedPreferences
settings
=
getSharedPreferences
(
PREFS_NAME
,
0
);
SharedPreferences
settings
=
getSharedPreferences
(
Device
.
PREFS_NAME
,
0
);
username
=
settings
.
getString
(
"username"
,
""
);
password
=
settings
.
getString
(
"password"
,
""
);
}
...
...
@@ -92,7 +93,7 @@ public class SerialActivity extends Activity {
toast
.
show
();
}
else
{
SharedPreferences
settings
=
getSharedPreferences
(
PREFS_NAME
,
0
);
SharedPreferences
settings
=
getSharedPreferences
(
Device
.
PREFS_NAME
,
0
);
SharedPreferences
.
Editor
editor
=
settings
.
edit
();
editor
.
putString
(
"username"
,
supUsers
.
elementAt
(
position
).
get_email_sup
());
editor
.
putString
(
"password"
,
supUsers
.
elementAt
(
position
).
get_pwd_sup
());
...
...
@@ -126,7 +127,7 @@ public class SerialActivity extends Activity {
listaStu
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
SharedPreferences
settings
=
getSharedPreferences
(
PREFS_NAME
,
0
);
SharedPreferences
settings
=
getSharedPreferences
(
Device
.
PREFS_NAME
,
0
);
SharedPreferences
.
Editor
editor
=
settings
.
edit
();
editor
.
putString
(
"username"
,
stuUsers
.
elementAt
(
position
).
get_nickname_stu
());
editor
.
putString
(
"password"
,
stuUsers
.
elementAt
(
position
).
get_pwd_stu
());
...
...
@@ -165,7 +166,7 @@ public class SerialActivity extends Activity {
String
username
=
mSerialViewMail
.
getText
().
toString
();
String
password
=
mSerialViewPass
.
getText
().
toString
();
SharedPreferences
settings
=
getSharedPreferences
(
PREFS_NAME
,
0
);
SharedPreferences
settings
=
getSharedPreferences
(
Device
.
PREFS_NAME
,
0
);
SharedPreferences
.
Editor
editor
=
settings
.
edit
();
editor
.
putString
(
"username"
,
username
);
editor
.
putString
(
"password"
,
password
);
...
...
sails/src/assets/app/i18n/en-gb.json
View file @
10cf7caf
...
...
@@ -189,10 +189,11 @@
"licenses"
:
"Licenses"
,
"license_already_activated"
:
"License already activated"
,
"license_created"
:
"License created"
,
"license_expires"
:
"License expires on "
,
"license_expired"
:
"License expired on "
,
"license_expires"
:
"PRO license expires on "
,
"license_expired"
:
"PRO license expired, you can"
,
"license_expired_renew"
:
"renew it"
,
"license_invalid"
:
"Invalid license number"
,
"license_missing"
:
"Account without license"
,
"license_missing"
:
"Account without
PRO
license"
,
"license_number"
:
"License number"
,
"license_pro"
:
"Pictogram PRO license"
,
"license_warning"
:
"Only available for professional licenses (Pictogram Pro)."
,
...
...
sails/src/assets/app/i18n/es-es.json
View file @
10cf7caf
...
...
@@ -189,14 +189,15 @@
"licenses"
:
"Licencias"
,
"licenses_left"
:
"{{number}} licencias disponibles"
,
"license_already_activated"
:
"Licencia ya activada previamente"
,
"license_expires"
:
"La licencia expira el "
,
"license_expired"
:
"La licencia expiró el "
,
"license_expires"
:
"La licencia PRO expira el "
,
"license_expired"
:
"La licencia PRO expiró, puede"
,
"license_expired_renew"
:
"renovarla"
,
"license_created"
:
"Licencia creada"
,
"license_invalid"
:
"Licencia inválida"
,
"license_number"
:
"Número de licencia"
,
"license_pro"
:
"Licencia Pictogram PRO"
,
"license_warning"
:
"Sólo disponible para licencias profesionales (Pictogram Pro)."
,
"license_missing"
:
"Cuenta sin licencia"
,
"license_missing"
:
"Cuenta sin licencia
PRO
"
,
"licenses_created"
:
"Licencias creadas"
,
"light_up"
:
"Iluminar"
,
"link"
:
"Vincular"
,
...
...
sails/src/assets/scripts/modules/student/views/instructions.html
View file @
10cf7caf
...
...
@@ -29,11 +29,13 @@
<!-- END select to add new method -->
<!-- Method instructions -->
<div
class=
"method
_details
"
ng-repeat=
"m in methods"
>
<div
class=
"method"
ng-repeat=
"m in methods"
>
<div
class=
"method-header"
>
<input
type=
"text"
class=
"editable title"
ng-model=
"m.name "
ng-blur=
"update_method(m)"
/>
<div
class=
"method-header-options"
>
<div
class=
"col-sm-6"
>
<input
type=
"text"
class=
"editable title"
ng-model=
"m.name "
ng-blur=
"update_method(m)"
/>
</div>
<div
class=
"col-sm-6 text-right"
>
<a
ng-click=
"save_as_template(m)"
popover=
"{{ 'save_as_template' | translate}}"
popover-trigger=
"mouseenter"
><span
class=
"text_medium color_black glyphicon glyphicon-floppy-disk options-button"
aria-hidden=
"true"
></span></a>
<a
ng-click=
"delete_method(m)"
popover=
"{{ 'delete' | translate}}"
popover-trigger=
"mouseenter"
><span
class=
"text_medium delete color_red glyphicon glyphicon-remove-circle options-button"
aria-hidden=
"true"
></span></a>
</div>
...
...
@@ -57,19 +59,19 @@
<td>
<a
ng-click=
"open_instruction(i)"
><span
class=
"glyphicon glyphicon-file text_medium"
aria-hidden=
"true"
></span></a>
</td>
<td><input
class=
"editable"
type=
"text"
ng-model=
"i.name"
ng-blur=
"update_instruction(i)"
/></td>
<td><input
class=
"editable"
type=
"text"
ng-model=
"i.name"
ng-blur=
"update_instruction(i)"
/></td>
<td><input
class=
"elipsis editable"
type=
"text"
ng-model=
"i.objective"
ng-blur=
"update_instruction(i)"
/></td>
<td
class=
"editable"
>
<div
class=
"text-center"
>
<span
class=
"color_blue"
>
{{ i.begin | date:"dd-MM-yyyy" }}
</span>
<br
/
>
<br>
{{ i.begin | date:"HH:mm:ss" }}
</div>
</td>
<td
class=
"editable"
>
<div
class=
"text-center"
ng-class=
"{ color_green : i.id == m.last_ins }"
>
<span
ng-class=
"{ color_green : i.id == m.last_ins, color_blue : i.id != m.last_ins }"
>
{{ i.end | date:"dd-MM-yyyy" }}
</span>
<br
/
>
<br>
{{ i.end | date:"HH:mm:ss" }}
</div>
</td>
...
...
@@ -82,7 +84,11 @@
'glyphicon-minus': i.status == null
}"
aria-hidden=
"true"
popover=
"{{(i.status || 'nobegin') | translate}}"
popover-trigger=
"mouseenter"
ng-click=
"change_status(i)"
></span>
</td>
<td><a
confirmed-click=
"delete_instruction(i);"
ng-confirm-click=
"{{ 'confirmation' | translate}}"
class=
"delete_instruction"
><span
class=
"text_medium delete color_red glyphicon glyphicon-remove-circle options-button"
aria-hidden=
"true"
></span></a></td>
<td>
<a
confirmed-click=
"delete_instruction(i);"
ng-confirm-click=
"{{ 'confirmation' | translate}}"
class=
"delete_instruction"
>
<span
class=
"text_medium delete color_red glyphicon glyphicon-remove-circle options-button"
aria-hidden=
"true"
></span>
</a>
</td>
</tr>
</table>
...
...
@@ -93,7 +99,7 @@
</a>
</p>
</div>
<!-- Fin de .method
_details
-->
<!-- Fin de .method -->
</div>
...
...
sails/src/assets/scripts/modules/student/views/setup.html
View file @
10cf7caf
...
...
@@ -55,10 +55,10 @@
<i
class=
"fa fa-info-circle"
aria-hidden=
"true"
></i>
{{ 'license_expires' | translate }} {{ studentData.expiration_date }}
</div>
<div
ng-show=
"studentData.license && studentData.license_expired"
class=
"alert alert-warning"
role=
"alert"
>
<i
class=
"fa fa-exclamation-circle"
aria-hidden=
"true"
></i>
{{ 'license_expired' | translate }}
{{ studentData.expiration_date }}
<i
class=
"fa fa-exclamation-circle"
aria-hidden=
"true"
></i>
{{ 'license_expired' | translate }}
<a
href=
"http://pictogramweb.com/caracteristicas-de-pictogram/"
>
{{ 'license_expired_renew' | translate }}
</a>
</div>
<div
ng-show=
"!studentData.license"
class=
"alert alert-danger"
role=
"alert"
>
<i
class=
"fa fa-exclamation-circle"
aria-hidden=
"true"
></i>
{{ 'license_missing' | translate }}
<i
class=
"fa fa-exclamation-circle"
aria-hidden=
"true"
></i>
{{ 'license_missing' | translate }}
.
<a
href=
"http://pictogramweb.com/caracteristicas-de-pictogram/"
>
{{ 'more_info' | translate }}
</a>
</div>
<!-- VERSION SOLO TEXTO
<span ng-show="studentData.license && !studentData.license_expired" class="text-info">
...
...
sails/src/assets/scripts/modules/supervisor/views/instructions.html
View file @
10cf7caf
...
...
@@ -16,15 +16,18 @@
<!-- END select to add new method -->
<!-- Method instructions -->
<div
class=
"method_details
"
ng-repeat=
"m in methods"
>
<div
class=
"method
"
ng-repeat=
"m in methods"
>
<input
type=
"text"
class=
"editable title"
ng-model=
"m.name "
ng-blur=
"update_method(m)"
/>
<div
class=
"method-header"
>
<div
class=
"col-sm-6"
>
<input
type=
"text"
class=
"editable title"
ng-model=
"m.name "
ng-blur=
"update_method(m)"
/>
</div>
<div
class=
"col-sm-6 text-right"
>
<a
ng-click=
"delete_method(m)"
popover=
"{{ 'delete' | translate}}"
popover-trigger=
"mouseenter"
><span
class=
"text_medium delete color_red glyphicon glyphicon-remove-circle options-button"
aria-hidden=
"true"
></span></a>
</div>
</div>
<div
class=
"options"
>
<a
ng-click=
"delete_method(m)"
popover=
"{{ 'delete' | translate}}"
popover-trigger=
"mouseenter"
><span
class=
"text_medium delete color_red glyphicon glyphicon-remove-circle"
aria-hidden=
"true"
></span></a>
</div>
<textarea
class=
"editable"
ng-model=
"m.description "
placeholder=
"{{'description' | translate}}"
ng-blur=
"update_method(m)"
></textarea>
<textarea
class=
"editable"
ng-model=
"m.description "
placeholder=
"{{'description' | translate}}"
ng-blur=
"update_method(m)"
></textarea>
<!-- Tabla método -->
<table
class=
"table_instructions table"
>
...
...
@@ -36,7 +39,7 @@
<tr
ng-repeat=
"i in m.metainstructions"
>
<td><input
class=
"editable"
type=
"text"
ng-model=
"i.name"
ng-blur=
"update_instruction(i)"
/></td>
<td><input
class=
"elipsis editable"
type=
"text"
ng-model=
"i.objective"
ng-blur=
"update_instruction(i)"
/></td>
<td><a
confirmed-click=
"delete_instruction(i);"
ng-confirm-click=
"{{ 'confirmation' | translate}}"
class=
"delete_instruction"
><span
class=
"text_medium delete color_red glyphicon glyphicon-remove-circle"
aria-hidden=
"true"
></span></a></td>
<td><a
confirmed-click=
"delete_instruction(i);"
ng-confirm-click=
"{{ 'confirmation' | translate}}"
class=
"delete_instruction"
><span
class=
"text_medium delete color_red glyphicon glyphicon-remove-circle
options-button
"
aria-hidden=
"true"
></span></a></td>
</tr>
</table>
...
...
@@ -47,7 +50,7 @@
</a>
</p>
</div>
<!-- Fin de .method
_details
-->
<!-- Fin de .method -->
</div>
...
...
sails/src/assets/styles/main.css
View file @
10cf7caf
...
...
@@ -264,9 +264,10 @@ tr:hover .ops a{
border
:
1px
solid
#DDDDDD
;
border-top-left-radius
:
10px
;
border-top-right-radius
:
10px
;
min-height
:
45px
;
}
.method
_details
{
.method
{
margin-bottom
:
30px
;
}
...
...
@@ -276,9 +277,6 @@ tr:hover .ops a{
padding-top
:
2px
;
}
.method-header-options
{
float
:
right
;
}
.options-button
{
opacity
:
.2
;
}
...
...
@@ -321,7 +319,8 @@ td.editable input{
}
input
.editable
{
min-width
:
400px
;
/*min-width: 400px;*/
width
:
100%
;
border
:
none
;
background
:
none
;
padding
:
6px
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment