Subversion Repositories eFlore/Applications.coel

Rev

Rev 689 | Rev 695 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 689 Rev 692
Line 9... Line 9...
9
import java.util.List;
9
import java.util.List;
Line 10... Line 10...
10
 
10
 
11
import org.tela_botanica.client.ComposantClass;
11
import org.tela_botanica.client.ComposantClass;
12
import org.tela_botanica.client.Mediateur;
12
import org.tela_botanica.client.Mediateur;
-
 
13
import org.tela_botanica.client.RegistreId;
13
import org.tela_botanica.client.RegistreId;
14
import org.tela_botanica.client.composants.ChampMultiValeurs;
14
import org.tela_botanica.client.images.Images;
15
import org.tela_botanica.client.images.Images;
15
import org.tela_botanica.client.interfaces.Rafraichissable;
16
import org.tela_botanica.client.interfaces.Rafraichissable;
Line 16... Line 17...
16
import org.tela_botanica.client.modeles.Configuration;
17
import org.tela_botanica.client.modeles.Configuration;
Line 498... Line 499...
498
		fsContact.setLayout(new RowLayout());
499
		fsContact.setLayout(new RowLayout());
Line 499... Line 500...
499
 
500
 
500
		right.add(fsContact);
501
		right.add(fsContact);
Line 501... Line 502...
501
		hmIdentite.put("fsContact", fsContact);
502
		hmIdentite.put("fsContact", fsContact);
502
 
503
 
503
		LabelField lfCourriel = new LabelField();
-
 
504
		lfCourriel.setText("<b>Courriels:</b>");
-
 
505
 
-
 
506
		fsContact.add(lfCourriel);
-
 
507
 
-
 
508
		LayoutContainer lcCourriel = new LayoutContainer();
-
 
509
		lcCourriel.setLayout(new ColumnLayout());
-
 
510
			
-
 
511
		TextField tfCourriel = new TextField();
-
 
512
		lcCourriel.add(tfCourriel, new ColumnData(0.80));
-
 
513
		
-
 
514
		HiddenField hfHiddenCourriel = new HiddenField();
-
 
515
		hfHiddenCourriel.setId("tfHiddenCourriel");
-
 
516
		hfHiddenCourriel.setValue("");
-
 
517
		
-
 
518
		add(hfHiddenCourriel);
-
 
519
		hmIdentite.put("hfHiddenCourriel", hfHiddenCourriel);
-
 
520
		hmIdentite.put("tfCourriel", tfCourriel);
-
 
521
 
-
 
522
		Button bAjouterCourriel = new Button();
-
 
523
		bAjouterCourriel.setIcon(Images.ICONES.ajouter());
-
 
524
		bAjouterCourriel.addSelectionListener(
-
 
525
			new SelectionListener<ButtonEvent>() {
-
 
526
	
-
 
527
				public void componentSelected(ButtonEvent ce) {
-
 
528
					
-
 
529
					String strEmail = ((TextField<String>) hmIdentite.get("tfCourriel")).getValue();
-
 
530
					if ((strEmail==null)||(strEmail.trim().equals("")))	{
-
 
531
						MessageBox.alert("Erreur de saisie", "Vous devez saisir une adresse", null);
-
 
532
					} else if (hmIdentite.get("email-" + strEmail) != null){
-
 
533
						MessageBox.alert("Erreur de saisie", "L'adresse saisie est déjà dans la liste", null);							
-
 
534
					} else {
-
 
535
						
-
 
536
						if (!strEmail.matches("(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*"))	{
-
 
537
							MessageBox.alert("Erreur de saisie", "L'adresse n'est pas au bon format (ex: me@domain.com)", null);			
-
 
538
						} else if (strEmail.length()>255){
-
 
539
							MessageBox.alert("Erreur de saisie", "L'adresse ne peut dépasser 255 caractères", null);
-
 
540
						} else {
-
 
541
							ajouterCourriel(strEmail);
-
 
542
						}
-
 
543
						
-
 
544
					}
-
 
545
					
-
 
546
					
-
 
547
				}
-
 
548
			});
