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 @@
<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>
<session-config>
<session-timeout>30</session-timeout>
<session-timeout>120</session-timeout>
</session-config>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
......
......@@ -6,7 +6,7 @@
<h:body>
<ui:composition template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
<f:metadata>
<f:metadata>
<f:event type="preRenderView" listener="#{authView.executeAdduserViewLogin}" />
</f:metadata>
<ui:define name="topbar">
......@@ -18,9 +18,9 @@
<ui:define name="content">
<h:panelGrid columns="2">
<h:panelGroup>
<h1>#{i18n['login.login']}</h1>
<h1>#{i18n['login.login']}</h1>
</h:panelGroup>
<h:panelGroup>
<login:login />
</h:panelGroup>
......
......@@ -10,6 +10,7 @@
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:event type="preRenderView" listener="#{mapView.initViewMap()}" />
<f:viewParam name="userid" value="#{userView.userid}" />
</f:metadata>
<ui:param name="thispage" value="page.place.placemap" />
......
......@@ -8,6 +8,7 @@
<composite:interface>
<composite:attribute name="isOneliner" required="false" />
<composite:attribute name="onError" required="false" />
</composite:interface>
<composite:implementation>
......@@ -29,7 +30,7 @@
<p:password id="gridPwd" value="#{authView.password}" />
</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:choose>
......
......@@ -37,14 +37,12 @@
<h:panelGroup>
<h:outputLabel value="#{i18n['shop.barcode']}" />
<h:inputText id="barcode" value="#{productShopView.barcode}" />
<h:commandButton action="#{productShopView.readBarcode}" onclick="blip(); return true;" value="#{i18n['shop.readBarcode']}">
<h:inputText id="barcode" value="#{productShopView.barcode}" />
<h:commandButton action="#{productShopView.readBarcode}" value="#{i18n['shop.readBarcode']}">
<f:ajax render="@form" onevent="barcodeReadEvent" execute="@form" />
</h:commandButton>
<br />
<p:dataTable id="prods" value="#{productShopView.boughtItems}" var="prods">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['shop.count']}" />
......@@ -138,10 +136,12 @@
function calc() {
$("#returnval").val($("#inputval").val() - $(".inputval").text().replace(",","."));
}
function barcodeReadEvent(data) {
if (data.status == "success") {
$("#shoppingcartform\\:barcode").focus();
$("[id$=shoppingcartform\\:barcode]").focus();
}
}
</script>
......
......@@ -72,8 +72,8 @@
<h:link value="#{i18n['user.email']}" includeViewParams="true" >
<f:param name="sort" value="email" />
</h:link>
<h:outputText value="#{user.email}" />
</f:facet>
<h:outputText value="#{user.email}" />
</p:column>
<p:column>
......
......@@ -45,6 +45,11 @@ public class MapView extends GenericCDIView {
private static final Logger logger = LoggerFactory.getLogger(MapView.class);
public void initViewMap()
{
super.requirePermissions(MapPermission.VIEW);
}
public boolean canView() {
return permbean.hasPermission(MapPermission.VIEW);
}
......
......@@ -140,7 +140,7 @@ public class ProductShopView extends GenericCDIView {
Map<Integer, BigDecimal> prodCounts = new HashMap<Integer, BigDecimal>();
for (ProductShopItem sc : shoppingcart) {
prodCounts.put(sc.getProduct().getId(), sc.getCount());
prodCounts.put(sc.getProduct().getId(), sc.getCount());
}
HashMap<Integer, BigDecimal> limits = productBean.getProductLimit(
......@@ -365,16 +365,25 @@ public class ProductShopView extends GenericCDIView {
public String readBarcode() {
Product product = productBean.findByBarcode(this.barcode);
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) {
if (a.getProduct().equals(product)) {
a.setCount(a.getCount().add(BigDecimal.ONE));
if (a.getProduct().equals(product))
{
//a.setCount(a.getCount().add(BigDecimal.ONE));
//updateCartLimits(null);
shoppingcart.setRowIndex(n);
this.addOne();
setBlip(true);
break;
}
n++;
}
this.barcode = null;
logger.debug("barcode read");
return null;
return "success";
}
public boolean isBlip() {
......
......@@ -58,8 +58,15 @@ public class AuthView extends GenericCDIView {
}
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) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!