Commit e587d51f by Sebastián Collado Montañez

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

parents 7a78c9d1 ef5d94ba
...@@ -81,6 +81,8 @@ public class PCBDBHelper extends SQLiteOpenHelper { ...@@ -81,6 +81,8 @@ public class PCBDBHelper extends SQLiteOpenHelper {
Log.e(LOG_TAG, e.getMessage() + " BAD FORMED JSON: " + cursor.getString(5)); Log.e(LOG_TAG, e.getMessage() + " BAD FORMED JSON: " + cursor.getString(5));
System.exit(-1); System.exit(-1);
} }
}else{
Log.e(LOG_TAG,"NO HAY USER EN USER DETAIL CON ESE ID: "+sup);
} }
cursor.close(); cursor.close();
//db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ //db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ
...@@ -170,10 +172,6 @@ public class PCBDBHelper extends SQLiteOpenHelper { ...@@ -170,10 +172,6 @@ public class PCBDBHelper extends SQLiteOpenHelper {
e.printStackTrace(); e.printStackTrace();
Log.e(LOG_TAG,"Error setting active scene:"+e.getMessage()); 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();*/
} }
/** /**
......
...@@ -59,8 +59,6 @@ public class Picto extends Img { ...@@ -59,8 +59,6 @@ public class Picto extends Img {
public static String LEGEND = "legend"; public static String LEGEND = "legend";
public static String URI_SOUND = "uri_sound"; public static String URI_SOUND = "uri_sound";
public static String USER_AVATAR = "user_avatar"; public static String USER_AVATAR = "user_avatar";
//public static String SCENE = "scene";
} }
public final static class JSON_ATTTR_LEGEND_VALUES { public final static class JSON_ATTTR_LEGEND_VALUES {
...@@ -110,7 +108,6 @@ public class Picto extends Img { ...@@ -110,7 +108,6 @@ public class Picto extends Img {
.put(JSON_ATTTRS.STUPICTO_ID,stupicto_id) .put(JSON_ATTTRS.STUPICTO_ID,stupicto_id)
.put(JSON_ATTTRS.EXPRESSION,translation) .put(JSON_ATTTRS.EXPRESSION,translation)
.put(JSON_ATTTRS.USER_AVATAR,user_avatar) .put(JSON_ATTTRS.USER_AVATAR,user_avatar)
/*.put(JSON_ATTTRS.SCENE,scene)*/
); );
} }
public Picto(int id, String url,String translation, String attributes) throws JSONException { public Picto(int id, String url,String translation, String attributes) throws JSONException {
...@@ -350,14 +347,6 @@ public class Picto extends Img { ...@@ -350,14 +347,6 @@ public class Picto extends Img {
/** /**
* *
* @return the id of an scene of a picto
*/
/*public int get_id_scene() throws JSONException {
return this.attributes.getInt(JSON_ATTTRS.SCENE);
}
*/
/**
*
* @return the row of the picto * @return the row of the picto
*/ */
public int get_row() { public int get_row() {
......
...@@ -30,7 +30,7 @@ public class User { ...@@ -30,7 +30,7 @@ public class User {
public final static class JSON_STUDENT_ATTTRS{ public final static class JSON_STUDENT_ATTTRS{
public enum delivery {clean, one, many} public enum delivery {clean, one, many}
static String CATEGORIES = "categories"; static String ID_ACTIVE_SCENE = "id_active_scene";
static String INPUT_FEEDBACK = "input_feedback"; static String INPUT_FEEDBACK = "input_feedback";
static String INPUT_SELECTION = "input_selection"; static String INPUT_SELECTION = "input_selection";
static String PICTOGRAM_SIZE ="size"; static String PICTOGRAM_SIZE ="size";
...@@ -247,19 +247,20 @@ public class User { ...@@ -247,19 +247,20 @@ public class User {
} }
/** /**
* * @return The id of the active scene of this student
* @return true if the collection is organized by categories (default: True)
*/ */
public boolean has_categories() { public int get_active_scene() {
return this.attributes_stu.optBoolean(JSON_STUDENT_ATTTRS.CATEGORIES, true); try {
return (int) this.attributes_stu.get(JSON_STUDENT_ATTTRS.ID_ACTIVE_SCENE);
} catch (JSONException e) {
e.printStackTrace();
}
return -1;
} }
/** public void set_active_scene(int id) {
* Change the value wich knows if the user has categories or not
*/
public void set_has_categories(boolean categories){
try { try {
this.attributes_stu.put(JSON_STUDENT_ATTTRS.CATEGORIES, categories); this.attributes_stu.put(JSON_STUDENT_ATTTRS.ID_ACTIVE_SCENE,id);
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -95,7 +95,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -95,7 +95,7 @@ public class Vocabulary implements Iterable<Picto> {
JSONObject attrs_picto = args.getJSONObject("attributes"); JSONObject attrs_picto = args.getJSONObject("attributes");
attrs_picto.put(Picto.JSON_ATTTRS.STUPICTO_ID,args.getInt("id")); attrs_picto.put(Picto.JSON_ATTTRS.STUPICTO_ID,args.getInt("id"));
Picto newPicto=new Picto(picto_id, uri, attrs_picto); Picto newPicto=new Picto(picto_id, uri, attrs_picto);
Picto prev_picto=/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().isHas_categories() Picto prev_picto=/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()
? find_picto(newPicto.get_category(), newPicto.get_row(),newPicto.get_column()) ? find_picto(newPicto.get_category(), newPicto.get_row(),newPicto.get_column())
: find_picto(newPicto.getFreeRow(),newPicto.getFreeColumn()); : find_picto(newPicto.getFreeRow(),newPicto.getFreeColumn());
...@@ -192,9 +192,9 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -192,9 +192,9 @@ public class Vocabulary implements Iterable<Picto> {
JSONObject picto, attributes; JSONObject picto, attributes;
JSONObject stupicto = null; JSONObject stupicto = null;
try { try {
//PCBcontext.getPcbdb().getCurrentUser().set_has_categories(result.getBoolean("categories"));
setHas_categories(result.getBoolean("categories")); setHas_categories(result.getBoolean("categories"));
setId_scene(result.getInt("id")); setId_scene(result.getInt("id"));
PCBcontext.getPcbdb().getCurrentUser().set_active_scene(result.getInt("id"));
JSONArray stu_pictos = result.getJSONArray("pictos"); //Obtengo el JSONArray de los pictos JSONArray stu_pictos = result.getJSONArray("pictos"); //Obtengo el JSONArray de los pictos
Picto[] pictos = new Picto[stu_pictos.length()]; Picto[] pictos = new Picto[stu_pictos.length()];
...@@ -250,7 +250,6 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -250,7 +250,6 @@ public class Vocabulary implements Iterable<Picto> {
for (Picto updated_picto: updated_collection) { for (Picto updated_picto: updated_collection) {
LinkedList<Picto> pictos_cat; LinkedList<Picto> pictos_cat;
//Log.i("TAG_PRUEBAS","URL: "+updated_picto.get_url());
Picto picto = new Picto(updated_picto.get_id(), Picto picto = new Picto(updated_picto.get_id(),
updated_picto.get_url(), updated_picto.get_url(),
updated_picto.get_translation(), updated_picto.get_translation(),
...@@ -399,7 +398,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -399,7 +398,7 @@ public class Vocabulary implements Iterable<Picto> {
* @return list of pictos which should be selectable at the beginning of a sentence. Empty categories are removed * @return list of pictos which should be selectable at the beginning of a sentence. Empty categories are removed
*/ */
public LinkedList<Picto> startSentence(){ public LinkedList<Picto> startSentence(){
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().isHas_categories()) { if (PCBcontext.getVocabulary().has_categories()) {
return this.pictos.get(new Integer(Picto.NO_CATEGORY)); return this.pictos.get(new Integer(Picto.NO_CATEGORY));
} else { } else {
LinkedList<Picto> freePictos = new LinkedList<>(); LinkedList<Picto> freePictos = new LinkedList<>();
...@@ -438,7 +437,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -438,7 +437,7 @@ public class Vocabulary implements Iterable<Picto> {
public void saveLocalPicto(String url, String exp, int cat, int coord_x, int coord_y, int free_category_coord_x, int free_category_coord_y,String user_avatar, String path_sound,final iLocalPicto listener) { public void saveLocalPicto(String url, String exp, int cat, int coord_x, int coord_y, int free_category_coord_x, int free_category_coord_y,String user_avatar, String path_sound,final iLocalPicto listener) {
Picto prev_picto=/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().isHas_categories() ? find_picto(cat, coord_x,coord_y) : find_picto(free_category_coord_x,free_category_coord_y); //¿estamos reemplazanddo un picto que ya existe? Picto prev_picto=PCBcontext.getVocabulary().has_categories() ? find_picto(cat, coord_x,coord_y) : find_picto(free_category_coord_x,free_category_coord_y); //¿estamos reemplazanddo un picto que ya existe?
if (prev_picto!=null) { //El picto ya existe if (prev_picto!=null) { //El picto ya existe
removePicto(prev_picto.get_category(),prev_picto.get_id()); //borramos el picto local actual removePicto(prev_picto.get_category(),prev_picto.get_id()); //borramos el picto local actual
...@@ -508,7 +507,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -508,7 +507,7 @@ public class Vocabulary implements Iterable<Picto> {
return vocabulary; return vocabulary;
} }
public boolean isHas_categories() { public boolean has_categories() {
return has_categories; return has_categories;
} }
......
...@@ -150,8 +150,7 @@ public class PictoUploader { ...@@ -150,8 +150,7 @@ public class PictoUploader {
JSONObject json_attrs =new JSONObject().put("status",picto.get_status()); JSONObject json_attrs =new JSONObject().put("status",picto.get_status());
if (picto.get_user_avatar()!=null) json_attrs.put(Picto.JSON_ATTTRS.USER_AVATAR,picto.get_user_avatar()); if (picto.get_user_avatar()!=null) json_attrs.put(Picto.JSON_ATTTRS.USER_AVATAR,picto.get_user_avatar());
/*json_attrs.put("scene",picto.get_id_scene());*/ if (PCBcontext.getVocabulary().has_categories())
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().isHas_categories())
json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.get_category()) json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.get_category())
.put(Picto.JSON_ATTTRS.COLUMN, picto.get_column()) .put(Picto.JSON_ATTTRS.COLUMN, picto.get_column())
.put(Picto.JSON_ATTTRS.ROW, picto.get_row()); .put(Picto.JSON_ATTTRS.ROW, picto.get_row());
...@@ -159,7 +158,7 @@ public class PictoUploader { ...@@ -159,7 +158,7 @@ public class PictoUploader {
json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.NO_CATEGORY) json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.NO_CATEGORY)
.put(Picto.JSON_ATTTRS.FREE_COLUMN, picto.getFreeColumn()) .put(Picto.JSON_ATTTRS.FREE_COLUMN, picto.getFreeColumn())
.put(Picto.JSON_ATTTRS.FREE_ROW, picto.getFreeRow()); .put(Picto.JSON_ATTTRS.FREE_ROW, picto.getFreeRow());
params.put("json", new JSONObject().put("attributes",json_attrs).put("id_scene",50).toString()); params.put("json", new JSONObject().put("attributes",json_attrs).put("id_scene",PCBcontext.getPcbdb().getActiveSceneForStudent(PCBcontext.getPcbdb().getCurrentUser().get_id_stu())).toString());
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -53,16 +53,17 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -53,16 +53,17 @@ public class VocabularyTalk implements Emitter.Listener {
JSONObject picto_stupicto = stu_picto.optJSONObject(param_picto); JSONObject picto_stupicto = stu_picto.optJSONObject(param_picto);
int picto_id = picto_stupicto.getInt(param_picto_id); int picto_id = picto_stupicto.getInt(param_picto_id);
int picto_cat = attrs_stu_picto!=null ? attrs_stu_picto.optInt(param_picto_cat, Picto.NO_CATEGORY) : 0; int picto_cat = attrs_stu_picto!=null ? attrs_stu_picto.optInt(param_picto_cat, Picto.NO_CATEGORY) : 0;
PCBcontext.getNetService().nextSynchro(new Date().getTime()+PCBcontext.getNetService().getSynchroTimingLength()*2); //nos saltamos una sincronización para evitar que llegue antes que los websockets if(PCBcontext.getVocabulary().getId_scene() == PCBcontext.getPcbdb().getCurrentUser().get_active_scene()) {
Log.i(LOG_TAG, "Received message '" + action + PCBcontext.getNetService().nextSynchro(new Date().getTime() + PCBcontext.getNetService().getSynchroTimingLength() * 2); //nos saltamos una sincronización para evitar que llegue antes que los websockets
"' for picto " + picto_id + " (cat " + picto_cat + ", picto: " + picto_stupicto); Log.i(LOG_TAG, "Received message '" + action +
for (iVocabularyListener listener: this.listeners) "' for picto " + picto_id + " (cat " + picto_cat + ", picto: " + picto_stupicto);
listener.change(action.equals(action_update) ? iVocabularyListener.action.update for (iVocabularyListener listener : this.listeners)
: action.equals(action_update_category) ? iVocabularyListener.action.update_category listener.change(action.equals(action_update) ? iVocabularyListener.action.update
: action.equals(action_add) ? iVocabularyListener.action.add : action.equals(action_update_category) ? iVocabularyListener.action.update_category
: iVocabularyListener.action.delete : action.equals(action_add) ? iVocabularyListener.action.add
, picto_cat, picto_id, stu_picto); : iVocabularyListener.action.delete
, picto_cat, picto_id, stu_picto);
}
} catch (JSONException e) { } catch (JSONException e) {
Log.e(LOG_TAG, e.getClass().getCanonicalName() + "--" + e); Log.e(LOG_TAG, e.getClass().getCanonicalName() + "--" + e);
} }
......
...@@ -77,8 +77,8 @@ public final class PCBcontext { ...@@ -77,8 +77,8 @@ public final class PCBcontext {
@Override @Override
public void change(User updatedStudent) { public void change(User updatedStudent) {
PCBcontext.getDevice().insertUser(updatedStudent); PCBcontext.getDevice().insertUser(updatedStudent);
if (updatedStudent.is_picto_size_big()!=getPcbdb().getCurrentUser().is_picto_size_big() /*|| updatedStudent.has_categories()!=getPcbdb().getCurrentUser().has_categories()*/ if (updatedStudent.is_picto_size_big()!=getPcbdb().getCurrentUser().is_picto_size_big() || PCBcontext.getVocabulary().has_categories() != vocabulary.has_categories()
|| PCBcontext.getVocabulary().isHas_categories() != vocabulary.isHas_categories() || PCBcontext.getVocabulary().getId_scene()!= vocabulary.getId_scene()) || PCBcontext.getVocabulary().getId_scene()!= PCBcontext.getPcbdb().getCurrentUser().get_active_scene())
PCBcontext.getNetService().restart_app(false); PCBcontext.getNetService().restart_app(false);
else { else {
PCBcontext.getPcbdb().setCurrentUser(updatedStudent); PCBcontext.getPcbdb().setCurrentUser(updatedStudent);
......
...@@ -82,7 +82,7 @@ public class PictoMenu { ...@@ -82,7 +82,7 @@ public class PictoMenu {
public void addPicto(int row, int col, int cat, int source) { public void addPicto(int row, int col, int cat, int source) {
//Enviar al PictogramActivity los datos necesarios para crear el picto despues //Enviar al PictogramActivity los datos necesarios para crear el picto despues
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().isHas_categories()) { if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) {
activity.getIntent().putExtra(Picto.JSON_ATTTRS.CATEGORY, cat); activity.getIntent().putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
activity.getIntent().putExtra(Picto.JSON_ATTTRS.ROW, row); activity.getIntent().putExtra(Picto.JSON_ATTTRS.ROW, row);
activity.getIntent().putExtra(Picto.JSON_ATTTRS.COLUMN, col); activity.getIntent().putExtra(Picto.JSON_ATTTRS.COLUMN, col);
...@@ -108,7 +108,7 @@ public class PictoMenu { ...@@ -108,7 +108,7 @@ public class PictoMenu {
intent.putExtra(ID_PICTO_IMAGE,id_picto); intent.putExtra(ID_PICTO_IMAGE,id_picto);
//Enviar al PictogramActivity los datos necesarios para editar el picto despues //Enviar al PictogramActivity los datos necesarios para editar el picto despues
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().isHas_categories()) { if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) {
intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, cat); intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
intent.putExtra(Picto.JSON_ATTTRS.ROW, row); intent.putExtra(Picto.JSON_ATTTRS.ROW, row);
intent.putExtra(Picto.JSON_ATTTRS.COLUMN, col); intent.putExtra(Picto.JSON_ATTTRS.COLUMN, col);
......
...@@ -41,16 +41,13 @@ import android.widget.ImageButton; ...@@ -41,16 +41,13 @@ import android.widget.ImageButton;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
import com.yottacode.net.RestapiWrapper;
import com.yottacode.pictogram.action.PictosAction; import com.yottacode.pictogram.action.PictosAction;
import com.yottacode.pictogram.action.TalkAction; import com.yottacode.pictogram.action.TalkAction;
import com.yottacode.pictogram.dao.PCBDBHelper;
import com.yottacode.pictogram.dao.Picto; import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User; import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.grammar.Vocabulary; import com.yottacode.pictogram.grammar.Vocabulary;
import com.yottacode.pictogram.grammar.iLocalPicto; import com.yottacode.pictogram.grammar.iLocalPicto;
import com.yottacode.pictogram.net.ImgDownloader; import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.net.NetService;
import com.yottacode.pictogram.net.PictoUploader; import com.yottacode.pictogram.net.PictoUploader;
import com.yottacode.pictogram.net.websockets.ActionTalk; import com.yottacode.pictogram.net.websockets.ActionTalk;
import com.yottacode.pictogram.net.websockets.VocabularyTalk; import com.yottacode.pictogram.net.websockets.VocabularyTalk;
...@@ -164,11 +161,11 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -164,11 +161,11 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() { this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() {
@Override @Override
public void action(action action, int picto_cat, int picto_id, JSONObject msg) { public void action(action action, int picto_cat, int picto_id, JSONObject msg) {
if(msg == null) /* if(msg == null)
Log.i("TAG_PRUEBAS","No viene nada de mensaje"); Log.i("TAG_PRUEBAS","No viene nada de mensaje");*/
Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched"); Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched");
if (action==ActionTalk.iActionListener.action.show) { if (action==ActionTalk.iActionListener.action.show) {
Log.i("TAG_PRUEBAS","Llega aqui"); /*Log.i("TAG_PRUEBAS","Llega aqui");
Log.i("TAG_PRUEBAS","show message received:"+msg.toString()); Log.i("TAG_PRUEBAS","show message received:"+msg.toString());
try { try {
//Log.i("TAG_PRUEBAS","show message received:"+msg.get("expression")); //Log.i("TAG_PRUEBAS","show message received:"+msg.get("expression"));
...@@ -188,7 +185,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -188,7 +185,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
fragmentTransaction.add(R.id.fragment_container, fragment, "ALERTA"); fragmentTransaction.add(R.id.fragment_container, fragment, "ALERTA");
fragmentTransaction.commit(); fragmentTransaction.commit();
mainLayout.setEnabled(false); //Desactivar el fondo mainLayout.setEnabled(false); //Desactivar el fondo*/
} }
else if (PCBcontext.getPcbdb().getCurrentUser().is_mirror_on()) { else if (PCBcontext.getPcbdb().getCurrentUser().is_mirror_on()) {
...@@ -562,7 +559,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -562,7 +559,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
Iterator<Picto> pictos=list.iterator(); Iterator<Picto> pictos=list.iterator();
while (pictos.hasNext()) { while (pictos.hasNext()) {
Picto p= pictos.next(); Picto p= pictos.next();
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().isHas_categories()) { if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) {
if (p.get_column() != -1 && p.get_row() != -1 if (p.get_column() != -1 && p.get_row() != -1
&& p.get_column() < maxRows && p.get_row() < maxColumns) { && p.get_column() < maxRows && p.get_row() < maxColumns) {
mp[p.get_column()][p.get_row()] = p; mp[p.get_column()][p.get_row()] = p;
...@@ -905,7 +902,7 @@ Log.e(LOG_TAG,"AUDIO:"+(audioFile!=null)+":"+p.get_audioPath()); ...@@ -905,7 +902,7 @@ Log.e(LOG_TAG,"AUDIO:"+(audioFile!=null)+":"+p.get_audioPath());
Picto p = getCurrentPictoGridAdapter().getItem(position); Picto p = getCurrentPictoGridAdapter().getItem(position);
if (p == null) { if (p == null) {
// No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device si no es categoria // No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device si no es categoria
if (getCurrentCategory() != null || /*!PCBcontext.getPcbdb().getCurrentUser().has_categories()*/!PCBcontext.getVocabulary().isHas_categories()) { if (getCurrentCategory() != null || /*!PCBcontext.getPcbdb().getCurrentUser().has_categories()*/!PCBcontext.getVocabulary().has_categories()) {
int cat = getCurrentCategory() != null ? currentCategory.get_id() : Picto.NO_CATEGORY; int cat = getCurrentCategory() != null ? currentCategory.get_id() : Picto.NO_CATEGORY;
new PictoMenu(PictogramActivity.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), cat); new PictoMenu(PictogramActivity.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), cat);
} else } else
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
"double_click": "Double click", "double_click": "Double click",
"down": "Down", "down": "Down",
"duplicate": "Duplicate", "duplicate": "Duplicate",
"duration_in_months": "Duration (in number of months)", "duration_in_months": "Duration (months)",
"drag": "Drag", "drag": "Drag",
"edit": "Edit", "edit": "Edit",
"email": "Email address", "email": "Email address",
...@@ -433,6 +433,7 @@ ...@@ -433,6 +433,7 @@
"unlink": "Unlink", "unlink": "Unlink",
"up": "Up", "up": "Up",
"undefined": "Undefined", "undefined": "Undefined",
"unlimited": "Unlimited",
"update_office": "Update office", "update_office": "Update office",
"update_supervisor": "Update supervisor", "update_supervisor": "Update supervisor",
"upload_image": "Upload image", "upload_image": "Upload image",
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
"double_click": "Doble clic", "double_click": "Doble clic",
"down": "Abajo", "down": "Abajo",
"duplicate": "Duplicar", "duplicate": "Duplicar",
"duration_in_months": "Duración (en número de meses)", "duration_in_months": "Duración (meses)",
"drag": "Arrastrar", "drag": "Arrastrar",
"edit": "Editar", "edit": "Editar",
"email": "Correo electrónico", "email": "Correo electrónico",
...@@ -432,6 +432,7 @@ ...@@ -432,6 +432,7 @@
"tutors": "Tutores", "tutors": "Tutores",
"undefined": "Sin definir", "undefined": "Sin definir",
"unlink": "Desvincular", "unlink": "Desvincular",
"unlimited": "Ilimitada",
"up": "Arriba", "up": "Arriba",
"update_office": "Editar gabinete", "update_office": "Editar gabinete",
"update_supervisor": "Editar supervisor", "update_supervisor": "Editar supervisor",
......
...@@ -14,6 +14,7 @@ dashboardControllers.controller('AdminLicensesCtrl', function AdminLicensesCtrl( ...@@ -14,6 +14,7 @@ dashboardControllers.controller('AdminLicensesCtrl', function AdminLicensesCtrl(
repeat: 1 repeat: 1
}; };
$scope.licenses = []; $scope.licenses = [];
$scope.unlimited_state = false;
// Get all licenses for the user // Get all licenses for the user
$http $http
...@@ -46,4 +47,12 @@ dashboardControllers.controller('AdminLicensesCtrl', function AdminLicensesCtrl( ...@@ -46,4 +47,12 @@ dashboardControllers.controller('AdminLicensesCtrl', function AdminLicensesCtrl(
$scope.duration_registered = $scope.formdatalicense.duration; $scope.duration_registered = $scope.formdatalicense.duration;
}; };
$scope.unlimited = function(){
if($scope.unlimited_state){
$scope.formdatalicense.duration=120;
}else{
$scope.formdatalicense.duration=3;
}
};
}); });
...@@ -6,33 +6,42 @@ ...@@ -6,33 +6,42 @@
<div class="col-md-5"> <div class="col-md-5">
<form role="form" ng-submit="create_licenses()"> <form role="form" ng-submit="create_licenses()">
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label translate>duration_in_months</label>
<input type="number" class="form-control" id="setup_duration" placeholder="{{ 'duration_in_months' | translate }}" ng-disabled="unlimited_state" required ng-model="formdatalicense.duration"/>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label translate>unlimited</label>
<input type="checkbox" class="checkbox" id="unlimited" placeholder="{{ 'duration_in_months' | translate }}" required ng-model="unlimited_state" ng-change="unlimited()"/>
</div>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label translate>duration_in_months</label> <label translate>how_many</label>
<input type="number" class="form-control" id="setup_duration" placeholder="{{ 'duration_in_months' | translate }}" required ng-model="formdatalicense.duration" required/> <input type="number" class="form-control" id="setup_repeat" placeholder="{{ 'how_many' | translate }}" ng-model="formdatalicense.repeat" required/>
</div> </div>
<div class="form-group"> <div class="form-group text-center">
<label translate>how_many</label> <button type="submit" class="btn btn-primary" translate>generate</button>
<input type="number" class="form-control" id="setup_repeat" placeholder="{{ 'how_many' | translate }}" ng-model="formdatalicense.repeat" required/> </div>
</div>
<div class="form-group text-center"> </form>
<button type="submit" class="btn btn-primary" translate>generate</button>
</div>
</form> <div ng-show="new_numbers.length > 0" class="alert alert-info">
<p>{{ 'licenses_created' | translate }}:</p><p>&nbsp;</p>
<div ng-repeat="number in new_numbers track by $index">
<p> <strong>{{ number }}</strong></p>
</div>
<p>{{ 'duration_in_months' | translate }}: {{ duration_registered }}</p>
</div>
<div ng-show="new_numbers.length > 0" class="alert alert-info"> </div>
<p>{{ 'licenses_created' | translate }}:</p><p>&nbsp;</p>
<div ng-repeat="number in new_numbers track by $index">
<p> <strong>{{ number }}</strong></p>
</div>
<p>{{ 'duration_in_months' | translate }}: {{ duration_registered }}</p>
</div>
</div>
<div class="col-md-2"> <div class="col-md-2">
</div> </div>
......
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