-
 
549
			
-
 
550
		lcCourriel.add(bAjouterCourriel, new ColumnData(0.15));
-
 
Line -... Line 504...
-
 
504
		//LabelField lfCourriel = new LabelField();
-
 
505
		//lfCourriel.setText("<b>Courriels:</b>");
-
 
506
 
-
 
507
		ChampMultiValeurs courriels = new ChampMultiValeurs("Courriels");
551
					
508
		fsContact.add(courriels);
Line 552... Line 509...
552
		fsContact.add(lcCourriel);
509
		hmIdentite.put("courriels", courriels);
553
 
510
		
Line 554... Line -...
554
		LayoutContainer lcCourrielContainer = new LayoutContainer(new RowLayout());
-
 
555
		
511
		LayoutContainer lcCourrielContainer = new LayoutContainer(new RowLayout());
556
		fsContact.add(lcCourrielContainer);
-
 
557
		hmIdentite.put("lcCourrielContainer", lcCourrielContainer);
-
 
558
 
512
		
559
 
-
 
560
		LabelField lfUrl = new LabelField();
-
 
561
		lfUrl.setText("<b>Sites Web:</b>");
-
 
562
		
-
 
563
		fsContact.add(lfUrl);
-
 
564
 
-
 
565
		LayoutContainer lcUrl = new LayoutContainer(new ColumnLayout());
-
 
566
		hmIdentite.put("lcUrl", lcUrl);
-
 
567
 
-
 
568
		HiddenField<String> hfUrl = new HiddenField<String>();
-
 
569
		hmIdentite.put("hfUrl", hfUrl);
-
 
570
		add(hfUrl);
-
 
571
					
513
		fsContact.add(lcCourrielContainer);
572
		TextField tfUrl = new TextField();
-
 
573
		tfUrl.setValue("http://");
-
 
574
 
-
 
575
		lcUrl.add(tfUrl, new ColumnData(0.8));
-
 
576
		hmIdentite.put("tfUrl", tfUrl);
-
 
577
 
-
 
578
		Button ibAjouterUrl = new Button();
-
 
579
		ibAjouterUrl.setIcon(Images.ICONES.ajouter());
-
 
580
		ibAjouterUrl.addSelectionListener(new SelectionListener<ButtonEvent>() {
-
 
581
 
-
 
582
			public void componentSelected(ButtonEvent ce) {
-
 
583
				
-
 
584
				TextField<String> tfUrl = (TextField) hmIdentite.get("tfUrl");
-
 
585
				String strUrl = tfUrl.getValue();
-
 
586
				
-
 
587
				if ((strUrl == null)||(strUrl.trim().equals("http://"))||(strUrl.trim().equals("")))	{
-
 
588
					MessageBox.alert("Erreur de saisie", "Vous devez saisir un URL", null);
-
 
589
				} else if(hmIdentite.get("url-" + strUrl) != null)	{
-
 
590
					MessageBox.alert("Erreur de saisie", "L'url est déjà présente dans la liste.", null);
-
 
591
				}	else	{
-
 
592
					tfUrl.setValue("http://");
-
 
593
						//if (!strUrl.matches("[a-z]{3,}://[a-z0-9-]+.[.a-z0-9-]+(?::[0-9]*)?"))	{
-
 
594
						if (!strUrl.startsWith("http://"))	{	
-
 
595
							MessageBox.alert("Erreur de saisie", "L'adresse n'est pas au bon format (ex: http://www.domain.com)", null);			
-
 
596
						} else if (strUrl.length()>255){
-
 
597
							MessageBox.alert("Erreur de saisie", "L'adresse ne peut dépasser 255 caractères", null);
-
 
598
						} else {
-
 
599
							ajouterUrl(strUrl);
-
 
600
						}
-
 
601
					
-
 
602
				}
-
 
603
				
-
 
Line 604... Line -...
604
			}
-
 
605
		});
