Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
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 fee1ce08
authored
May 18, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Streamisäätöjä..
1 parent
918c544e
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
241 additions
and
71 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/CardTemplateBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/Menubean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ReaderBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/UserBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/UserUtilBean.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/CardTemplateBeanLocal.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/PermissionBeanLocal.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/UserBeanLocal.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/ReaderEvent.java
code/LanBortalWeb/.metadata/WebContent/WEB-INF/faces-config.pageflow
code/LanBortalWeb/WebContent/WEB-INF/faces-config.xml
code/LanBortalWeb/WebContent/resources/cditools/shop/readerevents.xhtml
code/LanBortalWeb/WebContent/resources/cditools/user/usertabs.xhtml
code/LanBortalWeb/WebContent/shop/assocToUser.xhtml
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
code/LanBortalWeb/WebContent/useradmin/edit.xhtml
code/LanBortalWeb/WebContent/useradmin/userCards.xhtml
code/LanBortalWeb/WebContent/useradmin/validateUser.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n.properties
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_en.properties
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/helpers/ProductShopItem.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/CardTemplateBean.java
View file @
fee1ce0
...
...
@@ -176,7 +176,8 @@ public class CardTemplateBean implements CardTemplateBeanLocal {
}
@RolesAllowed
(
UserPermission
.
S_WRITE_ROLES
)
@Override
@RolesAllowed
(
UserPermission
.
S_VIEW_ALL
)
public
CardTemplate
getUsersCardtype
(
EventUser
user
)
{
List
<
Role
>
roles
=
userbean
.
findUsersRoles
(
user
);
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/Menubean.java
View file @
fee1ce0
...
...
@@ -93,6 +93,7 @@ public class Menubean implements MenubeanLocal {
shopTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/shop/createBill"
),
BillPermission
.
CREATE_BILL
);
shopTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/bill/list"
),
BillPermission
.
VIEW_OWN
);
shopTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/bill/edit"
),
null
).
setVisible
(
false
);
shopTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/shop/assocToUser"
),
null
).
setVisible
(
false
);
MenuNavigation
pollTopmenu
=
usernavi
.
addPage
(
null
,
null
);
pollTopmenu
.
setKey
(
"topnavi.poll"
);
...
...
@@ -121,6 +122,15 @@ public class Menubean implements MenubeanLocal {
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/place/adminInsertToken"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/sendPicture"
),
UserPermission
.
VIEW_ALL
).
setVisible
(
false
);
MenuNavigation
initUser
=
adminnavi
.
addPage
(
null
,
null
);
initUser
.
setKey
(
"topnavi.userinit"
);
initUser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/validateUser"
),
UserPermission
.
VIEW_ALL
);
MenuNavigation
usershop
=
adminnavi
.
addPage
(
null
,
null
);
usershop
.
setKey
(
"topnavi.adminshop"
);
usershop
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/shop/showReaderEvents"
),
ShopPermission
.
SHOP_TO_OTHERS
);
usershop
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/shop/listReaders"
),
ShopPermission
.
SHOP_TO_OTHERS
);
MenuNavigation
billnavi
=
adminnavi
.
addPage
(
null
,
null
);
billnavi
.
setKey
(
"topnavi.billing"
);
billnavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/bill/billSummary"
),
BillPermission
.
READ_ALL
);
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ReaderBean.java
View file @
fee1ce0
...
...
@@ -2,6 +2,7 @@ package fi.insomnia.bortal.beans;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.regex.Pattern
;
import
javax.ejb.EJB
;
import
javax.ejb.Stateless
;
...
...
@@ -45,12 +46,25 @@ public class ReaderBean implements ReaderBeanLocal {
@Override
public
ReaderEvent
checkTag
(
String
readerIdent
,
String
tag
,
String
hash
)
{
tag
=
tag
.
replace
(
"\"\b"
,
""
);
if
(
Pattern
.
matches
(
"^.*000000$"
,
tag
))
{
tag
=
tag
.
replace
(
"000000"
,
""
);
}
StringBuilder
sb
=
new
StringBuilder
(
tag
);
while
(
sb
.
length
()
<
16
)
{
sb
.
insert
(
0
,
"0"
);
}
tag
=
sb
.
toString
();
PrintedCard
card
=
cardfacade
.
findByRfid
(
tag
);
Reader
reader
=
readerfacade
.
findOrCreateByIdent
(
readerIdent
);
logger
.
info
(
"reader {},
ident {}"
,
reader
,
readerIdent
);
logger
.
info
(
"reader {},
card {}"
,
reader
,
card
);
// RfidEvent revent = reventcontainer.foundTag(reader, tag);
List
<
ReaderEvent
>
lastevents
=
readerEventFacade
.
findLastEvents
(
reader
,
1
);
ReaderEvent
ret
=
null
;
if
(!
lastevents
.
isEmpty
())
{
ReaderEvent
lastevent
=
lastevents
.
get
(
0
);
...
...
@@ -206,6 +220,10 @@ public class ReaderBean implements ReaderBeanLocal {
{
CardTemplate
ct
=
cardTemplateBean
.
getUsersCardtype
(
user
);
if
(
ct
==
null
)
{
return
null
;
}
PrintedCard
card
=
new
PrintedCard
(
user
,
ct
,
null
,
true
);
card
.
setRfidUid
(
event
.
getValue
());
cardfacade
.
create
(
card
);
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/UserBean.java
View file @
fee1ce0
...
...
@@ -281,7 +281,7 @@ public class UserBean implements UserBeanLocal {
User
user
=
userFacade
.
findByLogin
(
username
);
String
hash
=
PasswordFunctions
.
generateRandomString
(
25
);
logger
.
info
(
"Initializing password sending: {}, hash: {}"
,
user
,
hash
);
String
path
=
MessageFormat
.
format
(
url
,
new
Object
[]
{
user
.
getId
(),
hash
});
String
path
=
MessageFormat
.
format
(
url
,
new
Object
[]
{
user
.
getId
()
.
toString
()
,
hash
});
if
(
hash
==
null
||
hash
.
length
()
<
20
||
user
==
null
||
user
.
getEmail
()
==
null
||
user
.
getEmail
().
length
()
<=
5
)
{
logger
.
info
(
"Not sending email with params {} {}"
,
new
Object
[]
{
user
,
hash
});
...
...
@@ -450,4 +450,18 @@ public class UserBean implements UserBeanLocal {
}
return
ret
;
}
@Override
public
EventUser
validateUser
(
String
username
,
String
password
)
{
User
user
=
userFacade
.
findByLogin
(
username
);
EventUser
ret
=
null
;
if
(
user
.
checkPassword
(
password
))
{
ret
=
this
.
getEventUser
(
user
);
}
return
ret
;
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/UserUtilBean.java
View file @
fee1ce0
...
...
@@ -8,7 +8,8 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.facade.UserFacade
;
import
fi.insomnia.bortal.model.IUser
;
import
fi.insomnia.bortal.model.EventUser
;
import
fi.insomnia.bortal.model.User
;
/**
* Session Bean implementation class UserUtilBean
...
...
@@ -34,12 +35,12 @@ public class UserUtilBean implements UserUtilBeanLocal {
@Override
public
void
convertUsernames
()
{
for
(
I
User
u
:
userbean
.
getUsers
())
{
for
(
Event
User
u
:
userbean
.
getUsers
())
{
if
(
u
.
getLogin
().
trim
().
isEmpty
())
{
logger
.
warn
(
"User {} has empty login..."
);
continue
;
}
I
User
testU
=
userfacade
.
findByLogin
(
u
.
getLogin
().
toLowerCase
());
User
testU
=
userfacade
.
findByLogin
(
u
.
getLogin
().
toLowerCase
());
if
(
testU
==
null
||
testU
.
equals
(
u
))
{
u
.
setLogin
(
u
.
getLogin
().
toLowerCase
());
logger
.
info
(
"Converted user {}"
,
u
.
getLogin
());
...
...
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/CardTemplateBeanLocal.java
View file @
fee1ce0
...
...
@@ -7,7 +7,6 @@ import javax.ejb.Local;
import
fi.insomnia.bortal.model.CardTemplate
;
import
fi.insomnia.bortal.model.EventUser
;
import
fi.insomnia.bortal.model.IUser
;
import
fi.insomnia.bortal.model.PrintedCard
;
import
fi.insomnia.bortal.utilities.jsf.EntityFinderBean
;
...
...
@@ -40,4 +39,6 @@ public interface CardTemplateBeanLocal extends EntityFinderBean<CardTemplate> {
PrintedCard
checkPrintedCard
(
EventUser
user
);
CardTemplate
getUsersCardtype
(
EventUser
user
);
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/PermissionBeanLocal.java
View file @
fee1ce0
...
...
@@ -6,7 +6,6 @@ import javax.resource.spi.IllegalStateException;
import
fi.insomnia.bortal.enums.apps.IAppPermission
;
import
fi.insomnia.bortal.model.EventUser
;
import
fi.insomnia.bortal.model.IUser
;
import
fi.insomnia.bortal.model.User
;
@Local
public
interface
PermissionBeanLocal
{
...
...
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/UserBeanLocal.java
View file @
fee1ce0
...
...
@@ -64,4 +64,6 @@ public interface UserBeanLocal {
*/
EventUser
getEventUser
(
User
user
);
EventUser
validateUser
(
String
username
,
String
password
);
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/ReaderEvent.java
View file @
fee1ce0
package
fi
.
insomnia
.
bortal
.
model
;
import
static
javax
.
persistence
.
CascadeType
.
ALL
;
import
java.util.Calendar
;
import
javax.persistence.Column
;
...
...
@@ -49,7 +47,7 @@ public class ReaderEvent extends GenericEntity {
private
PrintedCard
printedCard
;
@JoinColumn
(
name
=
"readers_id"
,
referencedColumnName
=
"id"
,
nullable
=
false
,
updatable
=
false
)
@ManyToOne
(
optional
=
false
,
cascade
=
ALL
)
@ManyToOne
(
optional
=
false
)
private
Reader
reader
;
public
ReaderEvent
(
Calendar
eventTime
,
PrintedCard
card
,
Reader
reader
)
{
...
...
code/LanBortalWeb/.metadata/WebContent/WEB-INF/faces-config.pageflow
View file @
fee1ce0
<?xml version="1.0" encoding="UTF-8"?>
<pageflow:Pageflow
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:pageflow=
"http://www.sybase.com/suade/pageflow"
id=
"pf13012981621060"
configfile=
"/LanBortalWeb/WebContent/WEB-INF/faces-config.xml"
>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"*"
x=
"122"
y=
"
370"
id=
"pf131682121330014"
referenceLink=
"//@navigationRule.0/@fromViewId|"
outlinks=
"pf131682121330015 pf1319650625664
0"
path=
"*"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"*"
x=
"122"
y=
"
562"
id=
"pf131682121330014"
referenceLink=
"//@navigationRule.0/@fromViewId|"
outlinks=
"pf131682121330015 pf13196506256640 pf1337295634797
0"
path=
"*"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"auth/logoutResponse"
x=
"338"
y=
"178"
id=
"pf131682121330016"
referenceLink=
"//@navigationRule.0/@navigationCase.0/@toViewId|"
inlinks=
"pf131682121330015"
path=
"/auth/logoutResponse"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"place/placemap"
x=
"122"
y=
"
754"
id=
"pf13168224196920"
referenceLink=
"//@navigationRule.3
/@navigationCase.0/@toViewId|"
outlinks=
"pf13168224196921"
inlinks=
"pf13168224196921"
path=
"/place/placemap"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"place/placemap"
x=
"122"
y=
"
946"
id=
"pf13168224196920"
referenceLink=
"//@navigationRule.2
/@navigationCase.0/@toViewId|"
outlinks=
"pf13168224196921"
inlinks=
"pf13168224196921"
path=
"/place/placemap"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"user/sendPicture"
x=
"338"
y=
"562"
id=
"pf13196506256641"
referenceLink=
"//@navigationRule.0/@navigationCase.1/@toViewId|"
inlinks=
"pf13196506256640"
path=
"/user/sendPicture"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/edit"
x=
"122"
y=
"1138"
id=
"pf13241645918110"
path=
"/news/edit.xhtml"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/listAll"
x=
"122"
y=
"1522"
id=
"pf13241645918111"
path=
"/news/listAll.xhtml"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"actionlog/messagelist"
x=
"122"
y=
"2290"
id=
"pf13336707109910"
referenceLink=
"//@navigationRule.4/@navigationCase.0/@toViewId|"
outlinks=
"pf13336707109911"
inlinks=
"pf13336707109911"
path=
"/actionlog/messagelist.xhtml"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/editNews"
x=
"36"
y=
"96"
id=
"pf13336707109912"
referenceLink=
"//@navigationRule.1/@fromViewId|"
outlinks=
"pf13336707109913"
path=
"/news/editNews"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/listAll"
x=
"352"
y=
"84"
id=
"pf13336707109914"
referenceLink=
"//@navigationRule.1/@navigationCase.0/@toViewId|"
inlinks=
"pf13336707109913"
path=
"/news/listAll"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"shop/createBill"
x=
"468"
y=
"144"
id=
"pf13365201875590"
referenceLink=
"//@navigationRule.2/@fromViewId|"
outlinks=
"pf13365201875591"
path=
"/shop/createBill"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"bill/list"
x=
"732"
y=
"96"
id=
"pf13365201875592"
referenceLink=
"//@navigationRule.2/@navigationCase.0/@toViewId|"
inlinks=
"pf13365201875591"
path=
"/bill/list"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/edit"
x=
"122"
y=
"1330"
id=
"pf13241645918110"
path=
"/news/edit.xhtml"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/listAll"
x=
"122"
y=
"1714"
id=
"pf13241645918111"
path=
"/news/listAll.xhtml"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"actionlog/messagelist"
x=
"122"
y=
"2098"
id=
"pf13336707109910"
referenceLink=
"//@navigationRule.3/@navigationCase.0/@toViewId|"
outlinks=
"pf13336707109911"
inlinks=
"pf13336707109911"
path=
"/actionlog/messagelist.xhtml"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/editNews"
x=
"122"
y=
"2482"
id=
"pf13336707109912"
referenceLink=
"//@navigationRule.1/@fromViewId|"
outlinks=
"pf13336707109913"
path=
"/news/editNews"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/listAll"
x=
"338"
y=
"2482"
id=
"pf13336707109914"
referenceLink=
"//@navigationRule.1/@navigationCase.0/@toViewId|"
inlinks=
"pf13336707109913"
path=
"/news/listAll"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"shop/createBill"
x=
"122"
y=
"2866"
id=
"pf13365201875590"
referenceLink=
"//@navigationRule.2/@fromViewId|"
path=
"/shop/createBill"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"bill/list"
x=
"338"
y=
"946"
id=
"pf13365201875592"
referenceLink=
"//@navigationRule.0/@navigationCase.2/@toViewId|"
inlinks=
"pf13372956347970"
path=
"/bill/list"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"voting/create"
x=
"122"
y=
"3250"
id=
"pf13372956347981"
referenceLink=
"//@navigationRule.4/@fromViewId|"
outlinks=
"pf13372956347982"
path=
"/voting/create.xhtml"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"voting/compolist.xhtml"
x=
"338"
y=
"3250"
id=
"pf13372956347983"
referenceLink=
"//@navigationRule.4/@navigationCase.0/@toViewId|"
inlinks=
"pf13372956347982"
path=
"/voting/compolist.xhtml"
/>
<links
id=
"pf131682121330015"
target=
"pf131682121330016"
source=
"pf131682121330014"
outcome=
"logoutDone"
redirect=
"true"
/>
<links
id=
"pf13196506256640"
target=
"pf13196506256641"
source=
"pf131682121330014"
outcome=
"redirToUserimage"
redirect=
"true"
/>
<links
id=
"pf13336707109913"
target=
"pf13336707109914"
source=
"pf13336707109912"
outcome=
"news/listAll"
redirect=
"true"
/>
<links
id=
"pf13372956347970"
target=
"pf13365201875592"
source=
"pf131682121330014"
outcome=
"redirBillList"
redirect=
"true"
/>
<links
id=
"pf13372956347982"
target=
"pf13372956347983"
source=
"pf13372956347981"
outcome=
"success"
redirect=
"true"
/>
<links
id=
"pf13168224196921"
target=
"pf13168224196920"
source=
"pf13168224196920"
outcome=
"placesReserved"
redirect=
"true"
>
<bendPoints
d1Height=
"-36"
d2Height=
"-36"
/>
<bendPoints
d1Width=
"-64"
d1Height=
"-36"
d2Width=
"-64"
d2Height=
"-36"
/>
...
...
@@ -23,6 +28,4 @@
<bendPoints
d1Width=
"-64"
d1Height=
"-36"
d2Width=
"-64"
d2Height=
"-36"
/>
<bendPoints
d1Width=
"-64"
d2Width=
"-64"
/>
</links>
<links
id=
"pf13336707109913"
target=
"pf13336707109914"
source=
"pf13336707109912"
outcome=
"news/listAll"
redirect=
"true"
/>
<links
id=
"pf13365201875591"
target=
"pf13365201875592"
source=
"pf13365201875590"
outcome=
"bill_list"
redirect=
"true"
/>
</pageflow:Pageflow>
code/LanBortalWeb/WebContent/WEB-INF/faces-config.xml
View file @
fee1ce0
...
...
@@ -47,6 +47,11 @@
<navigation-rule>
<from-view-id>
*
</from-view-id>
<navigation-case>
<from-outcome>
shopToUser
</from-outcome>
<to-view-id>
/shop/shopToUser
</to-view-id>
<redirect
/>
</navigation-case>
<navigation-case>
<from-outcome>
logoutDone
</from-outcome>
<to-view-id>
/auth/logoutResponse
</to-view-id>
<redirect
/>
...
...
@@ -118,13 +123,13 @@
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>
voting/create
</display-name>
<from-view-id>
/voting/create.xhtml
</from-view-id>
<navigation-case>
<from-outcome>
success
</from-outcome>
<to-view-id>
/voting/compolist.xhtml
</to-view-id>
<redirect
/>
</navigation-case>
<display-name>
voting/create
</display-name>
<from-view-id>
/voting/create.xhtml
</from-view-id>
<navigation-case>
<from-outcome>
success
</from-outcome>
<to-view-id>
/voting/compolist.xhtml
</to-view-id>
<redirect
/>
</navigation-case>
</navigation-rule>
</faces-config>
...
...
code/LanBortalWeb/WebContent/resources/cditools/shop/readerevents.xhtml
View file @
fee1ce0
...
...
@@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:composite=
"http://java.sun.com/jsf/composite"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
>
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
xmlns:p=
"http://primefaces.org/ui"
>
<composite:interface>
...
...
@@ -10,6 +10,7 @@
<composite:implementation>
<h:form>
<p:poll
interval=
"3"
/>
<h:dataTable
border=
"1"
id=
"event"
value=
"#{readerView.readerEvents}"
var=
"event"
>
<h:column>
<f:facet
name=
"header"
>
...
...
code/LanBortalWeb/WebContent/resources/cditools/user/usertabs.xhtml
View file @
fee1ce0
...
...
@@ -9,8 +9,13 @@
<composite:implementation>
<h:outputStylesheet
library=
"style"
name=
"tabnav.css"
/>
<div
class=
"userstatus"
style=
"float: right; margin-right: 10px; color: #7DAC0C; font-size: 16px;"
>
<h:outputText
value=
"#{i18n['user.cardPower']}: #{userView.usersCardtemplate.name}"
/>
</div>
<ui:fragment
rendered=
"#{!userView.currentUser}"
>
<h2>
#{i18n['usertitle.managingUser']}: #{userView.user.wholeName}
</h2>
<h2>
<h:outputText
value=
"#{i18n['usertitle.managingUser']}: #{userView.user.nick} / #{userView.user.wholeName} "
/>
</h2>
</ui:fragment>
...
...
@@ -21,9 +26,6 @@
<f:param
name=
"userid"
value=
"#{userView.user.user.id}"
/>
</h:link></li>
<li
class=
"chpass"
><h:link
outcome=
"/useradmin/changePassword"
value=
"#{i18n['submenu.user.changePassword']}"
>
<f:param
name=
"userid"
value=
"#{userView.user.user.id}"
/>
</h:link></li>
<li
class=
"shop"
><h:link
outcome=
"/shop/shopToUser"
value=
"#{i18n['submenu.user.shop']}"
>
<f:param
name=
"userid"
value=
"#{userView.user.user.id}"
/>
...
...
@@ -45,9 +47,6 @@
</ul>
</div>
</composite:implementation>
</html>
code/LanBortalWeb/WebContent/shop/assocToUser.xhtml
View file @
fee1ce0
...
...
@@ -12,23 +12,7 @@
<ui:define
name=
"content"
>
<ui:fragment
rendered=
"#{!empty readerView.neighborUser}"
>
<h:form>
<h:dataTable
var=
"card"
value=
"#{readerView.neighborUser.printedCards}"
>
<h:column>
<h:outputText
value=
"#{card.template.name}"
/>
</h:column>
<h:column>
<h:outputText
value=
"#{card.printCount}"
/>
</h:column>
<h:column>
<h:commandButton
action=
"#{readerView.assocToNeighborCard()}"
value=
"#{i18n['readerView.assocToNeighborCard']}"
/>
</h:column>
</h:dataTable>
<h:commandButton
action=
"#{readerView.assocToNeighbor()}"
value=
"#{i18n['readerView.assocToNeighbor']}"
/>
</h:form>
</ui:fragment>
<h:outputText
rendered=
"#{empty readerView.event}"
value=
"#{i18n['rfidevent.empty']}"
/>
<h:panelGrid
columns=
"2"
rendered=
"#{!empty readerView.event}"
>
...
...
@@ -38,13 +22,6 @@
<h:outputLabel
value=
"#{i18n['rfidevent.tag']}:"
/>
<h:outputText
value=
"#{readerView.event.value}"
/>
<h:outputLabel
value=
"#{i18n['rfidevent.insertplacecode']}"
/>
<h:form
id=
"placecodeform"
>
<h:inputText
value=
"#{readerView.placecode}"
/>
<h:commandButton
value=
"#{i18n['readerView.assocToPlacecode']}"
action=
"#{readerView.assocToPlacecode()}"
/>
</h:form>
<h:outputLabel
value=
"#{i18n['rfidevent.searchuser']}"
/>
<h:form
id=
"usersearchform"
>
<h:inputText
value=
"#{readerView.usersearch}"
/>
...
...
@@ -53,7 +30,6 @@
</h:panelGrid>
<h:form
rendered=
"#{!empty readerView.userlist}"
id=
"usercardclickform"
>
<h:dataTable
border=
"1"
id=
"userassoclist"
value=
"#{readerView.userlist}"
var=
"user"
>
<h:column>
<f:facet
name=
"header"
>
...
...
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
View file @
fee1ce0
...
...
@@ -21,15 +21,19 @@
<h:form
id=
"shoppingcartform"
>
<h:panelGrid
columns=
"2"
>
<h:outputLabel
value=
"#{i18n['shop.totalPrice']}"
/>
<h:outputText
value=
"#{productShopView.totalPrice}"
>
<h:outputLabel
style=
"#{productShopView.accountPositive?'':'color: red;'} font-size: 1.1em;"
value=
"#{i18n['shop.accountBalance']}"
/>
<h:outputText
style=
"#{productShopView.accountPositive?'':'color: red';} font-size: 1.1em;"
value=
"#{productShopView.accountBalance}"
>
<f:convertNumber
/>
</h:outputText>
<h:outputLabel
value=
"#{i18n['shop.accountBalance']}"
/>
<h:outputText
value=
"#{productShopView.accountBalance}"
>
<h:outputLabel
value=
"#{i18n['shop.totalPrice']}"
/>
<h:outputText
value=
"#{productShopView.totalPrice}"
>
<f:convertNumber
/>
</h:outputText>
<h:outputLabel
value=
"#{i18n['shop.cash']}"
/>
<h:inputText
value=
"#{productShopView.cash}"
>
<f:ajax
render=
"@form"
event=
"valueChange"
/>
...
...
@@ -39,6 +43,7 @@
</h:panelGrid>
<h:outputText
value=
"#{i18n['product.shopInstant']}"
/>
<products:shop
commitaction=
"#{productShopView.commitShoppingCart()}"
items=
"#{productShopView.shoppingcart}"
commitValue=
"#{i18n['productshop.commit']}"
/>
<h:selectBooleanCheckbox
value=
"#{productShopView.payInstant}"
>
<f:ajax
render=
"@form"
execute=
"@form"
/>
</h:selectBooleanCheckbox>
...
...
code/LanBortalWeb/WebContent/useradmin/edit.xhtml
View file @
fee1ce0
...
...
@@ -15,6 +15,11 @@
<users:usertabs
tabId=
"edit"
/>
</ui:define>
<ui:define
name=
"content"
>
<p>
<h:link
outcome=
"/useradmin/changePassword"
value=
"#{i18n['submenu.user.changePassword']}"
>
<f:param
name=
"userid"
value=
"#{userView.user.user.id}"
/>
</h:link>
</p>
<users:edit
commitaction=
"#{userView.saveUser()}"
commitvalue=
"#{i18n['user.save']}"
/>
<h:form
id=
"roleform"
rendered=
"#{roleView.canReadRoles()}"
>
...
...
code/LanBortalWeb/WebContent/useradmin/userCards.xhtml
0 → 100644
View file @
fee1ce0
<!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:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:f=
"http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{userView.initView}"
/>
</f:metadata>
<ui:param
name=
"thispage"
value=
"page.account.list"
/>
<ui:define
name=
"title"
>
<h1>
#{i18n['user.usercards']}
</h1>
<users:usertabs
tabId=
"usercards"
/>
</ui:define>
<ui:define
name=
"content"
>
<h:dataTable
var=
"card"
value=
"#{userView.user.printedCards}"
>
<h:column>
<h:outputText
value=
"#{card.rfidUid}"
/>
</h:column>
<h:column>
<h:outputText
value=
"#{card.template.name}"
/>
</h:column>
</h:dataTable>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/WebContent/useradmin/validateUser.xhtml
0 → 100644
View file @
fee1ce0
<!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:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:account=
"http://java.sun.com/jsf/composite/cditools/account"
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=
"#{userView.initValidateView}"
/>
</f:metadata>
<ui:define
name=
"title"
>
<h1>
#{i18n['user.validateUser.header']}
</h1>
</ui:define>
<ui:define
name=
"content"
>
<h:form
id=
"validate"
>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
for=
"login"
value=
"#{i18n['login.username']}"
/>
<h:inputText
id=
"login"
value=
"#{userView.username}"
/>
<h:message
for=
"login"
/>
<h:outputLabel
for=
"pwd"
value=
"#{i18n['login.password']}"
/>
<h:inputSecret
id=
"pwd"
value=
"#{userView.password}"
/>
<h:message
for=
"pwd"
/>
</h:panelGrid>
<h:commandButton
action=
"#{userView.validateUser}"
value=
"#{i18n['user.validateUser.commit']}"
/>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n.properties
View file @
fee1ce0
...
...
@@ -29,4 +29,4 @@ productshop.minusTen = -10
productshop.plusOne
=
+1
productshop.plusTen
=
+10
user.unauthenticated
=
Kirjautumaton
user.unauthenticated
=
Kirjautumaton
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_en.properties
View file @
fee1ce0
...
...
@@ -342,13 +342,18 @@ productshop.noItemsInCart = There are no products in shopping cart
productshop.total
=
Total
reader.assocToCard
=
Associate to card
reader.description
=
Description
reader.name
=
Reader name
reader.select
=
Select reader
reader.tag
=
Tag
reader.user
=
User
readerView.searchforuser
=
Search user
readerevent.associateToUser
=
Associate to user
readerevent.seenSince
=
Last seen
readerevent.shopToUser
=
Buy to user
readerevent.tagname
=
Tag
readerview.cards
=
Card ( printcount )
...
...
@@ -371,7 +376,7 @@ role.parents = Parents
role.read
=
(R)
role.write
=
(W)
shop.accountBalance
=
B
alance
shop.accountBalance
=
Account b
alance
shop.cash
=
Cash deposit
shop.totalPrice
=
Price of products
shop.user
=
Selling to
...
...
@@ -429,6 +434,8 @@ submenu.product.list = List products
submenu.role.create
=
Create role
submenu.role.list
=
Roles
submenu.shop.createBill
=
Shop
submenu.shop.listReaders
=
List readers
submenu.shop.showReaderEvents
=
Reader events
submenu.user.accountEvents
=
Account events
submenu.user.changePassword
=
Change password
submenu.user.create
=
Create new user
...
...
@@ -449,6 +456,7 @@ supernavi.user = Userview
template.loggedInAs
=
Logged in as:
topnavi.adminshop
=
Adminshop
topnavi.billing
=
Billing
topnavi.contents
=
Site contents
topnavi.frontpage
=
Front page
...
...
@@ -458,6 +466,7 @@ topnavi.poll = Polls
topnavi.products
=
Products
topnavi.shop
=
Shop
topnavi.user
=
My properties
topnavi.userinit
=
User auth
topnavi.usermgmt
=
Users
user.accountBalance
=
Account balance
...
...
@@ -466,6 +475,7 @@ user.accountevents = Account events
user.address
=
Address
user.bank
=
Bank
user.bankaccount
=
Bank number
user.cardPower
=
Usertype
user.changePassword
=
Change password
user.changepassword.forUser
=
For user
user.changepassword.title
=
Change password
...
...
@@ -481,6 +491,7 @@ user.image = Image
user.imagelist
=
Saved images
user.imagesubmit
=
Send image
user.insertToken
=
Insert token
user.invalidLoginCredentials
=
Invalid user credentials
user.invite
=
Invite
user.invite.header
=
Accept invitation
user.invitemail
=
Email address
...
...
@@ -516,6 +527,8 @@ user.town = City
user.uploadimage
=
Send image
user.username
=
Username
user.validate.notUniqueUsername
=
Username already exists. Please select another.
user.validateUser.commit
=
Send
user.validateUser.header
=
Please insert credentials
user.wholeName
=
Name
user.zipCode
=
Postal nr.
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
fee1ce0
...
...
@@ -332,13 +332,18 @@ productshop.noItemsInCart = Ostoskorissa ei ole tuotteita
productshop.total
=
Yhteens
\u
00E4
reader.assocToCard
=
Yhdist
\u
00E4 korttiin
reader.description
=
Kuvaus
reader.name
=
Lukijan nimi
reader.select
=
Valitse lukija
reader.tag
=
Tag
reader.user
=
K
\u
00E4ytt
\u
00E4j
\u
00E4
readerView.searchforuser
=
Etsi k
\u
00E4ytt
\u
00E4j
\u
00E4
\u
00E4
readerevent.associateToUser
=
Yhdist
\u
00E4 k
\u
00E4ytt
\u
00E4j
\u
00E4
\u
00E4n
readerevent.seenSince
=
N
\u
00E4hty viimeksi
readerevent.shopToUser
=
Osta k
\u
00E4ytt
\u
00E4j
\u
00E4lle
readerevent.tagname
=
Tagi
readerview.cards
=
Kortit ( tulostuslkm )
...
...
@@ -417,6 +422,8 @@ submenu.product.list = Listaa tuotteet
submenu.role.create
=
Luo rooli
submenu.role.list
=
Roolit
submenu.shop.createBill
=
Luo lasku
submenu.shop.listReaders
=
N
\u
00E4yt
\u
00E4 lukijat
submenu.shop.showReaderEvents
=
Lukijan tapahtumat
submenu.user.accountEvents
=
Tilitapahtumat
submenu.user.changePassword
=
Vaihda salasana
submenu.user.create
=
Luo k
\u
00E4ytt
\u
00E4j
\u
00E4
...
...
@@ -440,6 +447,7 @@ supernavi.user = K\u00E4ytt\u00E4j\u00E4n\u00E4kym\u00E4
template.loggedInAs
=
Kirjautunut tunnuksella:
topnavi.adminshop
=
Kauppa
topnavi.billing
=
Laskutus
topnavi.contents
=
Sivuston sis
\u
00E4lt
\u
00F6
topnavi.frontpage
=
Etusivu
...
...
@@ -449,6 +457,7 @@ topnavi.poll = Kyselyt
topnavi.products
=
Tuotteet
topnavi.shop
=
Kauppa
topnavi.user
=
Omat tiedot
topnavi.userinit
=
K
\u
00E4ytt
\u
00E4j
\u
00E4n tunnistus
topnavi.usermgmt
=
K
\u
00E4ytt
\u
00E4j
\u
00E4t
user.accountBalance
=
Tilin saldo
...
...
@@ -457,6 +466,7 @@ user.accountevents = Tilitapahtumat
user.address
=
Osoite
user.bank
=
Pankki
user.bankaccount
=
Pankkitili
user.cardPower
=
K
\u
00E4ytt
\u
00E4j
\u
00E4tyyppi
user.changePassword
=
Vaihda salasana
user.changepassword.forUser
=
K
\u
00E4ytt
\u
00E4j
\u
00E4lle
user.changepassword.title
=
Vaihda salasana
...
...
@@ -471,6 +481,7 @@ user.hasImage = Kuva
user.imageUploaded
=
Kuva l
\u
00E4hetetty.
user.imagelist
=
Tallennetut kuvat
user.imagesubmit
=
L
\u
00E4het
\u
00E4 kuva
user.invalidLoginCredentials
=
K
\u
00E4ytt
\u
00E4j
\u
00E4tunnus tai salasana v
\u
00E4
\u
00E4rin.
user.invite
=
Kutsu
user.invite.header
=
Luo k
\u
00E4ytt
\u
00E4j
\u
00E4 kutsusta
user.invitemail
=
S
\u
00E4hk
\u
00F6postiosoite
...
...
@@ -504,6 +515,8 @@ user.town = Kaupunki
user.uploadimage
=
L
\u
00E4het
\u
00E4 kuva
user.username
=
K
\u
00E4ytt
\u
00E4j
\u
00E4tunnus
user.validate.notUniqueUsername
=
K
\u
00E4ytt
\u
00E4j
\u
00E4tunnus on jo olemassa. Ole hyv
\u
00E4 ja valitse toinen tunnus
user.validateUser.commit
=
L
\u
00E4het
\u
00E4
user.validateUser.header
=
Ole hyv
\u
00E4 ja sy
\u
00F6t
\u
00E4 kirjautumistiedot
user.wholeName
=
Nimi
user.zipCode
=
Postinumero
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
View file @
fee1ce0
...
...
@@ -86,7 +86,7 @@ public class ProductShopView extends GenericCDIView {
ret
=
ret
.
add
(
getCash
());
ret
=
ret
.
subtract
(
getTotalPrice
());
logger
.
info
(
"User accountbalance {}, cash{}, total {}. retBalance {}"
,
new
Object
[]
{
user
.
getAccountBalance
(),
cash
,
getTotalPrice
(),
ret
user
.
getAccountBalance
(),
getCash
()
,
getTotalPrice
(),
ret
});
return
ret
;
}
...
...
@@ -201,6 +201,9 @@ public class ProductShopView extends GenericCDIView {
cash
=
getTotalPrice
();
logger
.
info
(
"Getting instantcash as {}"
,
cash
);
}
if
(
cash
==
null
)
{
cash
=
BigDecimal
.
ZERO
;
}
return
cash
;
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserView.java
View file @
fee1ce0
...
...
@@ -20,6 +20,7 @@ import fi.insomnia.bortal.beans.EventBeanLocal;
import
fi.insomnia.bortal.beans.RoleBeanLocal
;
import
fi.insomnia.bortal.beans.UserBeanLocal
;
import
fi.insomnia.bortal.enums.apps.UserPermission
;
import
fi.insomnia.bortal.model.CardTemplate
;
import
fi.insomnia.bortal.model.EventUser
;
import
fi.insomnia.bortal.model.PrintedCard
;
import
fi.insomnia.bortal.model.Role
;
...
...
@@ -29,7 +30,7 @@ import fi.insomnia.bortal.web.annotations.LoggedIn;
import
fi.insomnia.bortal.web.annotations.SelectedUser
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@Named
(
"userView"
)
@Named
()
@ConversationScoped
public
class
UserView
extends
GenericCDIView
{
...
...
@@ -42,6 +43,8 @@ public class UserView extends GenericCDIView {
private
transient
UserBeanLocal
userbean
;
private
Integer
userid
;
private
UploadedFile
image
;
@EJB
private
CardTemplateBeanLocal
ctbean
;
private
CroppedImage
croppedImage
;
...
...
@@ -59,6 +62,7 @@ public class UserView extends GenericCDIView {
}
private
boolean
canSave
=
false
;
private
String
username
;
private
String
password
;
private
String
passwordcheck
;
...
...
@@ -164,11 +168,28 @@ public class UserView extends GenericCDIView {
}
}
public
void
initValidateView
()
{
super
.
requirePermissions
(
UserPermission
.
VIEW_ALL
);
}
public
boolean
canManage
()
{
return
permbean
.
hasPermission
(
UserPermission
.
MODIFY
);
}
public
String
validateUser
()
{
user
=
userbean
.
validateUser
(
username
,
password
);
if
(
user
!=
null
)
{
super
.
beginConversation
();
return
"shopToUser"
;
}
super
.
addFaceMessage
(
"user.invalidLoginCredentials"
);
return
null
;
}
public
String
saveUser
()
{
if
(
permbean
.
getCurrentUser
().
equals
(
user
)
||
permbean
.
hasPermission
(
UserPermission
.
MODIFY
))
{
...
...
@@ -182,6 +203,13 @@ public class UserView extends GenericCDIView {
return
"edit"
;
}
public
CardTemplate
getUsersCardtemplate
()
{
CardTemplate
ret
=
ctbean
.
getUsersCardtype
(
user
);
logger
.
info
(
"Users cardtemplate is {}"
,
ret
);
return
ret
;
}
public
boolean
isCurrentUser
()
{
return
permbean
.
isCurrentUser
(
user
);
...
...
@@ -247,4 +275,12 @@ public class UserView extends GenericCDIView {
public
void
setUsersRoles
(
List
<
Role
>
usersRoles
)
{
this
.
usersRoles
=
usersRoles
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/helpers/ProductShopItem.java
View file @
fee1ce0
...
...
@@ -38,8 +38,7 @@ public class ProductShopItem {
public
static
List
<
ProductShopItem
>
productGTList
(
List
<
Product
>
products
)
{
List
<
ProductShopItem
>
ret
=
new
ArrayList
<
ProductShopItem
>();
for
(
Product
prod
:
products
)
{
if
(
prod
.
getPrice
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
prod
.
getPrice
().
compareTo
(
BigDecimal
.
ZERO
)
>=
0
)
{
ret
.
add
(
new
ProductShopItem
(
prod
));
}
}
...
...
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