Subversion Repositories eFlore/Applications.cel

Rev

Rev 401 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 401 Rev 408
Line 248... Line 248...
248
		// pour chacune des photos
248
		// pour chacune des photos
249
		final XTemplate template = new XTemplate(
249
		final XTemplate template = new XTemplate(
250
				new String[] {
250
				new String[] {
251
						"<tpl for='.'>",
251
						"<tpl for='.'>",
252
						"<div class='thumb-wrap' id='{num_image}'>",
252
						"<div class='thumb-wrap' id='{num_image}'>",
253
						"<div class='thumb dview-list'>{indication_transmission}{indication_liaison}<img class='miniature_galerie' src='{url_image_M}' width='{taille_x_s} px' height='{taille_y_s} px' title='{nom_original}' /></div>",
253
						"<div class='thumb dview-list'>{indication_transmission}{indication_liaison}<img class='miniature_galerie' src='{url_image_M}' width='{taille_x_s} px' height='{taille_y_s} px' title='{infobulle}' /></div>",
254
						"<span class='info_image'>{nom_obs_associees_formatees}</span></div>", "</tpl>",
254
						"<span class='info_image'>{nom_obs_associees_formatees}</span></div>", "</tpl>",
255
						"<div class='x-clear'></div>" });
255
						"<div class='x-clear'></div>" });
256
		// pour des raisons de performances on compile le template en une
256
		// pour des raisons de performances on compile le template en une
257
		// fonction
257
		// fonction
258
		template.compile();
258
		template.compile();
Line 279... Line 279...
279
				
279
				
280
				data.setProperty("taille_x_s", XYresize[0]);
280
				data.setProperty("taille_x_s", XYresize[0]);
Line 281... Line 281...
281
				data.setProperty("taille_y_s", XYresize[1]);	
281
				data.setProperty("taille_y_s", XYresize[1]);	
282
				
-
 
-
 
282
				
283
				String nomObs = data.getProperty("obs_associees");
283
				String nomObs = data.getProperty("obs_associees");
284
				String[] obsTab = nomObs.split(";;");
284
 
285
				String htmltransmis = "";
285
				String htmltransmis = "";
286
				String htmllie = "";
286
				String htmllie = "";
287
 
287
				
288
				if(obsTab.length >= 1) {
288
				boolean associee = estAssocieeTransmise(nomObs)[0];
289
					String[] elementsObs = obsTab[0].split("#");
-
 
290
					
289
				boolean transmise = estAssocieeTransmise(nomObs)[1];
-
 
290
				
291
					if(elementsObs.length >= 3) {
291
				String nomFormate = getNomsObservationsFormatees(nomObs);
292
						nomObs = elementsObs[1];
-
 
293
						//if(elementsObs[2] == "1") {
292
				
294
							htmltransmis = "<img class='picto_haut_gauche' src='tela.png' />";
293
				if(associee) {
-
 
294
					htmllie = "<img class='picto_haut_droite' src='chain.png' />";
295
							htmllie = "<img class='picto_haut_droite' src='chain.png' />";
295
				}
-
 
296
				
296
						//}
297
				if(transmise) {
Line -... Line 298...
-
 
298
					htmltransmis = "<img class='picto_haut_gauche' src='tela.png' />";
297
					}
299
				}
298
				}
300
 
299
 
301
				data.setProperty("infobulle", nomFormate);
Line 300... Line 302...
300
				data.setProperty("indication_transmission", htmltransmis);
302
				data.setProperty("indication_transmission", htmltransmis);
301
				data.setProperty("indication_liaison", htmllie);
303
				data.setProperty("indication_liaison", htmllie);
302
				data.setProperty("nom_obs_associees_formatees", nomObs);
304
				data.setProperty("nom_obs_associees_formatees", nomFormate);
Line 501... Line 503...
501
				});
503
				});
502
			}
504
			}
Line 503... Line 505...
503
 
505
 
504
		});
506
		});
-
 
507
	}
-
 
508
	
-
 
509
	private String getNomsObservationsFormatees(String nomObs) {
-
 
510
		
-
 
511
		String htmlInfobulle = "";
-
 
512
		
-
 
513
		String[][] obs = getObservationsAssociees(nomObs);
-
 
514
		
-
 
515
		for(int i = 0; i < obs.length; i++) {
-
 
516
			if(obs[i].length == 3 && obs[i][1] != null && !obs[i][1].equals("")) {
-
 
517
				htmlInfobulle += ", "+obs[i][1];
-
 
518
			}
-
 
519
		}
-
 
520
		
-
 
521
		htmlInfobulle = htmlInfobulle.replaceFirst(", ", "");
-
 
522
		
-
 
523
		return htmlInfobulle;
-
 
524
	}
-
 
525
	
-
 
526
	private String[][] getObservationsAssociees(String nomObs) {
-
 
527
		
-
 
528
		if(nomObs.trim().equals("")) {
-
 
529
			return new String[0][0];
-
 
530
		}
-
 
531
		
-
 
532
		String[] obsTab = nomObs.split(";;");
-
 
533
		String[][] obsAnalysees = new String[obsTab.length][3];
-
 
534
		
-
 
535
		for(int i = 0; i < obsTab.length; i++) {
-
 
536
			
-
 
537
			obsAnalysees[i] = obsTab[i].split("#");
-
 
538
			
-
 
539
		}
-
 
540
		
-
 
541
		return obsAnalysees;
-
 
542
	}
-
 
543
	
-
 
544
	private boolean[] estAssocieeTransmise(String nomObs) {
-
 
545
		
-
 
546
		String[][] obs = getObservationsAssociees(nomObs);
-
 
547
		boolean[] associeesTranmises = {false, false};
-
 
548
		
-
 
549
		if(obs.length > 0) {
-
 
550
			associeesTranmises[0] = true;
-
 
551
		}
-
 
552
		
-
 
553
		for(int i = 0; i < obs.length; i++) {
-
 
554
			
-
 
555
			if(obs[i].length == 3 && obs[i][2] != null && obs[i][2].equals("1")) {
-
 
556
				associeesTranmises[1] = true;
-
 
557
			}
-
 
558
		}
-
 
559
		
-
 
560
		return associeesTranmises;
505
	}
561
	}