[Suiviobsmer-commits] r1148 - in trunk/wao-ui/src/main: java/fr/ifremer/wao/ui/pages webapp
Author: bleny Date: 2011-04-06 15:40:12 +0000 (Wed, 06 Apr 2011) New Revision: 1148 Log: fix broken access to boat infos for admin Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Boats.java trunk/wao-ui/src/main/webapp/Boats.tml Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Boats.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Boats.java 2011-04-06 15:39:45 UTC (rev 1147) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Boats.java 2011-04-06 15:40:12 UTC (rev 1148) @@ -126,7 +126,8 @@ // private String sampleRowContextId; /** Selected boat immatriculation for showing boatInfos */ - @Persist(PersistenceConstants.FLASH) + //@Persist(PersistenceConstants.FLASH) + @Persist private Integer boatSelectedImmatriculation; @Persist @@ -445,7 +446,7 @@ /**************************** Boats List *****************************************/ /** DataSource containing the boats */ -// @Persist + @Persist private BoatDataSource boats; /** Current boat in the Grid */ @@ -537,7 +538,7 @@ } if (user.isAdmin() && getCompany() != null) { - companySelectedId = getCompany().getTopiaId(); +// companySelectedId = getCompany().getTopiaId(); } return boatsZone.getBody(); } @@ -566,19 +567,19 @@ private Date boardingFromDate; - private GenericSelectModel<Company> companies; + // private GenericSelectModel<Company> companies; @Inject private ServiceUser serviceUser; - @Property - @Persist(PersistenceConstants.FLASH) - private String companySelectedId; - private Company company; + public void setCompany(Company company) { + this.company = company; + } + /*@Persist - private WaoPropertyChangeListener propertyChange;*/ + private WaoPropertyChangeListener propertyChange;*/ /** /////////////////////// GLOBAL TO THE BLOCK /////////////////////// **/ @@ -611,11 +612,16 @@ * @return the GenericSelectModel<Company> * @throws WaoException */ - public GenericSelectModel<Company> getCompanies() throws WaoException { - if (companies == null) { - List<Company> results = serviceUser.getCompanies(true); - companies = new GenericSelectModel<Company>(results, Company.class, "name","topiaId",propertyAccess); - } +// public GenericSelectModel<Company> getCompanies() throws WaoException { +// if (companies == null) { +// List<Company> results = serviceUser.getCompanies(true); +// companies = new GenericSelectModel<Company>(results, Company.class, "name","topiaId",propertyAccess); +// } +// return companies; +// } + + public List<Company> getCompanies() { + List<Company> companies = serviceUser.getCompanies(true); return companies; } @@ -626,17 +632,27 @@ * @return the current Company * @throws WaoException */ - public Company getCompany() throws WaoException { +// public Company getCompany() throws WaoException { +// if (company == null) { +// if (StringUtils.isNotEmpty(companySelectedId)) { +// company = getCompanies().findObject(companySelectedId); +// } else if (!user.isAdmin()) { +// company = user.getCompany(); +// } +// } +// return company; +// } + + public Company getCompany() { if (company == null) { - if (StringUtils.isNotEmpty(companySelectedId)) { - company = getCompanies().findObject(companySelectedId); - } else if (!user.isAdmin()) { + if ( ! user.isAdmin()) { company = user.getCompany(); } } return company; } + /** * Used to get the selected boat. * Modified: trunk/wao-ui/src/main/webapp/Boats.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Boats.tml 2011-04-06 15:39:45 UTC (rev 1147) +++ trunk/wao-ui/src/main/webapp/Boats.tml 2011-04-06 15:40:12 UTC (rev 1148) @@ -146,7 +146,12 @@ <t:unless t:test="user.readOnly"> <form t:type="form" t:id="companySelectForm" t:zone="so-boats-boat-infos"> <label for="company">${message:wao.ui.entity.Company} :</label> - <input t:type="select" t:id="company" t:model="companies" t:value="companySelectedId" /> + <!--input t:type="select" t:id="company" t:model="companies" t:value="companySelectedId" /--> + <t:topiaEntitySelector t:id="company" + t:clazzName="Company" + t:labelPropertyName="name" + t:values="companies" + t:selectedValue="company" /> <input t:type="submit" class="ico search" t:id="searchCompany" value="Search" /> </form> </t:unless>
participants (1)
-
bleny@users.labs.libre-entreprise.org