Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
reglage des préférences pour les images
Browse files Browse the repository at this point in the history
  • Loading branch information
miledrousset committed Jun 30, 2017
1 parent 5e4fcf9 commit aa78062
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ public void editAllPref() {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error.BDD")));
return;
}
initUserNodePref(idTheso);

FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("user.info6")));
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mom/trd/opentheso/SelectedBeans/FileBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ public void chargeImage(FileUploadEvent event) {
String suffix = FilenameUtils.getExtension(file.getFileName());
InputStream input = file.getInputstream();
String path = selectedTerme.getUser().nodePreference.getPathImage();//pathImage;



SimpleDateFormat dateFormatDirectory = new SimpleDateFormat(" dd-MM-yyyy HH-mm-ss");
String dateDirectory = dateFormatDirectory.format(new Date());
Expand All @@ -535,6 +537,7 @@ public void chargeImage(FileUploadEvent event) {

resizeImage(image.getName());
addFiligrane(image.getName(), source, suffix);

addFiligrane(selectedTerme.getUser().nodePreference.getDossierResize()
/*dossierResize*/
+ "/" + image.getName(), source, suffix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public SelectedThesaurus() {

}

private void majPref() {
public void majPref() {
if(user == null || user.getNodePreference() == null) return;

cheminSite = user.getNodePreference().getCheminSite();//bundlePref.getString("cheminSite");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public boolean updateAllPreferenceUser(HikariDataSource ds, NodePreference np, S
boolean status = false;
StringPlus stringPlus = new StringPlus();

np = normalizeDatas(np);
try {
conn = ds.getConnection();

Expand Down Expand Up @@ -260,6 +261,32 @@ public boolean updateAllPreferenceUser(HikariDataSource ds, NodePreference np, S
return status;
}

/**
* permet de nettoyer les "/" et préparer les paramètres correctement
* @param nodePreference
* @return
*/
private NodePreference normalizeDatas(NodePreference nodePreference) {

// vérification des "/" à la fin
if(!nodePreference.getCheminSite().isEmpty()) {
if(!nodePreference.getCheminSite().substring(nodePreference.getCheminSite().length() - 1, nodePreference.getCheminSite().length()).equalsIgnoreCase("/")) {
nodePreference.setCheminSite(nodePreference.getCheminSite() + "/");
}
}
if(!nodePreference.getServeurArk().isEmpty()) {
if(!nodePreference.getServeurArk().substring(nodePreference.getServeurArk().length() - 1, nodePreference.getServeurArk().length()).equalsIgnoreCase("/")) {
nodePreference.setServeurArk(nodePreference.getServeurArk() + "/");
}
}
if(!nodePreference.getPathImage().isEmpty()) {
if(!nodePreference.getPathImage().substring(nodePreference.getPathImage().length() - 1, nodePreference.getPathImage().length()).equalsIgnoreCase("/")) {
nodePreference.setPathImage(nodePreference.getPathImage() + "/");
}
}
return nodePreference;
}



}
2 changes: 1 addition & 1 deletion src/main/resources/language/site.properties
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ gps.delete=Supprimer les coordonn\u00e9s
image.add=Ajouter une image
image.delete=Supprimer
import.total=total
conf.modifPref=Modifier les pr\u00e9f\u00e9rences
conf.modifPref=Pr\u00e9f\u00e9rences
conf.newId=Reg\u00e9n\u00e9rer de nouveaux indentifiants
conf.newIdExplication=Remplace tous les id des concepts et des groupes par des nouveaux id
concept.setId=modifier l'identifiant
4 changes: 2 additions & 2 deletions src/main/resources/language/site_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ gps.delete=l\u00f6schen koordiniert
image.add=Bild hinzuf\u00fcgen
image.delete=entfernen
import.total=gesamt
conf.modifPref=Modifier les pr\u00e9f\u00e9rences
conf.modifPref=Einstellung
conf.newId=Regenerieren Sie neue indentifiants
conf.newIdExplication=Ersetzt alle ID-Konzepte und Gruppen mit neuen id
concept.setId=modifier l'identifiant
concept.setId=\u00c4ndern des Identifizierers
4 changes: 2 additions & 2 deletions src/main/resources/language/site_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ gps.delete=Remove coordinates
image.add=Add image
image.delete=Delete
import.total=totale
conf.modifPref=Modifier les pr\u00e9f\u00e9rences
conf.modifPref=Setting
conf.newId=Regenerating new identifiers
conf.newIdExplication=Replaces all ids of concepts and groups with new ids
concept.setId=modifier l'identifiant
concept.setId=Modify the identifier
4 changes: 2 additions & 2 deletions src/main/resources/language/site_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ gps.delete=eliminar coordinada
image.add=Agregar imagen
image.delete=Quitar
import.total=total
conf.modifPref=Modifier les pr\u00e9f\u00e9rences
conf.modifPref=preferencias
conf.newId=Regenerar nuevos indentifiants
conf.newIdExplication=Reemplaza todos los conceptos de identidad y grupos con nueva identificaci\u00f3n
concept.setId=modifier l'identifiant
concept.setId=modificar el identificador
4 changes: 2 additions & 2 deletions src/main/resources/language/site_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ gps.delete=Eliminare coordinato
image.add=Aggiungi immagine
image.delete=rimuovere
import.total=totale
conf.modifPref=Modifier les pr\u00e9f\u00e9rences
conf.modifPref=preferenze
conf.newId=Rigenerare nuove indentifiants
conf.newIdExplication=Sostituisce tutti gli id delli concept e gruppi con nuovo ID
concept.setId=modifier l'identifiant
concept.setId=modificare l'identificatore
2 changes: 1 addition & 1 deletion src/main/webapp/dialogs/prefDlg.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
</h:panelGrid>
</p:fieldset>
</p:scrollPanel>
<p:commandButton value="#{langueBean.getMsg('conf.btnValid')}" actionListener="#{user1.editAllPref()}" styleClass="styleButton" oncomplete="PF('prefDlg').hide();" />
<p:commandButton value="#{langueBean.getMsg('conf.btnValid')}" actionListener="#{user1.editAllPref()}" action="#{theso.majPref()}" styleClass="styleButton" oncomplete="PF('prefDlg').hide();" />
</h:panelGrid>
</h:form>

Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/panelDroite/image/image.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<ui:repeat value="#{selectedTerme.images}" var="image" id="manuelSwitcherImages">
<h:form>
<img itemprop="image">
<p:graphicImage title="#{image.imageName}" value="/pix/#{theso.nodePreference.pathImage}/#{theso.nodePreference.dossierResize}/#{image.imageName}" onclick="PF('dlgPix').show()"
<p:graphicImage title="#{image.imageName}" value="/pix/#{theso.nodePreference.pathImage}#{theso.nodePreference.dossierResize}/#{image.imageName}" onclick="PF('dlgPix').show()"
style="cursor: pointer;" />
</img>
</h:form>
Expand All @@ -49,7 +49,7 @@
<div id="clean" />
<p:imageSwitch effect="fade" widgetVar="fullSwitcher" slideshowAuto="false">
<ui:repeat value="#{selectedTerme.images}" var="imageFull">
<p:graphicImage value="/pix/#{theso.nodePreference.pathImage}/#{imageFull.imageName}" />
<p:graphicImage value="/pix/#{theso.nodePreference.pathImage}#{imageFull.imageName}" />
</ui:repeat>
</p:imageSwitch>
</p:dialog>
Expand Down

0 comments on commit aa78062

Please sign in to comment.