Commit 8f92fad3 by Antti Tonkyra

Merge branch 'devel' of codecrew.fi:bortal into devel

2 parents 39393d8f 717d08dc
Showing with 422 additions and 218 deletions
eclipse.preferences.version=1
encoding/<project>=UTF-8
......@@ -193,6 +193,7 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
HttpResponse response = client.execute(postRequest);
final StringWriter writer = new StringWriter();
IOUtils.copy(response.getEntity().getContent(), writer, "UTF8");
final String xmlReturn = writer.toString();
......
......@@ -116,7 +116,8 @@ public class MenuBean implements MenuBeanLocal {
MenuNavigation userprofile = usermenu.addPage(null, null);
userprofile.setKey("topnavi.profile");
userprofile.addPage(menuitemfacade.findOrCreate("/user/edit"), UserPermission.MODIFY);
userprofile.addPage(menuitemfacade.findOrCreate("/user/edit"), UserPermission.MODIFY);
userprofile.addPage(menuitemfacade.findOrCreate("/user/changePassword"), UserPermission.VIEW_SELF);
userprofile.addPage(menuitemfacade.findOrCreate("/auth/logout"), UserPermission.LOGOUT);
/*
......@@ -195,6 +196,12 @@ public class MenuBean implements MenuBeanLocal {
adminPlaces.addPage(menuitemfacade.findOrCreate("/place/adminPlacemap"), UserPermission.VIEW_ALL);
// adminPlaces.addPage(menuitemfacade.findOrCreate("/place/adminGroups"), UserPermission.VIEW_ALL); // todo: make new view for managing
MenuNavigation mapnavi = adminPlaces.addPage(null, null);
mapnavi.setKey("topnavi.maps");
mapnavi.addPage(menuitemfacade.findOrCreate("/map/list"), MapPermission.MANAGE_MAPS);
mapnavi.addPage(menuitemfacade.findOrCreate("/map/create"), MapPermission.MANAGE_MAPS);
mapnavi.addPage(menuitemfacade.findOrCreate("/map/edit"), null).setVisible(false);
// event
MenuNavigation adminevent = adminmenu.addPage(null, null);
......
......@@ -6,6 +6,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Calendar;
......@@ -28,8 +29,6 @@ import javax.persistence.PersistenceContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.enterprise.security.webservices.GFServerPipeCreator;
import fi.codecrew.moya.enums.apps.SpecialPermission;
import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.facade.ApprovalFacade;
......@@ -75,8 +74,7 @@ public class UserBean implements UserBeanLocal {
private static final Logger logger = LoggerFactory.getLogger(UserBean.class);
/**
* Java EE container injektoi tämän luokkamuuttujan luokan luonnin
* yhteydessä.
* Java EE container injektoi tämän luokkamuuttujan luokan luonnin yhteydessä.
*/
@EJB
private UserFacade userFacade;
......@@ -226,7 +224,7 @@ public class UserBean implements UserBeanLocal {
@Override
@RolesAllowed(SpecialPermission.S_USER)
public UserImage uploadImage(EventUser user, String contentType, byte[] image, String filename, String description) {
public UserImage uploadImage(EventUser user, String contentType, InputStream imagestream, String filename, String description) {
user = eventUserFacade.merge(user);
logger.debug("uploading image to userid {}", user);
......@@ -237,7 +235,6 @@ public class UserBean implements UserBeanLocal {
throw new EJBAccessException("No permission to upload image as another user");
}
ByteArrayInputStream imagestream = new ByteArrayInputStream(image);
BufferedImage bimage;
try {
bimage = ImageIO.read(imagestream);
......@@ -587,9 +584,6 @@ public class UserBean implements UserBeanLocal {
return user;
}
@Override
public SearchResult<User> getEventUsers(SearchQuery search) {
......@@ -619,19 +613,19 @@ public class UserBean implements UserBeanLocal {
returnUsers = new SearchResult<EventUser>(newSearchList, (long) newSearchList.size());
}
else if(searchQuery.isUsersWithUnusedCodes()){
else if (searchQuery.isUsersWithUnusedCodes()) {
List<EventUser> newSearchList = new ArrayList<EventUser>();
List<GroupMembership> groupMembers = new ArrayList<GroupMembership>();
groupMembers = gmfacade.findAllWithoutUser();
for (GroupMembership member : groupMembers) {
PlaceGroup group = member.getPlaceGroup();
if(group != null && !newSearchList.contains(group.getCreator())) {
if (group != null && !newSearchList.contains(group.getCreator())) {
newSearchList.add(group.getCreator());
}
}
returnUsers = new SearchResult<EventUser>(newSearchList, (long)newSearchList.size());
returnUsers = new SearchResult<EventUser>(newSearchList, (long) newSearchList.size());
}
return returnUsers;
......
......@@ -51,11 +51,7 @@
<artifactId>pdfjet</artifactId>
<version>0.0.0-2013-08-19</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-authmodule-client</artifactId>
......@@ -66,5 +62,10 @@
<artifactId>httpclient</artifactId>
<version>4.3-beta2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
eclipse.preferences.version=1
encoding/<project>=UTF-8
package fi.codecrew.moya.beans;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import javax.ejb.Local;
......@@ -27,7 +28,7 @@ public interface UserBeanLocal {
EventUser mergeChanges(EventUser user);
UserImage uploadImage(EventUser user, String contentType, byte[] image, String filename, String description);
UserImage uploadImage(EventUser user, String contentType, InputStream inputStream, String filename, String description);
UserImage findUserImage(int id);
......@@ -69,8 +70,7 @@ public interface UserBeanLocal {
List<Role> findUsersRoles(EventUser u);
/**
* NOTICE! If the user parameter is a persisted object the returned
* EventUser has a reloaded user, eg changes to the User object are lost!
* NOTICE! If the user parameter is a persisted object the returned EventUser has a reloaded user, eg changes to the User object are lost!
*
* @param user
* @return
......
eclipse.preferences.version=1
encoding/<project>=UTF-8
eclipse.preferences.version=1
encoding/<project>=UTF-8
eclipse.preferences.version=1
encoding/<project>=UTF-8
......@@ -29,9 +29,6 @@
<dependent-module archiveName="pdfjet-0.0.0-2013-08-19.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/fi/iudex/pdfjet/pdfjet/0.0.0-2013-08-19/pdfjet-0.0.0-2013-08-19.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="commons-io-1.3.2.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="moya-authmodule-client-0.2.0.jar" deploy-path="/lib" handle="module:/resource/MoyaAuthModuleClient/MoyaAuthModuleClient">
<dependency-type>uses</dependency-type>
</dependent-module>
......@@ -47,6 +44,9 @@
<dependent-module archiveName="commons-codec-1.6.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-codec/commons-codec/1.6/commons-codec-1.6.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="commons-io-2.2.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-io/commons-io/2.2/commons-io-2.2.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="slf4j-jdk14-1.7.5.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/org/slf4j/slf4j-jdk14/1.7.5/slf4j-jdk14-1.7.5.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
......
eclipse.preferences.version=1
encoding/<project>=UTF-8
eclipse.preferences.version=1
encoding//WebContent/resources/templates/template1/css/style.css=UTF-8
encoding/<project>=UTF-8
......@@ -12,13 +12,14 @@
<res-ref-name>jsf/ProjectStage</res-ref-name>
<res-type>java.lang.String</res-type>
</resource-ref>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<filter>
<display-name>PrimefacesFileupload</display-name>
<filter-name>PrimeFacesFileupload</filter-name>
<filter-name>PrimefacesFileupload</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter
</filter-class>
</filter>
......@@ -28,7 +29,7 @@
<filter-class>fi.codecrew.moya.HostnameFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFacesFileupload</filter-name>
<filter-name>PrimefacesFileupload</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter-mapping>
......
......@@ -26,7 +26,7 @@
<h1>#{i18n["adduser.update"]}</h1>
<br />
<br />
<a class="touchItem" href="javascript:dophoto(pc);">
<a class="touchItem" href="javascript:dophoto(PF('pc'));">
<div>#{i18n["adduser.takePhoto"]}</div>
</a>
</h:panelGroup>
......
......@@ -61,12 +61,12 @@
<ui:fragment rendered="#{!billEditView.bill.paid and !billEditView.bill.expired}">
<h:form>
<p:commandButton id="cancelbtn" onclick="confirmation.show()" value="#{i18n['bill.cancel']}" />
<p:commandButton id="cancelbtn" onclick="PF('confirmation').show()" value="#{i18n['bill.cancel']}" />
<p:confirmDialog id="confirmDialog" message="#{i18n['generic.sure.message']}" header="#{i18n['generic.sure.header']}" severity="alert" widgetVar="confirmation">
<p:commandButton value="#{i18n['generic.sure.yes']}" onclick="confirmation.hide()" actionListener="#{billEditView.expireBill()}" ajax="false" />
<p:commandButton value="#{i18n['generic.sure.no']}" onclick="confirmation.hide()" type="button" />
<p:commandButton value="#{i18n['generic.sure.yes']}" onclick="PF('confirmation').hide()" actionListener="#{billEditView.expireBill()}" ajax="false" />
<p:commandButton value="#{i18n['generic.sure.no']}" onclick="PF('confirmation').hide()" type="button" />
</p:confirmDialog>
</h:form>
......
......@@ -17,6 +17,10 @@
</c:when>
<c:otherwise>
<login:login isOneliner="true" />
<br/>
<h:link value="#{i18n['submenu.user.create']}" outcome="/user/create" />
<br/>
<h:link value="#{i18n['submenu.auth.sendResetMail']}" outcome="/auth/sendResetMail" />
</c:otherwise>
</c:choose>
</composite:implementation>
......
......@@ -30,7 +30,7 @@
<p:overlayPanel id="chartPanel" for="webcamButton" hideEffect="fade">
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:commandButton type="button" value="Capture" onclick="pc.capture()" />
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" />
</p:overlayPanel>
<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
......
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:p="http://primefaces.org/ui">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:p="http://primefaces.org/ui">
<composite:interface>
......@@ -20,27 +21,28 @@
<h:panelGroup>
<ui:fragment rendered="#{not empty userView.user.id}">
<p:dialog rendered="#{!cc.attrs.camAlwaysOn}" id="chartPanel" for="webcamButton" modal="true" dynamic="true" widgetVar="webcamDialog">
<p:dialog id="chartPanel" for="webcamButton" modal="true" dynamic="true" widgetVar="webcamDialog">
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:commandButton type="button" value="Capture" onclick="pc.capture()" />
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" />
</p:dialog>
<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
<ui:fragment rendered="#{!empty userView.user.currentImage}">
<img style="width: 150px;" src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img" alt="image" />
</ui:fragment>
<br />
<p:commandButton rendered="#{!cc.attrs.camAlwaysOn}" id="webcamButton" value="#{i18n['userimage.webcam']}" onclick="webcamDialog.show()" type="button" />
<p:commandButton rendered="#{!cc.attrs.camAlwaysOn}" id="webcamButton" value="#{i18n['userimage.webcam']}" onclick="PF('webcamDialog').show()" type="button" />
<br />
<br />
<ui:fragment rendered="#{cc.attrs.camAlwaysOn}">
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:commandButton type="button" value="Capture" onclick="pc.capture()" />
</ui:fragment>
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" />
</ui:fragment>
<!-- -->
<p:fileUpload id="uploadfile" value="#{userView.image}" mode="simple" required="true" requiredMessage="Required!" invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024" />
<p:fileUpload id="uploadfile" required="TRUE" requiredMessage="Required!" invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024" value="#{userView.image}" mode="simple" />
<p:message for="uploadfile" />
<p:commandButton action="#{userView.sendImage}" ajax="false" value="#{i18n['user.imagesubmit']}" />
</ui:fragment>
......
......@@ -30,7 +30,7 @@
<p:overlayPanel id="chartPanel" for="webcamButton" hideEffect="fade">
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:commandButton type="button" value="Capture" onclick="pc.capture()" />
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" />
</p:overlayPanel>
<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html class="no-js" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<html class="no-js" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:tools="http://java.sun.com/jsf/composite/cditools"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html" locale="#{sessionHandler.locale}">
......@@ -111,16 +112,17 @@
</div>
<br />
<div class="ui-widget-header">Select Mode</div>
<div class="ui-widget-content" style="text-align: center">
<h:form render="#{menuview.viewChangeTopmenu.size() gt 1}">
<p:selectOneMenu value="#{menuView.menuChange}">
<p:ajax listener="#{menuView.menuChangeEvent}" />
<f:selectItems var="menuitem" value="#{menuView.viewChangeTopmenu}" itemLabel="#{i18n[menuitem.navigation.key]}" itemValue="#{menuitem.outcome}" />
</p:selectOneMenu>
</h:form>
</div>
<ui:fragment rendered="#{menuView.renderTopmenuChanger}">
<div class="ui-widget-header">Select Mode: #{menuView.renderTopmenuChanger}</div>
<div class="ui-widget-content" style="text-align: center">
<h:form>
<p:selectOneMenu value="#{menuView.menuChange}">
<p:ajax listener="#{menuView.menuChangeEvent}" />
<f:selectItems var="menuitem" value="#{menuView.viewChangeTopmenu}" itemLabel="#{i18n[menuitem.navigation.key]}" itemValue="#{menuitem.outcome}" />
</p:selectOneMenu>
</h:form>
</div>
</ui:fragment>
</div>
</aside>
</section>
......
......@@ -23,7 +23,7 @@
<div id="webcamcontainer" style="display: none;">
<h:form>
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:commandButton type="button" value="Capture" onclick="pc.capture()" />
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" />
</h:form>
</div>
......
......@@ -42,17 +42,17 @@
<h:selectBooleanCheckbox id="onlythisevent" value="#{userSearchView.searchQuery.onlyThisEvent}" />
<h:outputLabel for="onlythisevent" value="#{i18n['userlist.onlythisevent']}" />
<br />
<h:selectBooleanCheckbox id="userswithunusedcodes" value="#{userSearchView.searchQuery.usersWithUnusedCodes}" />
<h:outputLabel for="userswithunusedcodes" value="#{i18n['userlist.usersWithUnusedCodes']}" />
<br />
<h:inputText value="#{userSearchView.search}" />
<h:commandButton value="#{i18n['userlist.search']}" action="#{userSearchView.newSearch()}" />
</h:panelGroup>
<h:panelGroup>
<a style="display: #{((userCartView.isEmpty())?'block':'none')};" onclick="$('#usercart').show(); $(this).hide();"><h:outputText value="#{i18n['usercart.showCart']}" /></a>
<div id="usercart" style="display: #{((userCartView.isEmpty())?'none':'block')};">
<a style="display: #{((userCartView.isEmpty())?'block':'none')}" onclick="$('#usercart').show(); $(this).hide();"><h:outputText value="#{i18n['usercart.showCart']}" /></a>
<div id="usercart" style="display: #{((userCartView.isEmpty())?'none':'block')}">
<h:outputText value="#{i18n['usercart.cartsize']}" />
<h:outputText value=" #{userCartView.userCartSize}" />
<h:commandButton action="#{userCartView.clearCart()}" value="#{i18n['usercart.clear']}" />
......@@ -66,7 +66,7 @@
</div>
</h:panelGroup>
</h:panelGrid>
<h:outputText value="#{i18n['userlist.searchcount']}" />: <h:outputText value="#{userSearchView.resultcount}" />
<h:outputText value="#{i18n['userlist.searchcount']}" />: <h:outputText value="#{userSearchView.resultcount}" />
</h:form>
<p>
<users:list rendered="#{!userSearchView.searchQuery.onlyThisEvent}" />
......
......@@ -15,8 +15,8 @@
<p:inputTextarea />
<br />
<p:commandButton oncomplete="dialog.hide()" actionListener="#{userOverviewView.rejectCard()}" value="Apply" />
<p:commandButton onclick="dialog.hide()" type="button" value="Cancel" />
<p:commandButton oncomplete="PF('dialog').hide()" actionListener="#{userOverviewView.rejectCard()}" value="Apply" />
<p:commandButton onclick="PF('dialog').hide()" type="button" value="Cancel" />
</p:dialog>
<h:form id="form">
......@@ -52,7 +52,7 @@
<!-- <f:ajax execute="uov-items" render="@all"></f:ajax> -->
</p:commandButton>
<p:commandButton id="Reject" value="Reject" onclick="dialog.show();" type="button" />
<p:commandButton id="Reject" value="Reject" onclick="PF('dialog').show();" type="button" />
</p:column>
</p:dataTable>
</h:form>
......
......@@ -23,7 +23,7 @@
<h:form>
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:commandButton type="button" value="Capture" onclick="pc.capture()" />
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" />
</h:form>
......
......@@ -26,7 +26,7 @@
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
......@@ -56,12 +56,7 @@
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
<version>4.0-20130828.122054-5</version>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
......@@ -78,5 +73,15 @@
<artifactId>javamelody-core</artifactId>
<version>1.46.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
user.nickSizeMessage=Nick has to be at least {min} characters long.
user.emailregex=Field must contain an email address.
javax.validation.constraints.NotNull.message=Field can not be empty
voting.create.participantsError=Value must be 1 or over.
voting.create.nameError=Name must be longer than 3 chars.
actionlog.message.tooshort = Message is too short!
javax.validation.constraints.NotEmpty.message = Field cannot be empty
javax.validation.constraints.NotNull.message = Field can not be empty
user.emailregex = Field must contain an email address.
user.nickSizeMessage = Nick has to be at least {min} characters long.
voting.create.nameError = Name must be longer than 3 chars.
voting.create.participantsError = Value must be 1 or over.
......@@ -50,6 +50,7 @@ public class SessionHandler {
public TimeZone getTimezone() {
return TimeZone.getTimeZone("Europe/Helsinki");
}
public String getLocale() {
......
......@@ -16,6 +16,14 @@ actionlog.tasklist.header = Tasklist
actionlog.time = Time
actionlog.user = User
adduser.newphoto = Take new photo
adduser.newuser = Create new user
adduser.takePhoto = Take photo
adduser.tostart = Back to start
adduser.update = Update profile picture
adduser.welcome = Welcome
adduser.welcometext = Here you can add new user or update your current user profile image. Please select desired action below.
bill.billAmount = Amount
bill.billNumber = Number
bill.cancel = Cancel bill
......@@ -24,60 +32,75 @@ bill.isExpired = Bill is expired
bill.markPaid.show = Show Mark paid -buttons
bill.save = Save
bortalApplication.BILL = Creating, and managing bills
bortalApplication.COMPO = Managing compos
bortalApplication.CONTENT = Product & shop management
bortalApplication.LAYOUT = Laout management
bortalApplication.MAP = Map management
bortalApplication.POLL = Polling stuff
bortalApplication.SALESPOINT = Managing salespoint
bortalApplication.SHOP = Product % shop management
bortalApplication.TERMINAL = Sales and self help terminal roles
bortalApplication.USER = User management related
bortalApplication.bill.CREATE_BILL = Create bills for self
bortalApplication.bill.READ_ALL = "Read all bills"
bortalApplication.bill.VIEW_OWN = View own bills
bortalApplication.bill.WRITE_ALL = Modify all bills
bortalApplication.compo.MANAGE = Manage compos
bortalApplication.compo.SUBMIT_ENTRY = Submit entry
bortalApplication.compo.VIEW_COMPOS = View compos
bortalApplication.compo.VOTE = Vote
bortalApplication.content.MANAGE_ACTIONLOG = Manage actionlog
bortalApplication.content.MANAGE_MENU = Manage menus
bortalApplication.content.MANAGE_NEWS = Manage newsgroups
bortalApplication.content.MANAGE_PAGES = Manage pages
bortalApplication.map.BUY_PLACES = Reserve and buy places from map
bortalApplication.map.MANAGE_MAPS = Create and modify maps
bortalApplication.map.MANAGE_OTHERS = Manage other users reservations in map
bortalApplication.map.VIEW = View maps
bortalApplication.poll.ANSWER = Can answer and view availabe polls
bortalApplication.poll.CREATE = Create and manage polls
bortalApplication.poll.VIEW_RESULTS = View anonymized poll results
bortalApplication.salespoint.MODIFY = Modify salespoints
bortalApplication.salespoint.VIEW = View salespoints
bortalApplication.shop.LIST_ALL_PRODUCTS = List all products in shop
bortalApplication.shop.LIST_USERPRODUCTS = List products for users in shop
bortalApplication.shop.MANAGE_PRODUCTS = Create and modify products
bortalApplication.shop.SHOP_PRODUCTS = Shop products to self
bortalApplication.shop.SHOP_TO_OTHERS = Shop to other users
bortalApplication.terminal.CASHIER = Access cashier terminal functions
bortalApplication.terminal.CUSTOMER = Access client terminal functions
bortalApplication.terminal.SELFHELP = Self help terminal
bortalApplication.user.ANYUSER = All users have this anyways
bortalApplication.user.CREATE_NEW = Create new user
bortalApplication.user.INVITE_USERS = Invite users
bortalApplication.user.LOGIN = Can login
bortalApplication.user.LOGOUT = Can logout
bortalApplication.user.MANAGE_HTTP_SESSION = Manage http sessions
bortalApplication.user.MODIFY = Modify users
bortalApplication.user.MODIFY_ACCOUNTEVENTS = Modify Account events
bortalApplication.user.READ_ORGROLES = View organization roles
bortalApplication.user.READ_ROLES = View all roles.
bortalApplication.user.VIEW_ACCOUNTEVENTS = Show other users account events
bortalApplication.user.VIEW_ALL = View all users
bortalApplication.user.VIEW_SELF = Can view self
bortalApplication.user.WRITE_ORGROLES = Modify organization roles
bortalApplication.user.WRITE_ROLES = Modify roles
bortalApplication.BILL = Creating, and managing bills
bortalApplication.COMPO = Managing compos
bortalApplication.CONTENT = Product & shop management
bortalApplication.EVENT = Event permissions
bortalApplication.LAYOUT = Laout management
bortalApplication.LICENSE = License stuff
bortalApplication.MAP = Map management
bortalApplication.POLL = Polling stuff
bortalApplication.SALESPOINT = Managing salespoint
bortalApplication.SHOP = Product % shop management
bortalApplication.TERMINAL = Sales and self help terminal roles
bortalApplication.USER = User management related
bortalApplication.bill.CREATE_BILL = Create bills for self
bortalApplication.bill.CREATE_VERKKOMAKSU = Can create web payment to self
bortalApplication.bill.READ_ALL = "Read all bills"
bortalApplication.bill.VIEW_OWN = View own bills
bortalApplication.bill.WRITE_ALL = Modify all bills
bortalApplication.compo.MANAGE = Manage compos
bortalApplication.compo.SUBMIT_ENTRY = Submit entry
bortalApplication.compo.VIEW_COMPOS = View compos
bortalApplication.compo.VOTE = Vote
bortalApplication.content.MANAGE_ACTIONLOG = Manage actionlog
bortalApplication.content.MANAGE_MENU = Manage menus
bortalApplication.content.MANAGE_NEWS = Manage newsgroups
bortalApplication.content.MANAGE_PAGES = Manage pages
bortalApplication.event.MANAGE_PRIVATE_PROPERTIES = Can manage event private properties
bortalApplication.event.MANAGE_PROPERTIES = Can manage event properties
bortalApplication.license.MANAGE = Can manage licenses
bortalApplication.license.VIEW_OWN_CODES = Can view own licenses
bortalApplication.map.BUY_PLACES = Reserve and buy places from map
bortalApplication.map.MANAGE_MAPS = Create and modify maps
bortalApplication.map.MANAGE_OTHERS = Manage other users reservations in map
bortalApplication.map.RELEASE_PLACE = Can release place
bortalApplication.map.VIEW = View maps
bortalApplication.poll.ANSWER = Can answer and view availabe polls
bortalApplication.poll.CREATE = Create and manage polls
bortalApplication.poll.VIEW_RESULTS = View anonymized poll results
bortalApplication.salespoint.MODIFY = Modify salespoints
bortalApplication.salespoint.VIEW = View salespoints
bortalApplication.shop.LIST_ALL_PRODUCTS = List all products in shop
bortalApplication.shop.LIST_USERPRODUCTS = List products for users in shop
bortalApplication.shop.MANAGE_FOODWAVES = Can manage food waves
bortalApplication.shop.MANAGE_PRODUCTS = Create and modify products
bortalApplication.shop.SHOP_FOODWAVE = Can shop on food wave
bortalApplication.shop.SHOP_PRODUCTS = Shop products to self
bortalApplication.shop.SHOP_TO_OTHERS = Shop to other users
bortalApplication.terminal.CASHIER = Access cashier terminal functions
bortalApplication.terminal.CUSTOMER = Access client terminal functions
bortalApplication.terminal.SELFHELP = Self help terminal
bortalApplication.user = User permissions
bortalApplication.user.ANYUSER = All users have this anyways
bortalApplication.user.CREATE_NEW = Create new user
bortalApplication.user.INVITE_USERS = Invite users
bortalApplication.user.LOGGED_IN_USER = Logged in user
bortalApplication.user.LOGIN = Can login
bortalApplication.user.LOGOUT = Can logout
bortalApplication.user.MANAGE_HTTP_SESSION = Manage http sessions
bortalApplication.user.MODIFY = Modify users
bortalApplication.user.MODIFY_ACCOUNTEVENTS = Modify Account events
bortalApplication.user.READ_ORGROLES = View organization roles
bortalApplication.user.READ_ROLES = View all roles.
bortalApplication.user.VIEW_ACCOUNTEVENTS = Show other users account events
bortalApplication.user.VIEW_ALL = View all users
bortalApplication.user.VIEW_SELF = Can view self
bortalApplication.user.VITUTTAAKO = Can send feedback
bortalApplication.user.WRITE_ORGROLES = Modify organization roles
bortalApplication.user.WRITE_ROLES = Modify roles
card.massprint.title = Print all
cardTemplate.emptyCardTemplate = ----
......
......@@ -50,43 +50,45 @@ applicationPermission.name = Rightsgroup
barcodeReader.readBarcode = Read barcode
bill.addr1 = Address 1
bill.addr2 = Address 2
bill.addr3 = Address 3
bill.addr4 = Address 4
bill.addr5 = Address 5
bill.address = Payers address
bill.billAmount = Bill amount
bill.billIsPaid = Bill is paid
bill.billLines = Products
bill.billNumber = Number
bill.billPaidDate = Paid date
bill.cancel = Cancel bill
bill.deliveryTerms = Delivery terms
bill.edit = edit
bill.expires = Expires
bill.isExpired = Bill is expired
bill.isPaid = Paid
bill.markPaid = Mark paid
bill.markPaid.show = Show Mark paid -buttons
bill.markedPaid = Bill marked paid
bill.notes = Notes
bill.noticetime = Notice time
bill.ourReference = Our reference
bill.paidDate = Paid date
bill.payer = Payer
bill.paymentTime = Payment time
bill.paymentTime.now = Now
bill.printBill = Print bill
bill.receiverAddress = Receiver address
bill.referenceNumberBase = Reference number base
bill.referencenumber = Reference nr.
bill.save = Save
bill.sentDate = Sent date
bill.show = Show
bill.theirReference = Clients reference
bill.totalPrice = Total
bill.totalprice = Total
bill.addr1 = Address 1
bill.addr2 = Address 2
bill.addr3 = Address 3
bill.addr4 = Address 4
bill.addr5 = Address 5
bill.address = Payers address
bill.billAmount = Bill amount
bill.billIsPaid = Bill is paid
bill.billLines = Products
bill.billMarkedPaidMail.message = Your deposit number {0} has been marked as paid.
bill.billMarkedPaidMail.subject = Bill marked paid
bill.billNumber = Number
bill.billPaidDate = Paid date
bill.cancel = Cancel bill
bill.deliveryTerms = Delivery terms
bill.edit = edit
bill.expires = Expires
bill.isExpired = Bill is expired
bill.isPaid = Paid
bill.markPaid = Mark paid
bill.markPaid.show = Show Mark paid -buttons
bill.markedPaid = Bill marked paid
bill.notes = Notes
bill.noticetime = Notice time
bill.ourReference = Our reference
bill.paidDate = Paid date
bill.payer = Payer
bill.paymentTime = Payment time
bill.paymentTime.now = Now
bill.printBill = Print bill
bill.receiverAddress = Receiver address
bill.referenceNumberBase = Reference number base
bill.referencenumber = Reference nr.
bill.save = Save
bill.sentDate = Sent date
bill.show = Show
bill.theirReference = Clients reference
bill.totalPrice = Total
bill.totalprice = Total
billLine.eventuser = Customer
billLine.nick = Nick
......@@ -108,6 +110,74 @@ billine.vat = VAT
bills.noBills = No bills
bortalApplication.BILL = Creating, and managing bills
bortalApplication.COMPO = Managing compos
bortalApplication.CONTENT = Product & shop management
bortalApplication.EVENT = Event permissions
bortalApplication.LAYOUT = Laout management
bortalApplication.LICENSE = License stuff
bortalApplication.MAP = Map management
bortalApplication.POLL = Polling stuff
bortalApplication.SALESPOINT = Managing salespoint
bortalApplication.SHOP = Product and shop management
bortalApplication.TERMINAL = Sales and self help terminal roles
bortalApplication.USER = User management related
bortalApplication.bill.CREATE_BILL = Create bills for self
bortalApplication.bill.CREATE_VERKKOMAKSU = Can create web payment to self
bortalApplication.bill.READ_ALL = Read all bills
bortalApplication.bill.VIEW_OWN = View own bills
bortalApplication.bill.WRITE_ALL = Modify all bills
bortalApplication.compo.MANAGE = Manage compos
bortalApplication.compo.SUBMIT_ENTRY = Submit compo entry
bortalApplication.compo.VIEW_COMPOS = View compos
bortalApplication.compo.VOTE = Vote on compos
bortalApplication.content.MANAGE_ACTIONLOG = Manage actionlog
bortalApplication.content.MANAGE_MENU = Manage menus
bortalApplication.content.MANAGE_NEWS = Manage newsgroups
bortalApplication.content.MANAGE_PAGES = Manage pages
bortalApplication.event.MANAGE_PRIVATE_PROPERTIES = Can manage event private properties
bortalApplication.event.MANAGE_PROPERTIES = Can manage event properties
bortalApplication.license.MANAGE = Can manage licenses
bortalApplication.license.VIEW_OWN_CODES = Can view own licenses
bortalApplication.map.BUY_PLACES = Reserve and buy places from map
bortalApplication.map.MANAGE_MAPS = Create and modify maps
bortalApplication.map.MANAGE_OTHERS = Manage other users reservations in map
bortalApplication.map.RELEASE_PLACE = Can release place
bortalApplication.map.VIEW = View maps
bortalApplication.poll.ANSWER = Can answer and view availabe polls
bortalApplication.poll.CREATE = Create and manage polls
bortalApplication.poll.VIEW_RESULTS = View anonymized poll results
bortalApplication.salespoint.MODIFY = Modify salespoints
bortalApplication.salespoint.VIEW = View salespoints
bortalApplication.shop.LIST_ALL_PRODUCTS = List all products in shop
bortalApplication.shop.LIST_USERPRODUCTS = List products for users in shop
bortalApplication.shop.MANAGE_FOODWAVES = Can manage food waves
bortalApplication.shop.MANAGE_PRODUCTS = Create and modify products
bortalApplication.shop.SHOP_FOODWAVE = Can shop on food wave
bortalApplication.shop.SHOP_PRODUCTS = Shop products to self
bortalApplication.shop.SHOP_TO_OTHERS = Shop to other users
bortalApplication.terminal.CASHIER = Access cashier terminal functions
bortalApplication.terminal.CUSTOMER = Access client terminal functions
bortalApplication.terminal.SELFHELP = Self help terminal
bortalApplication.user = User permissions
bortalApplication.user.ANYUSER = All users have this anyways
bortalApplication.user.CREATE_NEW = Create new user
bortalApplication.user.INVITE_USERS = Invite users
bortalApplication.user.LOGGED_IN_USER = Logged in user
bortalApplication.user.LOGIN = Can login
bortalApplication.user.LOGOUT = Can logout
bortalApplication.user.MANAGE_HTTP_SESSION = Manage http sessions
bortalApplication.user.MODIFY = Modify users
bortalApplication.user.MODIFY_ACCOUNTEVENTS = Modify Account events
bortalApplication.user.READ_ORGROLES = View organization roles
bortalApplication.user.READ_ROLES = View all roles.
bortalApplication.user.VIEW_ACCOUNTEVENTS = Show other users account events
bortalApplication.user.VIEW_ALL = View all users
bortalApplication.user.VIEW_SELF = Can view self
bortalApplication.user.VITUTTAAKO = Can send feedback
bortalApplication.user.WRITE_ORGROLES = Modify organization roles
bortalApplication.user.WRITE_ROLES = Modify roles
card.massprint.title = Print all
cardTemplate.create = Create
......
......@@ -98,6 +98,8 @@ billLine.product = Tuote
billLine.quantity = M\u00E4\u00E4r\u00E4
billLine.time = Tilausaika
billedit.billnotfound = Laskua ei l\u00F6ytynyt. Ole hyv\u00E4 ja valitse uudelleen.
billine.linePrice = Yhteens\u00E4
billine.name = Tuote
billine.quantity = Lukum\u00E4\u00E4r\u00E4
......@@ -109,6 +111,74 @@ billine.vat = ALV
bills.noBills = Ei laskuja
bortalApplication.BILL = Laskujen oikeudet
bortalApplication.COMPO = Compojen oikeudet
bortalApplication.CONTENT = Sis\u00E4lt\u00F6jen hallitaoikeudet
bortalApplication.EVENT = Tapahtuman oikeudet
bortalApplication.LAYOUT = N\u00E4kymien hallinta
bortalApplication.LICENSE = Lisenssioikeudet
bortalApplication.MAP = Karttojen oikeudet
bortalApplication.POLL = Kyselyiden oikeudet
bortalApplication.SALESPOINT = Myyntipisteiden oikeudet
bortalApplication.SHOP = Kaupan oikeudet
bortalApplication.TERMINAL = K\u00E4ytt\u00F6p\u00E4\u00E4tteiden roolit
bortalApplication.USER = K\u00E4ytt\u00E4j\u00E4oikeudet
bortalApplication.bill.CREATE_BILL = Voi luoda laskuja itselle
bortalApplication.bill.CREATE_VERKKOMAKSU = Voi luoda verkkomaksun itselleen
bortalApplication.bill.READ_ALL = Saa lukea kaikkia laskuja
bortalApplication.bill.VIEW_OWN = Voi katsoa omia laskuja
bortalApplication.bill.WRITE_ALL = Saa muokata kaikkia laskuja
bortalApplication.compo.MANAGE = Saa hallita compoja
bortalApplication.compo.SUBMIT_ENTRY = Saa lis\u00E4t\u00E4 entryn compoon
bortalApplication.compo.VIEW_COMPOS = Saa katsoa compoja
bortalApplication.compo.VOTE = Voi \u00E4\u00E4nest\u00E4\u00E4 compoissa
bortalApplication.content.MANAGE_ACTIONLOG = Saa hallita tapahtumalogia
bortalApplication.content.MANAGE_MENU = Saa hallinnoida valikoita
bortalApplication.content.MANAGE_NEWS = Saa hallinnoida uutisia
bortalApplication.content.MANAGE_PAGES = Saa hallinnoida sivuja
bortalApplication.event.MANAGE_PRIVATE_PROPERTIES = Saa hallita tapahtuman yksityisi\u00E4 asetuksia
bortalApplication.event.MANAGE_PROPERTIES = Saa hallita tapahtuman asetuksia
bortalApplication.license.MANAGE = Saa hallinnoida lisenssej\u00E4
bortalApplication.license.VIEW_OWN_CODES = Voi katsella omia lisenssej\u00E4
bortalApplication.map.BUY_PLACES = Voi varata ja ostaa konepaikkoja kartalta
bortalApplication.map.MANAGE_MAPS = Saa luoda ja muokata karttoja
bortalApplication.map.MANAGE_OTHERS = Saa hallita muiden k\u00E4ytt\u00E4jien varauksia kartalla
bortalApplication.map.RELEASE_PLACE = Voi vapauttaa paikan
bortalApplication.map.VIEW = Saa n\u00E4hd\u00E4 kartat
bortalApplication.poll.ANSWER = Voi vastata avoimiin kyselyihin
bortalApplication.poll.CREATE = Saa luoda ja hallita kyselyit\u00E4
bortalApplication.poll.VIEW_RESULTS = Saa n\u00E4hd\u00E4 nimett\u00F6mien kyselyiden vastaukset
bortalApplication.salespoint.MODIFY = Saa muokata myyntipisteit\u00E4
bortalApplication.salespoint.VIEW = Saa n\u00E4hd\u00E4 myyntipisteet
bortalApplication.shop.LIST_ALL_PRODUCTS = Saa listata kaikki kaupan tuotteet
bortalApplication.shop.LIST_USERPRODUCTS = Voi listata kaikki k\u00E4ytt\u00E4jille tarkoitetut tuotteet kaupassa
bortalApplication.shop.MANAGE_FOODWAVES = Saa hallita ruokatilauksia
bortalApplication.shop.MANAGE_PRODUCTS = Saa luoda ja muokata tuotteita
bortalApplication.shop.SHOP_FOODWAVE = Voi ostaa ruokatilauksessa
bortalApplication.shop.SHOP_PRODUCTS = Voi ostaa tuotteita itselle
bortalApplication.shop.SHOP_TO_OTHERS = Saa ostaa tuotteita muille
bortalApplication.terminal.CASHIER = Muokata rahastusp\u00E4\u00E4tteiden toimintoja
bortalApplication.terminal.CUSTOMER = Muokata k\u00E4vij\u00E4p\u00E4\u00E4tteiden toimintoja
bortalApplication.terminal.SELFHELP = Itsepalvelup\u00E4\u00E4te
bortalApplication.user = K\u00E4ytt\u00E4j\u00E4oikeudet
bortalApplication.user.ANYUSER = AINA kaikilla k\u00E4ytt\u00E4jill\u00E4
bortalApplication.user.CREATE_NEW = Voi luoda uuden k\u00E4ytt\u00E4j\u00E4n
bortalApplication.user.INVITE_USERS = Voi kutsua k\u00E4ytt\u00E4j\u00E4ksi
bortalApplication.user.LOGGED_IN_USER = Kirjautunut k\u00E4ytt\u00E4j\u00E4
bortalApplication.user.LOGIN = Voi kirjautua
bortalApplication.user.LOGOUT = Voi uloskirjautua
bortalApplication.user.MANAGE_HTTP_SESSION = Saa hallita http istuntoja
bortalApplication.user.MODIFY = Saa muokata k\u00E4ytt\u00E4ji\u00E4
bortalApplication.user.MODIFY_ACCOUNTEVENTS = Saa muokata k\u00E4ytt\u00E4j\u00E4tapahtumia
bortalApplication.user.READ_ORGROLES = Saa n\u00E4hd\u00E4 j\u00E4rjest\u00E4j\u00E4roolit
bortalApplication.user.READ_ROLES = Saa n\u00E4hd\u00E4 kaikki roolit
bortalApplication.user.VIEW_ACCOUNTEVENTS = Saa n\u00E4hd\u00E4 muiden k\u00E4ytt\u00E4jien tapahtumat
bortalApplication.user.VIEW_ALL = Saa n\u00E4hd\u00E4 kaikki k\u00E4ytt\u00E4j\u00E4t
bortalApplication.user.VIEW_SELF = Voi katsella omaa tunnusta
bortalApplication.user.VITUTTAAKO = Saa avautua
bortalApplication.user.WRITE_ORGROLES = Saa muokata organisaation rooleja
bortalApplication.user.WRITE_ROLES = Saa muokata rooleja
card.massprint.title = Tulosta kaikki
cardTemplate.create = Luo
......
......@@ -18,7 +18,6 @@ import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.MenuBeanLocal;
import fi.codecrew.moya.beans.SitePageBeanLocal;
import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.MenuNavigation;
import fi.codecrew.moya.model.PageContent;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
......@@ -52,7 +51,6 @@ public class MenuView extends GenericCDIView {
private String menuChange;
@SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(MenuView.class);
public List<PageContent> getPagecontent(String pagekey)
......@@ -90,17 +88,38 @@ public class MenuView extends GenericCDIView {
// super.navihandler.forward(menuChange);
}
public boolean isRenderTopmenuChanger()
{
return getViewChangeTopmenu().size() > 1;
}
private List<JsfMenuitem> viewchangeTopmenu;
public List<JsfMenuitem> getViewChangeTopmenu()
{
if (viewchangeTopmenu == null) {
viewchangeTopmenu = new ArrayList<JsfMenuitem>();
viewchangeTopmenu.add(new JsfMenuitem("topmenu.user", "/index"));
if (super.hasPermission(UserPermission.VIEW_ALL)) {
viewchangeTopmenu.add(new JsfMenuitem("topmenu.helpdesk", "/admin/info/index"));
viewchangeTopmenu.add(new JsfMenuitem("topmenu.admin", "/useradmin/list"));
for (MenuNavigation topmenu : menubean.getTopmenus()) {
String out = null;
if (topmenu.getItem() != null) {
out = topmenu.getItem().getUrl();
}
if (out == null) {
out = getOutcome(topmenu);
}
if (out != null) {
logger.info("Adding topmenu {}", out);
viewchangeTopmenu.add(new JsfMenuitem(topmenu.getKey(), out));
}
}
// viewchangeTopmenu.add(new JsfMenuitem("topmenu.user", "/index"));
// if (super.hasPermission(UserPermission.VIEW_ALL)) {
// viewchangeTopmenu.add(new JsfMenuitem("topmenu.helpdesk", "/admin/info/index"));
// viewchangeTopmenu.add(new JsfMenuitem("topmenu.admin", "/useradmin/list"));
// }
}
return viewchangeTopmenu;
......@@ -170,6 +189,7 @@ public class MenuView extends GenericCDIView {
private String getOutcome(MenuNavigation navi) {
String ret = null;
// try to get the outcome from the first child we have permission to.
for (MenuNavigation child : navi.getChildren())
{
......
......@@ -7,16 +7,16 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.primefaces.component.menuitem.MenuItem;
import org.primefaces.component.separator.Separator;
import org.primefaces.component.submenu.Submenu;
import org.primefaces.model.DefaultMenuModel;
import org.primefaces.model.MenuModel;
import org.primefaces.model.menu.DefaultMenuItem;
import org.primefaces.model.menu.DefaultMenuModel;
import org.primefaces.model.menu.DefaultSeparator;
import org.primefaces.model.menu.DefaultSubMenu;
import org.primefaces.model.menu.MenuModel;
import org.primefaces.model.menu.Submenu;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.MenuBeanLocal;
import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.MenuNavigation;
import fi.codecrew.moya.utilities.I18n;
......@@ -91,11 +91,11 @@ public class PrimeMenuView extends GenericCDIView {
{
if (m.getItem() != null && m.getChildren().isEmpty())
{
MenuItem menuitem = mkMenuitem(m);
DefaultMenuItem menuitem = mkMenuitem(m);
if (menuitem != null)
{
menuModel.addMenuItem(menuitem);
menuModel.addElement(menuitem);
}
} else {
......@@ -103,22 +103,22 @@ public class PrimeMenuView extends GenericCDIView {
if (subm != null)
{
menuModel.addSubmenu(subm);
menuModel.addElement(subm);
}
}
}
}
return menuModel;
}
private Submenu addSubmenu(MenuNavigation m) {
Submenu ret = null;
private DefaultSubMenu addSubmenu(MenuNavigation m) {
DefaultSubMenu ret = null;
if (m.isVisible() && (m.getPermission() == null || super.hasPermission(m.getPermission())))
{
ret = new Submenu();
ret = new DefaultSubMenu();
ret.setLabel(I18n.get(m.getKey()));
for (MenuNavigation child : m.getChildren())
{
......@@ -126,29 +126,28 @@ public class PrimeMenuView extends GenericCDIView {
if (child.getItem() != null)
{
MenuItem item = mkMenuitem(child);
DefaultMenuItem item = mkMenuitem(child);
if (item != null)
{
item.setValue(I18n.get(child.getKey()));
ret.getChildren().add(item);
ret.addElement(item);
}
} else if (ret.getChildCount() > 0) {
ret.getChildren().add(new Separator());
} else if (ret.getElementsCount() > 0) {
ret.addElement(new DefaultSeparator());
}
} else {
Submenu subm = addSubmenu(child);
DefaultSubMenu subm = addSubmenu(child);
if (subm != null)
{
subm.setLabel(I18n.get(child.getKey()));
ret.getChildren().add(subm);
ret.addElement(subm);
}
}
}
if (ret.getChildCount() == 0)
{
if (ret.getElementsCount() == 0) {
ret = null;
}
......@@ -156,11 +155,11 @@ public class PrimeMenuView extends GenericCDIView {
return ret;
}
private MenuItem mkMenuitem(MenuNavigation m) {
MenuItem item = null;
private DefaultMenuItem mkMenuitem(MenuNavigation m) {
DefaultMenuItem item = null;
if (m.isVisible() && (m.getPermission() == null || super.hasPermission(m.getPermission())))
{
item = new MenuItem();
item = new DefaultMenuItem();
String outcome;
if (m.getSitepage() != null)
{
......@@ -170,6 +169,7 @@ public class PrimeMenuView extends GenericCDIView {
outcome = m.getItem().getUrl();
}
String key = I18n.get(m.getKey());
item.setValue(key);
item.setOutcome(outcome);
}
......
......@@ -2,6 +2,7 @@ package fi.codecrew.moya.web.cdiview.user;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import javax.ejb.EJB;
......@@ -14,6 +15,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import org.primefaces.event.CaptureEvent;
import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.CroppedImage;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
......@@ -60,7 +62,7 @@ public class UserView extends GenericCDIView {
private transient ReaderBeanLocal readerbean;
private Integer userid;
private transient UploadedFile image;
private UploadedFile image;
private CroppedImage croppedImage;
......@@ -121,9 +123,18 @@ public class UserView extends GenericCDIView {
return permbean.getCurrentUser();
}
public void handleImageUpload(FileUploadEvent event) {
FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
UploadedFile f = event.getFile();
if (f != null)
logger.info("Received file {}, {}, {}", f.getContentType(), f.getFileName(), f.getSize());
}
public void oncapture(CaptureEvent captureEvent) {
byte[] data = captureEvent.getData();
ByteArrayInputStream data = new ByteArrayInputStream(captureEvent.getData());
UserImage img = userbean.uploadImage(user, "image/png", data, "userimage.png", "Uploaded image");
user = userbean.getEventUser(img.getUser());
// super.navihandler.forward("/admin/adduser/capturesuccess");
......@@ -222,15 +233,13 @@ public class UserView extends GenericCDIView {
return null;
}
public String sendImage() {
if (getImage() == null)
{
public String sendImage() throws IOException {
if (image == null) {
super.addFaceMessage("user.imageUpload.imageNotFound");
} else {
UserImage userimage = userbean.uploadImage(user, getImage().getContentType(), getImage().getContents(), getImage().getFileName(), "");
InputStream istr = getImage().getInputstream();
UserImage userimage = userbean.uploadImage(user, getImage().getContentType(), getImage().getInputstream(), getImage().getFileName(), "");
user = userbean.getEventUser(userimage.getUser());
super.addFaceMessage("user.imageUploaded");
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!