Commit 17e0fb65 by Tuomas Riihimäki

Merge branch 'moarmoaretikettia' into 'master'

Moarmoaretikettia

Toivon että tässä on ny uusimmat, vähän spurdospardocommittia :P

See merge request !157
2 parents e4140e2a 5e903338
Showing with 978 additions and 70 deletions
......@@ -39,7 +39,11 @@ public interface BarcodeBeanLocal {
public String getPlaceTextCode(Place place);
public Place getPlaceFromTextCode(String hexcode);
public String checkVrAuthCode(String code);
public String getUserTextCode(EventUser user);
public EventUser getUserFromTextCode(String textcode);
public String getUserLongTextCode(EventUser user);
public EventUser getUserFromLongTextCode(String textcode);
public Product getProduct(String barcode);
public Place getPlaceFromBarcode(String barcode);
......
......@@ -54,5 +54,4 @@ public interface PlaceGroupBeanLocal {
void markGrouMembershipNotEntered(GroupMembership row);
List<GroupMembership> findMembershipPrintlistForUser(EventUser user);
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moya.beans;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.GroupMembership;
import fi.codecrew.moya.model.PlaceGroup;
import javax.ejb.Local;
import java.io.OutputStream;
import java.util.List;
@Local
public interface TicketBeanLocal {
List<GroupMembership> findMembershipPrintlistForUser(EventUser user);
void sendTicketEmail(EventUser user, String url);
}
......@@ -53,7 +53,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
private static final String EVENTUSER_TEXTCODEPREFIX = "12";
private static final String TEXTCODE_CHARACTER_MAP = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
private static final int TEXTCODE_ROTATE_COUNT = 128;
private static final int TEXTCODE_ROTATE_COUNT = 500;
//private static final String NEXT_PREFIX = "265"; //2A
......@@ -97,9 +97,47 @@ public class BarcodeBean implements BarcodeBeanLocal {
return BarcodeUtils.getBarcodeEAN(barcode);
}
@Override
public String getUserLongTextCode(EventUser user) {
return getUserTextCode(user,38,16);
}
@Override
public EventUser getUserFromLongTextCode(String textcode) {
return getUserFromTextCode(textcode,38,16);
}
@Override
public String getUserTextCode(EventUser user) {
return getUserTextCode(user, 12, 5);
}
@Override
public EventUser getUserFromTextCode(String textcode) {
return getUserFromTextCode(textcode,12,5);
}
private String getUserTextCode(EventUser user, int lenght, int bytecount) {
int barcodeLenght = 12;
if(lenght < barcodeLenght)
barcodeLenght = lenght;
// barcode is still only 12 marks long
String barcode = generateBarcodeNumbers(EVENTUSER_TEXTCODEPREFIX, user.getId(), barcodeLenght);
// add some random -stuff to start of string
for (int i = lenght - barcode.length(); i > 0; --i) {
barcode = ((int) (Math.random() * 10.0)) + barcode;
}
logger.debug(barcode);
String barcode = generateBarcodeNumbers(EVENTUSER_TEXTCODEPREFIX, user.getId(), 12);
BigInteger intCode;
try {
......@@ -109,11 +147,10 @@ public class BarcodeBean implements BarcodeBeanLocal {
return "GenFail";
}
String textCode = generateTextcode(intCode, 5);
String textCode = generateTextcode(intCode, bytecount);
BigInteger checkCode = textcodeToNumber(textCode, 5);
BigInteger checkCode = textcodeToNumber(textCode, bytecount);
logger.debug("CheckCode {} : Original {}", checkCode, intCode);
if(checkCode.compareTo(intCode) != 0) {
logger.error("CheckCode {} : Original {}", checkCode, intCode);
......@@ -125,6 +162,37 @@ public class BarcodeBean implements BarcodeBeanLocal {
return textCode;
}
private EventUser getUserFromTextCode(String textcode, int lenght, int bytecount) {
BigInteger numbercode = textcodeToNumber(textcode, bytecount);
String barcode = numbercode.toString();
// remove random prefix
int barcodeLenght = 12;
if(lenght < barcodeLenght)
barcodeLenght = lenght;
// remove some random -stuff to start of string
for (int i = lenght - barcodeLenght; i > 0; --i) {
barcode = barcode.substring(1);
}
try {
if (barcode.startsWith(EVENTUSER_TEXTCODEPREFIX)) {
int id = Integer.parseInt(barcode.substring(PLACE_TEXTCODEPREFIX.length(), barcode.length()));
EventUser user = userBean.findByEventUserId(id);
return user;
}
} catch (NumberFormatException x) {
}
return null;
}
public String getPlaceTextCode(Place place) {
String barcode = generateBarcodeNumbers(PLACE_TEXTCODEPREFIX, place.getId(), 8);
......@@ -140,8 +208,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
String textCode = generateTextcode(intCode, 3);
BigInteger checkCode = textcodeToNumber(textCode, 3);
logger.debug("CheckCode {} : Original {}", checkCode, intCode);
if(checkCode.compareTo(intCode) != 0) {
logger.error("CheckCode {} : Original {}", checkCode, intCode);
......
......@@ -154,6 +154,7 @@ public class MenuBean implements MenuBeanLocal {
userPlaces.addPage(menuitemfacade.findOrCreate("/place/viewplacemap"), MapPermission.VIEW);
userPlaces.addPage(menuitemfacade.findOrCreate("/place/myEtickets"), MapPermission.BUY_PLACES).setVisible(false);
userPlaces.addPage(menuitemfacade.findOrCreate("/place/edit"), MapPermission.MANAGE_OTHERS).setVisible(false);
userPlaces.addPage(menuitemfacade.findOrCreate("/place/eticketStandalone"), UserPermission.ANYUSER).setVisible(false);
MenuNavigation usercompetitions = usermenu.addPage(null, null);
usercompetitions.setKey("topnavi.competitions");
......
......@@ -316,32 +316,5 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
}
@Override
public List<GroupMembership> findMembershipPrintlistForUser(EventUser user) {
// TODO: get from placefacade. Sometimes it's easier to think loops then facadequeries
boolean printOnlyOwn = eventbean.getPropertyBoolean(LanEventPropertyKey.PLACECODE_PRINT_ONLY_OWN);
List<GroupMembership> gmems = gmemfacade.findMemberOrCreator(user);
List<GroupMembership> ret = new ArrayList<>();
for(GroupMembership gm : gmems) {
if(gm.getPlaceReservation() != null) {
// places with no user belongs to creator
if(gm.getUser() == null || !printOnlyOwn) {
ret.add(gm);
} else if(user.equals(gm.getUser())) {
ret.add(gm);
}
}
}
return ret;
}
}
......@@ -74,7 +74,7 @@ public class StatisticsBean implements StatisticsBeanLocal {
public Map<Long, Long> getHourlyIncomingStatistics(long startingFromMillis, int hourCount) {
List<GroupMembership> groupMemberships = groupMembershipFacade.findAllEnteredBetween(startingFromMillis, (startingFromMillis + ((long) hourCount)*60l*60l*1000l));
HashMap<Long, Long> retMap = new HashMap<Long, Long>();
HashMap<Long, Long> retMap = new HashMap<>();
long currentTimestamp = startingFromMillis;
long hour = (60l*60l*1000l);
......
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moya.beans;
import com.pdfjet.*;
import fi.codecrew.moya.enums.apps.MapPermission;
import fi.codecrew.moya.enums.apps.SpecialPermission;
import fi.codecrew.moya.facade.EventUserFacade;
import fi.codecrew.moya.facade.GroupMembershipFacade;
import fi.codecrew.moya.facade.PlaceGroupFacade;
import fi.codecrew.moya.model.*;
import fi.codecrew.moya.util.MailMessage;
import fi.codecrew.moya.utilities.BarcodeUtils;
import fi.codecrew.moya.utilities.moyamessage.MoyaEventType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.RolesAllowed;
import javax.ejb.EJB;
import javax.ejb.EJBAccessException;
import javax.ejb.Stateless;
import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
/**
* Session Bean implementation class PlaceGroupBean
*/
@Stateless
@DeclareRoles({ SpecialPermission.S_USER, MapPermission.S_BUY_PLACES, MapPermission.S_MANAGE_MAPS })
public class TicketBean implements TicketBeanLocal {
private static final Logger logger = LoggerFactory.getLogger(TicketBean.class);
private static final int YSTART = 30;
@EJB
private EventBeanLocal eventbean;
@EJB
private BarcodeBeanLocal barcodeBean;
@EJB
private GroupMembershipFacade gmemfacade;
@EJB
private LoggingBeanLocal loggingbean;
@EJB
private PermissionBeanLocal permbean;
@EJB
private PlaceGroupFacade pgfacade;
@EJB
private EventUserFacade eventuserfacade;
@EJB
private UtilBean utilBean;
/**
* Default constructor.
*/
public TicketBean() {
// TODO Auto-generated constructor stub
}
@Override
public List<GroupMembership> findMembershipPrintlistForUser(EventUser user) {
// TODO: get from placefacade. Sometimes it's easier to think loops then facadequeries
boolean printOnlyOwn = eventbean.getPropertyBoolean(LanEventPropertyKey.PLACECODE_PRINT_ONLY_OWN);
List<GroupMembership> gmems = gmemfacade.findMemberOrCreator(user);
List<GroupMembership> ret = new ArrayList<>();
for(GroupMembership gm : gmems) {
if(gm.getPlaceReservation() != null) {
// places with no user belongs to creator
if(gm.getUser() == null || !printOnlyOwn) {
ret.add(gm);
} else if(user.equals(gm.getUser())) {
ret.add(gm);
}
}
}
return ret;
}
@Override
public void sendTicketEmail(EventUser user , String url) {
String token = barcodeBean.getUserLongTextCode(user);
MailMessage msg = new MailMessage();
msg.setSubject(eventbean.getPropertyString(LanEventPropertyKey.ETICKETMAIL_SUBJECT));
String formatUrl = MessageFormat.format(url, token);
logger.info("Sending eticket url {}", formatUrl);
msg.setMessage(MessageFormat.format(eventbean.getPropertyString(LanEventPropertyKey.ETICKETMAIL_CONTENT), formatUrl, user.getUser().getWholeName()));
msg.setToAddress(user.getEmail());
utilBean.sendMail(msg);
}
}
......@@ -80,6 +80,7 @@ public class UtilBean implements UtilBeanLocal {
@Override
public boolean sendMail(MailMessage message) {
logger.info("Sending mail message {} ", message);
if (message.getFromAddress() == null || message.getFromAddress().isEmpty()) {
message.setFromAddress(eventbean.getPropertyString(LanEventPropertyKey.PORTAL_EMAIL_ADDRESS));
......
......@@ -44,6 +44,8 @@ public enum LanEventPropertyKey {
TEMPLATE_PROPERTY5(Type.TEXT, null),
INVITE_ONLY_EVENT(Type.BOOL, null),
USE_ETICKET(Type.BOOL, null),
ETICKETMAIL_SUBJECT(Type.TEXT, "Your etickets to Moya Online Youth Accumulator"),
ETICKETMAIL_CONTENT(Type.TEXT, "Hello {1},\n\nYou can find your etickets to an event from: {0}"),
MAP_QUEUE(Type.BOOL, null),
;
......
<!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:products="http://java.sun.com/jsf/composite/cditools/products"
xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">
<h:body>
<ui:composition template="#{sessionHandler.fullscreen}">
<f:metadata>
<f:viewParam name="t" value="#{standaloneEticketView.token}" />
<f:event type="preRenderView" listener="#{standaloneEticketView.initView}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['etickets.title']}</h1>
</ui:define>
<ui:define name="content">
<h:form id="etickets">
<br /><br />
<p:commandButton value="#{i18n['print']}" type="button" icon="ui-icon-print" style="display:block;margin-bottom: 20px">
<p:printer target="eticketpanel"/>
</p:commandButton>
<p:outputPanel id="eticketpanel">
<p:fieldset legend="#{i18n['etickets.eticketcode']}" style="width: 250px; ">
<p:outputPanel style="text-align: center;">
<p:barcode id="userqrcode" value="#{standaloneEticketView.userTextCode}" type="qr" width="200" height="200"/><br />
<p:outputLabel for="userqrcode" value="#{standaloneEticketView.userTextCode}"/>
</p:outputPanel>
</p:fieldset>
<br /><br />
<p:fieldset legend="#{i18n['etickets.placeinfo']}">
<p:dataTable value="#{standaloneEticketView.groupMemberships}" var="member" id="placestable">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['etickets.place']}"/>
</f:facet>
<h:outputText value="#{member.placeReservation.name}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['etickets.product']}"/>
</f:facet>
<h:outputText value="#{member.placeReservation.product.name}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['etickets.user']}"/>
</f:facet>
<h:outputText rendered="#{!empty member.user}" value="#{member.user.wholeName} (#{member.user.nick})"/>
<h:outputText rendered="#{empty member.user}" value="#{member.placeGroup.creator.firstnames} #{member.placeGroup.creator.lastname} (#{member.placeGroup.creator.nick})" />
</p:column>
</p:dataTable>
</p:fieldset>
<br /><br />
<p:outputPanel id="mapPanel">
<h2>#{i18n['etickets.placemap']}</h2>
<p:commandButton rendered="#{!standaloneEticketView.mapVisible}" value="#{i18n['etickets.showMap']}" actionListener="#{standaloneEticketView.showMap}" update="mapPanel" />
<p:graphicImage id="mapImage" rendered="#{standaloneEticketView.mapVisible}" url="/PlaceMap?mapid=#{mapView.activeMap.id}&amp;token=#{standaloneEticketView.token}" styleClass="printImage"/>
</p:outputPanel>
</p:outputPanel>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
......@@ -10,7 +10,7 @@
</f:metadata>
<ui:define rendered="#{lectureUserView.lectureGroupsVisible}" name="title">
<ui:define name="title">
<h1>#{i18n['etickets.title']}</h1>
</ui:define>
......@@ -18,12 +18,12 @@
<h:form id="etickets">
<br /><br />
<p:commandButton value="Print" type="button" icon="ui-icon-print" style="display:block;margin-bottom: 20px">
<br /><br />
<p:commandButton value="#{i18n['print']}" type="button" icon="ui-icon-print" style="display:block;margin-bottom: 20px">
<p:printer target="eticketpanel"/>
</p:commandButton>&lt;--Tarvitaanko?<br/>
</p:commandButton>
<p:commandButton icon="ui-icon-mail-closed" value="Send as email (TODO)"/><br/><br/><br/>
<p:commandButton update="messages" icon="ui-icon-mail-closed" value="#{i18n['etickets.sendAsMail']}" actionListener="#{eticketView.sendAsMail}" /><br/><br/><br/>
<p:outputPanel id="eticketpanel">
......@@ -64,9 +64,9 @@
</p:fieldset>
<br /><br />
<p:fieldset legend="#{i18n['etickets.placemap']}" style="#{eticketView.mapFieldsetStyle}">
<p:graphicImage url="/PlaceMap?mapid=#{mapView.activeMap.id}&amp;userid=#{userView.selectedUser.user.id}"/>
</p:fieldset>
<h2>#{i18n['etickets.placemap']}</h2>
<p:graphicImage url="/PlaceMap?mapid=#{mapView.activeMap.id}&amp;userid=#{userView.selectedUser.user.id}" styleClass="printImage"/>
</p:outputPanel>
</h:form>
......
......@@ -27,8 +27,6 @@ xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
<h:panelGroup id="reader_autopoll">
<p:poll rendered="#{readerView.pollingMode}" interval="2" listener="#{cc.attrs.selectaction}" onerror="location.reload();" />
</h:panelGroup>
readerid:
#{readerNameContainer.readerId}
<p:dataTable rendered="#{empty readerNameContainer.readerId}" border="1" id="reader" value="#{readerListDataView.readers}" var="rr">
<p:column>
......@@ -50,9 +48,13 @@ readerid:
<p:outputLabel value="#{i18n['reader.autopoll']}" />&nbsp;
<p:selectBooleanButton offLabel="#{i18n['off']}" onLabel="#{i18n['on']}" value="#{readerView.pollingMode}" immediate="true">
<p:inputSwitch offLabel="#{i18n['off']}" onLabel="#{i18n['on']}" value="#{readerView.pollingMode}" immediate="true">
<p:ajax update="reader_autopoll,readerevents" />
</p:selectBooleanButton>
</p:inputSwitch>
<p:commandLink actionListener="#{readerView.changeReader}" value="#{i18n['incomingflow.changereader']}" update="@all" />
<h:panelGroup id="readerevents">
<reader:readerevents rendered="#{!empty readerNameContainer.readerId and !readerView.pollingMode}" showAssociateToUser="#{cc.attrs.showAssociateToUser}" selectvalue="#{cc.attrs.selectvalue}" selectaction="#{cc.attrs.selectaction}" linkvalue="#{cc.attrs.linkvalue}" linkoutcome="#{cc.attrs.linkoutcome}" />
......
@media print {
header,#menu,.flex1,#header_left,#header_center,#header_right,nav,#menu,.languageSelector,#leftpanel, #rightpanel, #leftpanel, #rightpanel, #toppanel
{
display: none;
}
#main {
background: none;
border: none;
}
.no_print {
display: none;
}
.printImage {
max-width: 20cm;
}
}
\ No newline at end of file
/* This is file for styling (colors and font-sizes) */
.ui-widget {
font-size: 95% !important;
}
.bgColor1.ui-layout-unit {
}
.bgColor1 .ui-layout-unit-content {
background-image: none;
}
.bgColor1 .ui-layout-unit-header {
background-image: none;
}
.missing_i18n {
color: red;
-webkit-animation-name: blinker;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-moz-animation-name: blinker;
-moz-animation-duration: 1s;
-moz-animation-timing-function: linear;
-moz-animation-iteration-count: infinite;
animation-name: blinker;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
@-moz-keyframes blinker {
0% { opacity: 1.0; }
50% { opacity: 0.0; }
100% { opacity: 1.0; }
}
@-webkit-keyframes blinker {
0% { opacity: 1.0; }
50% { opacity: 0.0; }
100% { opacity: 1.0; }
}
@keyframes blinker {
0% { opacity: 1.0; }
50% { opacity: 0.0; }
100% { opacity: 1.0; }
}
/* Structual stuff, like sizes, margins etc.*/
.bgColor1.ui-layout-unit {
margin: 0px;
padding: 0px;
}
.bgColor1 .ui-layout-unit-content {
margin: 0px;
padding: 0px;
}
.bgColor1 .ui-layout-unit-header {
margin: 0px;
padding: 0px;
}
#header_right {
text-align: right;
}
#header_box {
display: flex;
display: -ms-flexbox;
display: -webkit-flex;
}
#mainlayoutpanel {
margin: 10px;
padding: 10px;
}
#header_center {
position: relative;
text-align: right;
-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-flex: 1; /* OLD - Firefox 19- */
width: 20%; /* For old syntax, otherwise collapses. */
-webkit-flex: 1; /* Chrome */
-ms-flex: 1; /* IE 10 */
flex: 1; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
\ No newline at end of file
#edit { float: left; width:100%; border-bottom: 1px solid black; }
#usertabnav { font-size: 90%; }
ul#usertabnav { float:left; width: 100%; border:1px solid rgba(200,200,200,0); background:rgba(200,200,200,0); border-radius: 16px 16px 0 0; }
ul#usertabnav li {display:inline; list-style:none; }
ul#usertabnav li a {display:block; line-height: 1.7em; float:left; padding:2px 5px 2px 5px; color:rgb(125,125,125); text-decoration:none; font-size:120%; background-color:rgba(100,100,100,0.3); color: rgba(0,0,0,1); border-radius: 12px 12px 0 0; border: 1px solid rgba(0,0,0,0.1); border-bottom: none;}
ul#usertabnava:hover {text-decoration:none; color:rgb(50,50,50);}
ul#usertabnav li.active {font-weight: bold; background-color:rgba(250,250,250,0.4); color: rgba(0,0,0,1); border-radius: 12px 12px 0 0; border: 1px solid black; border-bottom: none }
#edit {
clear: both;
}
\ No newline at end of file
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
*/
;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)u[c[d]]=c[d]in k;return u.list&&(u.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),u}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:e=k.value!=l)),t[a[d]]=!!e;return t}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={svg:"http://www.w3.org/2000/svg"},s={},t={},u={},v=[],w=v.slice,x,y=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return J("flexWrap")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){return!!a.WebGLRenderingContext},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var L in s)C(s,L)&&(x=L.toLowerCase(),e[x]=s[L](),v.push((e[x]?"":"no-")+x));return e.input||K(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},D(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html class="no-js" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html" locale="#{sessionHandler.locale}">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><h:outputText value="#{layoutView.getHeader()}" /></title>
<meta name="description" content="Lippukauppa" />
<meta name="author" content="CodeCrew ry" />
<meta http-equiv="Content-Language" content="#{sessionHandler.locale}" />
<link rel="icon" href="#{request.contextPath}/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/primelayout/css/print.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/primelayout/css/skinning.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/primelayout/css/structual.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/custom_components.css" />
<ui:insert name="headerdata" />
<h:outputStylesheet>
.bgColor1 .ui-layout-unit-content {
background-color: #{layoutView.getLayoutProperty1('#68A3C2')};
}
.bgColor1 .ui-layout-unit-header {
background-color: #{layoutView.getLayoutProperty1('#68A3C2')};
}
</h:outputStylesheet>
</h:head>
<h:body>
<!-- Javascript-lokalisaatiolippupuljausta -->
<script type="text/javascript">
$(document)
.ready(
function() {
<ui:repeat value="#{localeSelectorView.availableLocales}" var="loc" varStatus="idx">
$(
".languageSelector .ui-button:eq(#{idx.index})")
.css(
"background",
"url('#{request.contextPath}/resources/icons/flags/#{loc.locale.language}.png') no-repeat")
.css("width", "16px").css("height",
"11px").css("padding", "0")
.css("margin-right", "5px").css(
"border-radius", "0")
</ui:repeat>
$(".languageSelector .ui-button-text").text("");
});
var apina = null;
</script>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<p:layout widgetVar="mainlayout" fullPage="true" id="mainlayoutpanel" >
<p:layoutUnit position="center">
<div class="container top">
<h:form id="selectLanguage">
<p:selectOneButton id="langselect" styleClass="languageSelector" value="#{sessionStore.locale}" immediate="true" converter="#{localeConverter}">
<f:selectItems value="#{localeSelectorView.availableLocales}" var="loc" itemValue="#{loc.locale}" itemLabel="#{loc.locale.displayName}" />
<p:ajax update="@all" event="change" />
</p:selectOneButton>
</h:form>
<h:link rendered="#{layoutView.manageContent}" styleClass="editorlink" value="#{i18n['layout.editTop']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}:top" />
</h:link>
</div>
<!-- TODO: tyyleistys tähän, toisaalta tarttis tulla vaan teksti -->
<ui:insert name="title" />
<p:menubar rendered="#{primeMenuView.hasSecondaryMenu}" model="#{primeMenuView.secondaryMenuModel}" />
<h:form id="messages">
<p:growl id="growl" showDetail="true" />
</h:form>
<ui:insert name="edittab" />
<ui:repeat var="cont1" value="#{menuView.getPagecontent('top')}">
<h:outputText value="#{cont1.content}" escape="false" />
</ui:repeat>
<ui:insert name="content" />
<ui:repeat var="cont1" value="#{menuView.getPagecontent('bottom')}">
<h:outputText value="#{cont1.content}" escape="false" />
</ui:repeat>
<h:link rendered="#{layoutView.manageContent}" styleClass="editorlink" value="#{i18n['layout.editBottom']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}:bottom" />
</h:link>
</p:layoutUnit>
</p:layout>
<h:form>
<p:confirmDialog global="true" showEffect="fade" hideEffect="explode">
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
</h:form>
<footer class="bgColor1"> </footer>
<script type="text/javascript">
PrimeFaces.locales['fi'] = {
closeText : 'Sulje',
prevText : 'Edellinen',
nextText : 'Seuraava',
currentText : 'Tänään',
monthNames : [ 'Tammikuu', 'Helmikuu', 'Maaliskuu', 'Huhtikuu',
'Toukokuu', 'Kesäkuu', 'Heinäkuu', 'Elokuu', 'Syyskuu',
'Lokakuu', 'Marraskuu', 'Joulukuu' ],
monthNamesShort : [ 'Tammikuu', 'Helmikuu', 'Maaliskuu',
'Huhtikuu', 'Toukokuu', 'Kesäkuu', 'Heinäkuu',
'Elokuu', 'Syyskuu', 'Lokakuu', 'Marraskuu', 'Joulukuu' ],
dayNames : [ 'Sunnuntai', 'Maanantai', 'Tiistain',
'Keskiviikko', 'Torstai', 'Perjantai', 'Lauantai' ],
dayNamesShort : [ 'Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La' ],
dayNamesMin : [ 'Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La' ],
weekHeader : 'vk',
firstDay : 1,
isRTL : false,
showMonthAfterYear : false,
yearSuffix : '',
month : 'Kuukausi',
week : 'Viikko',
day : 'Päivä',
allDayText : 'Koko päivä'
};
PrimeFaces.locales['und'] = {
closeText : 'Sulje',
prevText : 'Edellinen',
nextText : 'Seuraava',
currentText : 'Tänään',
monthNames : [ 'Tammikuu', 'Helmikuu', 'Maaliskuu', 'Huhtikuu',
'Toukokuu', 'Kesäkuu', 'Heinäkuu', 'Elokuu', 'Syyskuu',
'Lokakuu', 'Marraskuu', 'Joulukuu' ],
monthNamesShort : [ 'Tammikuu', 'Helmikuu', 'Maaliskuu',
'Huhtikuu', 'Toukokuu', 'Kesäkuu', 'Heinäkuu',
'Elokuu', 'Syyskuu', 'Lokakuu', 'Marraskuu', 'Joulukuu' ],
dayNames : [ 'Sunnuntai', 'Maanantai', 'Tiistain',
'Keskiviikko', 'Torstai', 'Perjantai', 'Lauantai' ],
dayNamesShort : [ 'Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La' ],
dayNamesMin : [ 'Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La' ],
weekHeader : 'vk',
firstDay : 1,
isRTL : false,
showMonthAfterYear : false,
yearSuffix : '',
month : 'Kuukausi',
week : 'Viikko',
day : 'Päivä',
allDayText : 'Koko päivä'
};
</script>
<c:if test="#{sessionHandler.isInDevelopmentMode()}">
<script type="text/javascript">
$('*:contains("???"):not(:has(*))').filter(
function() {
return (this.textContent || this.innerText)
.indexOf("???") === 0;
}).addClass("missing_i18n");
</script>
</c:if>
</h:body>
</f:view>
</html>
\ No newline at end of file
......@@ -11,4 +11,8 @@
.no_print {
display: none;
}
.printImage {
max-width: 20cm;
}
}
\ No newline at end of file
......@@ -108,8 +108,8 @@ public class SessionHandler {
}
public String getFullscreen() {
template = "blipview";
return template;
template = "fullprimelayout";
return getTemplate();
}
public String getInfoscreen() {
......
......@@ -46,6 +46,7 @@ import javax.servlet.http.HttpServletResponse;
import fi.codecrew.moya.beans.*;
import fi.codecrew.moya.model.User;
import org.primefaces.component.barcode.Barcode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -77,8 +78,13 @@ public class PlaceMapServlet extends HttpServlet {
@EJB
private UserBeanLocal userBean;
@EJB
private BarcodeBeanLocal barcodeBean;
private static final String PARAMETER_EVENT_MAP_ID = "mapid";
private static final String PARAMETER_USER_ID = "userid";
private static final String PARAMETER_TOKEN = "token";
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
......@@ -107,8 +113,10 @@ public class PlaceMapServlet extends HttpServlet {
Integer mapId = getIntegerParameter(request, PARAMETER_EVENT_MAP_ID);
Integer userId = getIntegerParameter(request, PARAMETER_USER_ID);
// Integer userId = getIntegerParameter(request,
// PARAMETER_CURRENT_USER_ID); Tämä saadaan beaneilta.
String userToken = request.getParameter(PARAMETER_TOKEN);
EventMap map = placeBean.findMap(mapId);
logger.debug("Mapid: {}", mapId);
......@@ -129,17 +137,21 @@ public class PlaceMapServlet extends HttpServlet {
type = splittype[splittype.length-1];
response.setContentType(map.getMimeType());
printPlaceMapToStream(ostream, type, map,userId);
printPlaceMapToStream(ostream, type, map,userId, userToken);
logger.debug("Flushing ostream");
ostream.flush();
}
} catch (EJBException e) {
logger.debug("Permission denied. Returning SC_FORBIDDEN!");
response.setContentType("text/html;charset=UTF-8");
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
ostream = response.getOutputStream();
ostream.print("Error 403 \nPermission denied! Please login before accessing resource");
// e.printStackTrace();
} finally {
if (ostream != null) {
ostream.close();
......@@ -147,13 +159,18 @@ public class PlaceMapServlet extends HttpServlet {
}
}
private void printPlaceMapToStream(OutputStream outputStream, String filetype, EventMap map, Integer userid) throws IOException
private void printPlaceMapToStream(OutputStream outputStream, String filetype, EventMap map, Integer userid, String userToken) throws IOException
{
if (!permbean.hasPermission(MapPermission.VIEW))
EventUser user = null;
if(userToken != null)
user = barcodeBean.getUserFromLongTextCode(userToken);
if (!permbean.hasPermission(MapPermission.VIEW) && user == null)
{
loggerbean.sendMessage(MoyaEventType.USER_INSUFFICIENT_PERMISSIONS, permbean.getCurrentUser(),
"User tried to print the placemap to stream without sufficient permissions");
loggerbean.sendMessage(MoyaEventType.USER_INSUFFICIENT_PERMISSIONS, permbean.getCurrentUser(), "User tried to print the placemap to stream without sufficient permissions");
throw new EJBAccessException("Not enough permissions to print placemap");
}
long begin = new Date().getTime();
......@@ -177,14 +194,20 @@ public class PlaceMapServlet extends HttpServlet {
if(userid != null && userid != 0) {
EventUser user = userBean.findByUserId(userid, false);
EventUser placesForUser = userBean.findByUserId(userid, false);
if(user != null) {
userplaces = placeBean.findPlacePrintlistForUser(user);
userplaces = placeBean.findPlacePrintlistForUser(placesForUser);
}
}
EventUser user = permbean.getCurrentUser();
if(user != null) {
userplaces = placeBean.findPlacePrintlistForUser(user);
}
if(user == null)
user = permbean.getCurrentUser();
// List<Place> selectedPlaces = placemapBean.findSelectedPlaces(map);
BufferedImage image = ImageIO.read(new ByteArrayInputStream(map.getMapData()));
......@@ -229,6 +252,7 @@ public class PlaceMapServlet extends HttpServlet {
return null;
}
// <editor-fold defaultstate="collapsed"
// desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
......
......@@ -18,10 +18,7 @@
*/
package fi.codecrew.moya.web.cdiview.eticket;
import fi.codecrew.moya.beans.BarcodeBeanLocal;
import fi.codecrew.moya.beans.PlaceBeanLocal;
import fi.codecrew.moya.beans.PlaceGroupBeanLocal;
import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.beans.*;
import fi.codecrew.moya.enums.apps.MapPermission;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.GroupMembership;
......@@ -30,11 +27,14 @@ import fi.codecrew.moya.model.PlaceGroup;
import fi.codecrew.moya.web.annotations.SelectedUser;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.shop.InviteView;
import fi.codecrew.moya.web.cdiview.user.UserView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.model.ListDataModel;
import javax.inject.Inject;
import javax.inject.Named;
......@@ -52,9 +52,10 @@ public class EticketView extends GenericCDIView {
// @Inject
// private UserView userview;
@Inject
@SelectedUser
private EventUser user;
private UserView userView;
@EJB
private BarcodeBeanLocal barcodeBean;
......@@ -68,6 +69,9 @@ public class EticketView extends GenericCDIView {
@EJB
PlaceBeanLocal placeBean;
@EJB
TicketBeanLocal ticketBean;
@Inject
private InviteView inviteView;
......@@ -83,12 +87,12 @@ public class EticketView extends GenericCDIView {
public String getUserTextCode() {
return barcodeBean.getUserTextCode(user);
return barcodeBean.getUserTextCode(userView.getSelectedUser());
}
public ListDataModel<GroupMembership> getGroupMemberships() {
memberlist = new ListDataModel<GroupMembership>(placegroupBean.findMembershipPrintlistForUser(user));
memberlist = new ListDataModel<GroupMembership>(ticketBean.findMembershipPrintlistForUser(userView.getSelectedUser()));
return memberlist;
}
......@@ -100,4 +104,55 @@ public class EticketView extends GenericCDIView {
return "width: " + (width+100) + "px;";
}
public void sendAsMail() {
ticketBean.sendTicketEmail(userView.getSelectedUser(), getTicketUrl());
}
public String getTicketUrl() {
ExternalContext extcontext = FacesContext.getCurrentInstance().getExternalContext();
StringBuilder path = new StringBuilder();
String servername = extcontext.getRequestServerName();
if (extcontext.getRequestServerPort() != 80) {
if (extcontext.getRequestServerPort() == 443) {
path.append("https://").append(servername.replace(":443", ""));
} else {
path.append("http://").append(servername);
path.append(":").append(extcontext.getRequestServerPort());
}
} else {
path.append("http://").append(servername);
}
path.append("/")
.append(FacesContext.getCurrentInstance().getExternalContext().getContextName())
.append("/place/eticketStandalone.jsf?t={0}");
return path.toString();
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moya.web.cdiview.eticket;
import fi.codecrew.moya.beans.*;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.GroupMembership;
import fi.codecrew.moya.model.Place;
import fi.codecrew.moya.model.PlaceGroup;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.shop.InviteView;
import fi.codecrew.moya.web.cdiview.user.UserView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.model.ListDataModel;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.HashMap;
import java.util.Map;
@Named
@ConversationScoped
public class StandaloneEticketView extends GenericCDIView {
private static final long serialVersionUID = -3934253910818396155L;
private static final Logger logger = LoggerFactory.getLogger(StandaloneEticketView.class);
// @Inject
// private UserView userview;
private String token;
private EventUser user;
@EJB
private BarcodeBeanLocal barcodeBean;
@EJB
private PlaceGroupBeanLocal placegroupBean;
@EJB
UserBeanLocal userBean;
@EJB
PlaceBeanLocal placeBean;
@EJB
TicketBeanLocal ticketBean;
@Inject
private InviteView inviteView;
private Place place;
private PlaceGroup group;
private transient ListDataModel<PlaceGroup> placegroups;
private transient ListDataModel<Place> placelist;
private transient ListDataModel<GroupMembership> memberlist;
private Map<Integer, String> inviteMails = new HashMap<>();
private boolean mapVisible = false;
public void initView() {
if(token == null)
throw new RuntimeException("todo");
user = barcodeBean.getUserFromLongTextCode(token);
if(user == null)
throw new RuntimeException("todo");
}
public String getUserTextCode() {
return barcodeBean.getUserTextCode(user);
}
public ListDataModel<GroupMembership> getGroupMemberships() {
memberlist = new ListDataModel<GroupMembership>(ticketBean.findMembershipPrintlistForUser(user));
return memberlist;
}
public String getMapFieldsetStyle() {
Integer width = placeBean.getActiveMap().getWidth();
if(width == null || width < 100)
return "";
return "width: " + (width+100) + "px;";
}
public void showMap() {
mapVisible = true;
}
public EventUser getUser() {
return user;
}
public void setUser(EventUser user) {
this.user = user;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public boolean isMapVisible() {
return mapVisible;
}
public void setMapVisible(boolean mapVisible) {
this.mapVisible = mapVisible;
}
}
......@@ -90,11 +90,10 @@ public class FoodWaveFoodView extends GenericCDIView {
foodWave = foodWaveBean.findFoodwave(getFoodwaveid());
logger.debug("Foodwave {}", foodWave);
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productGTList(foodWave.getTemplate().getProducts(), userview.getUser()));
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productGTList(foodWave.getTemplate().getProducts(), userview.getSelectedUser()));
this.beginConversation();
}
logger.info("injected user {}", userview.getUser());
}
public ListDataModel<Product> getProducts() {
......
......@@ -515,3 +515,5 @@ place.send=Siirr\u00E4 paikka
place.mapY=
place.cancelSend=Peruuta siirto
place.buyable=
etickets.sendAsMail=L\u00E4het\u00E4 s\u00E4hk\u00F6postina
etickets.showMap=N\u00E4yt\u00E4 kartta
......@@ -1662,3 +1662,5 @@ bill.isNotPaid=Not paid
placegroupview.owner=Owner
place.send=Transfer place
place.cancelSend=Cancel transfer
etickets.sendAsMail=Send as mail
etickets.showMap=Show map
......@@ -1643,3 +1643,5 @@ bill.isNotPaid=Maksamatta
placegroupview.owner=Omistaja
place.send=Siirr\u00E4 paikka
place.cancelSend=Peruuta siirto
etickets.sendAsMail=L\u00E4het\u00E4 s\u00E4hk\u00F6postiin
etickets.showMap=N\u00E4yt\u00E4 kartta
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!