Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1262 Rev 1284
Line 1... Line 1...
1
package org.tela_botanica.client.vues.structure;
1
package org.tela_botanica.client.vues.structure;
Line 2... Line 2...
2
 
2
 
-
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.Date;
4
import java.util.Iterator;
5
import java.util.Iterator;
Line 5... Line 6...
5
import java.util.List;
6
import java.util.List;
6
 
7
 
Line 31... Line 32...
31
import org.tela_botanica.client.util.Pattern;
32
import org.tela_botanica.client.util.Pattern;
32
import org.tela_botanica.client.util.UtilArray;
33
import org.tela_botanica.client.util.UtilArray;
33
import org.tela_botanica.client.util.UtilString;
34
import org.tela_botanica.client.util.UtilString;
34
import org.tela_botanica.client.vues.Formulaire;
35
import org.tela_botanica.client.vues.Formulaire;
Line -... Line 36...
-
 
36
 
35
 
37
import com.extjs.gxt.ui.client.Style.Scroll;
36
import com.extjs.gxt.ui.client.event.Events;
38
import com.extjs.gxt.ui.client.event.Events;
37
import com.extjs.gxt.ui.client.Registry;
39
import com.extjs.gxt.ui.client.Registry;
38
import com.extjs.gxt.ui.client.event.BaseEvent;
40
import com.extjs.gxt.ui.client.event.BaseEvent;
39
import com.extjs.gxt.ui.client.event.ButtonEvent;
41
import com.extjs.gxt.ui.client.event.ButtonEvent;
Line 116... Line 118...
116
	private ComboBox<InterneValeur> comboAcronyme = null;
118
	private ComboBox<InterneValeur> comboAcronyme = null;
117
	private TextField<String> ihChp = null;
119
	private TextField<String> ihChp = null;
118
	private TextField<String> mnhnChp = null;
120
	private TextField<String> mnhnChp = null;
119
	private ComboBox<InterneValeur> comboTypeStructure = null;
121
	private ComboBox<InterneValeur> comboTypeStructure = null;
120
	private TextField<String> nomStructureChp = null;
122
	private TextField<String> nomStructureChp = null;
121
	private DateField dateFondationChp = null;
123
	private TextField<String> dateFondationChp = null;
122
	private TextArea descriptionChp = null;
124
	private TextArea descriptionChp = null;
123
	private TextArea conditionAccesChp = null;
125
	private TextArea conditionAccesChp = null;
124
	private TextArea conditionUsageChp = null;
126
	private TextArea conditionUsageChp = null;
125
	private TextArea adrChp = null;
127
	private TextArea adrChp = null;
126
	private TextArea adrComplementChp = null;
128
	private TextArea adrComplementChp = null;
Line 340... Line 342...
340
			if (!personnelNumero.equals("")) {
342
			if (!personnelNumero.equals("")) {
341
				messages.add("Veuillez indiquez un prénom et un nom au personnel numéro : "+personnelNumero);
343
				messages.add("Veuillez indiquez un prénom et un nom au personnel numéro : "+personnelNumero);
342
			}
344
			}
343
		}
345
		}
Line -... Line 346...
-
 
346
 
-
 
347
		//Vérification de la date de fondation
-
 
348
		String valeurDateFondation = dateFondationChp.getValue();
-
 
349
		if (!UtilString.isEmpty(valeurDateFondation) && (!valeurDateFondation.matches("\\d{2}/\\d{2}/\\d{4}") && 
-
 
350
				!valeurDateFondation.matches("\\d{4}")))	{
-
 
351
				messages.add("La date de fondation n'est pas au format jj/MM/AAAA ou AAAA");
-
 
352
			} 
344
 
353
		
345
		// Affichage des messages d'alerte
354
		// Affichage des messages d'alerte
346
		if (messages.size() != 0) {
355
		if (messages.size() != 0) {
347
			String[] a = {};
356
			String[] a = {};
348
			a = messages.toArray(a);
357
			a = messages.toArray(a);
349
			MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
358
			MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
350
			return false;
359
			return false;
-
 
360
		}
351
		}
361
		
352
		return true;
362
		return true;
Line 353... Line 363...
353
	}
363
	}
354
	
364
	
Line 660... Line 670...
660
					structureCollectee.setTypePublic(comboLstpu.getValue().getId());
670
					structureCollectee.setTypePublic(comboLstpu.getValue().getId());
661
				} else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
671
				} else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
662
					structureCollectee.setTypePrive(comboLstpr.getValue().getId());
672
					structureCollectee.setTypePrive(comboLstpr.getValue().getId());
