Commit 6b1f948c by Tuomas Riihimäki

Merge branch 'devel'

Conflicts:
	code/MoyaWeb/WebContent/admin/adduser/login.xhtml
	code/MoyaWeb/WebContent/resources/cditools/login/login.xhtml
2 parents 39c71bf1 54e3659f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>LanBortalWeb</display-name> <display-name>LanBortalWeb</display-name>
<session-config> <session-config>
<session-timeout>30</session-timeout> <session-timeout>120</session-timeout>
</session-config> </session-config>
<context-param> <context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name> <param-name>javax.faces.PROJECT_STAGE</param-name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
<f:metadata> <f:metadata>
<f:event type="preRenderView" listener="#{authView.executeAdduserViewLogin}" /> <f:event type="preRenderView" listener="#{authView.executeAdduserViewLogin}" />
</f:metadata> </f:metadata>
<ui:define name="topbar"> <ui:define name="topbar">
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
<ui:define name="content"> <ui:define name="content">
<h:panelGrid columns="2"> <h:panelGrid columns="2">
<h:panelGroup> <h:panelGroup>
<h1>#{i18n['login.login']}</h1> <h1>#{i18n['login.login']}</h1>
</h:panelGroup> </h:panelGroup>
<h:panelGroup> <h:panelGroup>
<login:login /> <login:login />
</h:panelGroup> </h:panelGroup>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata> <f:metadata>
<f:event type="preRenderView" listener="#{mapView.initViewMap()}" />
<f:viewParam name="userid" value="#{userView.userid}" /> <f:viewParam name="userid" value="#{userView.userid}" />
</f:metadata> </f:metadata>
<ui:param name="thispage" value="page.place.placemap" /> <ui:param name="thispage" value="page.place.placemap" />
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<composite:interface> <composite:interface>
<composite:attribute name="isOneliner" required="false" /> <composite:attribute name="isOneliner" required="false" />
<composite:attribute name="onError" required="false" />
</composite:interface> </composite:interface>
<composite:implementation> <composite:implementation>
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
<p:password id="gridPwd" value="#{authView.password}" /> <p:password id="gridPwd" value="#{authView.password}" />
</h:panelGrid> </h:panelGrid>
<p:commandButton id="gridsubmit" actionListener="#{authView.executeLogin()}" value="#{i18n['login.submit']}" /> <p:commandButton id="gridsubmit" actionListener="#{authView.executeLogin(cc.attrs.onerror)}" value="#{i18n['login.submit']}" />
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
......
...@@ -37,14 +37,12 @@ ...@@ -37,14 +37,12 @@
<h:panelGroup> <h:panelGroup>
<h:outputLabel value="#{i18n['shop.barcode']}" /> <h:outputLabel value="#{i18n['shop.barcode']}" />
<h:inputText id="barcode" value="#{productShopView.barcode}" /> <h:inputText id="barcode" value="#{productShopView.barcode}" />
<h:commandButton action="#{productShopView.readBarcode}" onclick="blip(); return true;" value="#{i18n['shop.readBarcode']}"> <h:commandButton action="#{productShopView.readBarcode}" value="#{i18n['shop.readBarcode']}">
<f:ajax render="@form" onevent="barcodeReadEvent" execute="@form" /> <f:ajax render="@form" onevent="barcodeReadEvent" execute="@form" />
</h:commandButton> </h:commandButton>
<br /> <br />
<p:dataTable id="prods" value="#{productShopView.boughtItems}" var="prods"> <p:dataTable id="prods" value="#{productShopView.boughtItems}" var="prods">
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['shop.count']}" /> <h:outputText value="#{i18n['shop.count']}" />
...@@ -138,10 +136,12 @@ ...@@ -138,10 +136,12 @@
function calc() { function calc() {
$("#returnval").val($("#inputval").val() - $(".inputval").text().replace(",",".")); $("#returnval").val($("#inputval").val() - $(".inputval").text().replace(",","."));
} }
function barcodeReadEvent(data) { function barcodeReadEvent(data) {
if (data.status == "success") { if (data.status == "success") {
$("#shoppingcartform\\:barcode").focus(); $("[id$=shoppingcartform\\:barcode]").focus();
} }
} }
</script> </script>
......
...@@ -72,8 +72,8 @@ ...@@ -72,8 +72,8 @@
<h:link value="#{i18n['user.email']}" includeViewParams="true" > <h:link value="#{i18n['user.email']}" includeViewParams="true" >
<f:param name="sort" value="email" /> <f:param name="sort" value="email" />
</h:link> </h:link>
<h:outputText value="#{user.email}" />
</f:facet> </f:facet>
<h:outputText value="#{user.email}" />
</p:column> </p:column>
<p:column> <p:column>
......
...@@ -45,6 +45,11 @@ public class MapView extends GenericCDIView { ...@@ -45,6 +45,11 @@ public class MapView extends GenericCDIView {
private static final Logger logger = LoggerFactory.getLogger(MapView.class); private static final Logger logger = LoggerFactory.getLogger(MapView.class);
public void initViewMap()
{
super.requirePermissions(MapPermission.VIEW);
}
public boolean canView() { public boolean canView() {
return permbean.hasPermission(MapPermission.VIEW); return permbean.hasPermission(MapPermission.VIEW);
} }
......
...@@ -140,7 +140,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -140,7 +140,7 @@ public class ProductShopView extends GenericCDIView {
Map<Integer, BigDecimal> prodCounts = new HashMap<Integer, BigDecimal>(); Map<Integer, BigDecimal> prodCounts = new HashMap<Integer, BigDecimal>();
for (ProductShopItem sc : shoppingcart) { for (ProductShopItem sc : shoppingcart) {
prodCounts.put(sc.getProduct().getId(), sc.getCount()); prodCounts.put(sc.getProduct().getId(), sc.getCount());
} }
HashMap<Integer, BigDecimal> limits = productBean.getProductLimit( HashMap<Integer, BigDecimal> limits = productBean.getProductLimit(
...@@ -365,16 +365,25 @@ public class ProductShopView extends GenericCDIView { ...@@ -365,16 +365,25 @@ public class ProductShopView extends GenericCDIView {
public String readBarcode() { public String readBarcode() {
Product product = productBean.findByBarcode(this.barcode); Product product = productBean.findByBarcode(this.barcode);
this.blip = false; this.blip = false;
// find product index, set index and add one
// I don't know why this does not work if you just loop over and change the product count
int n = 0;
for (ProductShopItem a : shoppingcart) { for (ProductShopItem a : shoppingcart) {
if (a.getProduct().equals(product)) { if (a.getProduct().equals(product))
a.setCount(a.getCount().add(BigDecimal.ONE)); {
//a.setCount(a.getCount().add(BigDecimal.ONE));
//updateCartLimits(null);
shoppingcart.setRowIndex(n);
this.addOne();
setBlip(true); setBlip(true);
break; break;
} }
n++;
} }
this.barcode = null; this.barcode = null;
logger.debug("barcode read"); logger.debug("barcode read");
return null; return "success";
} }
public boolean isBlip() { public boolean isBlip() {
......
...@@ -58,8 +58,15 @@ public class AuthView extends GenericCDIView { ...@@ -58,8 +58,15 @@ public class AuthView extends GenericCDIView {
} }
public void executeLogin() { public void executeLogin() {
doLogin("/auth/loginError"); executeLogin(null);
}
public void executeLogin(String onError) {
if(onError == null)
onError = "/auth/loginError";
doLogin(onError);
} }
private void doLogin(String onError) { private void doLogin(String onError) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!