Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1627 → Rev 1628

/trunk/jrest/JRest.php
154,9 → 154,14
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if (method_exists($service,'updateElement')) { // Update element
// TODO : a voir le retour ...
if ($service->updateElement($this->uid, $pairs)) {
$this->created();
$ret_value = false;
try {
// TODO : a voir le retour ...
$ret_value = $service->updateElement($this->uid, $pairs);
if($ret_value) $this->created();
else $this->badRequest();
} catch (Exception $e) {
$this->badRequest($e);
}
}
}
206,8 → 211,13
if (class_exists($resource_class)) {
$service = new $resource_class($this->config);
if (method_exists($service,'createElement')) { // Create a new element
if ($service->createElement($pairs)) {
$this->created();
$ret_value = false;
try {
$ret_value = $service->createElement($pairs);
if($ret_value) $this->created();
else $this->badRequest();
} catch (Exception $e) {
$this->badRequest($e);
}
}
}
254,8 → 264,9
/**
* Send a HTTP 400 response header.
*/
private function badRequest() {
private function badRequest(Exception $e = NULL) {
header('HTTP/1.0 400 Bad Request');
if($e) echo $e->getMessage();
}
 
/**
/trunk/jrest/services/Inventory.php
89,6 → 89,11
$champs_etendus = isset($pairs['obs_etendue']) ? json_decode(stripslashes($pairs['obs_etendue']),true) : null;
unset($pairs['obs_etendue']);
 
$time = strtotime(str_replace("/", "-", $pairs['date_observation']));
if(!$time || $time > time()) {
throw new Exception('Date invalide');
}
$gestionnaire_observation = new GestionObservation($this->config);
$modification_observation = $gestionnaire_observation->modifierObservation($uid[0],$uid[1],$pairs);
117,6 → 122,11
$champs_etendus = isset($pairs['obs_etendue']) ? json_decode(stripslashes($pairs['obs_etendue']),true) : null;
unset($pairs['obs_etendue']);
 
$time = strtotime(str_replace("/", "-", $pairs['date_observation']));
if(!$time || $time > time()) {
throw new Exception('Date invalide');
}
$gestionnaire_observation = new GestionObservation($this->config);
$id_nouvelle_obs = $gestionnaire_observation->ajouterObservation($pairs['ce_utilisateur'], $pairs);
/trunk/src/org/tela_botanica/client/vues/observation/FormulaireSaisieObservationVue.java
443,6 → 443,7
formatDate = "d/m/Y";
date.setFormat(formatDate) ;
date.setTitle("Date de l'observation au format jj/mm/aaaa");
date.setMaxValue(new Date());
//date.setTabIndex(5);
panneauPremierColonne.add(date, new AnchorLayoutData("55%"));
/trunk/src/org/tela_botanica/client/modeles/dao/ObservationAsynchroneDAO.java
12,6 → 12,7
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.Window;
 
 
/**
77,16 → 78,17
 
@Override
public void onError(Request request, Throwable exception) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
 
}
 
@Override
public void onResponseReceived(Request request,
Response response) {
r.rafraichir(obs,true);
if(response.getStatusCode() >= 400) {
com.google.gwt.user.client.Window.alert(response.getText());
}
r.rafraichir(obs,true);
}
}) ;
138,9 → 140,10
@Override
public void onResponseReceived(Request request,
Response response) {
r.rafraichir(obs,true);
if(response.getStatusCode() >= 400) {
com.google.gwt.user.client.Window.alert(response.getText());
}
r.rafraichir(obs,true);
}
199,4 → 202,4
}
}
}