11,6 → 11,7 |
import org.tela_botanica.del.client.modeles.Observation; |
import org.tela_botanica.del.client.modeles.Protocole; |
import org.tela_botanica.del.client.modeles.Utilisateur; |
import org.tela_botanica.del.client.utils.URLUtils; |
|
import com.google.gwt.core.client.GWT; |
import com.google.gwt.user.client.Window; |
24,6 → 25,7 |
private Observation observationCourante; |
private Image imageCourante; |
private String taxonPourRechercheEflore; |
private String idProtocoleEnAttente = null; |
private Protocole protocoleCourant; |
private String referentielCourant; |
private int numPageRechercheImage = 0; |
83,9 → 85,27 |
String tagCel = Location.getParameter("masque.tag_cel"); |
String tagDel = Location.getParameter("masque.tag_pictoflora"); |
String referentiel = Location.getParameter("masque.referentiel"); |
|
String protocole = Location.getParameter("protocole"); |
String statutParam = Location.getParameter("masque.type"); |
|
String page = Location.getParameter("page"); |
Integer pageInt = null; |
try { |
pageInt = Integer.parseInt(page); |
} catch (Exception e) { |
pageInt = null; |
} |
|
String pas = Location.getParameter("pas"); |
Integer pasInt = null; |
if(pas != null) { |
try { |
pasInt = Integer.parseInt(pas); |
} catch (Exception e) { |
pasInt = null; |
} |
} |
|
InformationsRecherche rechercheParArguments = new InformationsRecherche(); |
rechercheParArguments.setRechercheLibre(rechercheLibre); |
rechercheParArguments.setFamille(famille); |
96,9 → 116,23 |
rechercheParArguments.setAuteur(auteur); |
rechercheParArguments.setDate(date); |
rechercheParArguments.setTag(tag); |
|
if(protocole != null && !protocole.equals("")) { |
CacheClient.getInstance().setIdProtocoleEnAttente(protocole); |
rechercheParArguments.setIdProtocoleSelectionne(protocole); |
} else if(URLUtils.getURLSpecialParameterValue() != null) { |
CacheClient.getInstance().setIdProtocoleEnAttente(URLUtils.getURLSpecialParameterValue()); |
rechercheParArguments.setIdProtocoleSelectionne(URLUtils.getURLSpecialParameterValue()); |
} |
|
if(pasInt != null) setPasPagination(pasInt); |
|
if(pageCourante.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) { |
rechercheParArguments.setMotClefCel(tagCel); |
rechercheParArguments.setMotClefDel(tagDel); |
if(pageInt != null) setPageCouranteRechercheImages(pageInt); |
} else { |
if(pageInt != null) setPageCouranteRechercheObservations(pageInt); |
} |
|
|
107,11 → 141,11 |
|
if(tri != null) { |
ModeTri modeTri = ModeTri.TRI_ASCENDANT; |
if(ordre.equals("asc")) { |
if(ordre != null && ordre.equals("asc")) { |
modeTri = ModeTri.TRI_ASCENDANT; |
} |
|
if(ordre.equals("desc")) { |
if(ordre != null && ordre.equals("desc")) { |
modeTri = ModeTri.TRI_DESCENDANT; |
} |
|
125,8 → 159,7 |
|
if(tri.equals("date_observation")) { |
rechercheParArguments.setTriParDate(modeTri); |
} |
|
} |
} |
|
rechercheParArguments.setMotClef(tag); |
153,6 → 186,14 |
informationsRechercheObservation = rechercheParArguments; |
} |
|
public void setIdProtocoleEnAttente(String idProtocole) { |
idProtocoleEnAttente = idProtocole; |
} |
|
public String getIdProtocoleEnAttente() { |
return idProtocoleEnAttente; |
} |
|
public Utilisateur getUtilisateur() { |
if (this.utilisateur == null) { |
this.utilisateur = new Utilisateur(null, null); |
304,7 → 345,10 |
if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) { |
|
InformationsRecherche infoRecherche; |
infoRecherche = cache.getInformationsRechercheImage(); |
infoRecherche = cache.getInformationsRechercheImage(); |
if (CacheClient.getInstance().getProtocoleCourant() != null) { |
infoRecherche.setIdProtocoleSelectionne(""+CacheClient.getInstance().getProtocoleCourant().getId()); |
} |
argumentsRecherche = infoRecherche.versChaineRequete(); |
|
if(!GWT.isScript()) { |
311,23 → 355,25 |
argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+""; |
} |
|
argumentsRecherche += (argumentsRecherche.isEmpty()) ? "" : "&"; |
argumentsRecherche += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination(); |
|
argumentsRecherche = (argumentsRecherche.isEmpty()) ? argumentsRecherche : "?" + argumentsRecherche; |
arguments = argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_IMAGES; |
url = new Config().getUrl("del") + arguments; |
|
if (CacheClient.getInstance().getProtocoleCourant() != null) { |
url += "~"+String.valueOf(CacheClient.getInstance().getProtocoleCourant().getId()); |
} |
} else if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || cache.getPageCourante().equals("")) { |
|
InformationsRecherche infoRecherche; |
infoRecherche = cache.getInformationsRechercheObservation(); |
argumentsRecherche = "masque.type="+statut; |
argumentsRecherche += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination(); |
argumentsRecherche += "&"+infoRecherche.versChaineRequete(); |
|
if(!GWT.isScript()) { |
argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+""; |
} |
|
arguments = "?"+argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS; |
url = new Config().getUrl("del") + arguments; |
} else if (cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION) || cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION_PICTOFLORA)) { |
352,7 → 398,11 |
} |
|
private static native void mettreAJourUrlCouranteSansRecharger(String nouvelleUrl) /*-{ |
$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl); |
// javascript double negative trick |
// pour plus d'info http://stackoverflow.com/questions/4686583/can-someone-explain-this-double-negative-trick |
if(!!($wnd.history && $wnd.history.pushState)) { |
$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl); |
} |
}-*/; |
|
} |