663
				}
673
				}
664
			}
674
			}
-
 
675
			
-
 
676
			String valeurDateFondation = dateFondationChp.getValue();
-
 
677
			if (!UtilString.isEmpty(valeurDateFondation))	{
-
 
678
				if (valeurDateFondation.matches("\\d{2}/\\d{2}/\\d{4}"))	{
-
 
679
					Date dateFondation = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDateFondation);
665
			structureCollectee.setDateFondation(dateFondationChp.getValue());
680
					structureCollectee.setDateFondation(dateFondation);
-
 
681
				} else if (valeurDateFondation.matches("\\d{4}"))	{
-
 
682
					structureCollectee.setDateFondation(valeurDateFondation + "-00-00");
-
 
683
				}
-
 
684
			}
Line 666... Line 685...
666
			
685
			
667
			structureCollectee.setDescription(descriptionChp.getValue());
686
			structureCollectee.setDescription(descriptionChp.getValue());
668
			structureCollectee.setConditionAcces(conditionAccesChp.getValue());
687
			structureCollectee.setConditionAcces(conditionAccesChp.getValue());
Line 755... Line 774...
755
				if (identification.getTypePublic().matches("^[0-9]+$")) {
774
				if (identification.getTypePublic().matches("^[0-9]+$")) {
756
					comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
775
					comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
757
					comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
776
					comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
758
				}
777
				}
759
			}
778
			}
-
 
779
			
-
 
780
			String dateFondation = identification.getAnneeOuDateFondation();
-
 
781
			if (!dateFondation.equals(""))	{
-
 
782
				if (dateFondation.endsWith("00-00"))	{
760
			dateFondationChp.setValue(identification.getDateFondation());
783
					dateFondationChp.setValue(dateFondation.substring(0, 4));
-
 
784
				} else {
-
 
785
					Date date = DateTimeFormat.getFormat("yyyy-MM-dd").parse(dateFondation);
-
 
786
					dateFondationChp.setValue(DateTimeFormat.getFormat("dd/MM/yyyy").format(date));
-
 
787
				}
-
 
788
			}
Line 761... Line 789...
761
			
789
			
762
			descriptionChp.setValue(identification.getDescription());
790
			descriptionChp.setValue(identification.getDescription());
763
			conditionAccesChp.setValue(identification.getConditionAcces());
791
			conditionAccesChp.setValue(identification.getConditionAcces());
Line 1194... Line 1222...
1194
		});
1222
		});
Line 1195... Line 1223...
1195
		
1223
		
1196
		ContentPanel cp = new ContentPanel();
1224
		ContentPanel cp = new ContentPanel();
1197
		cp.setHeading("Personnes travaillant sur les collections");
1225
		cp.setHeading("Personnes travaillant sur les collections");
1198
		cp.setIcon(Images.ICONES.table());
1226
		cp.setIcon(Images.ICONES.table());
1199
		//cp.setScrollMode(Scroll.AUTO);
1227
		cp.setScrollMode(Scroll.AUTO);
1200
		cp.setLayout(new FitLayout());
1228
		cp.setLayout(new FitLayout());
1201
		//cp.setWidth(1250);
1229
		//cp.setWidth(1250);
1202
		//cp.setHeight("100%");
1230
		//cp.setHeight("100%");
Line 1678... Line 1706...
1678
		
1706
		
1679
		ligneTs.add(gaucheTs, new ColumnData(0.5));  
1707
		ligneTs.add(gaucheTs, new ColumnData(0.5));  
1680
		ligneTs.add(droiteTs, new ColumnData(0.5));
1708
		ligneTs.add(droiteTs, new ColumnData(0.5));
Line 1681... Line 1709...
1681
		fieldSetIdentite.add(ligneTs);
1709
		fieldSetIdentite.add(ligneTs);
1682
		
1710
		
1683
		dateFondationChp = new DateField();
1711
		dateFondationChp = new TextField();
1684
		dateFondationChp.setTabIndex(tabIndex++);
-
 
1685
		dateFondationChp.setFieldLabel("Date de fondation");
-
 
1686
		dateFondationChp.getPropertyEditor().getFormat();
-
 
1687
		dateFondationChp.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
1712
		dateFondationChp.setTabIndex(tabIndex++);
Line 1688... Line 1713...
1688
		dateFondationChp.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
1713
		dateFondationChp.setFieldLabel("Date de fondation");
1689
		fieldSetIdentite.add(dateFondationChp);
1714
		fieldSetIdentite.add(dateFondationChp);
1690
		
1715