Commit 42a45fe3 by Riku Silvola

Merge branch 'master' of codecrew.fi:bortal

2 parents 7f918cb6 675f6be5
...@@ -207,7 +207,7 @@ public class MenuBean implements MenuBeanLocal { ...@@ -207,7 +207,7 @@ public class MenuBean implements MenuBeanLocal {
foodnavi.addPage(menuitemfacade.findOrCreate("/foodadmin/editTemplate"), ShopPermission.MANAGE_FOODWAVES).setVisible(false); foodnavi.addPage(menuitemfacade.findOrCreate("/foodadmin/editTemplate"), ShopPermission.MANAGE_FOODWAVES).setVisible(false);
foodnavi.addPage(menuitemfacade.findOrCreate("/foodmanager/listFoodwaves"), ShopPermission.MANAGE_FOODWAVES); foodnavi.addPage(menuitemfacade.findOrCreate("/foodmanager/listFoodwaves"), ShopPermission.MANAGE_FOODWAVES);
foodnavi.addPage(menuitemfacade.findOrCreate("/foodmanager/listOrders"), ShopPermission.MANAGE_FOODWAVES); foodnavi.addPage(menuitemfacade.findOrCreate("/foodmanager/listOrders"), ShopPermission.MANAGE_FOODWAVES).setVisible(false);
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<context-param> <context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name> <param-name>javax.faces.PROJECT_STAGE</param-name>
<!-- <param-value>Production</param-value> --> <!-- <param-value>Production</param-value> -->
<param-value>Development</param-value> <param-value>Development</param-value>
</context-param> </context-param>
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<div id="actionlog"> <div id="actionlog">
<h:form id="refresh"> <h:form id="refresh">
<p:poll interval="1" update="actionlogtable" /> <p:poll interval="1" update="actionlogtable" />
<p:dataTable2styleClass="bordertable" id="actionlogtable" value="#{actionLogMessageView.messages}" var="message" paginator="true" rows="30" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,50,100"> <p:dataTable styleClass="bordertable" id="actionlogtable" value="#{actionLogMessageView.messages}" var="message" paginator="true" rows="30" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,50,100" >
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['actionlog.time']}" /> <h:outputText value="#{i18n['actionlog.time']}" />
......
...@@ -12,13 +12,12 @@ ...@@ -12,13 +12,12 @@
template="/layout/#{sessionHandler.layout}/template.xhtml"> template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata> <f:metadata>
<f:viewParam name="foodwaveid" value="#{foodWaveView.foodWaveId}" /> <f:viewParam name="foodwaveid" value="#{foodWaveView.foodWaveId}" />
<f:event type="preRenderView" <f:event type="preRenderView" listener="#{foodWaveView.initFoodWaveOrderList}" />
listener="#{foodWaveView.initFoodWaveOrderList}" />
<!-- <f:event type="preRenderView" listener="#{foodWaveView.initFoodwaveAccountEventList}" /> --> <!-- <f:event type="preRenderView" listener="#{foodWaveView.initFoodwaveAccountEventList}" /> -->
</f:metadata> </f:metadata>
<ui:define name="title"> <ui:define name="title">
<h1>#{foodWaveView.foodWave.name}</h1> <h1>#{foodWaveView.selectedFoodWave.name}</h1>
</ui:define> </ui:define>
<ui:define name="content"> <ui:define name="content">
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
</composite:interface> </composite:interface>
<composite:implementation> <composite:implementation>
<!-- <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:outputScript library="primefaces" name="jquery/jquery.js" />
...@@ -84,14 +82,14 @@ ...@@ -84,14 +82,14 @@
</p:column> </p:column>
</p:dataTable> </p:dataTable>
<div>
<h:commandButton action="#{cc.attrs.selectaction}" value="#{i18n[cc.attrs.commitValue]}" > <h:outputLabel for="total" value="#{i18n['foodshop.total']}: "/>
<h:outputText id="total" value="#{foodWaveFoodView.totalPrice}" >
</h:commandButton> <f:convertNumber minFractionDigits="0" maxFractionDigits="2" />
</h:outputText>
<h:commandButton action="#{foodWaveFoodView.buyFromInternet}" value="#{i18n['foodshop.buyFromInternet']}" > </div>
<h:commandButton action="#{cc.attrs.selectaction}" value="#{i18n[cc.attrs.commitValue]}" />
</h:commandButton> <h:commandButton action="#{foodWaveFoodView.buyFromInternet}" value="#{i18n['foodshop.buyFromInternet']}" />
</h:form> </h:form>
......
package fi.insomnia.bortal; package fi.insomnia.bortal;
import java.io.IOException; import java.io.IOException;
import java.util.LinkedList; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.Queue;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
...@@ -33,6 +31,7 @@ public class HostnameFilter implements Filter { ...@@ -33,6 +31,7 @@ public class HostnameFilter implements Filter {
@EJB @EJB
private SessionMgmtBeanLocal sessionmgmt; private SessionMgmtBeanLocal sessionmgmt;
private static final String HTTP_TRAIL_NAME = "lanbortal_http_trail";
/** /**
* Default constructor. * Default constructor.
...@@ -48,11 +47,11 @@ public class HostnameFilter implements Filter { ...@@ -48,11 +47,11 @@ public class HostnameFilter implements Filter {
public void destroy() { public void destroy() {
// Nothing... // Nothing...
} }
@SessionScoped
Queue<String> trail = new LinkedList<String>();
/** /**
* @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
*/ */
@SuppressWarnings("unchecked")
@Override @Override
public void doFilter(ServletRequest request, ServletResponse response, public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException { FilterChain chain) throws IOException, ServletException {
...@@ -117,12 +116,22 @@ public class HostnameFilter implements Filter { ...@@ -117,12 +116,22 @@ public class HostnameFilter implements Filter {
{ {
sessionmgmt.updateSessionUser(httpRequest.getSession().getId(), httpRequest.getUserPrincipal().getName()); sessionmgmt.updateSessionUser(httpRequest.getSession().getId(), httpRequest.getUserPrincipal().getName());
} }
while (trail.size() >= 10) {
trail.remove(); Object trailO = httpRequest.getSession().getAttribute(HTTP_TRAIL_NAME);
ConcurrentLinkedQueue<Object> trail = null;
if (trailO != null && trailO instanceof ConcurrentLinkedQueue)
{
trail = (ConcurrentLinkedQueue<Object>) trailO;
} else {
trail = new ConcurrentLinkedQueue<Object>();
httpRequest.getSession().setAttribute(HTTP_TRAIL_NAME, trail);
}
for (int remove = trail.size() - 10; remove > 0; --remove) {
Object removed = trail.poll();
logger.debug("Removed {} from http trail", removed);
} }
if (!httpRequest.getRequestURI().matches(".*(resource).*")) { if (!httpRequest.getRequestURI().matches(".*(resource).*")) {
trail.add(httpRequest.getRequestURI()); trail.add(httpRequest.getRequestURI());
httpRequest.getSession().setAttribute("trail", trail);
} }
} }
......
...@@ -210,13 +210,19 @@ foodWave.time = Time ...@@ -210,13 +210,19 @@ foodWave.time = Time
foodWave.totalReserved = Total foodWave.totalReserved = Total
foodWave.unconfirmedOrders = Unconfirmed foodWave.unconfirmedOrders = Unconfirmed
foodadmin.editTemplate = Edit
foodshop.buyAndPay = Buy and Pay
foodshop.buyFromCounter = Pay at info foodshop.buyFromCounter = Pay at info
foodshop.buyFromInternet = Pay at Internet foodshop.buyFromInternet = Pay at Internet
foodshop.total = Total
foodwave.orders = Foodwave Orders foodwave.orders = Foodwave Orders
foodwave.template.basicinfo = Template Information foodwave.template.basicinfo = Template Information
foodwave.template.description = Description
foodwave.template.edit.title = Foodwave Template Editor foodwave.template.edit.title = Foodwave Template Editor
foodwave.template.list.title = Foodwave Templates foodwave.template.list.title = Foodwave Templates
foodwave.template.name = Name
foodwave.template.selectproducts = Products foodwave.template.selectproducts = Products
foodwaveTemplate.name = Name foodwaveTemplate.name = Name
...@@ -225,8 +231,11 @@ foodwavetemplate.actions = Actions ...@@ -225,8 +231,11 @@ foodwavetemplate.actions = Actions
foodwavetemplate.addproduct = Add foodwavetemplate.addproduct = Add
foodwavetemplate.basicinfo = Template foodwavetemplate.basicinfo = Template
foodwavetemplate.createFoodwave = Create Foodwave foodwavetemplate.createFoodwave = Create Foodwave
foodwavetemplate.createwave = Create foodwave
foodwavetemplate.description = Description foodwavetemplate.description = Description
foodwavetemplate.edit = Edit foodwave template
foodwavetemplate.editRow = Edit foodwavetemplate.editRow = Edit
foodwavetemplate.maxfoods = Maximum orders
foodwavetemplate.name = Name foodwavetemplate.name = Name
foodwavetemplate.price = Price foodwavetemplate.price = Price
foodwavetemplate.productdescription = Description foodwavetemplate.productdescription = Description
...@@ -235,6 +244,8 @@ foodwavetemplate.removeFromList = Remove ...@@ -235,6 +244,8 @@ foodwavetemplate.removeFromList = Remove
foodwavetemplate.save = Ok foodwavetemplate.save = Ok
foodwavetemplate.savetemplate = Submit foodwavetemplate.savetemplate = Submit
foodwavetemplate.selectproducts = Products foodwavetemplate.selectproducts = Products
foodwavetemplate.startTime = Foodwave time
foodwavetemplate.waveName = Wave name
game.gamepoints = Game points game.gamepoints = Game points
...@@ -623,6 +634,9 @@ submenu.auth.sendResetMail = Password reset ...@@ -623,6 +634,9 @@ submenu.auth.sendResetMail = Password reset
submenu.bill.billSummary = Bill summary submenu.bill.billSummary = Bill summary
submenu.bill.list = My bills submenu.bill.list = My bills
submenu.bill.listAll = All bills submenu.bill.listAll = All bills
submenu.foodadmin.createTemplate = Create foodwave template
submenu.foodadmin.listTemplates = List foodwave templates
submenu.foodmanager.listFoodwaves = List active foodwaves
submenu.foodwave.list = Open foodwaves submenu.foodwave.list = Open foodwaves
submenu.foodwave.listTemplates = Food provides submenu.foodwave.listTemplates = Food provides
submenu.index = Frontpage submenu.index = Frontpage
......
...@@ -208,13 +208,19 @@ foodWave.time = Aika ...@@ -208,13 +208,19 @@ foodWave.time = Aika
foodWave.totalReserved = Yhteens\u00E4 foodWave.totalReserved = Yhteens\u00E4
foodWave.unconfirmedOrders = Vahvistamattomia foodWave.unconfirmedOrders = Vahvistamattomia
foodadmin.editTemplate = Muokkaa
foodshop.buyAndPay = Varaa ja maksa
foodshop.buyFromCounter = Maksa infossa foodshop.buyFromCounter = Maksa infossa
foodshop.buyFromInternet = Maksa Internetiss\u00E4 foodshop.buyFromInternet = Maksa Internetiss\u00E4
foodshop.total = Yhteens\u00E4
foodwave.orders = Maksetut Tilaukset foodwave.orders = Maksetut Tilaukset
foodwave.template.basicinfo = Template Infot foodwave.template.basicinfo = Template Infot
foodwave.template.description = Kuvaus
foodwave.template.edit.title = Foodwave Template Editori foodwave.template.edit.title = Foodwave Template Editori
foodwave.template.list.title = Ruokatilaus Templatet foodwave.template.list.title = Ruokatilaus Templatet
foodwave.template.name = Nimi
foodwave.template.selectproducts = Tuotteet foodwave.template.selectproducts = Tuotteet
foodwaveTemplate.name = Nimi foodwaveTemplate.name = Nimi
...@@ -223,16 +229,21 @@ foodwavetemplate.actions = Toimet ...@@ -223,16 +229,21 @@ foodwavetemplate.actions = Toimet
foodwavetemplate.addproduct = Lis\u00E4\u00E4 foodwavetemplate.addproduct = Lis\u00E4\u00E4
foodwavetemplate.basicinfo = Templeitti foodwavetemplate.basicinfo = Templeitti
foodwavetemplate.createFoodwave = Luo ruokatilaus foodwavetemplate.createFoodwave = Luo ruokatilaus
foodwavetemplate.createwave = Luo tilauspohja
foodwavetemplate.description = Kuvaus foodwavetemplate.description = Kuvaus
foodwavetemplate.edit = Muokkaa tilauspohjaa
foodwavetemplate.editRow = Muokkaa foodwavetemplate.editRow = Muokkaa
foodwavetemplate.maxfoods = Tilausten enimm\u00E4ism\u00E4\u00E4r\u00E4
foodwavetemplate.name = Nimi foodwavetemplate.name = Nimi
foodwavetemplate.price = Hinta foodwavetemplate.price = Hinta
foodwavetemplate.productdescription = Kuvaus foodwavetemplate.productdescription = Kuvaus
foodwavetemplate.productname = Nimi\r\n foodwavetemplate.productname = Nimi\n
foodwavetemplate.removeFromList = Poista foodwavetemplate.removeFromList = Poista
foodwavetemplate.save = Ok foodwavetemplate.save = Ok
foodwavetemplate.savetemplate = Tallenna foodwavetemplate.savetemplate = Tallenna
foodwavetemplate.selectproducts = Tuotteet foodwavetemplate.selectproducts = Tuotteet
foodwavetemplate.startTime = Tilausaika
foodwavetemplate.waveName = Tilauksen nimi
game.gamepoints = Insomnia Game pisteet: game.gamepoints = Insomnia Game pisteet:
...@@ -603,6 +614,9 @@ submenu.auth.sendResetMail = Salasanan palautus ...@@ -603,6 +614,9 @@ submenu.auth.sendResetMail = Salasanan palautus
submenu.bill.billSummary = Laskujen yhteenveto submenu.bill.billSummary = Laskujen yhteenveto
submenu.bill.list = N\u00E4yt\u00E4 omat laskut submenu.bill.list = N\u00E4yt\u00E4 omat laskut
submenu.bill.listAll = Kaikki laskut submenu.bill.listAll = Kaikki laskut
submenu.foodadmin.createTemplate = Luo tilauspohja
submenu.foodadmin.listTemplates = Muokkaa tilauspohjia
submenu.foodmanager.listFoodwaves = Aktiiviset ruokatilaukset
submenu.foodwave.list = Avoimet tilaukset submenu.foodwave.list = Avoimet tilaukset
submenu.index = Etusivu submenu.index = Etusivu
submenu.map.create = Uusi kartta submenu.map.create = Uusi kartta
......
...@@ -15,7 +15,8 @@ import javax.faces.model.ListDataModel; ...@@ -15,7 +15,8 @@ import javax.faces.model.ListDataModel;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import com.sun.xml.rpc.processor.schema.UnimplementedFeatureException; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.AccountEventBeanLocal; import fi.insomnia.bortal.beans.AccountEventBeanLocal;
import fi.insomnia.bortal.beans.BillBeanLocal; import fi.insomnia.bortal.beans.BillBeanLocal;
...@@ -68,9 +69,12 @@ public class FoodWaveView extends GenericCDIView { ...@@ -68,9 +69,12 @@ public class FoodWaveView extends GenericCDIView {
private Integer foodWaveId; private Integer foodWaveId;
private ListDataModel<AccountEvent> accountEventLines; private ListDataModel<AccountEvent> accountEventLines;
private List<FoodWave> foodWaves; private List<FoodWave> foodWaves;
private static final Logger logger = LoggerFactory.getLogger(FoodWaveView.class);
public List<Product> getProducts() { public List<Product> getProducts() {
return productbeanlocal.getProducts(); List<Product> ret = productbeanlocal.getProducts();
ret.removeAll(template.getProducts());
return ret;
} }
public void onEdit() { public void onEdit() {
...@@ -149,15 +153,15 @@ public class FoodWaveView extends GenericCDIView { ...@@ -149,15 +153,15 @@ public class FoodWaveView extends GenericCDIView {
System.out.println("..asdfasdf"); System.out.println("..asdfasdf");
HashMap<Product, FoodwaveProductSummary> pmap = new HashMap<Product, FoodwaveProductSummary>(); HashMap<Product, FoodwaveProductSummary> pmap = new HashMap<Product, FoodwaveProductSummary>();
for(AccountEvent ae : getSelectedFoodWave().getAccountEvents()) { for (AccountEvent ae : getSelectedFoodWave().getAccountEvents()) {
if(!pmap.containsKey(ae.getProduct())) { if (!pmap.containsKey(ae.getProduct())) {
pmap.put(ae.getProduct(), new FoodwaveProductSummary(ae.getProduct(), new BigDecimal(0), new BigDecimal(0))); pmap.put(ae.getProduct(), new FoodwaveProductSummary(ae.getProduct(), new BigDecimal(0), new BigDecimal(0)));
} }
System.out.println(".."); System.out.println("..");
pmap.get(ae.getProduct()).add(ae); pmap.get(ae.getProduct()).add(ae);
} }
System.out.println("::"+pmap.values().size()); System.out.println("::" + pmap.values().size());
return new ArrayList<FoodwaveProductSummary>(pmap.values()); return new ArrayList<FoodwaveProductSummary>(pmap.values());
} }
...@@ -222,9 +226,9 @@ public class FoodWaveView extends GenericCDIView { ...@@ -222,9 +226,9 @@ public class FoodWaveView extends GenericCDIView {
public void initFoodWaveOrderList() { public void initFoodWaveOrderList() {
if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES) && selectedFoodWave == null) { if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES) && selectedFoodWave == null) {
System.out.println("Testiä");
selectedFoodWave = foodWaveBean.findFoodwave(foodWaveId);
selectedFoodWave = foodWaveBean.findFoodwave(foodWaveId);
logger.debug("Got foodwave {} with id {}", selectedFoodWave, foodWaveId);
this.setAccountEventLines(new ListDataModel<AccountEvent>(selectedFoodWave.getAccountEvents())); this.setAccountEventLines(new ListDataModel<AccountEvent>(selectedFoodWave.getAccountEvents()));
List<BillLine> tmpLines = new ArrayList<BillLine>(); List<BillLine> tmpLines = new ArrayList<BillLine>();
...@@ -265,7 +269,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -265,7 +269,7 @@ public class FoodWaveView extends GenericCDIView {
} }
public FoodWave getSelectedFoodWave() { public FoodWave getSelectedFoodWave() {
//System.out.println("APOFKASFASFASFASFASFASFASFASFASFKJIOJIO"); // System.out.println("APOFKASFASFASFASFASFASFASFASFASFKJIOJIO");
return selectedFoodWave; return selectedFoodWave;
} }
......
...@@ -72,7 +72,6 @@ public class ProductShopView extends GenericCDIView { ...@@ -72,7 +72,6 @@ public class ProductShopView extends GenericCDIView {
private boolean blip = false; private boolean blip = false;
private ListDataModel<ProductShopItem> boughtItems; private ListDataModel<ProductShopItem> boughtItems;
@EJB
public void initBillView() { public void initBillView() {
if (requirePermissions(ShopPermission.LIST_USERPRODUCTS) if (requirePermissions(ShopPermission.LIST_USERPRODUCTS)
&& shoppingcart == null) { && shoppingcart == null) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!