| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.modeles;
|
1 |
package org.tela_botanica.client.modeles;
|
| Line -... |
Line 2... |
| - |
|
2 |
|
| - |
|
3 |
import org.tela_botanica.client.Mediateur;
|
| 2 |
|
4 |
import org.tela_botanica.client.RegistreId;
|
| 3 |
import org.tela_botanica.client.http.JsonRestRequestBuilder;
|
5 |
import org.tela_botanica.client.http.JsonRestRequestBuilder;
|
| 4 |
import org.tela_botanica.client.http.JsonRestRequestCallback;
|
6 |
import org.tela_botanica.client.http.JsonRestRequestCallback;
|
| 5 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
7 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| Line -... |
Line 8... |
| - |
|
8 |
import org.tela_botanica.client.util.UtilDAO;
|
| 6 |
import org.tela_botanica.client.util.UtilDAO;
|
9 |
|
| 7 |
|
10 |
import com.extjs.gxt.ui.client.Registry;
|
| 8 |
import com.google.gwt.core.client.GWT;
|
11 |
import com.google.gwt.core.client.GWT;
|
| 9 |
import com.google.gwt.http.client.URL;
|
12 |
import com.google.gwt.http.client.URL;
|
| 10 |
import com.google.gwt.json.client.JSONArray;
|
13 |
import com.google.gwt.json.client.JSONArray;
|
| Line 11... |
Line 14... |
| 11 |
import com.google.gwt.json.client.JSONObject;
|
14 |
import com.google.gwt.json.client.JSONObject;
|
| Line 12... |
Line 15... |
| 12 |
import com.google.gwt.json.client.JSONValue;
|
15 |
import com.google.gwt.json.client.JSONValue;
|
| Line -... |
Line 16... |
| - |
|
16 |
|
| 13 |
|
17 |
public class PublicationAPersonneAsyncDao {
|
| Line 14... |
Line 18... |
| 14 |
public class PublicationAPersonneAsyncDao {
|
18 |
|
| 15 |
|
19 |
private static final String SERVICE_NOM = "CoelPublicationAPersonne";
|
| - |
|
20 |
|
| 16 |
private static final String SERVICE_NOM = "CoelPublicationAPersonne";
|
21 |
private String utilisateurId = null;
|
| Line 17... |
Line 22... |
| 17 |
|
22 |
private Rafraichissable vueARafraichir = null;
|
| 18 |
private Rafraichissable vueARafraichir = null;
|
23 |
|
| 19 |
|
24 |
public PublicationAPersonneAsyncDao(Rafraichissable vueARafraichirCourrante) {
|
| Line 49... |
Line 54... |
| 49 |
}
|
54 |
}
|
| 50 |
}
|
55 |
}
|
| 51 |
});
|
56 |
});
|
| 52 |
}
|
57 |
}
|
| Line 53... |
Line 58... |
| 53 |
|
58 |
|
| 54 |
public void ajouter(String utilisateurid, String personnesId, String role, String publicationId) {
|
59 |
public void ajouter(String personnesId, String role, String publicationId) {
|
| 55 |
String postDonneesEncodees = "cpuap_id_publication="+URL.encode(publicationId)
|
60 |
String postDonneesEncodees = "cpuap_id_publication="+URL.encodeComponent(publicationId)
|
| 56 |
+"&cpuap_id_auteur="+personnesId
|
61 |
+"&cpuap_id_auteur="+personnesId
|
| 57 |
+"&cpuap_id_role="+URL.encode(role)
|
62 |
+"&cpuap_id_role="+URL.encodeComponent(role)
|
| Line 58... |
Line 63... |
| 58 |
+"&cmhl_ce_modifier_par="+utilisateurid;
|
63 |
+"&cmhl_ce_modifier_par="+utilisateurId;
|
| 59 |
|
64 |
|
| 60 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
|
65 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
|
| 61 |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
|
66 |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
|
| 62 |
@Override
|
67 |
@Override
|
| 63 |
public void surReponse(JSONValue reponseValeur) {
|
68 |
public void surReponse(JSONValue reponseValeur) {
|
| 64 |
traiterReponse(reponseValeur, "auteur_valide");
|
69 |
traiterReponse(reponseValeur, "auteur_valide");
|
| 65 |
}
|
70 |
}
|
| Line 66... |
Line 71... |
| 66 |
}) ;
|
71 |
}) ;
|
| 67 |
}
|
72 |
}
|
| Line 68... |
Line 73... |
| 68 |
|
73 |
|
| Line 69... |
Line 74... |
| 69 |
public void modifier(String utilisateurid, String idAuteurs, String idPublication) {
|
74 |
public void modifier(String idAuteurs, String idPublication) {
|
| 70 |
String[] parametres = {idPublication, idAuteurs, PublicationAPersonne.ROLE_AUTEUR};
|
75 |
String[] parametres = {idPublication, idAuteurs, PublicationAPersonne.ROLE_AUTEUR};
|
| Line 71... |
Line 76... |
| 71 |
|
76 |
|
| 72 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
|
77 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
|
| 73 |
|
78 |
|
| 74 |
String postDonneesEncodees = "cpuap_id_publication="+URL.encode(idPublication)
|
79 |
String postDonneesEncodees = "cpuap_id_publication="+URL.encodeComponent(idPublication)
|