Commit 7cc915b7 by Jose Antonio

Merge remote-tracking branch 'origin/develop' into develop

parents 7ca5ab40 33561f9d
......@@ -51,6 +51,7 @@ public abstract class Action {
Log.d("TIMESTAMP-----------> ", datetime.format(currentTime));
if (PCBcontext.getPcbdb().getCurrentUser().has_supervisor()) {
jsonObject.put(param_id_sup, PCBcontext.getPcbdb().getCurrentUser().get_id_sup());
Log.i("TAG_PRUEBAS","ACTION_ID_SCENE: "+PCBcontext.getPcbdb().getCurrentUser().get_active_scene());
jsonObject.put(param_id_scene, PCBcontext.getPcbdb().getCurrentUser().get_active_scene());
}
//TODO Decidir qué almacenar con DEVICE
......
......@@ -11,6 +11,7 @@ import android.util.Log;
import com.yottacode.pictogram.R;
import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext;
import org.json.JSONException;
......
......@@ -203,7 +203,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
public Vocabulary getStudentVocabulary(Vocabulary vocabulary ) throws JSONException {
int id_stu = this.getCurrentUser().get_id_stu();
int id_scene = this.getCurrentUser().get_active_scene();
Log.i(LOG_TAG,"Active Scene: "+id_scene+" id_Stu: "+id_stu);
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM collection_detail WHERE id_stu = "+id_stu+" AND id_scene = "+id_scene,null);
......
......@@ -253,17 +253,18 @@ public class User {
* @return The id of the active scene of this student
*/
public int get_active_scene() {
try {
/*try {
return this.attributes_stu.getInt(JSON_STUDENT_ATTTRS.ID_ACTIVE_SCENE);
} catch (JSONException e) {
e.printStackTrace();
}
return 134;
//return -1;
return -1;*/
return this.id_scene_stu;
}
public void set_active_scene(int id) {
try {
this.id_scene_stu = id;
this.attributes_stu.put(JSON_STUDENT_ATTTRS.ID_ACTIVE_SCENE,id);
} catch (JSONException e) {
e.printStackTrace();
......
......@@ -182,25 +182,26 @@ public class UserLogin {
JSONObject user = result.getJSONObject(TAG_USER);
Log.i(LOG_TAG,user.toString());
int st_id_int = user.getInt(TAG_ID);
//int st_id_scene = user.getInt(TAG_ID_SCENE);
int st_id_scene = user.getInt(TAG_ID_SCENE);
String st_name = user.getString(TAG_NAME);
String st_surname = user.getString(TAG_SURNAME);
String st_pic = user.getString(TAG_PIC);
String st_gender = user.getString(TAG_GENDER);
String st_lang = user.getString(TAG_LANG);
String st_attributes = user.getString(TAG_ATTRIBUTES);
set_student_oline(
new User(st_id_int,
username,
password,
st_name,
st_surname,
134/*st_id_scene*/,
st_pic,
st_gender,
st_lang,
st_attributes,
User.NO_SUPERVISOR, "", "", "", "", "", "M", "es-es", "", "")
User newStu = new User(st_id_int,
username,
password,
st_name,
st_surname,
st_id_scene,
st_pic,
st_gender,
st_lang,
st_attributes,
User.NO_SUPERVISOR, "", "", "", "", "", "M", "es-es", "", "");
newStu.set_active_scene(st_id_scene);
set_student_oline(newStu
, result.getString(TAG_TOKEN)
, pictogramActivity, activity);
} catch (JSONException e) {
......
......@@ -96,7 +96,7 @@ public class Vocabulary implements Iterable<Picto> {
JSONObject attrs_picto = args.getJSONObject("attributes");
attrs_picto.put(Picto.JSON_ATTTRS.STUPICTO_ID,args.getInt("id"));
Picto newPicto=new Picto(picto_id, uri, attrs_picto);
Picto prev_picto=/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()
Picto prev_picto=PCBcontext.getVocabulary().has_categories()
? find_picto(newPicto.get_category(), newPicto.get_row(),newPicto.get_column())
: find_picto(newPicto.getFreeRow(),newPicto.getFreeColumn());
......
......@@ -164,7 +164,6 @@ public class PictoUploader {
e.printStackTrace();
Log.e(LOG_TAG, " Error: " + e.getLocalizedMessage());
}
Log.i(LOG_TAG,"Uploading attributes ");
PictoUploader.this.picto.set_local_status(false);
PCBcontext.getRestapiWrapper().ask(PCBcontext.getPcbdb().getCurrentUser().get_restapi_operation_stu() + "/picto/"+id_picto, params, "post", true, new RestapiWrapper.iRestapiListener() {
@Override
......@@ -325,7 +324,6 @@ public class PictoUploader {
params.put("id_stu", Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_id_stu()));
//params.put("id_pic", Integer.toString(this.picto.get_id()));
//params.put("id_scene" , Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_active_scene()));
params.put("id_stuPicto", Integer.toString(this.picto.get_stupicto_id()));
Log.i(LOG_TAG, "Picto "+ this.picto.get_id()+" stupicto id:"+this.picto.get_stupicto_id()+" Uploading " + params.toString());
PCBcontext.getRestapiWrapper().ask(
......
......@@ -41,13 +41,13 @@ public class StudentTalk implements Emitter.Listener {
String username=msg.getString("username");
String name=msg.getString("name");
String surname=msg.getString("surname");
//int id_active_scene = msg.getInt("id_active_scene");
String gender=msg.getString("gender");
String pic=msg.getString("pic");
String lang=msg.getString("lang");
String attributes=msg.getString("attributes");
User user=PCBcontext.getPcbdb().getCurrentUser();
//TODO: Obtener el id de la scene del JSONObject en lugar de poner 134
User updatedUser=new User(id, username, user.get_pwd_stu(), name, surname,134, pic, gender, lang, attributes,
User updatedUser=new User(id, username, user.get_pwd_stu(), name, surname,user.get_active_scene(), pic, gender, lang, attributes,
user.get_id_sup(), user.get_email_sup(), user.get_pwd_sup(), user.get_name_sup(), user.get_surname_sup(), user.get_url_img_sup(), user.get_gender_sup(),
user.get_lang_sup(), user.get_tts_engine_sup(), user.get_office());
Log.i(this.getClass().getName(), "Attributes" +attributes+" listeners:"+listeners.length);
......
......@@ -53,7 +53,7 @@ public class VocabularyTalk implements Emitter.Listener {
JSONObject picto_stupicto = stu_picto.optJSONObject(param_picto);
int picto_id = picto_stupicto.getInt(param_picto_id);
int picto_cat = attrs_stu_picto!=null ? attrs_stu_picto.optInt(param_picto_cat, Picto.NO_CATEGORY) : 0;
/*TODO: if(PCBcontext.getVocabulary().getId_scene() == msg.get("id_scene")) {*/
if(PCBcontext.getVocabulary().getId_scene() == msg.getJSONObject("attributes").getInt("id_scene")) {
PCBcontext.getNetService().nextSynchro(new Date().getTime() + PCBcontext.getNetService().getSynchroTimingLength() * 2); //nos saltamos una sincronización para evitar que llegue antes que los websockets
Log.i(LOG_TAG, "Received message '" + action +
"' for picto " + picto_id + " (cat " + picto_cat + ", picto: " + picto_stupicto);
......@@ -63,7 +63,7 @@ public class VocabularyTalk implements Emitter.Listener {
: action.equals(action_add) ? iVocabularyListener.action.add
: iVocabularyListener.action.delete
, picto_cat, picto_id, stu_picto);
//}
}
} catch (JSONException e) {
Log.e(LOG_TAG, e.getClass().getCanonicalName() + "--" + e);
}
......
......@@ -77,10 +77,13 @@ public final class PCBcontext {
@Override
public void change(User updatedStudent) {
PCBcontext.getDevice().insertUser(updatedStudent);
Log.i("TAG_PRUEBAS","ID_SCENE_VOCAB: "+PCBcontext.getVocabulary().getId_scene()+
"ID_SCENE_USER: "+PCBcontext.getPcbdb().getCurrentUser().get_active_scene());
if (updatedStudent.is_picto_size_big()!=getPcbdb().getCurrentUser().is_picto_size_big() || PCBcontext.getVocabulary().has_categories() != vocabulary.has_categories()
|| PCBcontext.getVocabulary().getId_scene()!= PCBcontext.getPcbdb().getCurrentUser().get_active_scene())
|| PCBcontext.getVocabulary().getId_scene()!= PCBcontext.getPcbdb().getCurrentUser().get_active_scene()) {
PCBcontext.getNetService().restart_app(false);
else {
}else {
PCBcontext.getPcbdb().setCurrentUser(updatedStudent);
PCBcontext.getNetService().getNetServiceDevice().updateUserConfig(updatedStudent);
}
......
......@@ -93,15 +93,18 @@ public class StudentFragmentGrid extends Fragment{
private void new_user(int i) {
JSONObject st = this.downloaded_students.get(i);
Intent intent = getActivity().getIntent();
try {
Log.i(LOG_TAG,st.toString());
PCBcontext.getPcbdb();
User new_user = new User(
st.getInt(TAG_ID),
st.getString(TAG_USERNAME),
null,
st.getString(TAG_NAME),
st.getString(TAG_SURNAME),
105/*st.getInt(TAG_ID_SCENE)*/,
st.getInt(TAG_ID_SCENE),
st.getString(TAG_PIC),
st.getString(TAG_GENDER),
st.getString(TAG_LANG),
......
......@@ -51,28 +51,45 @@
<label translate>license_number</label>
<input type="text" id="setup_license" class="form-control" mask="wwww-wwww-wwww-wwww" clean="true" placeholder="{{ 'license_number' | translate }}" ng-model="formUser.license_number" required>
<!-- With license -->
<div ng-show="studentData.license && !studentData.license_expired" class="alert alert-info" role="alert">
<i class="fa fa-info-circle" aria-hidden="true"></i> {{ 'license_expires' | translate }} {{ studentData.expiration_date }}
<div class="row">
<div class="col-xs-2"><i class="fa fa-info-circle fa-lg" aria-hidden="true"></i></div>
<div class="col-xs-10">
<h4 class="alert-heading"> {{ 'license_expires' | translate }} <b>{{ studentData.expiration_date }}</b> </h4>
</div>
</div>
</div>
<!-- License expired -->
<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 }} <a href="http://pictogramweb.com/caracteristicas-de-pictogram/">{{ 'license_expired_renew' | translate }}</a>
<div class="row">
<div class="col-xs-2"><i class="fa fa-exclamation-circle fa-lg" aria-hidden="true"></i></div>
<div class="col-xs-10">
<h4 class="alert-heading"> {{ 'license_expired' | translate }} </h4>
<p>
<a href="http://pictogramweb.com/caracteristicas-de-pictogram/">{{ 'license_expired_renew' | translate }}</a>
</p>
</div>
</div>
</div>
<!-- No license -->
<div ng-show="!studentData.license" class="alert alert-danger" role="alert">
<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 class="row">
<div class="col-xs-2"><i class="fa fa-exclamation-circle fa-lg" aria-hidden="true"></i></div>
<div class="col-xs-10">
<h4 class="alert-heading"> {{ 'license_missing' | translate }} </h4>
<p>
<a href="http://pictogramweb.com/caracteristicas-de-pictogram/">{{ 'more_info' | translate }}</a>
</p>
</div>
</div>
</div>
<!-- VERSION SOLO TEXTO
<span ng-show="studentData.license && !studentData.license_expired" class="text-info">
({{ 'license_expires' | translate }} {{ studentData.expiration_date }})
</span>
<span ng-show="studentData.license && studentData.license_expired" class="text-danger">
({{ 'license_expired' | translate }} {{ studentData.expiration_date }})
</span>
<span ng-show="!studentData.license" class="text-danger">
({{ 'license_missing' | translate }})
</span>
-->
</div>
</fieldset>
</div>
</div>
......
......@@ -39,8 +39,8 @@
</div>
</td>
<td>
<span ng-show="!student.licenseIsValid" class="license-warning text-danger glyphicon glyphicon-exclamation-sign" aria-hidden="true" popover="{{ 'license_missing' | translate}}" popover-trigger="mouseenter"></span>
<i ng-show="student.licenseIsValid" class="fa fa-certificate license-warning text-primary" aria-hidden="true" popover="{{ 'license_pro' | translate}}" popover-trigger="mouseenter"></i>
<i ng-show="!student.licenseIsValid" class="fa fa-exclamation-circle fa-lg text-danger license-warning" aria-hidden="true" popover="{{ 'license_missing' | translate}}" popover-trigger="mouseenter"></i>
<i ng-show="student.licenseIsValid" class="fa fa-certificate fa-lg text-primary license-warning" aria-hidden="true" popover="{{ 'license_pro' | translate}}" popover-trigger="mouseenter"></i>
</td>
<td>
<h4>{{student.surname}}, {{student.name}}</h4>
......@@ -72,7 +72,7 @@
</td> <!-- /BUTTONS -->
<td>
<a ng-if="user.isSupAdmin" ng-click="delete_student(student)" class="delete_stu" title="{{ 'delete' | translate}}">
<span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span>
<span class="glyphicon glyphicon-remove-circle text-danger" aria-hidden="true"></span>
</a>
</td>
</tr>
......
......@@ -834,7 +834,7 @@ img.profile{
}
.delete_tutor, .delete_sup, .delete_device, .delete_stu{
visibility: hidden;
opacity: .2;
float: right;
}
......@@ -843,16 +843,20 @@ img.profile{
margin-top: 4px;
}
.delete_stu, .license-warning{
.delete_stu{
font-size: 18px;
margin-top: 10px;
}
.license-warning{
margin-top: 10px;
}
#user_tutors .list-group-item:hover .delete_tutor,
#user_sups .list-group-item:hover .delete_sup,
#table_students tr:hover .delete_stu{
visibility: visible;
opacity: 1;
}
label.student_setup{
......
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