Subversion Repositories eFlore/Applications.coel

Rev

Rev 822 | Rev 935 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 822 Rev 901
Line 56... Line 56...
56
		});
56
		});
57
	}
57
	}
Line 58... Line 58...
58
	
58
	
59
	public void ajouter(String publicationId, String personnesId, String roleId) {
59
	public void ajouter(String publicationId, String personnesId, String roleId) {
60
		String postDonneesEncodees = "cpuap_id_publication="+URL.encodeComponent(publicationId)
60
		String postDonneesEncodees = "cpuap_id_publication="+URL.encodeComponent(publicationId)
61
		+"&cpuap_id_auteur="+personnesId
61
		+"&cpuap_id_auteur="+URL.encodeComponent(personnesId)
62
		+"&cpuap_id_role="+URL.encodeComponent(roleId)
62
		+"&cpuap_id_role="+URL.encodeComponent(roleId)
Line 63... Line 63...
63
		+"&cmhl_ce_modifier_par="+utilisateurId;
63
		+"&cmhl_ce_modifier_par="+utilisateurId;
64
		
64
		
65
		final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
65
		final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
66
		rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
66
		rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
67
			@Override
67
			@Override
68
			public void surReponse(JSONValue reponseValeur) {
68
			public void surReponse(JSONValue reponseValeur) {
69
				traiterReponse(reponseValeur, "auteur_valide");
69
				traiterReponse(reponseValeur, "ajout_publication_a_personne");
70
			}
70
			}
Line 71... Line 71...
71
		}) ;
71
		}) ;
Line 80... Line 80...
80
		+"&cmhl_ce_modifier_par="+utilisateurId;
80
		+"&cmhl_ce_modifier_par="+utilisateurId;
Line 81... Line 81...
81
		
81
		
82
		rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
82
		rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
83
			@Override
83
			@Override
84
			public void surReponse(JSONValue reponseValeur) {
84
			public void surReponse(JSONValue reponseValeur) {
85
				traiterReponse(reponseValeur, "auteur_valide");
85
				traiterReponse(reponseValeur, "modif_publication_a_personne");
86
			}
86
			}
87
		}) ;
87
		}) ;
Line -... Line 88...
-
 
88
	}
-
 
89
	
-
 
90
	public void supprimer(String idPublicationAPersonne) {
-
 
91
		String[] parametres = {utilisateurId, idPublicationAPersonne};
-
 
92
		final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
-
 
93
		rb.envoyerRequeteSuppression(new JsonRestRequestCallback() {
-
 
94
			@Override
-
 
95
			public void surReponse(JSONValue responseValue) {
-
 
96
				if (responseValue.isString() != null) {
-
 
97
					Information info = new Information("suppression_publication_a_personne");
-
 
98
					info.setMessage(responseValue.isString().stringValue());
-
 
99
					vueARafraichir.rafraichir(info);
-
 
100
				} else {
-
 
101
					GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
-
 
102
				}
-
 
103
			}
-
 
104
		});
88
	}
105
	}
89
	
106
	
90
	private void traiterReponse(JSONValue reponseValeur, String type) {
107
	private void traiterReponse(JSONValue reponseValeur, String type) {
91
		Information info = new Information(type);
108
		Information info = new Information(type);
92
		// Si la requête est un succès, réception d'une chaîne
109
		// Si la requête est un succès, réception d'une chaîne