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