Commit 3bdc3b87 by Tuomas Riihimäki

Pääasiassa menu ja ulkoasuviilausta..

1 parent bf3b8dd9
Showing with 889 additions and 582 deletions
......@@ -72,17 +72,10 @@ public class Menubean implements MenubeanLocal {
MenuNavigation userTopnavi = usernavi.addPage(null, null);
userTopnavi.setKey("topnavi.user");
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/edit"), UserPermission.VIEW_SELF).setHeader("submenu.user.userlinks");
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/changePassword"), null);
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/accountEvents"), null);
userTopnavi.addPage(menuitemfacade.findOrCreate("/place/myGroups"), null);
userTopnavi.addPage(menuitemfacade.findOrCreate("/place/insertToken"), null);
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/sendPicture"), null);
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/list"), UserPermission.VIEW_ALL).setHeader("submenu.user.manageuserlinks");
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/adminCreate"), UserPermission.VIEW_ALL);
userTopnavi.addPage(menuitemfacade.findOrCreate("/role/list"), UserPermission.READ_ROLES).setHeader("submenu.user.rolelinks");
userTopnavi.addPage(menuitemfacade.findOrCreate("/role/create"), UserPermission.WRITE_ROLES);
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/listCardTemplates"), UserPermission.READ_ROLES);
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/createCardTemplate"), UserPermission.WRITE_ROLES);
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/changePassword"), UserPermission.VIEW_SELF);
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/accountEvents"), UserPermission.VIEW_SELF);
userTopnavi.addPage(menuitemfacade.findOrCreate("/place/myGroups"), UserPermission.VIEW_SELF);
userTopnavi.addPage(menuitemfacade.findOrCreate("/user/sendPicture"), UserPermission.VIEW_SELF);
MenuNavigation placemapTopmenu = usernavi.addPage(null, null);
placemapTopmenu.setKey("topnavi.placemap");
......@@ -99,6 +92,21 @@ public class Menubean implements MenubeanLocal {
MenuNavigation adminnavi = new MenuNavigation(ev, "supernavi.admin");
navifacade.create(adminnavi);
MenuNavigation adminuser = adminnavi.addPage(null, null);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/list"), UserPermission.VIEW_ALL).setHeader("submenu.user.manageuserlinks");
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/create"), UserPermission.VIEW_ALL);
adminuser.addPage(menuitemfacade.findOrCreate("/role/list"), UserPermission.READ_ROLES).setHeader("submenu.user.rolelinks");
adminuser.addPage(menuitemfacade.findOrCreate("/role/create"), UserPermission.WRITE_ROLES);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/listCardTemplates"), UserPermission.READ_ROLES);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/createCardTemplate"), UserPermission.WRITE_ROLES);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/edit"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/changePassword"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/accountEvents"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/place/adminGroups"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/place/adminInsertToken"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/sendPicture"), UserPermission.VIEW_ALL).setVisible(false);
MenuNavigation billnavi = adminnavi.addPage(null, null);
billnavi.setKey("topnavi.billing");
......@@ -134,7 +142,6 @@ public class Menubean implements MenubeanLocal {
navifacade.flush();
ret = navifacade.findToplevels();
}
logger.info("Returning topmenus: {}", ret);
return ret;
}
......
......@@ -19,6 +19,7 @@ import fi.insomnia.bortal.facade.UserFacade;
import fi.insomnia.bortal.model.AccountEvent;
import fi.insomnia.bortal.model.Discount;
import fi.insomnia.bortal.model.DiscountInstance;
import fi.insomnia.bortal.model.LanEvent;
import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.model.User;
......@@ -71,7 +72,10 @@ public class ProductBean implements ProductBeanLocal {
@Override
@RolesAllowed(ShopPermission.S_MANAGE_PRODUCTS)
public void create(Product prod) {
LanEvent event = eventBean.getCurrentEvent();
prod.setEvent(event);
productFacade.create(prod);
}
@Override
......@@ -157,7 +161,11 @@ public class ProductBean implements ProductBeanLocal {
@Override
public Product findById(int id) {
return productFacade.find(id);
Product ret = productFacade.find(id);
if (ret != null && !ret.getEvent().equals(eventBean.getCurrentEvent())) {
ret = null;
}
return ret;
}
@Override
......
......@@ -353,9 +353,7 @@ public class Bill extends GenericEntity {
if (this.billLines == null) {
billLines = new ArrayList<BillLine>();
}
logger.info("Adding billine: {}", this.getEvent());
this.getBillLines().add(new BillLine(this, product, count));
logger.info("Adding billine2: {}", this.getEvent());
for (Discount disc : product.getActiveDiscounts(count)) {
......
......@@ -107,7 +107,7 @@ public class BillLine extends GenericEntity {
this.name = product.getName();
this.setUnitName(product.getUnitName());
this.setQuantity(count);
this.setUnitPrice(product.getPrice());
this.setUnitPrice(product.getPrice().abs());
this.setVat(product.getVat());
}
......
......@@ -76,6 +76,7 @@ public class Discount extends GenericEntity {
public Discount(Product product) {
super();
this.event = product.getEvent();
this.products = new ArrayList<Product>();
products.add(product);
}
......
......@@ -44,7 +44,7 @@
</h:form>
<h:form>
<h:inputText value="#{eventorgView.newdomain}" />
<h:commandButton action="#{eventorgView.addDomain()}" />
<h:commandButton action="#{eventorgView.addDomain()}" value="#{eventdomain.add}"/>
<h:dataTable var="domain" value="#{eventorgView.eventdomains}">
<h:column>
<f:facet name="header">
......@@ -53,7 +53,7 @@
<h:outputText value="#{domain.domain}" />
</h:column>
<h:column>
<h:commandButton action="#{eventorgView.removeDomain()}" />
<h:commandButton action="#{eventorgView.removeDomain()}" value="#{i18n['eventdomain.remove']}"/>
</h:column>
</h:dataTable>
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/cditools"
>
<h:body>
<ui:composition rendered="#{sessionHandler.loggedIn}" template="/layout/insomnia1/sidebartemplate.xhtml">
<ui:param name="rendered" value="true" />
<ui:define name="sidebarcontent">
<ul>
<li><h:outputText styleClass="sidebartitle" value="#{i18n['sidebar.roles']}" />
<ul>
<li><h:link outcome="/role/create" value="#{i18n['sidebar.role.create']}" />
</li>
<li><h:link outcome="/role/list" value="#{i18n['sidebar.role.list']}" />
</li>
<li><h:link outcome="/user/createCardTemplate" value="#{i18n['sidebar.cardTemplate.create']}" />
</li>
<li><h:link outcome="/user/listCardTemplates" value="#{i18n['sidebar.cardTemplate.list']}" />
</li>
</ul></li>
<li><h:outputText styleClass="sidebartitle" value="#{i18n['sidebar.bills']}" />
<ul>
<li><h:link outcome="/bill/billSummary" value="#{i18n['sidebar.bill.summary']}" />
</li>
</ul></li>
<li><h:outputText styleClass="sidebartitle" value="#{i18n['sidebar.users']}" />
<ul>
<li><h:link outcome="/user/create" value="#{i18n['sidebar.user.create']}" />
</li>
<li><h:link outcome="/user/list" value="#{i18n['sidebar.user.list']}" />
</li>
</ul></li>
<li><h:outputText styleClass="sidebartitle" value="#{i18n['sidebar.products']}" />
<ul>
<li><h:link outcome="/product/create" value="#{i18n['sidebar.product.create']}" />
</li>
<li><h:link outcome="/product/list" value="#{i18n['sidebar.product.list']}" />
</li>
</ul></li>
<li><h:outputText styleClass="sidebartitle" value="#{i18n['sidebar.maps']}" />
<ul>
<li><h:link outcome="/map/list" value="#{i18n['sidebar.map.list']}" />
</li>
</ul></li>
<li><h:outputText styleClass="sidebartitle" value="#{i18n['sidebar.other']}" />
<ul>
<li><h:link outcome="/eventorg/list" value="#{i18n['sidebar.eventorg.list']}" />
</li>
<li><h:link outcome="/utils/flushCache" value="#{i18n['sidebar.utils.flushCache']}" />
</li>
<li><h:link outcome="/generateTestData" value="#{i18n['sidebar.utils.testdata']}" />
</li>
</ul></li>
</ul>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition template="/layout/insomnia1/sidebartemplate.xhtml">
<ui:param name="rendered" value="#{!sessionHandler.isLoggedIn()}" />
<ui:define name="sidebarcontent">
<ul>
<li><h:link outcome="/user/create.xhtml" value="#{i18n['sidebar.createuser']}"/></li>
<li><h:link outcome="/auth/sendResetMail" value="#{i18n['loginerror.resetpassword']}" /></li>
</ul>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition template="/layout/insomnia1/sidebartemplate.xhtml">
<ui:param name="rendered" value="false" />
<ui:define name="sidebarcontent">
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition template="/layout/insomnia1/sidebartemplate.xhtml">
<ui:define name="sidebarcontent">
<ul>
<li><h:link outcome="/user/create.xhtml" value="#{i18n['sidebar.user.create']}"/></li>
</ul>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition template="/layout/insomnia1/sidebartemplate.xhtml">
<ui:param name="rendered" value="false" />
<ui:define name="sidebarcontent">
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition template="/layout/insomnia1/sidebartemplate.xhtml">
<ui:param name="rendered" value="true" />
<ui:define name="sidebarcontent">
<ul>
<li><h:link outcome="/shop/listReaders" value="#{i18n['sidebar.shop.readerlist']}" /></li>
<li><h:link outcome="/shop/showReaderEvents" value="#{i18n['sidebar.shop.readerEvents']}" /></li>
</ul>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<h:body>
<ui:composition template="/layout/insomnia1/sidebartemplate.xhtml">
<ui:param name="rendered" value="true" />
<ui:define name="sidebarcontent">
<ul>
<li><h:link outcome="/bill/list" value="#{i18n['sidebar.bill.list']}" />
</li>
<c:if test="#{billListView.canReadAllBills()}">
<li><h:link outcome="/bill/listAll" value="#{i18n['sidebar.bill.listAll']}" />
</li>
</c:if>
</ul>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<h:body>
<ui:composition template="/layout/insomnia1/sidebartemplate.xhtml">
<ui:param name="rendered" value="#{sessionHandler.isLoggedIn()}" />
<ui:define name="sidebarcontent">
<h1>
<h:link outcome="/user/edit" value="#{userView.selectedUser.wholeName}">
<f:param name="userid" value="#{userView.selectedUser.id}" />
</h:link>
</h1>
<ul>
<!-- <li><h:link outcome="/user/sendPicture" value="#{i18n['user.sendPicture']}">
<f:param name="userid" value="#{userView.selectedUser.id}" />
</h:link></li>
-->
<li><h:link outcome="/user/changePassword" value="#{i18n['user.changePassword']}">
<f:param name="userid" value="#{userView.selectedUser.id}" />
</h:link></li>
<li><h:link outcome="/user/accountEvents" value="#{i18n['user.accountEvents']}">
<f:param name="userid" value="#{userView.selectedUser.id}" />
</h:link></li>
<li><h:link outcome="/place/myGroups" value="#{i18n['user.myGroups']}">
<f:param name="userid" value="#{userView.selectedUser.id}" />
</h:link>
</li>
<li><h:link outcome="/place/insertToken" value="#{i18n['user.insertToken']}">
<f:param name="userid" value="#{userView.selectedUser.id}" />
</h:link>
</li>
</ul>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title></title>
</h:head>
<h:body>
<ui:component>
<c:if test="#{rendered}">
<div id="sidebar"><ui:insert name="sidebarcontent" /></div>
</c:if>
</ui:component>
</h:body>
</html>
\ No newline at end of file
......@@ -17,6 +17,7 @@
<div id="header">
<div id="logo">
<h:link outcome="/index">
<c:choose>
<c:when test="#{sessionHandler.isInDevelopmentMode()}">
<img src="#{request.contextPath}/resources/style/insomnia2/img/devel_logo.png" />
......@@ -25,6 +26,7 @@
<img src="#{request.contextPath}/resources/style/insomnia2/img/logo.png" />
</c:otherwise>
</c:choose>
</h:link>
</div>
......@@ -36,8 +38,7 @@
</div>
<ui:fragment rendered="#{menuView.getMenu(0).size() > 1}">
<ul id="topmenu">
<li jsfc="ui:repeat" var="menuitem" value="#{menuView.getMenu(0)}">
<h:link outcome="#{menuitem.outcome}" value="#{i18n[menuitem.navigation.key]}"
<li jsfc="ui:repeat" var="menuitem" value="#{menuView.getMenu(0)}"><h:link outcome="#{menuitem.outcome}" value="#{i18n[menuitem.navigation.key]}"
styleClass="#{menuitem.selected?'active':''}" /></li>
</ul>
</ui:fragment>
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:f="http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<ui:param name="thispage" value="page.place.mygroups" />
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['placegroupview.header']}</h1>
<users:usertabs tabId="groups" />
</ui:define>
<ui:define name="content">
<h2>#{i18n['placetoken.pageHeader']}</h2>
<p>#{i18n['placetoken.topText']}</p>
<h:form id="placeTokenForm">
<h:panelGrid columns="2">
<h:outputLabel value="#{i18n['placetoken.token']}:" />
<h:inputText value="#{tokenView.token}" />
<h:commandButton id="commitbtn" action="#{tokenView.saveToken()}" value="#{i18n['placetoken.commit']}" />
</h:panelGrid>
</h:form>
<h2>#{i18n['placetoken.placelist']}</h2>
<p>#{i18n['placegroupview.toptext']}</p>
<h:outputText rendered="#{empty placeGroupView.groupMemberships}" value="#{i18n['placegroupview.noMemberships']}" />
<h:form rendered="#{!empty placeGroupView.groupMemberships}" id="placelistform">
<p>
<a href="#{request.contextPath}/PlaceGroupPdf">#{i18n['placegroup.printPdf']}</a>
</p>
<h:dataTable value="#{placeGroupView.groupMemberships}" var="member">
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.reservationName']}" />
</f:facet>
<h:outputText value="#{member.placeReservation.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.token']}" />
</f:facet>
<h:outputText rendered="#{empty member.user}" value="#{member.inviteToken}" />
<h:outputText rendered="#{!empty member.user}"
value="#{member.user.firstnames} #{member.user.lastname} (#{member.user.nick})"
/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.groupCreator']}" />
</f:facet>
<h:outputText
value="#{member.placeGroup.creator.firstnames} #{member.placeGroup.creator.lastname} (#{member.placeGroup.creator.nick})"
/>
</h:column>
<h:column>
<h:commandButton rendered="#{placeGroupView.canModify(member) and !empty member.user}"
action="#{placeGroupView.releasePlace()}" value="#{i18n['placegroupview.releasePlace']}"
/>
</h:column>
</h:dataTable>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
......@@ -14,7 +14,6 @@
</f:metadata>
<ui:define name="title">
<h1>#{i18n['placegroupview.header']}</h1>
<users:usertabs tabId="groups" />
</ui:define>
<ui:define name="content">
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:products="http://java.sun.com/jsf/composite/cditools/products"
>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:products="http://java.sun.com/jsf/composite/cditools/products">
<h:head>
<title></title>
</h:head>
......@@ -12,7 +10,20 @@
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<ui:define name="content">
<products:manageDiscount commitaction="#{productView.save()}" commitvalue="#{i18n['discount.save']}" />
<products:manageDiscount commitaction="#{productView.saveProduct()}" commitvalue="#{i18n['discount.save']}" />
<h2>
<h:outputText value="#{i18n['discount.products']}" />
</h2>
<h:dataTable var="prod" value="#{productView.discount.products}">
<h:column>
<h:outputText value="#{prod.name}" />
</h:column>
<h:column>
<h:link outcome="/product/edit" value="#{i18n['product.edit']}">
<f:param name="productid" value="#{prod.id}" />
</h:link>
</h:column>
</h:dataTable>
</ui:define>
</ui:composition>
</h:body>
......
<?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"
>
<composite:interface>
<composite:facet name="links" required="false" />
<composite:attribute name="view" required="true" type="fi.iki.tuomari.utils.jsf.IPaginationView" />
</composite:interface>
<composite:implementation>
<div>#{i18n['pagination.results']} #{cc.attrs.view.resultcount}, #{i18n['pagination.pages']}
#{cc.attrs.view.pagecount}</div>
<div>
<h:commandLink action="#{cc.attrs.view.gotoFirstpage}" value="#{i18n['pagination.firstpage']}" />
|
<h:commandLink action="#{cc.attrs.view.addToPage(-1)}" disabled="#{cc.attrs.view.page le 0 }"
value="#{i18n['pagination.previouspage']}"
/>
|
<h:commandLink action="#{cc.attrs.view.addToPage(-2)}" id="nrlink1" rendered="#{cc.attrs.view.page gt 1 }"
value="#{cc.attrs.view.page -1}"
/>
#{(cc.attrs.view.page gt 1) ? ' | ':'' }
<h:commandLink action="#{cc.attrs.view.addToPage(-1)}" id="nrlink2" rendered="#{cc.attrs.view.page gt 0 }"
value="#{cc.attrs.view.page }"
/>
#{(cc.attrs.view.page gt 0) ? ' | ':'' } #{cc.attrs.view.page + 1} #{(cc.attrs.view.pagecount gt (cc.attrs.view.page
+1)) ? ' | ':'' }
<h:commandLink action="#{cc.attrs.view.addToPage(1)}" id="nrlink3"
rendered="#{cc.attrs.view.pagecount gt (cc.attrs.view.page +1)}" value="#{cc.attrs.view.page+2}"
/>
#{(cc.attrs.view.pagecount gt (cc.attrs.view.page +2)) ? ' | ':'' }
<h:commandLink action="#{cc.attrs.view.addToPage(2)}" id="nrlink4"
rendered="#{cc.attrs.view.pagecount gt (cc.attrs.view.page +2)}" value="#{cc.attrs.view.page+3}"
/>
|
<h:commandLink action="#{cc.attrs.view.addToPage(1)}" id="nextpage"
disabled="#{cc.attrs.view.pagecount le (cc.attrs.view.page +1)}" value="#{i18n['pagination.nextpage']}"
/>
|
<h:commandLink action="#{cc.attrs.view.gotoLastpage}" id="lastpage" value="#{i18n['pagination.lastpage']}" />
</div>
</composite:implementation>
</html>
<?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"
>
<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">
<composite:interface>
......@@ -17,31 +15,39 @@
<h:link id="back" outcome="/product/edit" value="#{i18n['product.returnProductEdit']} #{productView.product.name}">
<f:param name="productid" value="#{productView.product.id}" />
</h:link>
<h:panelGrid columns="2">
<h:outputLabel value="#{i18n['discount.shortdesc']}:" />
<h:inputText value="#{productView.discount.shortdesc}" />
<h:panelGrid columns="3">
<h:outputLabel for="shortdesc" value="#{i18n['discount.shortdesc']}:" />
<h:inputText id="shortdesc" value="#{productView.discount.shortdesc}" />
<h:message for="shortdesc" />
<h:outputLabel value="#{i18n['discount.percentage']}:" />
<h:inputText value="#{productView.discount.percentage}" />
<h:outputLabel for="percentage" value="#{i18n['discount.percentage']}:" />
<h:inputText id="percentage" value="#{productView.discount.percentage}" required="true" />
<h:message for="percentage" />
<h:outputLabel value="#{i18n['discount.code']}:" />
<h:inputText value="#{productView.discount.code}" />
<h:outputLabel for="code" value="#{i18n['discount.code']}:" />
<h:inputText id="code" value="#{productView.discount.code}" />
<h:message for="code" />
<h:outputLabel value="#{i18n['discount.amountMin']}:" />
<h:inputText value="#{productView.discount.amountMin}" />
<h:outputLabel for="amountMin" value="#{i18n['discount.amountMin']}:" />
<h:inputText id="amountMin" value="#{productView.discount.amountMin}" required="true" />
<h:message for="amountMin" />
<h:outputLabel value="#{i18n['discount.amountMax']}:" />
<h:inputText value="#{productView.discount.amountMax}" />
<h:outputLabel for="amountmax" value="#{i18n['discount.amountMax']}:" />
<h:inputText id="amountmax" value="#{productView.discount.amountMax}" required="true" />
<h:message for="amountmax" />
<h:outputLabel value="#{i18n['discount.maxNum']}:" />
<h:inputText value="#{productView.discount.maxNum}" />
<h:outputLabel for="maxnum" value="#{i18n['discount.maxNum']}:" />
<h:inputText id="maxnum" value="#{productView.discount.maxNum}" required="true" />
<h:message for="maxnum" />
<h:outputLabel value="#{i18n['discount.active']}" />
<h:selectBooleanCheckbox value="#{productView.discount.active}" />
<h:outputLabel for="active" value="#{i18n['discount.active']}" />
<h:selectBooleanCheckbox id="active" value="#{productView.discount.active}" />
<h:message for="active" />
<h:commandButton id="commitbtn" action="#{cc.attrs.commitaction}" value="#{cc.attrs.commitvalue}" />
</h:panelGrid>
<h:commandButton id="commitbtn" action="#{cc.attrs.commitaction}" value="#{cc.attrs.commitvalue}" />
</h:form>
......
<?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">
<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">
<composite:interface>
......@@ -13,9 +12,9 @@
</composite:interface>
<composite:implementation>
<h:outputScript target="head" library="script" name="jquery.min.js" />
<h:outputScript target="head" library="script" name="shopscript.js" />
<!-- <h:outputScript target="head" library="script" name="jquery.min.js" /> -->
<!-- <h:outputScript target="head" library="script" name="shopscript.js" /> -->
<h:outputScript library="primefaces" name="jquery/jquery.js" />
<h:dataTable styleClass="bordertable" id="billcart" value="#{cc.attrs.items}" var="cart">
<h:column>
......@@ -28,25 +27,59 @@
<f:facet name="header">
<h:outputText value="${i18n['product.price']}" />
</f:facet>
<h:outputText id="price" value="#{cart.product.price}">
<h:outputText id="price" value="#{cart.product.price.abs()}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.totalPrice']}" />
</f:facet>
<h:outputText id="total" value="#{cart.price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText id="count" value="${i18n['product.cart.count']}" />
</f:facet>
<a href="#" onclick="return changeCartCount($(this).next().next(), -1)">-1</a>
<a href="#" onclick="return changeCartCount($(this).next(), -10)">-10</a>
<h:commandButton action="#{productShopView.add(-10)}" value="#{i18n['productshop.minusTen']}">
<f:ajax render="@form" />
</h:commandButton>
<h:commandButton action="#{productShopView.add(-1)}" value="#{i18n['productshop.minusOne']}">
<f:ajax render="@form" />
</h:commandButton>
<h:inputText size="4" id="cartcount" value="#{cart.count}" />
<a href="#" onclick="return changeCartCount($(this).prev(), +1)">+1</a>
<a href="#" onclick="return changeCartCount($(this).prev().prev(), +10)">+10</a>
<h:commandButton action="#{productShopView.add(1)}" value="#{i18n['productshop.plusOne']}">
<f:ajax render="@form" />
</h:commandButton>
<h:commandButton action="#{productShopView.add(10)}" value="#{i18n['productshop.plusTen']}">
<f:ajax render="@form" />
</h:commandButton>
<h:inputHidden value="#{cart.id}" />
</h:column>
<h:column>
<h:dataTable border="0" var="disc" value="#{cart.discounts}">
<h:column>
<h:outputText value="#{disc.shortdesc}" />
</h:column>
<h:column>
<h:outputText value="#{cart.getDiscount(disc.id)}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>
<div>
<h:outputText value="#{i18n['productshop.total']} " />
<h:outputText value="#{productShopView.totalPrice}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</div>
<h:commandButton action="#{cc.attrs.commitaction}" id="commitbutton" value="#{cc.attrs.commitValue}" />
......
......@@ -86,7 +86,7 @@
</h:column>
-->
<h:column>
<h:link outcome="/user/edit" value="#{i18n['user.edit']}">
<h:link outcome="/useradmin/edit" value="#{i18n['user.edit']}">
<f:param name="userid" value="#{user.id}" />
</h:link>
</h:column>
......
......@@ -19,23 +19,23 @@
<div id="#{cc.attrs.tabId}">
<ul id="usertabnav">
<li class="edit"><h:link outcome="/user/edit" value="#{i18n['user.edit']}">
<li class="edit"><h:link outcome="/useradmin/edit" value="#{i18n['user.edit']}">
<f:param name="userid" value="#{userView.user.id}" />
</h:link></li>
<li class="chpass"><h:link outcome="/user/changePassword" value="#{i18n['submenu.user.changePassword']}">
<li class="chpass"><h:link outcome="/useradmin/changePassword" value="#{i18n['submenu.user.changePassword']}">
<f:param name="userid" value="#{userView.user.id}" />
</h:link></li>
<li class="accountevents"><h:link outcome="/user/accountEvents" value="#{i18n['submenu.user.accountEvents']}">
<li class="accountevents"><h:link outcome="/useradmin/accountEvents" value="#{i18n['submenu.user.accountEvents']}">
<f:param name="userid" value="#{userView.user.id}" />
</h:link></li>
<li class="groups"><h:link outcome="/place/myGroups" value="#{i18n['submenu.place.myGroups']}">
<li class="groups"><h:link outcome="/place/adminGroups" value="#{i18n['submenu.place.myGroups']}">
<f:param name="userid" value="#{userView.user.id}" />
</h:link></li>
<li class="picture"><h:link outcome="/user/sendPicture" value="#{i18n['submenu.user.sendPicture']}">
<li class="picture"><h:link outcome="/useradmin/sendPicture" value="#{i18n['submenu.user.sendPicture']}">
<f:param name="userid" value="#{userView.user.id}" />
</h:link></li>
......
......@@ -14,7 +14,6 @@
<ui:param name="thispage" value="page.account.list" />
<ui:define name="title">
<h1>#{i18n['user.accountevents']}</h1>
<users:usertabs tabId="accountevents" />
</ui:define>
<ui:define name="content">
<h:outputLabel value="#{i18n['user.accountBalance']}: " for="accountbalance" />
......
......@@ -13,7 +13,6 @@
</f:metadata>
<ui:define name="title">
<h1>#{i18n['user.changepassword.title']}</h1>
<users:usertabs tabId="edit" />
</ui:define>
<ui:define name="content">
......
......@@ -14,7 +14,6 @@
<ui:define name="title">
<h1>#{i18n['user.edit.title']}</h1>
<users:usertabs tabId="edit" />
</ui:define>
<ui:define name="content">
<users:edit commitaction="#{userView.saveUser()}" commitvalue="#{i18n['user.save']}" />
......
......@@ -16,7 +16,6 @@
</f:metadata>
<ui:define name="title">
<h1>#{i18n['sendPicture.header']}</h1>
<users:usertabs tabId="picture" />
</ui:define>
<ui:define name="content">
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:f="http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
</f:metadata>
<ui:param name="thispage" value="page.account.list" />
<ui:define name="title">
<h1>#{i18n['user.accountevents']}</h1>
<users:usertabs tabId="accountevents" />
</ui:define>
<ui:define name="content">
<h:outputLabel value="#{i18n['user.accountBalance']}: " for="accountbalance" />
<h:outputText id="accountbalance" value="#{userView.user.accountBalance}" />
<h:dataTable border="1" id="ac" value="#{userView.user.accountEvents}" var="ac">
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['accountEvent.productname']}" />
</f:facet>
<h:outputText value="#{ac.product.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['accountEvent.quantity']}" />
</f:facet>
<h:outputText value="#{ac.quantity}">
<f:convertNumber minFractionDigits="2" maxFractionDigits="2" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['accountEvent.unitPrice']}" />
</f:facet>
<h:outputText value="#{ac.unitPrice}">
<f:convertNumber minFractionDigits="2" maxFractionDigits="2" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['accountEvent.total']}" />
</f:facet>
<h:outputText value="#{ac.total}">
<f:convertNumber minFractionDigits="2" maxFractionDigits="2" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['accountEvent.eventTime']}" />
</f:facet>
<h:outputText value="#{ac.eventTime.time}">
<f:convertDateTime type="both" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['accountEvent.delivered']}" />
</f:facet>
<h:outputText value="#{ac.delivered.time}">
<f:convertDateTime type="both" />
</h:outputText>
</h:column>
<!-- <h:column> -->
<!-- <h:link outcome="/user/editAccountevent" value="#{i18n['accountEvent.edit']}"> -->
<!-- <f:param name="accountid" value="#{ac.id}" /> -->
<!-- </h:link> -->
<!-- </h:column> -->
</h:dataTable>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:users="http://java.sun.com/jsf/composite/tools/user" xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<ui:param name="thispage" value="page.admin.sendimage" />
<ui:define name="content">
<h1>Sending image to</h1>
<h:panelGrid columns="2">
<h:outputText value="#{i18n['user.login']}" />
<h:outputText value="#{userView.user.login}" />
<h:outputText value="#{i18n['user.wholeName']}" />
<h:outputText value="#{userView.user.wholeName}" />
</h:panelGrid>
<users:sendImage />
#{userView.initUserimagelist()}
<h:form id="changeimageform">
<h:dataTable border="1" id="user" value="#{userView.userImageList}" var="img">
<h:column>
<h:outputText value="#{img.name}" />
</h:column>
<h:column>
<h:outputText value="#{img.mimeType}" />
</h:column>
<h:column>
<a href="#"
onclick="window.open('#{request.contextPath}/Userimage?imageid=#{img.id}', 'imagesubmitpopup', 'height=240,width=320'); this.target='imagesubmitpopup'; return true; ">
Näytä kuva </a>
</h:column>
<h:column>
<h:commandButton action="#{userView.setDefaultImage()}" value="Set default image" />
</h:column>
</h:dataTable>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
</f:metadata>
<ui:define name="content">
<users:edit creating="true" commitaction="#{userView.createUser()}" commitvalue="#{i18n['user.create']}" />
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['user.changepassword.title']}</h1>
<users:usertabs tabId="edit" />
</ui:define>
<ui:define name="content">
<h:form id="userform">
<h:panelGrid columns="2">
<h:outputLabel value="#{i18n['user.password']}:" />
<h:inputSecret id="password" value="#{passwordView.password}" />
<h:outputLabel value="#{i18n['user.passwordcheck']}:" />
<h:inputSecret id="passwordcheck" value="#{passwordView.passwordcheck}" />
<h:commandButton id="createuserbtn" action="#{passwordView.changePassword()}"
value="#{i18n['user.changePassword']}"
/>
</h:panelGrid>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
......@@ -2,21 +2,19 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<ui:param name="thispage" value="page.place.insertToken" />
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
<f:event type="preRenderView" listener="#{userView.initCreateView}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['user.accountevents']}</h1>
<users:usertabs tabId="token" />
</ui:define>
<ui:param name="thispage" value="page.user.create" />
<ui:define name="content">
<users:edit creating="true" commitaction="#{userView.createUser()}" commitvalue="#{i18n['user.create']}" />
</ui:define>
</ui:composition>
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:login="http://java.sun.com/jsf/composite/tools/login"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition template="/layout/insomnia1/sidebartemplate.xhtml">
<ui:param name="rendered" value="false" />
<ui:define name="sidebarcontent">
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<ui:param name="thispage" value="page.user.create" />
<ui:define name="content">
<p>#{i18n['user.createdmessage']}</p>
</ui:define>
</ui:composition>
</h:body>
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:tools="http://java.sun.com/jsf/composite/cditools"
xmlns:account="http://java.sun.com/jsf/composite/cditools/account" xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['user.edit.title']}</h1>
<users:usertabs tabId="edit" />
</ui:define>
<ui:define name="content">
<users:edit commitaction="#{userView.saveUser()}" commitvalue="#{i18n['user.save']}" />
<!--
<h2>#{i18n['user.accountEventHeader']}</h2>
<h:outputText rendered="#{userView.user.accountEvents.size() le 0}" value="#{i18n['user.noAccountevents']}" />
<account:list rendered="#{!empty userView.user.accountEvents}" accountevents="#{userView.user.accountEvents}" />
<h2>#{i18n['user.placegroups']}</h2>
<h:outputText value="#{i18n['user.noPlacegroups']}" rendered="#{empty userView.user.placeGroups}" />
<h:form id="placegrouplist" rendered="#{!empty userView.user.placeGroups}">
<h:dataTable border="1" id="placegroup" value="#{userView.user.placeGroups}" var="placegroup">
<h:column>
<f:facet name="header">
<h:outputText value="ID" />
</f:facet>
<h:outputText value="#{placegroup.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroup.name']}" />
</f:facet>
<h:outputText value="#{placegroup.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroup.creator']}" />
</f:facet>
<h:outputText value="#{placegroup.creator.wholeName}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroup.created']}" />
</f:facet>
<h:outputText value="#{placegroup.created.time}">
<f:convertDateTime />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroup.edited']}" />
</f:facet>
<h:outputText value="#{placegroup.edited.time}">
<f:convertDateTime />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroup.details']}" />
</f:facet>
<h:outputText value="#{placegroup.details}">
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroup.places']}" />
</f:facet>
<h:dataTable border="0" id="placegroup" value="#{placegroup.places}" var="place">
<h:column>
<h:outputText value="#{place.name}" />
</h:column>
<h:column>
<h:outputText rendered="#{! empty place.placeReserver}" value="#{place.placeReserver.user.nick}" />
</h:column>
</h:dataTable>
</h:column>
<h:column>
<h:commandButton id="saverole" action="#{placegroupView.editGroup()}" value="#{i18n['placegroup.edit']}" />
</h:column>
</h:dataTable>
</h:form>
-->
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui"
xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:shop="http://java.sun.com/jsf/composite/cditools/shop"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<ui:param name="thispage" value="page.user.create" />
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['sendPicture.header']}</h1>
<users:usertabs tabId="picture" />
</ui:define>
<ui:define name="content">
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<h:outputScript target="head" library="jpegcam" name="webcam.js" />
<h:outputScript target="head">
webcam.set_api_url( '#{request.contextPath}/UploadServlet?type=userimage&amp;id=#{userView.selectedUser.id}' );
webcam.set_hook('onComplete', 'my_completion_handler');
webcam.set_swf_url('#{request.contextPath}/resources/jpegcam/Webcam.swf');
webcam.set_shutter_sound(true,'#{request.contextPath}/resources/jpegcam/shutter.mp3');
function my_completion_handler(msg) {
// alert("Completition handler executed" + msg);
window.location.href="#{request.contextPath}/user/sendPicture.jsf?userid=#{userView.user.id}";
}
</h:outputScript>
<button
onclick="$('#webcamcontainer').prepend(webcam.get_html(320, 240));$('#webcamcontainer').show();$(this).hide();"
>#{i18n['userimage.webcam']}</button>
<div id="webcamcontainer" style="display: none;"></div>
<p>Voit lisätä kuvan kävijälippuasi varten. Näin nopeutat asiointiasi tapahtumaan tullessasi.</p>
<p>
Kuvasta on pystyttävä tunnistamaan ongelmitta kortin omistaja. Tästä johtuen kuvan tulee olla selkeä, eikä kuvassa
saa olla useita henkilöitä. Ohjeita hyvän tunnistekuvan ottamiseksi löytyy <a
href="http://www.poliisi.fi/poliisi/home.nsf/files/Passikuvaohje_26-02-2008_FI/$file/Passikuvaohje_26-02-2008_FI.pdf"
>poliisin passikuvaohjeesta.</a>
</p>
<h:form enctype="multipart/form-data">
<p:fileUpload value="#{userView.image}" mode="simple" />
<h:commandButton action="#{userView.sendImage}" value="#{i18n['user.imagesubmit']}" />
</h:form>
<h2>#{i18n['user.thisIsCurrentImage']}</h2>
<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
<ui:fragment rendered="#{!empty userView.user.currentImage}">
<h:panelGrid columns="2">
<img width="300" src="#{request.contextPath}/Userimage?imageid=#{userView.user.currentImage.id}" alt="image" />
<ui:fragment rendered="#{userView.canManage()}">
<h:form>
<p:imageCropper value="#{userView.croppedImage}" aspectRatio="0.8"
image="http://kauppa.insomnia.fi#{request.contextPath}/Userimage?imageid=#{userView.user.currentImage.id}"
/>
<h:commandButton action="#{userView.crop}" value="#{i18n['user.cropImage']}" />
</h:form>
</ui:fragment>
</h:panelGrid>
<ui:fragment rendered="#{userView.canManage()}">
<h2>Ylläpito</h2>
<h:form>
<h:commandButton action="#{userView.makeCard()}" value="#{i18n['user.makeCard']}" />
<h:dataTable var="card" value="#{userCardView.printedCards}">
<h:column>
<h:outputText value="#{card.enabled}" />
</h:column>
<h:column>
<h:outputText value="#{card.enabled}" />
</h:column>
<h:column>
<a href="#{request.contextPath}/UserCard?cardid=#{card.id}">View Card</a>
<a href="#{request.contextPath}/UserCard?cardid=#{card.id}&amp;download=1">Print Card</a>
</h:column>
</h:dataTable>
</h:form>
<h3>RFID</h3>
<h:form rendered="#{empty readerView.readername}">
<h:dataTable border="1" id="reader" value="#{readerListDataView.readers}" var="rr">
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['reader.name']}" />
</f:facet>
<h:outputText value="#{rr}" />
</h:column>
<h:column>
<h:commandButton action="#{readerListDataView.selectReader}" />
</h:column>
</h:dataTable>
</h:form>
<shop:readerevents rendered="#{!empty readerView.readername}" />
</ui:fragment>
<!-- <h:dataTable var="image" value="#{userView.user.userImageList}"> -->
<!-- <h:column> -->
<!-- <h:outputText value="#{image.id}" /> -->
<!-- </h:column> -->
<!-- <h:column> -->
<!-- <h:outputText value="#{image.name}" /> -->
<!-- </h:column> -->
<!-- <h:column> -->
<!-- <h:outputText value="#{image.description}" /> -->
<!-- </h:column> -->
<!-- </h:dataTable> -->
</ui:fragment>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
......@@ -3,75 +3,28 @@ global.copyright = Verkkopeliyhdistys Insomnia ry
global.productname = Omnia
httpsession.creationTime = Luotu
#Bill number
# Validationmessages
httpsession.id = ID
httpsession.invalidate = Mit\uFFFDt\uFFFDi
httpsession.invalidateSuccessfull = Sessio onnistuneesti mit\uFFFDt\uFFFDity
httpsession.isSessionNew = Uusi sessio
httpsession.lastAccessedTime = Viimeksi n\uFFFDhty
httpsession.maxInactiveInterval = Aikakatkaisu (s)
httpsession.sessionHasExisted = Ollut elossa (s)
httpsession.user = Tunnus
map.id = #
navi.auth.login = frontpage
navi.auth.loginerror = frontpage
navi.auth.logout = frontpage
page.account.edit.pagegroup = admin
page.account.list.pagegroup = user
page.admin.sendimage.pagegroup = admin
page.auth.login.loginerror.pagegroup = frontpage
page.auth.login.logout.pagegroup = frontpage
page.auth.login.pagegroup = login
page.auth.loginerror.pagegroup = frontpage
page.auth.logout.pagegroup = login
page.auth.logoutsuccess.pagegroup = frontpage
page.auth.notauthorized.pagegroup = frontpage
page.auth.resetPassword.pagegroup = user
page.bill.billSummary.pagegroup = shop
page.bill.edit.pagegroup = shop
page.bill.list.pagegroup = shop
page.bill.listAll.pagegroup = shop
page.bill.placemap.pagegroup = placemap
page.eventorg.create.pagegroup = admin
page.eventorg.edit.pagegroup = admin
page.eventorg.editEvent.pagegroup = admin
page.eventorg.list.pagegroup = admin
page.game.list.pagegroup = game
page.game.start.pagegroup = game
page.index.pagegroup = frontpage
page.permissionDenied.pagegroup = frontpage
page.place.edit.pagegroup = admin
page.place.insertToken.pagegroup = user
page.place.mygroups.pagegroup = user
page.place.placemap.pagegroup = placemap
page.poll.answer.pagegroup = poll
page.poll.answered.pagegroup = poll
page.poll.start.pagegroup = poll
page.product.create.pagegroup = admin
page.product.createBill.pagegroup = shop
page.product.edit.pagegroup = admin
page.product.list.pagegroup = admin
page.role.create.pagegroup = admin
page.role.edit.pagegroup = admin
page.role.list.pagegroup = admin
page.shop.readerevents.pagegroup = rfidshop
page.user.create.pagegroup = user
page.user.edit.pagegroup = user
page.user.editself.pagegroup = user
page.user.list.pagegroup = user
page.user.mygroups.pagegroup = user
page.viewexpired.pagegroup = frontpage
pagegroup.auth.login = frontpage
placegroupview.toptext = \
poll.edit = edit
product.providedRole = Tuote tarjoaa roolin
product.returnProductEdit = Palaa tuotteeseen:
product.saved = Tuote tallennettu
productshop.minusOne = -1
productshop.minusTen = -10
productshop.plusOne = +1
productshop.plusTen = +10
user.unauthenticated = Kirjautumaton
......@@ -79,6 +79,7 @@ discount.edit = Edit
discount.maxNum = Max nr of discounts
discount.perUser = Discounts per user
discount.percentage = Discount percent
discount.products = Products
discount.role = Role discount
discount.save = Save
discount.shortdesc = Description
......@@ -294,6 +295,7 @@ product.price = Price of product
product.save = Save
product.shopInstant = Luo k\u2030teismaksu tuotteille
product.sort = Sort nr
product.totalPrice = Total
product.unitName = Unit name
product.vat = VAT
......@@ -301,6 +303,7 @@ products.save = Save
productshop.commit = Buy
productshop.noItemsInCart = There are no products in shopping cart
productshop.total = Total
reader.assocToCard = Associate to card
reader.name = Reader name
......
......@@ -78,6 +78,7 @@ discount.edit = Muokkaa
discount.maxNum = Alennusten enimm\u00E4islkm
discount.perUser = Alennuksia per k\u00E4ytt\u00E4j\u00E4
discount.percentage = Alennusprosentti
discount.products = Tuotteet
discount.role = Roolialennus
discount.save = Tallenna
discount.shortdesc = Kuvaus
......@@ -98,6 +99,15 @@ global.notAuthorizedExecute = Sinulla ei ole riitt\u00E4v\u00E4sti oikeuksia suo
global.notauthorized = Sinulla ei ole riitt\u00E4vi\u00E4 oikeuksia t\u00E4lle sivulle.
global.save = Tallenna
httpsession.id = ID
httpsession.invalidate = Mit\uFFFDt\uFFFDi
httpsession.invalidateSuccessfull = Sessio onnistuneesti mit\uFFFDt\uFFFDity
httpsession.isSessionNew = Uusi sessio
httpsession.lastAccessedTime = Viimeksi n\uFFFDhty
httpsession.maxInactiveInterval = Aikakatkaisu (s)
httpsession.sessionHasExisted = Ollut elossa (s)
httpsession.user = Tunnus
imagefile.description = Kuvaus
imagefile.file = Kuvatiedosto
......@@ -146,19 +156,19 @@ menu.poll.index = Kyselyt
menu.shop.createBill = Kauppa
menu.user.edit = Omat tiedot
news.abstract = Lyhennelm\uFFFD
news.abstract = Lyhennelm\u00E4
news.expire = Lopeta julkaisu
news.publish = Julkaise
news.save = Tallenna
news.title = Otsikko
newsgroup.edit = Muokkaa
newsgroup.name = Uutisryhm\uFFFDn nimi
newsgroup.priority = J\uFFFDrjestysnumero
newsgroup.name = Uutisryhm\u00E4n nimi
newsgroup.priority = J\u00E4rjestysnumero
newsgroup.readerRole = Lukijoiden roolit
newsgroup.writerRole = Kirjoittajaryhm\uFFFD
newsgroup.writerRole = Kirjoittajaryhm\u00E4
newslist.header = Uutisryhm\uFFFDt
newslist.header = Uutisryhm\u00E4t
org.hibernate.validator.constraints.Email.message = not a well-formed email address
org.hibernate.validator.constraints.Length.message = length must be between {min} and {max}
......@@ -205,13 +215,13 @@ place.commit = Tallenna
place.description = Kuvaus
place.details = Tiedot
place.edit = Muokkaa
place.groupremove = Poista paikka paikkaryhm\uFFFDst\uFFFD
place.groupremove = Poista paikka paikkaryhm\u00E4st\u00E4
place.height = Korkeus
place.mapX = X
place.mapY = Y
place.membership = Yhdistetty k\u00E4ytt\u00E4j\u00E4
place.name = Nimi
place.noReserver = Ei liitetty k\uFFFDytt\uFFFDj\uFFFD\uFFFDn
place.noReserver = Ei liitetty k\u00E4ytt\u00E4j\u00E4\u00E4n
place.product = Tuote
place.releasetime = Vapautusaika
place.width = Leveys
......@@ -278,6 +288,7 @@ product.price = Tuotteen hinta
product.save = Tallenna
product.shopInstant = Luo k\u00E4teismaksu tuotteille
product.sort = J\u00E4rjestys luku
product.totalPrice = Summa
product.unitName = Tuoteyksikk\u00F6
product.vat = ALV
......@@ -286,6 +297,7 @@ products.save = Tallenna
productshop.billCreated = Lasku luotu
productshop.commit = Osta
productshop.noItemsInCart = Ostoskorissa ei ole tuotteita
productshop.total = Yhteens\u00E4
reader.assocToCard = Yhdist\u00E4 korttiin
reader.name = Lukijan nimi
......@@ -315,7 +327,7 @@ role.name = Nimi
role.parents = Periytyy
role.savePermissions = Tallenna oikeudet
sendPicture.header = L\uFFFDhet\uFFFD kuva
sendPicture.header = L\u00E4het\u00E4 kuva
shop.accountBalance = Tilin saldo
shop.user = Myyd\u00E4\u00E4n
......@@ -402,7 +414,7 @@ user.edit.title = K\u00E4ytt\u00E4j\u00E4n tiedot
user.email = S\u00E4hk\u00F6posti
user.firstNames = Etunimi
user.hasImage = Kuva
user.imageUploaded = Kuva l\uFFFDhetetty.
user.imageUploaded = Kuva l\u00E4hetetty.
user.imagelist = Tallennetut kuvat
user.imagesubmit = L\u00E4het\u00E4 kuva
user.lastName = Sukunimi
......@@ -420,7 +432,7 @@ user.realname = Nimi
user.roles = Roolit
user.rolesave = Tallenna roolit
user.save = Tallenna
user.sendPicture = Kuvan l\uFFFDhetys
user.sendPicture = Kuvan l\u00E4hetys
user.sex = Sukupuoli
user.sex.FEMALE = Nainen
user.sex.MALE = Mies
......
......@@ -2,12 +2,12 @@ package fi.insomnia.bortal.web.cdiview;
public interface IPaginationView {
public int getPage();
public Integer getPage();
public int getPagesize();
public Integer getPagesize();
public long getResultcount();
public Long getResultcount();
public long getPagecount();
public Long getPagecount();
}
......@@ -2,64 +2,113 @@ package fi.insomnia.bortal.web.cdiview;
import java.util.List;
import javax.faces.model.ListDataModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.utilities.SearchResult;
import fi.insomnia.bortal.utilities.jpa.ModelInterface;
public abstract class PaginationView<T extends ModelInterface<?>> extends GenericCDIView implements IPaginationView {
private static final long serialVersionUID = -673649175435129349L;
protected int page;
protected int pagesize = 20;
protected long resultcount;
private long pagecount;
private static long serialVersionUID = -673649175435129349L;
protected Integer page = 0;
protected Integer pagesize = 20;
protected Long resultcount = 0L;
private Long pagecount = 0L;
protected String sort;
protected String search;
private List<T> results;
private ListDataModel<T> resultdatamodel;
private static Logger logger = LoggerFactory.getLogger(PaginationView.class);
public abstract void initView();
// public abstract void initView();
public void setResult(SearchResult<T> products) {
setResultcount(products.getResultcount());
results = products.getResults();
setResults(products.getResults());
}
public String addToPage(Integer count) {
pagechangeCallback();
if (count != null) {
page += count;
}
if (page >= pagecount) {
page = pagecount.intValue() - 1;
}
return null;
}
protected void pagechangeCallback() {
// logger.info("NOT Overriden pagechange callback");
results = null;
resultdatamodel = null;
}
public String gotoFirstpage() {
// logger.info("Setting page to first page");
pagechangeCallback();
page = 0;
return null;
}
public String gotoLastpage() {
// logger.info("Setting page to last page");
pagechangeCallback();
page = pagecount.intValue() - 1;
if (page < 0) {
page = 0;
}
return null;
}
public ListDataModel<T> getResultdatamodel() {
if (resultdatamodel == null) {
resultdatamodel = new ListDataModel<T>(results);
}
return resultdatamodel;
}
@Override
public int getPage() {
public Integer getPage() {
return page;
}
public void setPage(int page) {
public void setPage(Integer page) {
this.page = page;
}
@Override
public int getPagesize() {
public Integer getPagesize() {
if (pagesize < 1) {
pagesize = 20;
}
return pagesize;
}
public void setPagesize(int pagesize) {
public void setPagesize(Integer pagesize) {
this.pagesize = pagesize;
}
@Override
public long getResultcount() {
public Long getResultcount() {
return resultcount;
}
public void setResultcount(long resultcount) {
public void setResultcount(Long resultcount) {
this.resultcount = resultcount;
pagecount = ((resultcount + pagesize - 1) / pagesize);
}
@Override
public long getPagecount() {
public Long getPagecount() {
return pagecount;
}
public void setPagecount(long pagecount) {
public void setPagecount(Long pagecount) {
this.pagecount = pagecount;
}
......@@ -79,18 +128,21 @@ public abstract class PaginationView<T extends ModelInterface<?>> extends Generi
this.search = search;
}
public void setResults(List<T> results) {
this.results = results;
public String newSearch() {
logger.info("Setting new Search for pagination..");
page = 0;
setResults(null);
resultdatamodel = null;
return null;
}
public List<T> getResults() {
return results;
}
public String newSearch() {
page = 0;
results = null;
return null;
public void setResults(List<T> results) {
this.results = results;
resultdatamodel = null;
}
}
......@@ -11,9 +11,6 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.MenubeanLocal;
import fi.insomnia.bortal.model.MenuNavigation;
import fi.insomnia.bortal.web.cdiview.GenericCDIView;
......@@ -36,8 +33,6 @@ public class MenuView extends GenericCDIView {
private HashSet<MenuNavigation> navis;
private static final Logger logger = LoggerFactory.getLogger(MenuView.class);
public List<JsfMenuitem> getMenu(Integer level)
{
getMenus();
......@@ -47,7 +42,6 @@ public class MenuView extends GenericCDIView {
}
List<JsfMenuitem> ret = menus.get(level);
logger.info("Trying to get menu for level {}, menus {}", level, ret);
return ret;
}
......
......@@ -61,6 +61,12 @@ public class EventOrgView extends GenericCDIView {
return null;
}
public String saveEvent()
{
setEvent(eventbean.mergeChanges(event));
return null;
}
public String addDomain() {
getEvent().getDomains().add(new LanEventDomain(getEvent(), newdomain));
setEvent(eventbean.mergeChanges(getEvent()));
......@@ -95,6 +101,7 @@ public class EventOrgView extends GenericCDIView {
if (super.requirePermissions(user.isSuperadmin() || (eventbean.getCurrentEvent().getOrganiser().getAdmin().equals(user))) && getEvent() == null)
{
setEvent(eventorgbean.findEvent(eventid));
super.beginConversation();
}
}
......@@ -195,4 +202,12 @@ public class EventOrgView extends GenericCDIView {
eventdomains = new ListDataModel<LanEventDomain>(event.getDomains());
}
public ListDataModel<LanEventDomain> getEventdomains() {
return eventdomains;
}
public void setEventdomains(ListDataModel<LanEventDomain> eventdomains) {
this.eventdomains = eventdomains;
}
}
package fi.insomnia.bortal.web.cdiview.shop;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
......@@ -9,75 +7,24 @@ import javax.inject.Named;
import fi.insomnia.bortal.beans.ProductBeanLocal;
import fi.insomnia.bortal.enums.apps.ShopPermission;
import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.web.cdiview.GenericCDIView;
import fi.insomnia.bortal.web.cdiview.IPaginationView;
import fi.insomnia.bortal.web.cdiview.PaginationView;
@Named
@RequestScoped
public class ProductListView extends GenericCDIView implements IPaginationView {
public class ProductListView extends PaginationView<Product> {
/**
*
*/
private static final long serialVersionUID = -5621674984772482156L;
private List<Product> products;
private int page;
private int pagesize;
private long resultcount;
private long pagecount;
@EJB
private transient ProductBeanLocal prodbean;
public void initView() {
if (super.requirePermissions(ShopPermission.LIST_ALL_PRODUCTS)) {
products = prodbean.getProducts();
}
}
public void setProducts(List<Product> products) {
this.products = products;
}
public List<Product> getProducts() {
return products;
}
@Override
public int getPage() {
return page;
}
@Override
public int getPagesize() {
return pagesize;
super.setResults(prodbean.getProducts());
}
@Override
public long getResultcount() {
return resultcount;
}
@Override
public long getPagecount() {
return pagecount;
}
public void setPage(int page) {
this.page = page;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
public void setResultcount(long resultcount) {
this.resultcount = resultcount;
}
public void setPagecount(long pagecount) {
this.pagecount = pagecount;
}
}
......@@ -64,6 +64,23 @@ public class ProductShopView extends GenericCDIView {
}
}
public String add(Integer count)
{
ProductShopItem item = shoppingcart.getRowData();
item.setCount(item.getCount().add(BigDecimal.valueOf(count)));
return null;
}
public BigDecimal getTotalPrice()
{
BigDecimal ret = BigDecimal.ZERO;
for (ProductShopItem cart : shoppingcart)
{
ret = ret.add(cart.getPrice());
}
return ret;
}
public String commitBillCart() {
logger.debug("Committing billCart");
......@@ -73,17 +90,12 @@ public class ProductShopView extends GenericCDIView {
return null;
}
Iterator<ProductShopItem> cartIter = shoppingcart.iterator();
Bill bill = new Bill(eventbean.getCurrentEvent(), user);
bill.setOurReference(eventbean.getCurrentEvent().getName());
while (cartIter.hasNext()) {
ProductShopItem shopitem = cartIter.next();
for (ProductShopItem shopitem : shoppingcart) {
if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) {
bill.addProduct(shopitem.getProduct(), shopitem.getCount());
}
}
billbean.createBill(bill);
......
......@@ -38,9 +38,11 @@ public class ProductView extends GenericCDIView {
public void initEditView() {
if (super.requirePermissions(ShopPermission.MANAGE_PRODUCTS) && product == null) {
product = prodbean.findById(getProductId());
if (super.requirePermissions(product != null)) {
super.beginConversation();
}
}
}
public void initCreateView() {
if (super.requirePermissions(ShopPermission.MANAGE_PRODUCTS)) {
......
......@@ -17,99 +17,15 @@ public class UserSearchView extends PaginationView<User> {
*
*/
private static final long serialVersionUID = -7131921062890234604L;
// private int page;
// private int pagesize = 20;
// private long resultcount;
// private long pagecount;
// private String sort;
// private String search;
@EJB
private transient UserBeanLocal userbean;
// private ListDataModel<User> users;
@Override
public void initView() {
if (requirePermissions(permbean.hasPermission(UserPermission.VIEW_ALL))) {
super.setResult(userbean.getUsers(page, pagesize, sort, search));
// resultcount = userbean.getUsersCount(search);
// pagecount = ((resultcount + pagesize - 1) / pagesize);
}
}
// @Override
// public String newSearch() {
// page = 0;
// return null;
// }
//
// @Override
// public int getPage() {
// return page;
// }
//
// @Override
// public void setPage(int page) {
// this.page = page;
// }
//
// @Override
// public int getPagesize() {
// return pagesize;
// }
//
// @Override
// public void setPagesize(int pagesize) {
// this.pagesize = pagesize;
// }
//
// @Override
// public long getResultcount() {
// return resultcount;
// }
//
// @Override
// public void setResultcount(long resultcount) {
// this.resultcount = resultcount;
// }
//
// @Override
// public String getSort() {
// return sort;
// }
//
// @Override
// public void setSort(String sort) {
// this.sort = sort;
// }
//
// @Override
// public String getSearch() {
// return search;
// }
//
// @Override
// public void setSearch(String search) {
// this.search = search;
// }
//
// public ListDataModel<User> getUsers() {
// return users;
// }
//
// public void setUsers(ListDataModel<User> users) {
// this.users = users;
// }
//
// @Override
// public void setPagecount(long pagecount) {
// this.pagecount = pagecount;
// }
//
// @Override
// public long getPagecount() {
// return pagecount;
// }
}
......@@ -2,23 +2,30 @@ package fi.insomnia.bortal.web.helpers;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.model.Discount;
import fi.insomnia.bortal.model.Product;
public class ProductShopItem {
private static final Logger logger = LoggerFactory.getLogger(ProductShopItem.class);
private final Product product;
private BigDecimal count = BigDecimal.ZERO;
private BigDecimal count;
private final Integer id;
private List<Discount> discounts;
private Map<Integer, BigDecimal> discountValues;
private BigDecimal price;
public ProductShopItem(Product prod) {
this.product = prod;
id = this.product.getId();
setCount(BigDecimal.ZERO);
}
public static List<ProductShopItem> productList(List<Product> products) {
......@@ -35,7 +42,37 @@ public class ProductShopItem {
}
public void setCount(BigDecimal count) {
if (count == null || count.compareTo(BigDecimal.ZERO) < 0)
{
count = BigDecimal.ZERO;
}
this.count = count;
price = product.getPrice().abs().multiply(count);
discounts = product.getActiveDiscounts(count);
discountValues = new HashMap<Integer, BigDecimal>();
for (Discount d : discounts)
{
BigDecimal newprice = price.multiply(d.getPercentage());
discountValues.put(d.getId(), price.subtract(newprice));
price = newprice;
}
}
public List<Discount> getDiscounts()
{
return discounts;
}
public BigDecimal getDiscount(Integer discId)
{
return discountValues.get(discId);
}
public BigDecimal getPrice()
{
return price;
}
public BigDecimal getCount() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!