-
 
606
			
-
 
607
		lcUrl.add(ibAjouterUrl, new ColumnData(0.15));
-
 
608
		fsContact.add(lcUrl);
-
 
609
			
514
		hmIdentite.put("lcCourrielContainer", lcCourrielContainer);
610
		LayoutContainer lcUrlContainer = new LayoutContainer(new RowLayout());
515
 
Line 611... Line 516...
611
		
516
		ChampMultiValeurs sites = new ChampMultiValeurs("Sites web");
612
		fsContact.add(lcUrlContainer);
517
		fsContact.add(sites);
Line 1004... Line 909...
1004
			}
909
			}
1005
			else if (info.getType().equals("maj_utilisateur"))	{
910
			else if (info.getType().equals("maj_utilisateur"))	{
1006
				gererEtatActivationBouton();
911
				gererEtatActivationBouton();
1007
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
912
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
Line 1008... Line -...
1008
			
-
 
1009
			
913
			
1010
					Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
914
					Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
1011
					Iterator itPersonneListe = colPersonneListe.iterator();
915
					Iterator itPersonneListe = colPersonneListe.iterator();
Line 1012... Line 916...
1012
					Personne personne = (Personne) itPersonneListe.next();
916
					Personne personne = (Personne) itPersonneListe.next();
Line 1087... Line 991...
1087
							ajouterTelephone(strTelephone, idTel, strTypeTelephone);
991
							ajouterTelephone(strTelephone, idTel, strTypeTelephone);
1088
						}
992
						}
1089
					}
993
					}
Line 1090... Line 994...
1090
					
994
					
1091
					//Courriel
-
 
1092
					LinkedList<String> lCourriels = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
-
 
1093
					if (lCourriels != null) {
995
					//Courriel
1094
						Iterator<String> itCourriels = lCourriels.iterator(); 
996
					((ChampMultiValeurs) hmIdentite.get("courriels")).peupler(personne.getCourriel());
1095
					
997
					
1096
						while (itCourriels.hasNext())	{
998
					//Sites web
1097
							String strEmail = itCourriels.next();
-
 
1098
							ajouterCourriel(strEmail);
-
 
1099
						}
-
 
Line 1100... Line -...
1100
					}
-
 
1101
					
-
 
1102
					// Sites
-
 
1103
					LinkedList<String> lUrl = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_url");
-
 
1104
					if (lUrl!=null) {
-
 
1105
						Iterator<String> itUrl = lUrl.iterator(); 
-
 
1106
						while (itUrl.hasNext())	{
-
 
1107
							String strUrl = itUrl.next();
-
 
1108
							ajouterUrl(strUrl);
-
 
Line 1109... Line 999...
1109
						}
999
					((ChampMultiValeurs) hmIdentite.get("sites")).peupler(personne.getString("truk_url"));
1110
					}
1000
					
1111
					
1001
					
Line 1346... Line 1236...
1346
			
1236
			
Line 1347... Line -...
1347
		
-
 
1348
		
-
 
1349
	}
-
 
1350
	
-
 
