Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 010b7f84
authored
Dec 12, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prelento-commit
1 parent
e4140e2a
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
572 additions
and
51 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/BarcodeBeanLocal.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/PlaceGroupBeanLocal.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/TicketBeanLocal.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PlaceGroupBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/TicketBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/UtilBean.java
code/moya-database/src/main/java/fi/codecrew/moya/model/LanEventPropertyKey.java
code/moya-web/WebContent/place/eticketStandalone.xhtml
code/moya-web/WebContent/place/myEtickets.xhtml
code/moya-web/WebContent/resources/templates/primelayout/css/print.css
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/eticket/EticketView.java
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/eticket/StandaloneEticketView.java
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n.properties
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_en.properties
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_fi.properties
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/BarcodeBeanLocal.java
View file @
010b7f8
...
@@ -39,7 +39,11 @@ public interface BarcodeBeanLocal {
...
@@ -39,7 +39,11 @@ public interface BarcodeBeanLocal {
public
String
getPlaceTextCode
(
Place
place
);
public
String
getPlaceTextCode
(
Place
place
);
public
Place
getPlaceFromTextCode
(
String
hexcode
);
public
Place
getPlaceFromTextCode
(
String
hexcode
);
public
String
checkVrAuthCode
(
String
code
);
public
String
checkVrAuthCode
(
String
code
);
public
String
getUserTextCode
(
EventUser
user
);
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
Product
getProduct
(
String
barcode
);
public
Place
getPlaceFromBarcode
(
String
barcode
);
public
Place
getPlaceFromBarcode
(
String
barcode
);
...
...
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/PlaceGroupBeanLocal.java
View file @
010b7f8
...
@@ -54,5 +54,4 @@ public interface PlaceGroupBeanLocal {
...
@@ -54,5 +54,4 @@ public interface PlaceGroupBeanLocal {
void
markGrouMembershipNotEntered
(
GroupMembership
row
);
void
markGrouMembershipNotEntered
(
GroupMembership
row
);
List
<
GroupMembership
>
findMembershipPrintlistForUser
(
EventUser
user
);
}
}
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/TicketBeanLocal.java
0 → 100644
View file @
010b7f8
/*
* 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
);
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
View file @
010b7f8
...
@@ -53,7 +53,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -53,7 +53,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
private
static
final
String
EVENTUSER_TEXTCODEPREFIX
=
"12"
;
private
static
final
String
EVENTUSER_TEXTCODEPREFIX
=
"12"
;
private
static
final
String
TEXTCODE_CHARACTER_MAP
=
"23456789ABCDEFGHJKLMNPQRSTUVWXYZ"
;
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
//private static final String NEXT_PREFIX = "265"; //2A
...
@@ -97,9 +97,47 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -97,9 +97,47 @@ public class BarcodeBean implements BarcodeBeanLocal {
return
BarcodeUtils
.
getBarcodeEAN
(
barcode
);
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
)
{
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
;
BigInteger
intCode
;
try
{
try
{
...
@@ -109,11 +147,10 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -109,11 +147,10 @@ public class BarcodeBean implements BarcodeBeanLocal {
return
"GenFail"
;
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
)
{
if
(
checkCode
.
compareTo
(
intCode
)
!=
0
)
{
logger
.
error
(
"CheckCode {} : Original {}"
,
checkCode
,
intCode
);
logger
.
error
(
"CheckCode {} : Original {}"
,
checkCode
,
intCode
);
...
@@ -125,6 +162,37 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -125,6 +162,37 @@ public class BarcodeBean implements BarcodeBeanLocal {
return
textCode
;
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
)
{
public
String
getPlaceTextCode
(
Place
place
)
{
String
barcode
=
generateBarcodeNumbers
(
PLACE_TEXTCODEPREFIX
,
place
.
getId
(),
8
);
String
barcode
=
generateBarcodeNumbers
(
PLACE_TEXTCODEPREFIX
,
place
.
getId
(),
8
);
...
@@ -140,8 +208,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -140,8 +208,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
String
textCode
=
generateTextcode
(
intCode
,
3
);
String
textCode
=
generateTextcode
(
intCode
,
3
);
BigInteger
checkCode
=
textcodeToNumber
(
textCode
,
3
);
BigInteger
checkCode
=
textcodeToNumber
(
textCode
,
3
);
logger
.
debug
(
"CheckCode {} : Original {}"
,
checkCode
,
intCode
);
if
(
checkCode
.
compareTo
(
intCode
)
!=
0
)
{
if
(
checkCode
.
compareTo
(
intCode
)
!=
0
)
{
logger
.
error
(
"CheckCode {} : Original {}"
,
checkCode
,
intCode
);
logger
.
error
(
"CheckCode {} : Original {}"
,
checkCode
,
intCode
);
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PlaceGroupBean.java
View file @
010b7f8
...
@@ -316,32 +316,5 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
...
@@ -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
;
}
}
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/TicketBean.java
0 → 100644
View file @
010b7f8
/*
* 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
);
}
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/UtilBean.java
View file @
010b7f8
...
@@ -80,6 +80,7 @@ public class UtilBean implements UtilBeanLocal {
...
@@ -80,6 +80,7 @@ public class UtilBean implements UtilBeanLocal {
@Override
@Override
public
boolean
sendMail
(
MailMessage
message
)
{
public
boolean
sendMail
(
MailMessage
message
)
{
logger
.
info
(
"Sending mail message {} "
,
message
);
logger
.
info
(
"Sending mail message {} "
,
message
);
if
(
message
.
getFromAddress
()
==
null
||
message
.
getFromAddress
().
isEmpty
())
{
if
(
message
.
getFromAddress
()
==
null
||
message
.
getFromAddress
().
isEmpty
())
{
message
.
setFromAddress
(
eventbean
.
getPropertyString
(
LanEventPropertyKey
.
PORTAL_EMAIL_ADDRESS
));
message
.
setFromAddress
(
eventbean
.
getPropertyString
(
LanEventPropertyKey
.
PORTAL_EMAIL_ADDRESS
));
...
...
code/moya-database/src/main/java/fi/codecrew/moya/model/LanEventPropertyKey.java
View file @
010b7f8
...
@@ -44,6 +44,8 @@ public enum LanEventPropertyKey {
...
@@ -44,6 +44,8 @@ public enum LanEventPropertyKey {
TEMPLATE_PROPERTY5
(
Type
.
TEXT
,
null
),
TEMPLATE_PROPERTY5
(
Type
.
TEXT
,
null
),
INVITE_ONLY_EVENT
(
Type
.
BOOL
,
null
),
INVITE_ONLY_EVENT
(
Type
.
BOOL
,
null
),
USE_ETICKET
(
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
),
MAP_QUEUE
(
Type
.
BOOL
,
null
),
;
;
...
...
code/moya-web/WebContent/place/eticketStandalone.xhtml
0 → 100644
View file @
010b7f8
<!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.template}"
>
<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"
>
TODO: this will be done
#{standaloneEticketView.user.user.wholeName}
<!--
<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:commandButton icon="ui-icon-mail-closed" value="#{i18n['etickets.sendAsMail']}" actionListener="#{eticketView.sendAsMail}" /><br/><br/><br/>
<p:outputPanel id="eticketpanel">
<p:fieldset legend="#{i18n['etickets.eticketcode']}" style="width: 250px; ">
<p:outputPanel style="text-align: center;">
<p:barcode id="userqrcode" value="#{eticketView.userTextCode}" type="qr" width="200" height="200"/><br />
<p:outputLabel for="userqrcode" value="#{eticketView.userTextCode}"/>
</p:outputPanel>
</p:fieldset>
<br /><br />
<p:fieldset legend="#{i18n['etickets.placeinfo']}">
<p:dataTable value="#{eticketView.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 />
<h2>#{i18n['etickets.placemap']}</h2>
<p:graphicImage rendered="" url="/PlaceMap?mapid=#{mapView.activeMap.id}&userid=#{userView.selectedUser.user.id}" styleClass="printImage"/>
</p:outputPanel>
-->
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/moya-web/WebContent/place/myEtickets.xhtml
View file @
010b7f8
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
</f:metadata>
</f:metadata>
<ui:define
rendered=
"#{lectureUserView.lectureGroupsVisible}"
name=
"title"
>
<ui:define
name=
"title"
>
<h1>
#{i18n['etickets.title']}
</h1>
<h1>
#{i18n['etickets.title']}
</h1>
</ui:define>
</ui:define>
...
@@ -18,12 +18,12 @@
...
@@ -18,12 +18,12 @@
<h:form
id=
"etickets"
>
<h:form
id=
"etickets"
>
<br
/><br
/>
<br
/><br
/>
<p:commandButton
value=
"
Print
"
type=
"button"
icon=
"ui-icon-print"
style=
"display:block;margin-bottom: 20px"
>
<p:commandButton
value=
"
#{i18n['print']}
"
type=
"button"
icon=
"ui-icon-print"
style=
"display:block;margin-bottom: 20px"
>
<p:printer
target=
"eticketpanel"
/>
<p:printer
target=
"eticketpanel"
/>
</p:commandButton>
<
--Tarvitaanko?
<br/>
</p:commandButton>
<p:commandButton
icon=
"ui-icon-mail-closed"
value=
"
Send as email (TODO)"
/><br/><br/><br/>
<p:commandButton
icon=
"ui-icon-mail-closed"
value=
"
#{i18n['etickets.sendAsMail']}"
actionListener=
"#{eticketView.sendAsMail}"
/><br/><br/><br/>
<p:outputPanel
id=
"eticketpanel"
>
<p:outputPanel
id=
"eticketpanel"
>
...
@@ -64,9 +64,9 @@
...
@@ -64,9 +64,9 @@
</p:fieldset>
</p:fieldset>
<br
/><br
/>
<br
/><br
/>
<
p:fieldset
legend=
"#{i18n['etickets.placemap']}"
style=
"#{eticketView.mapFieldsetStyle}"
>
<
h2>
#{i18n['etickets.placemap']}
</h2
>
<p:graphicImage
url=
"/PlaceMap?mapid=#{mapView.activeMap.id}&userid=#{userView.selectedUser.user.id}
"
/>
<p:graphicImage
url=
"/PlaceMap?mapid=#{mapView.activeMap.id}&userid=#{userView.selectedUser.user.id}"
styleClass=
"printImage
"
/>
</p:fieldset>
</p:outputPanel>
</p:outputPanel>
</h:form>
</h:form>
...
...
code/moya-web/WebContent/resources/templates/primelayout/css/print.css
View file @
010b7f8
...
@@ -11,4 +11,8 @@
...
@@ -11,4 +11,8 @@
.no_print
{
.no_print
{
display
:
none
;
display
:
none
;
}
}
.printImage
{
max-width
:
20cm
;
}
}
}
\ No newline at end of file
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/eticket/EticketView.java
View file @
010b7f8
...
@@ -18,10 +18,7 @@
...
@@ -18,10 +18,7 @@
*/
*/
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
eticket
;
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
eticket
;
import
fi.codecrew.moya.beans.BarcodeBeanLocal
;
import
fi.codecrew.moya.beans.*
;
import
fi.codecrew.moya.beans.PlaceBeanLocal
;
import
fi.codecrew.moya.beans.PlaceGroupBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.GroupMembership
;
import
fi.codecrew.moya.model.GroupMembership
;
...
@@ -30,11 +27,14 @@ import fi.codecrew.moya.model.PlaceGroup;
...
@@ -30,11 +27,14 @@ import fi.codecrew.moya.model.PlaceGroup;
import
fi.codecrew.moya.web.annotations.SelectedUser
;
import
fi.codecrew.moya.web.annotations.SelectedUser
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
fi.codecrew.moya.web.cdiview.shop.InviteView
;
import
fi.codecrew.moya.web.cdiview.shop.InviteView
;
import
fi.codecrew.moya.web.cdiview.user.UserView
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.faces.context.ExternalContext
;
import
javax.faces.context.FacesContext
;
import
javax.faces.model.ListDataModel
;
import
javax.faces.model.ListDataModel
;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
javax.inject.Named
;
...
@@ -52,9 +52,10 @@ public class EticketView extends GenericCDIView {
...
@@ -52,9 +52,10 @@ public class EticketView extends GenericCDIView {
// @Inject
// @Inject
// private UserView userview;
// private UserView userview;
@Inject
@Inject
@SelectedUser
private
UserView
userView
;
private
EventUser
user
;
@EJB
@EJB
private
BarcodeBeanLocal
barcodeBean
;
private
BarcodeBeanLocal
barcodeBean
;
...
@@ -68,6 +69,9 @@ public class EticketView extends GenericCDIView {
...
@@ -68,6 +69,9 @@ public class EticketView extends GenericCDIView {
@EJB
@EJB
PlaceBeanLocal
placeBean
;
PlaceBeanLocal
placeBean
;
@EJB
TicketBeanLocal
ticketBean
;
@Inject
@Inject
private
InviteView
inviteView
;
private
InviteView
inviteView
;
...
@@ -83,12 +87,12 @@ public class EticketView extends GenericCDIView {
...
@@ -83,12 +87,12 @@ public class EticketView extends GenericCDIView {
public
String
getUserTextCode
()
{
public
String
getUserTextCode
()
{
return
barcodeBean
.
getUserTextCode
(
user
);
return
barcodeBean
.
getUserTextCode
(
user
View
.
getSelectedUser
()
);
}
}
public
ListDataModel
<
GroupMembership
>
getGroupMemberships
()
{
public
ListDataModel
<
GroupMembership
>
getGroupMemberships
()
{
memberlist
=
new
ListDataModel
<
GroupMembership
>(
placegroupBean
.
findMembershipPrintlistForUser
(
user
));
memberlist
=
new
ListDataModel
<
GroupMembership
>(
ticketBean
.
findMembershipPrintlistForUser
(
userView
.
getSelectedUser
()
));
return
memberlist
;
return
memberlist
;
}
}
...
@@ -100,4 +104,55 @@ public class EticketView extends GenericCDIView {
...
@@ -100,4 +104,55 @@ public class EticketView extends GenericCDIView {
return
"width: "
+
(
width
+
100
)
+
"px;"
;
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
();
}
}
}
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/eticket/StandaloneEticketView.java
0 → 100644
View file @
010b7f8
/*
* 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
<>();
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
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
;
}
}
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n.properties
View file @
010b7f8
...
@@ -515,3 +515,4 @@ place.send=Siirr\u00E4 paikka
...
@@ -515,3 +515,4 @@ place.send=Siirr\u00E4 paikka
place.mapY
=
place.mapY
=
place.cancelSend
=
Peruuta siirto
place.cancelSend
=
Peruuta siirto
place.buyable
=
place.buyable
=
etickets.sendAsMail
=
L
\u
00E4het
\u
00E4 s
\u
00E4hk
\u
00F6postina
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_en.properties
View file @
010b7f8
...
@@ -1662,3 +1662,4 @@ bill.isNotPaid=Not paid
...
@@ -1662,3 +1662,4 @@ bill.isNotPaid=Not paid
placegroupview.owner
=
Owner
placegroupview.owner
=
Owner
place.send
=
Transfer place
place.send
=
Transfer place
place.cancelSend
=
Cancel transfer
place.cancelSend
=
Cancel transfer
etickets.sendAsMail
=
Send as mail
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_fi.properties
View file @
010b7f8
...
@@ -1643,3 +1643,4 @@ bill.isNotPaid=Maksamatta
...
@@ -1643,3 +1643,4 @@ bill.isNotPaid=Maksamatta
placegroupview.owner
=
Omistaja
placegroupview.owner
=
Omistaja
place.send
=
Siirr
\u
00E4 paikka
place.send
=
Siirr
\u
00E4 paikka
place.cancelSend
=
Peruuta siirto
place.cancelSend
=
Peruuta siirto
etickets.sendAsMail
=
L
\u
00E4het
\u
00E4 s
\u
00E4hk
\u
00F6postiin
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment