Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 39c71bf1
authored
Dec 28, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'devel'
2 parents
76ed1caf
9add6114
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
297 additions
and
78 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/CardPrintBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/CardTemplateBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/ReaderBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/VotingBean.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/BarcodeBeanLocal.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/ReaderBeanLocal.java
code/MoyaDatabase/src/fi/codecrew/moya/model/CompoEntry.java
code/MoyaWeb/WebContent/admin/adduser/update.xhtml
code/MoyaWeb/WebContent/card/massprint.xhtml
code/MoyaWeb/WebContent/resources/cditools/shop/readerevents.xhtml
code/MoyaWeb/WebContent/shop/createReader.xhtml
code/MoyaWeb/WebContent/useradmin/userCartShow.xhtml
code/MoyaWeb/WebContent/voting/submitEntry.xhtml
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/card/CardMassPrintView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/menu/PrimeMenuView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/BarcodeView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ReaderView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/user/UserSearchView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/CompoView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
0 → 100644
View file @
39c71bf
package
fi
.
codecrew
.
moya
.
beans
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.model.PrintedCard
;
import
fi.codecrew.moya.utilities.BarcodeUtils
;
/**
* Session Bean implementation class BarcodeBean
*/
@Stateless
@LocalBean
public
class
BarcodeBean
implements
BarcodeBeanLocal
{
private
static
final
String
PRINTED_CARD_PREFIX
=
"200"
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
BarcodeBean
.
class
);
/**
* Default constructor.
*/
public
BarcodeBean
()
{
// TODO Auto-generated constructor stub
}
public
InputStream
getCardBarcode
(
PrintedCard
printedCard
)
throws
IOException
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
PRINTED_CARD_PREFIX
);
String
idStr
=
printedCard
.
getId
().
toString
();
for
(
int
i
=
12
-
idStr
.
length
()
-
sb
.
length
();
i
>
0
;
--
i
)
{
sb
.
append
(
"0"
);
}
sb
.
append
(
idStr
);
String
barcode
=
sb
.
toString
();
logger
.
debug
(
"Geneating barcode for card {} : {}"
,
printedCard
,
barcode
);
return
BarcodeUtils
.
getBarcodeEAN
(
barcode
);
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/CardPrintBean.java
View file @
39c71bf
...
...
@@ -22,12 +22,10 @@ import com.pdfjet.TextLine;
import
fi.codecrew.moya.facade.CardTemplateFacade
;
import
fi.codecrew.moya.facade.EventUserFacade
;
import
fi.codecrew.moya.facade.UserFacade
;
import
fi.codecrew.moya.beans.CardPrintBeanLocal
;
import
fi.codecrew.moya.model.CardTemplate
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.PrintedCard
;
import
fi.codecrew.moya.util.MassPrintResult
;
import
fi.codecrew.moya.utilities.BarcodeUtils
;
/**
* Session Bean implementation class CardPrintBean
...
...
@@ -46,6 +44,8 @@ public class CardPrintBean implements CardPrintBeanLocal {
private
CardTemplateFacade
cardTemplateFacade
;
@EJB
private
UserFacade
userfacade
;
@EJB
private
BarcodeBean
barcodeBean
;
/**
* Default constructor.
...
...
@@ -111,13 +111,14 @@ public class CardPrintBean implements CardPrintBeanLocal {
cardTemplate
.
getImage
()));
BufferedImage
faceBufferedImage
=
ImageIO
.
read
(
new
ByteArrayInputStream
(
user
.
getCurrentImage
()
.
getImageData
()));
if
(
faceBufferedImage
.
getWidth
()
>
1024
||
faceBufferedImage
.
getHeight
()
>
1024
)
{
throw
new
Exception
(
"Image dimensions too large, please take/upload smaller!"
);
}
.
read
(
new
ByteArrayInputStream
(
user
.
getCurrentImage
().
getImageData
()));
/*
* if (faceBufferedImage.getWidth() > 1024 ||
* faceBufferedImage.getHeight() > 1024) { throw new
* Exception("Image dimensions too large, please take/upload smaller!"
* ); }
*/
int
originalWidth
=
faceBufferedImage
.
getWidth
();
int
originalHeight
=
faceBufferedImage
.
getHeight
();
...
...
@@ -184,14 +185,15 @@ public class CardPrintBean implements CardPrintBeanLocal {
roleTextLine
.
drawOn
(
page
);
// Barcode
String
barcodeString
=
String
.
valueOf
(
user
.
getUser
().
getCreated
()
.
getTime
().
getTime
());
barcodeString
=
barcodeString
.
substring
(
barcodeString
.
length
()
-
12
);
BufferedImage
barCodeBufferedImage
=
ImageIO
.
read
(
BarcodeUtils
.
getBarcodeEAN
(
barcodeString
));
Image
barCodeImage
=
new
Image
(
pdf
,
convertBufferedImageToPng
(
barCodeBufferedImage
),
ImageType
.
PNG
);
barCodeImage
.
setPosition
(
0.0
,
243.5
);
// String barcodeString =
// String.valueOf(user.getUser().getCreated().getTime().getTime());
// barcodeString = barcodeString.substring(barcodeString.length() -
// 12);
BufferedImage
barCodeBufferedImage
=
ImageIO
.
read
(
barcodeBean
.
getCardBarcode
(
printedCard
));
Image
barCodeImage
=
new
Image
(
pdf
,
convertBufferedImageToPng
(
barCodeBufferedImage
),
ImageType
.
PNG
);
barCodeImage
.
setPosition
(
0.0
,
230
);
// 243.5);
barCodeImage
.
scaleBy
(
0.7
);
barCodeImage
.
drawOn
(
page
);
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/CardTemplateBean.java
View file @
39c71bf
...
...
@@ -17,16 +17,12 @@ import javax.imageio.ImageIO;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.enums.apps.UserPermission
;
import
fi.codecrew.moya.facade.CardTemplateFacade
;
import
fi.codecrew.moya.facade.EventUserFacade
;
import
fi.codecrew.moya.facade.GroupMembershipFacade
;
import
fi.codecrew.moya.facade.LanEventPropertyFacade
;
import
fi.codecrew.moya.facade.PrintedCardFacade
;
import
fi.codecrew.moya.beans.CardTemplateBeanLocal
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.beans.UtilBeanLocal
;
import
fi.codecrew.moya.enums.apps.UserPermission
;
import
fi.codecrew.moya.model.CardTemplate
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.LanEvent
;
...
...
@@ -179,6 +175,8 @@ public class CardTemplateBean implements CardTemplateBeanLocal {
}
else
{
logger
.
info
(
"User {} has power {} and roles has power {}"
,
new
Object
[]
{
user
.
getUser
().
getLogin
(),
existingPower
,
newPower
});
}
eventPropertyFacade
.
flush
();
return
biggestCard
;
}
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
View file @
39c71bf
...
...
@@ -11,10 +11,6 @@ import javax.ejb.Stateless;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.facade.MenuNavigationFacade
;
import
fi.codecrew.moya.facade.MenuitemFacade
;
import
fi.codecrew.moya.beans.MenuBeanLocal
;
import
fi.codecrew.moya.beans.PermissionBeanLocal
;
import
fi.codecrew.moya.enums.apps.BillPermission
;
import
fi.codecrew.moya.enums.apps.CompoPermission
;
import
fi.codecrew.moya.enums.apps.ContentPermission
;
...
...
@@ -23,6 +19,8 @@ import fi.codecrew.moya.enums.apps.PollPermission;
import
fi.codecrew.moya.enums.apps.ShopPermission
;
import
fi.codecrew.moya.enums.apps.SpecialPermission
;
import
fi.codecrew.moya.enums.apps.UserPermission
;
import
fi.codecrew.moya.facade.MenuNavigationFacade
;
import
fi.codecrew.moya.facade.MenuitemFacade
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.MenuNavigation
;
...
...
@@ -74,7 +72,18 @@ public class MenuBean implements MenuBeanLocal {
LanEvent
ev
=
eventbean
.
getCurrentEvent
();
MenuNavigation
usermenu
=
new
MenuNavigation
(
ev
,
"topnavi.usernavi"
,
menusort
=
+
10
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/index"
),
UserPermission
.
ANYUSER
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/permissionDenied"
),
null
).
setVisible
(
false
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/auth/login"
),
null
).
setVisible
(
false
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/auth/loginError"
),
null
).
setVisible
(
false
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/auth/logout"
),
null
).
setVisible
(
false
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/auth/logoutResponse"
),
null
).
setVisible
(
false
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/auth/resetPassword"
),
null
).
setVisible
(
false
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/auth/resetmailSent"
),
null
).
setVisible
(
false
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/auth/passwordChanged"
),
null
).
setVisible
(
false
);
usermenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/auth/notauthorized"
),
null
).
setVisible
(
false
);
MenuNavigation
userkauppa
=
usermenu
.
addPage
(
null
,
null
);
userkauppa
.
setKey
(
"topnavi.usershop"
);
userkauppa
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/shop/createBill"
),
BillPermission
.
CREATE_BILL
);
...
...
@@ -95,6 +104,8 @@ public class MenuBean implements MenuBeanLocal {
usercompetitions
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/voting/compolist"
),
CompoPermission
.
VIEW_COMPOS
);
usercompetitions
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/voting/myEntries"
),
CompoPermission
.
VIEW_COMPOS
);
usercompetitions
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/voting/create"
),
CompoPermission
.
MANAGE
);
usercompetitions
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/voting/submitEntry"
),
null
).
setVisible
(
false
);
usercompetitions
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/voting/details"
),
null
).
setVisible
(
false
);
MenuNavigation
createuser
=
usermenu
.
addPage
(
null
,
null
);
createuser
.
setKey
(
"topnavi.createuser"
);
...
...
@@ -107,15 +118,25 @@ public class MenuBean implements MenuBeanLocal {
adminuser
.
setKey
(
"topnavi.usermgmt"
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/create"
),
UserPermission
.
VIEW_ALL
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/list"
),
UserPermission
.
VIEW_ALL
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/edit"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/changePassword"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/accountEvents"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/place/adminGroups"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/place/adminInsertToken"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/foodwaveshop"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/foodwaveProducts"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/showTakePicture"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
MenuNavigation
adminroles
=
adminuser
.
addPage
(
null
,
null
);
adminroles
.
setKey
(
"subnavi.roles"
);
adminroles
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/role/list"
),
UserPermission
.
READ_ROLES
);
adminroles
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/role/create"
),
UserPermission
.
WRITE_ROLES
);
adminroles
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/role/edit"
),
null
).
setVisible
(
false
);
MenuNavigation
adminshop
=
adminmenu
.
addPage
(
null
,
null
);
adminshop
.
setKey
(
"topnavi.adminshop"
);
MenuNavigation
adminShopProducts
=
adminshop
.
addPage
(
null
,
null
);
adminShopProducts
.
setKey
(
"subnavi.products"
);
adminShopProducts
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/product/create"
),
ShopPermission
.
MANAGE_PRODUCTS
);
adminShopProducts
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/product/list"
),
ShopPermission
.
LIST_ALL_PRODUCTS
);
...
...
@@ -125,7 +146,7 @@ public class MenuBean implements MenuBeanLocal {
adminShopReaders
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/shop/listReaders"
),
ShopPermission
.
SHOP_TO_OTHERS
);
MenuNavigation
adminShopBilling
=
adminshop
.
addPage
(
null
,
null
);
adminShop
Readers
.
setKey
(
"subnavi.billing"
);
adminShop
Billing
.
setKey
(
"subnavi.billing"
);
adminShopBilling
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/bill/billSummary"
),
BillPermission
.
READ_ALL
);
adminShopBilling
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/bill/listAll"
),
BillPermission
.
WRITE_ALL
);
...
...
@@ -135,6 +156,9 @@ public class MenuBean implements MenuBeanLocal {
adminEventCards
.
setKey
(
"subnavi.cards"
);
adminEventCards
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/listCardTemplates"
),
UserPermission
.
READ_ROLES
);
adminEventCards
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/createCardTemplate"
),
UserPermission
.
WRITE_ROLES
);
adminEventCards
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/editCardTemplate"
),
null
).
setVisible
(
false
);
adminEventCards
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/shop/shopToUser"
),
null
).
setVisible
(
false
);
adminEventCards
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/shop/assocToUser"
),
null
).
setVisible
(
false
);
navifacade
.
create
(
adminmenu
);
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/ReaderBean.java
View file @
39c71bf
...
...
@@ -15,10 +15,6 @@ import org.slf4j.LoggerFactory;
import
fi.codecrew.moya.facade.PrintedCardFacade
;
import
fi.codecrew.moya.facade.ReaderEventFacade
;
import
fi.codecrew.moya.facade.ReaderFacade
;
import
fi.codecrew.moya.beans.CardTemplateBeanLocal
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.ReaderBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.model.AccountEvent
;
import
fi.codecrew.moya.model.CardTemplate
;
import
fi.codecrew.moya.model.EventUser
;
...
...
@@ -260,4 +256,11 @@ public class ReaderBean implements ReaderBeanLocal {
}
return
readerfacade
.
merge
(
reader
);
}
@Override
public
void
createReader
(
Reader
reader
)
{
reader
.
setEvent
(
eventbean
.
getCurrentEvent
());
readerfacade
.
create
(
reader
);
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/VotingBean.java
View file @
39c71bf
...
...
@@ -92,6 +92,10 @@ public class VotingBean implements VotingBeanLocal {
Compo
co
=
compoFacade
.
reload
(
entry
.
getCompo
());
entry
.
setCreator
(
permissionBean
.
getCurrentUser
());
if
(
entry
.
getTitle
()
==
null
)
{
entry
.
setTitle
(
""
);
}
if
(
co
.
getCompoEntries
()
==
null
)
{
co
.
setCompoEntries
(
new
ArrayList
<
CompoEntry
>());
}
...
...
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/BarcodeBeanLocal.java
0 → 100644
View file @
39c71bf
package
fi
.
codecrew
.
moya
.
beans
;
import
javax.ejb.Local
;
@Local
public
interface
BarcodeBeanLocal
{
}
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/ReaderBeanLocal.java
View file @
39c71bf
...
...
@@ -35,4 +35,6 @@ public interface ReaderBeanLocal {
Reader
saveReader
(
Reader
reader
);
void
createReader
(
Reader
reader
);
}
code/MoyaDatabase/src/fi/codecrew/moya/model/CompoEntry.java
View file @
39c71bf
...
...
@@ -43,21 +43,21 @@ public class CompoEntry extends GenericEntity {
private
Calendar
created
=
Calendar
.
getInstance
();
@Column
(
name
=
"title"
,
nullable
=
false
)
private
String
title
;
private
String
title
=
""
;
@Column
(
name
=
"author"
)
private
String
author
;
private
String
author
=
""
;
@Lob
@Column
(
name
=
"notes"
)
private
String
notes
;
private
String
notes
=
""
;
@Lob
@Column
(
name
=
"screen_message"
)
private
String
screenMessage
;
private
String
screenMessage
=
""
;
@Column
(
name
=
"sort"
)
private
Integer
sort
;
private
Integer
sort
=
10
;
@Column
(
name
=
"final_position"
)
private
Integer
finalPosition
;
...
...
code/MoyaWeb/WebContent/admin/adduser/update.xhtml
View file @
39c71bf
...
...
@@ -42,7 +42,9 @@
</h:panelGrid>
</h:form>
</div>
<div
style=
""
>
<h:link
style=
"margin: 0 auto; font-size: 3em;"
outcome=
"/admin/adduser/start"
value=
"Valmis"
/>
</div>
<script>
function
dophoto
(
pc
)
{
...
...
code/MoyaWeb/WebContent/card/massprint.xhtml
View file @
39c71bf
...
...
@@ -14,13 +14,15 @@
<h1>
#{i18n['card.massprint.title']}
</h1>
</ui:define>
<ui:define
name=
"content"
>
<h:form
rendered=
"#{
cardMassPrintView.file!=null
}"
>
<h:form
rendered=
"#{
!empty cardMassPrintView.streamedFile
}"
>
<p:commandButton
id=
"downloadLink"
value=
"Download"
ajax=
"false"
onclick=
"PrimeFaces.monitorDownload(start, stop)"
icon=
"ui-icon-arrowthichk-s"
>
<p:fileDownload
value=
"#{cardMassPrintView.streamedFile}"
/>
</p:commandButton>
<p:commandButton
value=
"Accept printout"
action=
"#{cardMassPrintView.acceptPrintout()}"
rendered=
"#{cardMassPrintView.waitForAcceptance}"
/>
</h:form>
<h:outputText
value=
"Error generating mass output!"
rendered=
"#{empty cardMassPrintView.streamedFile}"
/>
</ui:define>
</ui:composition>
</h:body>
...
...
code/MoyaWeb/WebContent/resources/cditools/shop/readerevents.xhtml
View file @
39c71bf
...
...
@@ -10,7 +10,11 @@
<composite:implementation>
<h:form>
<p:poll
interval=
"3"
/>
<p:poll
interval=
"3"
/>
<h:dataTable
border=
"1"
id=
"event"
value=
"#{readerView.readerEvents}"
var=
"event"
>
<h:column>
<f:facet
name=
"header"
>
...
...
code/MoyaWeb/WebContent/shop/createReader.xhtml
0 → 100644
View file @
39c71bf
<!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:shop=
"http://java.sun.com/jsf/composite/cditools/shop"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{readerView.initCreateReader}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
for=
"name"
value=
"#{i18n['reader.identification']}"
/>
<h:inputText
id=
"name"
value=
"#{readerView.reader.identification}"
/>
<h:message
for=
"name"
/>
<h:outputLabel
for=
"type"
value=
"#{i18n['reader.type']}"
/>
<h:selectOneMenu
value=
"#{readerView.reader.type}"
>
<f:selectItems
value=
"#{readerView.readerTypes}"
/>
</h:selectOneMenu>
</h:panelGrid>
<h:commandButton
action=
"#{readerView.createReader}"
value=
"#{i18n['reader.create']}"
/>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/MoyaWeb/WebContent/useradmin/userCartShow.xhtml
View file @
39c71bf
...
...
@@ -6,7 +6,8 @@
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{userCartView.initView}"
/>
<!-- f:event type="preRenderView" listener="#{userCartView.initView}" />
-->
</f:metadata>
<ui:define
name=
"title"
>
...
...
code/MoyaWeb/WebContent/voting/submitEntry.xhtml
View file @
39c71bf
...
...
@@ -7,16 +7,19 @@
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:viewParam
name=
"compoId"
value=
"#{compoView.compoId}"
/>
<f:viewParam
name=
"entryId"
value=
"#{compoView.entryId}"
/>
<f:event
type=
"preRenderView"
listener=
"#{compoView.initEntryView}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
#{i18n['voting.compoentryadd.title']}
</h1>
<p>
#{i18n['voting.compoentryadd.description']} #{compoView.compo.name}
</p>
<p>
#{i18n['voting.compoentryadd.description']}
<h:outputText
value=
"#{compoView.compo.name}"
/></p>
<p>
<h:outputText
value=
"#{compoView.compo.description}"
/>
</p>
<h:form>
<h:panelGrid
columns=
"3"
>
<
!-- <
h:panelGrid columns="3">
<h:outputLabel value="Title" for="name" />
<h:inputText value="#{compoView.entry.title}" id="name" />
<h:message for="name" />
...
...
@@ -32,14 +35,18 @@
<h:outputLabel value="#{i18n['voting.compoentryadd.screenmessage']}" for="screenmessage" />
<h:inputTextarea value="#{compoView.entry.screenMessage}" id="screenmessage" />
<h:message for="screenmessage" />
<h:commandButton rendered="#{empty compoView.entry.id}" action="#{compoView.createEntry()}" value="#{i18n['voting.compoentryadd.button']}" />
<h:commandButton
rendered=
"#{!empty compoView.entry.id}"
action=
"#{compoView.saveEntry()}"
value=
"#{i18n['voting.compoentrysave.button']}"
/>
<h:commandButton rendered="#{!empty compoView.entry.id}" action="#{compoView.saveEntry()}" value="#{i18n['voting.compoentrysave.button']}" />
</h:panelGrid>
</h:form>
-->
<h:commandButton
rendered=
"#{empty compoView.entry.id}"
action=
"#{compoView.createEntry()}"
value=
"Ilmoittaudu kilpailuun"
/>
</h:form>
<ui:fragment
rendered=
"#{!empty compoView.entry.id}"
>
<h:form
enctype=
"multipart/form-data"
>
<!--
<h:form enctype="multipart/form-data">
<p:fileUpload value="#{compoView.uploadedFile}" id="uploadedfile" mode="simple" />
<h:commandButton action="#{compoView.submitEntryfile}" value="#{i18n['compofile.upload']}" />
</h:form>
...
...
@@ -54,6 +61,8 @@
<p:fileDownload value="#{compoFileDownloadView.dlfile}" />
</h:commandButton>
</h:form>
-->
Ilmoittautuminen otettu vastaan.
</ui:fragment>
</ui:define>
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
View file @
39c71bf
...
...
@@ -136,4 +136,6 @@ resetMail.username = Username
resetmailSent.body
=
Email has been sent containing a link where you can change the password.
resetmailSent.header
=
Email sent
subnavi.cards
=
\t\t
user.unauthenticated
=
Kirjautumaton
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
View file @
39c71bf
...
...
@@ -368,6 +368,8 @@ menu.item = Item
menu.name
=
Name
menu.select
=
Select
menu.sort
=
Sort
menu.toAdmin
=
Adminview
menu.toUser
=
Userview
menuitem.navigation.key
=
Product flag
...
...
@@ -728,6 +730,12 @@ submenu.voting.compolist = Compos
submenu.voting.create
=
Create new compo
submenu.voting.myEntries
=
My entries
subnavi.billing
=
Billing
subnavi.cards
=
Cards
subnavi.products
=
Products
subnavi.readers
=
Readers
subnavi.roles
=
Roles
supernavi.admin
=
Adminview
supernavi.user
=
Userview
...
...
@@ -748,6 +756,7 @@ topnavi.competitions = Competitions
topnavi.compos
=
Compos
topnavi.contents
=
Site contents
topnavi.createuser
=
Create user
topnavi.event
=
Event
topnavi.foodwave
=
Food
topnavi.frontpage
=
Front page
topnavi.log
=
Log
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
View file @
39c71bf
...
...
@@ -378,6 +378,8 @@ menu.poll.index = Kyselyt
menu.select
=
Valitse
menu.shop.createBill
=
Kauppa
menu.sort
=
J
\u
00E4rjest
\u
00E4
menu.toAdmin
=
Yll
\u
00E4piton
\u
00E4kym
\u
00E4
menu.toUser
=
K
\u
00E4ytt
\u
00E4j
\u
00E4n
\u
00E4kym
\u
00E4
menu.user.edit
=
Omat tiedot
news.abstract
=
Lyhennelm
\u
00E4
...
...
@@ -709,6 +711,12 @@ submenu.voting.compolist = Kilpailut
submenu.voting.create
=
Uusi kilpailu
submenu.voting.myEntries
=
Omat entryt
subnavi.billing
=
Laskutus
subnavi.cards
=
Kortit
subnavi.products
=
Tuotteet
subnavi.readers
=
Lukijat
subnavi.roles
=
Roolit
supernavi.admin
=
Yll
\u
00E4piton
\u
00E4kym
\u
00E4
supernavi.user
=
K
\u
00E4ytt
\u
00E4j
\u
00E4n
\u
00E4kym
\u
00E4
...
...
@@ -729,6 +737,7 @@ topnavi.competitions = Kilpailut
topnavi.compos
=
Kilpailut
topnavi.contents
=
Sivuston sis
\u
00E4lt
\u
00F6
topnavi.createuser
=
Luo k
\u
00E4ytt
\u
00E4j
\u
00E4
topnavi.event
=
Tapahtuma
topnavi.foodwave
=
Ruokatilaus
topnavi.frontpage
=
Etusivu
topnavi.log
=
Logi
...
...
@@ -862,12 +871,12 @@ voting.allcompos.voteStart = \u00C4\u00E4nestys auki
voting.compo.submit
=
L
\u
00E4het
\u
00E4 kappale
voting.compo.vote
=
\u
00C4
\u
00E4nest
\u
00E4
voting.compoentryadd.button
=
L
\u
00E4het
\u
00E4
voting.compoentryadd.description
=
Lis
\u
00E4
\u
00E4 uusi entry compoon
voting.compoentryadd.description
=
Ilmoittaudu kilpailuun:
voting.compoentryadd.entryname
=
Nimi
voting.compoentryadd.file
=
Tiedosto
voting.compoentryadd.notes
=
Huomatuksia
voting.compoentryadd.screenmessage
=
Screenmessage
voting.compoentryadd.title
=
Lis
\u
00E4
\u
00E4 entry
voting.compoentryadd.title
=
Ilmoittaudu
voting.compoentryadd.uploadedFile
=
asdsda
voting.compoentrysave.button
=
Tallenna
voting.create.compoEnd
=
Lopetusaika
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/card/CardMassPrintView.java
View file @
39c71bf
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
card
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -15,6 +14,8 @@ import javax.inject.Named;
import
org.primefaces.model.DefaultStreamedContent
;
import
org.primefaces.model.StreamedContent
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.beans.CardPrintBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
...
...
@@ -32,11 +33,11 @@ public class CardMassPrintView extends GenericCDIView implements Serializable {
@EJB
private
CardPrintBeanLocal
cardPrintBean
;
private
File
file
;
private
StreamedContent
streamedFile
;
private
MassPrintResult
mpr
=
null
;
private
boolean
waitForAcceptance
=
true
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CardMassPrintView
.
class
);
public
CardMassPrintView
()
{
// TODO Auto-generated constructor stub
...
...
@@ -49,9 +50,8 @@ public class CardMassPrintView extends GenericCDIView implements Serializable {
userIdList
.
add
(
eu
.
getId
());
}
file
=
null
;
try
{
mpr
=
cardPrintBean
.
getUserCardsAsPrintablePdf
(
userIdList
);
waitForAcceptance
=
true
;
...
...
@@ -89,14 +89,6 @@ public class CardMassPrintView extends GenericCDIView implements Serializable {
this
.
userCartView
=
userCartView
;
}
public
File
getFile
()
{
return
file
;
}
public
void
setFile
(
File
file
)
{
this
.
file
=
file
;
}
public
StreamedContent
getStreamedFile
()
{
return
streamedFile
;
}
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/menu/PrimeMenuView.java
View file @
39c71bf
...
...
@@ -16,6 +16,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.beans.MenuBeanLocal
;
import
fi.codecrew.moya.enums.apps.UserPermission
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.MenuNavigation
;
import
fi.codecrew.moya.utilities.I18n
;
...
...
@@ -123,9 +124,23 @@ public class PrimeMenuView extends GenericCDIView {
myPlces
.
setOutcome
(
"/place/myGroups"
);
myPlces
.
setValue
(
I18n
.
get
(
"user.myPlaces"
));
nameSub
.
getChildren
().
add
(
myPlces
);
nameSub
.
getChildren
().
add
(
new
Separator
());
if
(
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
))
{
MenuItem
adminmenu
=
new
MenuItem
();
logger
.
info
(
"Selected topmenu: {}"
,
selectedTop
.
getKey
());
if
(
"topnavi.usernavi"
.
equals
(
selectedTop
.
getKey
()))
{
adminmenu
.
setOutcome
(
"/useradmin/list"
);
adminmenu
.
setValue
(
I18n
.
get
(
"menu.toAdmin"
));
}
else
{
adminmenu
.
setOutcome
(
"/index"
);
adminmenu
.
setValue
(
I18n
.
get
(
"menu.toUser"
));
}
nameSub
.
getChildren
().
add
(
adminmenu
);
nameSub
.
getChildren
().
add
(
new
Separator
());
}
MenuItem
logout
=
new
MenuItem
();
logout
.
setOutcome
(
"/auth/logout"
);
logout
.
setValue
(
I18n
.
get
(
"user.logout"
));
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/BarcodeView.java
View file @
39c71bf
...
...
@@ -19,10 +19,9 @@ import fi.codecrew.moya.web.cdiview.user.UserView;
public
class
BarcodeView
extends
GenericCDIView
{
private
static
final
long
serialVersionUID
=
-
5723180869625883034L
;
private
String
barcode
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
BarcodeView
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
BarcodeView
.
class
);
@Inject
private
UserView
userView
;
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ReaderView.java
View file @
39c71bf
...
...
@@ -14,7 +14,6 @@ import org.slf4j.LoggerFactory;
import
fi.codecrew.moya.beans.ProductBeanLocal
;
import
fi.codecrew.moya.beans.ReaderBeanLocal
;
import
fi.codecrew.moya.beans.RoleBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.enums.apps.ShopPermission
;
import
fi.codecrew.moya.enums.apps.UserPermission
;
...
...
@@ -46,7 +45,7 @@ public class ReaderView extends GenericCDIView {
@Inject
private
ReaderNameContainer
namecontainer
;
@EJB
private
transient
ReaderBeanLocal
readerbean
;
...
...
@@ -81,10 +80,27 @@ public class ReaderView extends GenericCDIView {
// card.getPrintedCard());
return
null
;
}
public
List
<
Role
>
getUserRoles
(
EventUser
user
)
{
return
userbean
.
findUsersRoles
(
user
);
}
public
void
initCreateReader
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
)
&&
reader
==
null
)
{
reader
=
new
Reader
();
super
.
beginConversation
();
}
}
public
String
createReader
()
{
readerbean
.
createReader
(
reader
);
namecontainer
.
setReaderId
(
reader
.
getId
());
return
"/shop/showReaderEvents"
;
}
public
void
initUserassocView
()
{
if
(
super
.
requirePermissions
(
UserPermission
.
CREATE_NEW
)
&&
event
==
null
)
{
event
=
readerbean
.
getEvent
(
eventid
);
...
...
@@ -95,9 +111,11 @@ public class ReaderView extends GenericCDIView {
super
.
beginConversation
();
}
}
public
boolean
isReaderSelected
()
{
return
this
.
readerid
!=
null
;
return
this
.
readerid
!=
null
;
}
public
String
assocToCard
()
{
...
...
@@ -123,10 +141,10 @@ public class ReaderView extends GenericCDIView {
public
void
initReaderList
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
))
{
}
}
public
List
<
Product
>
getAutoProducts
()
{
List
<
Product
>
ret
=
new
ArrayList
<
Product
>();
...
...
@@ -239,4 +257,8 @@ public class ReaderView extends GenericCDIView {
this
.
userview
=
userview
;
}
public
ReaderType
[]
getReaderTypes
()
{
return
ReaderType
.
values
();
}
}
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/user/UserSearchView.java
View file @
39c71bf
...
...
@@ -16,8 +16,8 @@ import fi.codecrew.moya.enums.apps.UserPermission;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.User
;
import
fi.codecrew.moya.util.UserSearchQuery
;
import
fi.codecrew.moya.utilities.SearchResult
;
import
fi.codecrew.moya.utilities.SearchQuery.QuerySortOrder
;
import
fi.codecrew.moya.utilities.SearchResult
;
import
fi.codecrew.moya.web.cdiview.PaginationView
;
@Named
...
...
@@ -72,6 +72,7 @@ public class UserSearchView extends PaginationView<User> {
sq
.
setSort
(
sortField
);
sq
.
setSortDirection
(
SortOrder
.
ASCENDING
.
equals
(
sortOrder
)
?
QuerySortOrder
.
ASCENDING
:
(
SortOrder
.
DESCENDING
.
equals
(
sortOrder
)
?
QuerySortOrder
.
DESCENDING
:
QuerySortOrder
.
UNSORTED
));
SearchResult
<
EventUser
>
sr
=
userbean
.
getThisEventsUsers
(
sq
);
this
.
setRowCount
(
new
Long
(
sr
.
getResultcount
()).
intValue
());
setResultcount
(
sr
.
getResultcount
());
setEventUserResults
(
sr
.
getResults
());
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/CompoView.java
View file @
39c71bf
...
...
@@ -47,6 +47,7 @@ public class CompoView extends GenericCDIView {
private
Compo
compo
;
private
Integer
entryId
;
private
Integer
compoId
;
private
transient
ListDataModel
<
EntryWrapper
>
voteEntries
;
...
...
@@ -56,17 +57,34 @@ public class CompoView extends GenericCDIView {
public
void
initEntryView
()
{
if
(
entry
==
null
)
if
(
super
.
requirePermissions
(
CompoPermission
.
SUBMIT_ENTRY
)
&&
entry
==
null
)
{
entry
=
votbean
.
findEntry
(
entryId
);
if
(
entry
==
null
||
!
super
.
requirePermissions
(
super
.
hasPermission
(
CompoPermission
.
MANAGE
)
||
permbean
.
isCurrentUser
(
entry
.
getCreator
())))
if
(
entryId
==
null
)
{
entry
=
null
;
}
else
{
super
.
beginConversation
();
entry
=
new
CompoEntry
();
if
(
compo
==
null
&&
compoId
!=
null
)
{
compo
=
votbean
.
getCompoById
(
compoId
);
entry
.
setCompo
(
compo
);
}
super
.
beginConversation
();
}
else
{
entry
=
votbean
.
findEntry
(
entryId
);
if
(
entry
==
null
||
!
super
.
requirePermissions
(
super
.
hasPermission
(
CompoPermission
.
MANAGE
)
||
permbean
.
isCurrentUser
(
entry
.
getCreator
())))
{
entry
=
null
;
compo
=
null
;
}
else
{
compo
=
entry
.
getCompo
();
super
.
beginConversation
();
}
}
}
logger
.
info
(
"Initializing entry view {} {}"
,
entry
,
compo
);
}
public
String
startVote
()
...
...
@@ -110,6 +128,7 @@ public class CompoView extends GenericCDIView {
public
String
createEntry
()
{
compo
=
votbean
.
addEntry
(
getEntry
());
return
null
;
}
...
...
@@ -209,4 +228,12 @@ public class CompoView extends GenericCDIView {
this
.
voteEntries
=
voteEntries
;
}
public
Integer
getCompoId
()
{
return
compoId
;
}
public
void
setCompoId
(
Integer
compoId
)
{
this
.
compoId
=
compoId
;
}
}
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