1351
	public void ajouterCourriel(String strEmail)	{
-
 
1352
			
-
 
1353
			TextField<String> tfCourriel = (TextField<String>) hmIdentite.get("tfCourriel");
-
 
1354
			tfCourriel.setValue("");
-
 
1355
			
-
 
1356
			//Ajouter adresse email
-
 
1357
			LayoutContainer lcCourrielContainer = (LayoutContainer) hmIdentite.get("lcCourrielContainer");
-
 
1358
			
-
 
1359
			LayoutContainer lcCourriel = new LayoutContainer();
-
 
1360
			lcCourriel.setLayout(new ColumnLayout());
-
 
1361
			
-
 
1362
			LabelField lfCourriel = new LabelField();
-
 
1363
			lfCourriel.setText(strEmail);
-
 
1364
			
-
 
1365
			lcCourriel.add(lfCourriel, new ColumnData(0.8));
-
 
1366
			hmIdentite.put("lc-" + strEmail, lcCourriel);
-
 
1367
			
-
 
1368
			//Bouton supprimer
-
 
1369
			Button btnSupprimerCourriel = new Button();
-
 
1370
			btnSupprimerCourriel.setIcon(Images.ICONES.supprimer());
-
 
1371
			btnSupprimerCourriel.setId(strEmail);
-
 
1372
			btnSupprimerCourriel.addSelectionListener(new SelectionListener<ButtonEvent>() {
-
 
1373
				
-
 
1374
				public void componentSelected(ButtonEvent ce) {
-
 
1375
					//Suppression de l'adresse email
-
 
1376
					String strEmail = ce.getComponent().getId();
-
 
1377
					LayoutContainer lcCourrielContainer = (LayoutContainer) hmIdentite.get("lcCourrielContainer");
-
 
1378
					LayoutContainer lcCourriel = (LayoutContainer) hmIdentite.get("lc-" + strEmail);
-
 
1379
					lcCourrielContainer.remove(lcCourriel);
-
 
1380
					
-
 
1381
					hmIdentite.remove("lc-" + strEmail);
-
 
1382
					hmIdentite.remove("email-" + strEmail);
-
 
1383
					
-
 
1384
						HiddenField<String> hfHiddenCourriel = (HiddenField) hmIdentite.get("hfHiddenCourriel");
-
 
1385
					String strValeurCourriel = hfHiddenCourriel.getValue();
-
 
1386
					strValeurCourriel = strValeurCourriel.replace(strEmail + ";;", "");
-
 
1387
					hfHiddenCourriel.setValue(strValeurCourriel);
-
 
1388
					
-
 
1389
				}
-
 
1390
				
-
 
1391
			});
-
 
1392
			
-
 
1393
			lcCourriel.add(btnSupprimerCourriel);
-
 
1394
			
-
 
1395
			
-
 
1396
			
-
 
1397
			lcCourrielContainer.add(lcCourriel);
-
 
1398
			hmIdentite.put("email-" + strEmail, lfCourriel);	
-
 
1399
			
-
 
1400
			HiddenField<String> hfHiddenCourriel = (HiddenField) hmIdentite.get("hfHiddenCourriel");
-
 
1401
			String strHiddenCourrielValue = hfHiddenCourriel.getValue();
-
 
1402
			if (strHiddenCourrielValue == null) { 
-
 
1403
				strHiddenCourrielValue = "";
-
 
1404
			}
-
 
1405
			hfHiddenCourriel.setRawValue(strHiddenCourrielValue + strEmail + ";;");
-
 
1406
			
-
 
1407
			
-
 
1408
			layout();
-
 
1409
			
-
 
1410
	}
-
 
1411
	
-
 
1412
	public void ajouterUrl(String strUrl)	{
-
 
1413
		
-
 
1414
		LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcUrlContainer");
-
 
1415
		
-
 
1416
		LayoutContainer lcUrl = new LayoutContainer();
-
 
1417
		lcUrl.setLayout(new ColumnLayout());
-
 
1418
		hmIdentite.put("lc-" + strUrl, lcUrl);
-
 
1419
		
-
 
1420
		
-
 
1421
		Text tUrl = new Text(strUrl);
-
 
1422
		hmIdentite.put("url-"+strUrl, tUrl);
-
 
1423
		
-
 
1424
		lcUrl.add(tUrl, new ColumnData(0.8));
-
 
1425
		
-
 
1426
		Button ibSupprimerUrl = new Button();
-
 
1427
		ibSupprimerUrl.setIcon(Images.ICONES.supprimer());
-
 
1428
		ibSupprimerUrl.setId(strUrl);
-
 
1429
		ibSupprimerUrl.addSelectionListener(new SelectionListener<ButtonEvent>() {
-
 
1430
 
-
 
1431
			public void componentSelected(ButtonEvent ce) {
-
 
1432
				
-
 
1433
				//Suppression url
-
 
1434
				String strUrl = ce.getComponent().getId();
-
 
1435
				LayoutContainer lcUrl = (LayoutContainer) hmIdentite.get("lc-" + strUrl);
-
 
1436
				LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcUrlContainer");
-
 
1437
				
-
 
1438
				lcUrlContainer.remove(lcUrl);
-
 
1439
				
-
 
1440
				
-
 
1441
				HiddenField<String> hfUrl = (HiddenField<String>) hmIdentite.get("hfUrl");
-
 
1442
				String strValeurUrl = hfUrl.getValue();
-
 
1443
				strValeurUrl = strValeurUrl.replace(strUrl, "");
-
 
1444
				hfUrl.setValue(strValeurUrl);
-
 
1445
				
-
 
1446
			}
-
 
1447
		});
-
 
1448
		
-
 
1449
		lcUrl.add(ibSupprimerUrl, new ColumnData(0.15));
-
 
1450
		lcUrlContainer.add(lcUrl);
-
 
1451
		
-
 
1452
		HiddenField<String> hfUrl = (HiddenField<String>) hmIdentite.get("hfUrl");
-
 
1453
		String strValeurUrl = hfUrl.getValue();
-
 
1454
		if (strValeurUrl == null)	{
-
 
1455
			strValeurUrl = "";
-
 
1456
		}
-
 
1457
		
-
 
1458
		strValeurUrl += strUrl + ";;";
-
 
1459
		hfUrl.setValue(strValeurUrl);
-
 
1460
		
-
 
1461
		layout();
-
 
1462
		
-
 
1463
		
1237
		
Line 1464... Line 1238...
1464
		
1238
		
Line 1465... Line 1239...
1465
	}
1239
	}
Line 1583... Line 1357...
1583
		personneSelectionnee.set("ce_truk_prefix", strValeur);
1357
		personneSelectionnee.set("ce_truk_prefix", strValeur);
Line 1584... Line 1358...
1584
		
1358
		
1585
		strValeur = obtenirValeurCombo("cbSuffixe"); 
1359
		strValeur = obtenirValeurCombo("cbSuffixe"); 
Line 1586... Line 1360...
1586
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1360
		personneSelectionnee.set("ce_truk_suffix", strValeur);
Line 1587... Line 1361...
1587
		
1361
		
1588
		personneSelectionnee.set("truk_courriel", ((HiddenField<String>) hmIdentite.get("hfHiddenCourriel")).getValue());
1362
		personneSelectionnee.set("truk_courriel", ((ChampMultiValeurs) hmIdentite.get("courriels")).getValeurs());
1589
		
1363
		
Line 1640... Line 1414...
1640
		if (logoUrls == null)	{
1414
		if (logoUrls == null)	{
1641
			logoUrls = "";
1415
			logoUrls = "";
1642
		}
1416
		}
1643
		personneSelectionnee.set("truk_logo", logoUrls);
1417
		personneSelectionnee.set("truk_logo", logoUrls);
Line 1644... Line 1418...
1644
		
1418
		
Line 1645... Line 1419...
1645
		personneSelectionnee.set("truk_url", ((HiddenField) hmIdentite.get("hfUrl")).getValue());
1419
		personneSelectionnee.set("truk_url", ((ChampMultiValeurs) hmIdentite.get("sites")).getValeurs());
1646
		
1420
		
1647
		if (lstMessageErreur.size() == 0)	{
1421
		if (lstMessageErreur.size() == 0)	{
1648
			mediateur.enregistrerPersonne(this, personneSelectionnee);
1422
			mediateur.enregistrerPersonne(this, personneSelectionnee);