| 989 |
aurelien |
1 |
package org.tela_botanica.client.modeles.objets;
|
| 2 |
aperonnet |
2 |
|
| 1542 |
aurelien |
3 |
import java.util.ArrayList;
|
|
|
4 |
import java.util.HashMap;
|
| 1967 |
aurelien |
5 |
import java.util.Iterator;
|
| 1542 |
aurelien |
6 |
import java.util.List;
|
|
|
7 |
import java.util.Map;
|
|
|
8 |
|
| 2 |
aperonnet |
9 |
import com.google.gwt.i18n.client.Dictionary;
|
| 1967 |
aurelien |
10 |
import com.google.gwt.json.client.JSONObject;
|
|
|
11 |
import com.google.gwt.json.client.JSONParser;
|
|
|
12 |
import com.google.gwt.json.client.JSONValue;
|
| 1542 |
aurelien |
13 |
import com.google.gwt.user.client.Window;
|
| 1966 |
aurelien |
14 |
import com.google.gwt.user.client.Window.Location;
|
| 2 |
aperonnet |
15 |
|
|
|
16 |
/**
|
| 5 |
aperonnet |
17 |
* Classe chargeant certains paramètres de configuration à partir d'un fichier
|
|
|
18 |
* javascript (config.js)
|
|
|
19 |
*
|
| 2 |
aperonnet |
20 |
* @author aurelien
|
| 5 |
aperonnet |
21 |
*
|
| 2 |
aperonnet |
22 |
*/
|
|
|
23 |
public class Configuration {
|
| 5 |
aperonnet |
24 |
|
| 2 |
aperonnet |
25 |
/**
|
|
|
26 |
* L'url de base du serveur jrest
|
|
|
27 |
*/
|
| 100 |
jpm |
28 |
private static String serviceBaseUrl;
|
| 5 |
aperonnet |
29 |
|
| 100 |
jpm |
30 |
private static String imageBaseUrl;
|
| 81 |
jpm |
31 |
|
| 100 |
jpm |
32 |
private static String suiviBugUrl ;
|
|
|
33 |
|
|
|
34 |
private static String aideBaseUrl ;
|
| 2081 |
mathias |
35 |
|
|
|
36 |
private static String remarquesBaseUrl ;
|
| 252 |
aurelien |
37 |
|
| 2600 |
mathias |
38 |
private static String serviceContact;
|
| 431 |
aurelien |
39 |
|
| 252 |
aurelien |
40 |
private static String referentielGeo ;
|
| 271 |
aurelien |
41 |
|
|
|
42 |
private static String cleGoogleMaps ;
|
| 5 |
aperonnet |
43 |
|
| 318 |
aurelien |
44 |
private static String lienEfloreBaseUrl;
|
|
|
45 |
|
|
|
46 |
private static String refTax;
|
|
|
47 |
|
|
|
48 |
private static String refTaxVersion;
|
| 596 |
aurelien |
49 |
|
|
|
50 |
private static String licence ="";
|
| 641 |
aurelien |
51 |
|
|
|
52 |
private static String formatOriginal = "";
|
|
|
53 |
|
|
|
54 |
private static String formatZoom = "";
|
|
|
55 |
|
|
|
56 |
private static String formatGalerie = "";
|
|
|
57 |
|
|
|
58 |
private static String formatListe = "";
|
| 318 |
aurelien |
59 |
|
| 731 |
aurelien |
60 |
private static String utiliseRedirectionImage;
|
|
|
61 |
|
|
|
62 |
private static String imageRedirectUrl;
|
| 1285 |
aurelien |
63 |
|
|
|
64 |
private static String tailleMaxUpload;
|
| 1542 |
aurelien |
65 |
|
|
|
66 |
private static List<InfosReferentielNom> referentielsDispos;
|
| 1940 |
aurelien |
67 |
|
|
|
68 |
private static String activerSaisieChampsEtendus = "0";
|
| 2392 |
aurelien |
69 |
|
|
|
70 |
private static String wikiDescriptionChampsEtendusPageUrl = "";
|
|
|
71 |
|
|
|
72 |
private static String wikiDescriptionChampsEtendusRestUrl = "";
|
|
|
73 |
|
|
|
74 |
private static String wikiDescriptionChampsEtendusRestUrlOptions = "";
|
|
|
75 |
|
|
|
76 |
private static String wikiDescriptionChampsEtendusUrlOptionsPageTpl = "";
|
| 731 |
aurelien |
77 |
|
| 2 |
aperonnet |
78 |
/**
|
|
|
79 |
* Constructeur sans argument
|
|
|
80 |
*/
|
| 5 |
aperonnet |
81 |
public Configuration() {
|
|
|
82 |
// on utilise le dictionnaire d'internationalisation pour lire les
|
|
|
83 |
// variables du fichier javascript
|
| 140 |
aurelien |
84 |
|
| 322 |
aurelien |
85 |
//if(GWT.isScript()) {
|
| 157 |
aurelien |
86 |
serviceBaseUrl = Dictionary.getDictionary("configuration").get(
|
|
|
87 |
"serviceBaseUrl");
|
| 252 |
aurelien |
88 |
|
| 2600 |
mathias |
89 |
serviceContact = Dictionary.getDictionary("configuration").get(
|
|
|
90 |
"serviceContact");
|
| 431 |
aurelien |
91 |
|
| 157 |
aurelien |
92 |
suiviBugUrl = Dictionary.getDictionary("configuration").get(
|
|
|
93 |
"suiviBugUrl");
|
| 252 |
aurelien |
94 |
|
| 157 |
aurelien |
95 |
imageBaseUrl = Dictionary.getDictionary("configuration").get(
|
|
|
96 |
"imageBaseUrl");
|
| 252 |
aurelien |
97 |
|
| 157 |
aurelien |
98 |
aideBaseUrl = Dictionary.getDictionary("configuration").get(
|
|
|
99 |
"aideBaseUrl");
|
| 252 |
aurelien |
100 |
|
| 2081 |
mathias |
101 |
remarquesBaseUrl = Dictionary.getDictionary("configuration").get(
|
|
|
102 |
"remarquesBaseUrl");
|
|
|
103 |
|
| 252 |
aurelien |
104 |
referentielGeo = Dictionary.getDictionary("configuration").get(
|
|
|
105 |
"referentielGeo");
|
|
|
106 |
|
| 271 |
aurelien |
107 |
cleGoogleMaps = Dictionary.getDictionary("configuration").get(
|
| 318 |
aurelien |
108 |
"cleGoogleMaps");
|
| 271 |
aurelien |
109 |
|
| 318 |
aurelien |
110 |
lienEfloreBaseUrl = Dictionary.getDictionary("configuration").get(
|
|
|
111 |
"lienEfloreBaseUrl");
|
|
|
112 |
|
| 641 |
aurelien |
113 |
formatOriginal = Dictionary.getDictionary("configuration").get(
|
|
|
114 |
"formatOriginal");
|
|
|
115 |
|
|
|
116 |
formatZoom = Dictionary.getDictionary("configuration").get(
|
|
|
117 |
"formatZoom");
|
|
|
118 |
|
|
|
119 |
formatGalerie = Dictionary.getDictionary("configuration").get(
|
|
|
120 |
"formatGalerie");
|
|
|
121 |
|
|
|
122 |
formatListe = Dictionary.getDictionary("configuration").get(
|
|
|
123 |
"formatListe");
|
|
|
124 |
|
| 731 |
aurelien |
125 |
utiliseRedirectionImage = Dictionary.getDictionary("configuration").get(
|
|
|
126 |
"utiliseRedirectionImage");
|
|
|
127 |
|
|
|
128 |
imageRedirectUrl = Dictionary.getDictionary("configuration").get(
|
|
|
129 |
"imageRedirectUrl");
|
|
|
130 |
|
| 1285 |
aurelien |
131 |
tailleMaxUpload = Dictionary.getDictionary("configuration").get(
|
|
|
132 |
"tailleMaxUpload");
|
|
|
133 |
|
| 1542 |
aurelien |
134 |
referentielsDispos = parserReferentielsDispos(Dictionary.getDictionary("configuration").get(
|
|
|
135 |
"referentielsDispos"));
|
| 1940 |
aurelien |
136 |
|
|
|
137 |
activerSaisieChampsEtendus = Dictionary.getDictionary("configuration").get(
|
|
|
138 |
"activerSaisieChampsEtendus");
|
| 1966 |
aurelien |
139 |
|
| 2392 |
aurelien |
140 |
wikiDescriptionChampsEtendusPageUrl = Dictionary.getDictionary("configuration").get(
|
|
|
141 |
"wikiDescriptionChampsEtendusPageUrl");
|
|
|
142 |
|
|
|
143 |
wikiDescriptionChampsEtendusRestUrl = Dictionary.getDictionary("configuration").get(
|
|
|
144 |
"wikiDescriptionChampsEtendusRestUrl");
|
|
|
145 |
|
|
|
146 |
wikiDescriptionChampsEtendusRestUrlOptions = Dictionary.getDictionary("configuration").get(
|
|
|
147 |
"wikiDescriptionChampsEtendusRestUrlOptions");
|
|
|
148 |
|
|
|
149 |
wikiDescriptionChampsEtendusUrlOptionsPageTpl = Dictionary.getDictionary("configuration").get(
|
|
|
150 |
"wikiDescriptionChampsEtendusUrlOptionsPageTpl");
|
|
|
151 |
|
| 1966 |
aurelien |
152 |
// Pour test, l'activation de l'ajout des champs étendus est activable ou désactivable par
|
|
|
153 |
// l'url
|
|
|
154 |
if(Location.getParameter("activerSaisieChampsEtendus") != null) {
|
|
|
155 |
if(Location.getParameter("activerSaisieChampsEtendus").equals("1")) {
|
|
|
156 |
activerSaisieChampsEtendus = "1";
|
|
|
157 |
} else if(Location.getParameter("activerSaisieChampsEtendus").equals("0")) {
|
|
|
158 |
activerSaisieChampsEtendus = "0";
|
|
|
159 |
}
|
|
|
160 |
}
|
| 2 |
aperonnet |
161 |
}
|
| 1542 |
aurelien |
162 |
|
|
|
163 |
private List<InfosReferentielNom> parserReferentielsDispos(String chaineListeReferentiels) {
|
|
|
164 |
String[] tabReferentiels = chaineListeReferentiels.split(";");
|
|
|
165 |
List<InfosReferentielNom> referentiels = new ArrayList<InfosReferentielNom>(tabReferentiels.length);
|
|
|
166 |
for (int i = 0; i < tabReferentiels.length; i++) {
|
|
|
167 |
InfosReferentielNom infoRef = new InfosReferentielNom(tabReferentiels[i]);
|
|
|
168 |
referentiels.add(infoRef);
|
|
|
169 |
}
|
|
|
170 |
return referentiels;
|
|
|
171 |
}
|
| 5 |
aperonnet |
172 |
|
| 2 |
aperonnet |
173 |
/**
|
|
|
174 |
* Accesseur pour l'url de base du serveur jrest
|
| 5 |
aperonnet |
175 |
*
|
| 2 |
aperonnet |
176 |
* @return une url de la forme http://emplacement_serveur/jrest
|
|
|
177 |
*/
|
| 100 |
jpm |
178 |
public static String getServiceBaseUrl() {
|
| 5 |
aperonnet |
179 |
return serviceBaseUrl;
|
| 2 |
aperonnet |
180 |
}
|
| 81 |
jpm |
181 |
|
|
|
182 |
/**
|
|
|
183 |
* Accesseur pour l'url de base du suivi de bug
|
|
|
184 |
*
|
|
|
185 |
* @return une url pointant vers le suivi des bugs
|
|
|
186 |
*/
|
| 100 |
jpm |
187 |
public static String getSuiviBugUrl() {
|
| 81 |
jpm |
188 |
return suiviBugUrl;
|
|
|
189 |
}
|
| 100 |
jpm |
190 |
|
|
|
191 |
/**
|
|
|
192 |
* Accesseur pour l'url de base des images
|
|
|
193 |
*
|
|
|
194 |
* @return une url pointant vers la racine du dossier contenant les images
|
|
|
195 |
*/
|
|
|
196 |
public static String getImageBaseUrl() {
|
|
|
197 |
return imageBaseUrl ;
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
/**
|
|
|
201 |
* Accesseur pour l'url de base de l'aide
|
|
|
202 |
*
|
|
|
203 |
* @return une url pointant vers la racine de l'aide
|
|
|
204 |
*/
|
|
|
205 |
public static String getAideBaseUrl() {
|
|
|
206 |
return aideBaseUrl ;
|
|
|
207 |
}
|
|
|
208 |
|
| 252 |
aurelien |
209 |
/**
|
| 2081 |
mathias |
210 |
* Accesseur pour l'url de base du widget de remarques
|
|
|
211 |
*
|
|
|
212 |
* @return une url pointant vers la racine du widget (sans paramètres)
|
|
|
213 |
*/
|
|
|
214 |
public static String getRemarquesBaseUrl() {
|
|
|
215 |
return remarquesBaseUrl;
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
/**
|
| 2600 |
mathias |
219 |
* Accesseur pour le service de contact du carnet en ligne
|
| 431 |
aurelien |
220 |
*
|
| 2600 |
mathias |
221 |
* @return une chaine contenant le service de contact
|
| 431 |
aurelien |
222 |
*/
|
| 2600 |
mathias |
223 |
public static String getServiceContact() {
|
|
|
224 |
return serviceContact;
|
| 431 |
aurelien |
225 |
}
|
|
|
226 |
|
|
|
227 |
/**
|
| 271 |
aurelien |
228 |
* Accesseur pour le référentiel geo
|
| 252 |
aurelien |
229 |
*
|
| 271 |
aurelien |
230 |
* @return le référentiel geo
|
| 252 |
aurelien |
231 |
*/
|
|
|
232 |
public static String getReferentielGeo() {
|
|
|
233 |
return referentielGeo ;
|
|
|
234 |
}
|
| 271 |
aurelien |
235 |
|
|
|
236 |
/**
|
|
|
237 |
* Accesseur pour la clé google maps
|
|
|
238 |
*
|
|
|
239 |
* @return la clé google maps
|
|
|
240 |
*/
|
|
|
241 |
public static String getCleGoogleMaps() {
|
|
|
242 |
return cleGoogleMaps ;
|
|
|
243 |
}
|
| 2 |
aperonnet |
244 |
|
| 318 |
aurelien |
245 |
public static String getLienEfloreBaseUrl() {
|
| 1285 |
aurelien |
246 |
return lienEfloreBaseUrl;
|
| 318 |
aurelien |
247 |
}
|
|
|
248 |
|
| 596 |
aurelien |
249 |
public static String getLicence() {
|
|
|
250 |
return licence;
|
|
|
251 |
}
|
| 641 |
aurelien |
252 |
|
|
|
253 |
public static String getFormatOriginal() {
|
|
|
254 |
return formatOriginal;
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
public static String getFormatZoom() {
|
|
|
258 |
return formatZoom;
|
|
|
259 |
}
|
|
|
260 |
|
|
|
261 |
public static String getFormatGalerie() {
|
|
|
262 |
return formatGalerie;
|
|
|
263 |
}
|
|
|
264 |
|
|
|
265 |
public static String getFormatListe() {
|
|
|
266 |
return formatListe;
|
|
|
267 |
}
|
| 731 |
aurelien |
268 |
|
| 1285 |
aurelien |
269 |
public static boolean utiliseRedirectionImages() {
|
| 731 |
aurelien |
270 |
return utiliseRedirectionImage.equals("1");
|
|
|
271 |
}
|
|
|
272 |
|
| 1285 |
aurelien |
273 |
public static String getImageRedirectUrl() {
|
|
|
274 |
return imageRedirectUrl;
|
| 731 |
aurelien |
275 |
}
|
| 1285 |
aurelien |
276 |
|
|
|
277 |
public static String getTailleMaxUpload() {
|
|
|
278 |
return tailleMaxUpload;
|
|
|
279 |
}
|
| 1542 |
aurelien |
280 |
|
|
|
281 |
public static List<InfosReferentielNom> getReferentielsDispos() {
|
|
|
282 |
return referentielsDispos;
|
|
|
283 |
}
|
| 1940 |
aurelien |
284 |
|
|
|
285 |
public static boolean saisieChampsEtendusActivee() {
|
|
|
286 |
return activerSaisieChampsEtendus.equals("1");
|
|
|
287 |
}
|
| 2392 |
aurelien |
288 |
|
|
|
289 |
public static String getWikiDescriptionChampsEtendusPageUrl() {
|
|
|
290 |
return wikiDescriptionChampsEtendusPageUrl;
|
|
|
291 |
}
|
|
|
292 |
|
|
|
293 |
public static String getWikiDescriptionChampsEtendusRestUrl() {
|
|
|
294 |
return wikiDescriptionChampsEtendusRestUrl;
|
|
|
295 |
}
|
|
|
296 |
|
|
|
297 |
public static String getWikiDescriptionChampsEtendusUrlOptions() {
|
|
|
298 |
return wikiDescriptionChampsEtendusRestUrlOptions;
|
|
|
299 |
}
|
|
|
300 |
|
|
|
301 |
public static String getWikiDescriptionChampsEtendusUrlOptionsPageTpl() {
|
|
|
302 |
return wikiDescriptionChampsEtendusUrlOptionsPageTpl;
|
|
|
303 |
}
|
| 2 |
aperonnet |
304 |
}
|