Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5b2d2f0c
authored
Feb 25, 2013
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user side also, not tested yet
1 parent
ee9d6ad5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
10 deletions
code/MoyaDatabase/src/fi/codecrew/moya/model/AccountEvent.java
code/MoyaWeb/WebContent/gamecode/manageCodes.xhtml
code/MoyaWeb/WebContent/gamecode/viewCodes.xhtml
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/game/GameCodeView.java
code/MoyaDatabase/src/fi/codecrew/moya/model/AccountEvent.java
View file @
5b2d2f0
...
@@ -61,7 +61,7 @@ public class AccountEvent extends GenericEntity {
...
@@ -61,7 +61,7 @@ public class AccountEvent extends GenericEntity {
private
Calendar
delivered
;
private
Calendar
delivered
;
@Column
(
name
=
"delivered_count"
,
nullable
=
false
,
precision
=
24
,
scale
=
4
)
@Column
(
name
=
"delivered_count"
,
nullable
=
false
,
precision
=
24
,
scale
=
4
)
private
BigDecimal
deliveredCount
;
private
BigDecimal
deliveredCount
=
new
BigDecimal
(
0
)
;
/**
/**
* If this AccountEvent is a product in foodwace, this field is a reference
* If this AccountEvent is a product in foodwace, this field is a reference
...
...
code/MoyaWeb/WebContent/gamecode/manageCodes.xhtml
View file @
5b2d2f0
...
@@ -6,12 +6,13 @@
...
@@ -6,12 +6,13 @@
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{gameCodeView.initView}"
/>
<f:event
type=
"preRenderView"
listener=
"#{gameCodeView.init
Admin
View}"
/>
</f:metadata>
</f:metadata>
<ui:param
name=
"thispage"
value=
"page.game
.list
"
/>
<ui:param
name=
"thispage"
value=
"page.game
code.manageCodes
"
/>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<h:form>
<h:dataTable
border=
"1"
id=
"games"
value=
"#{gameCodeView.games}"
var=
"game"
>
<h:dataTable
border=
"1"
id=
"games"
value=
"#{gameCodeView.games}"
var=
"game"
>
<h:column>
<h:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
...
@@ -34,6 +35,7 @@
...
@@ -34,6 +35,7 @@
</h:column>
</h:column>
</h:dataTable>
</h:dataTable>
</h:form>
<h:form>
<h:form>
<h:outputLabel
value=
"name"
/>
<h:outputLabel
value=
"name"
/>
...
...
code/MoyaWeb/WebContent/gamecode/viewCodes.xhtml
View file @
5b2d2f0
<!DOCTYPE html
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
"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"
<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:products=
"http://java.sun.com/jsf/composite/tools/products"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
xmlns:f=
"http://java.sun.com/jsf/core"
>
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:products=
"http://java.sun.com/jsf/composite/tools/products"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
xmlns:f=
"http://java.sun.com/jsf/core"
>
<h:body>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:param
name=
"thispage"
value=
"page.game.list"
/>
<ui:param
name=
"thispage"
value=
"page.gamecode.viewCodes"
/>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{gameCodeView.initUserView}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
No codes :(
<h:form>
<h:outputLabel
rendered=
"#{gameCodeView.noGameCodes}"
value=
"#{i18n['game.noGameCodes']}"
/>
<h:dataTable
rendered=
"#{not gameCodeView.noGameCodes}"
border=
"1"
id=
"codes"
value=
"#{gameCodeView.gameCodes}"
var=
"code"
>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.name']}"
/>
</f:facet>
<h:outputText
value=
"#{code.game.name}"
/>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.description']}"
/>
</f:facet>
<h:outputText
value=
"#{code.game.description}"
/>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['gamecode.code']}"
/>
</f:facet>
<h:commandButton
rendered=
"#{not code.accessed}"
value=
"#{i18n['gamecode.open']}"
action=
"#{gameCodeView.openSelectedCode}"
/>
<h:outputText
rendered=
"#{code.accessed}"
value=
"#{code.code}"
/>
</h:column>
</h:dataTable>
</h:form>
</ui:define>
</ui:define>
</ui:composition>
</ui:composition>
</h:body>
</h:body>
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/game/GameCodeView.java
View file @
5b2d2f0
...
@@ -10,6 +10,7 @@ import fi.codecrew.moya.beans.EventBeanLocal;
...
@@ -10,6 +10,7 @@ import fi.codecrew.moya.beans.EventBeanLocal;
import
fi.codecrew.moya.beans.GameBeanLocal
;
import
fi.codecrew.moya.beans.GameBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.Game
;
import
fi.codecrew.moya.model.Game
;
import
fi.codecrew.moya.model.GameCode
;
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
;
...
@@ -33,10 +34,11 @@ public class GameCodeView extends GenericCDIView {
...
@@ -33,10 +34,11 @@ public class GameCodeView extends GenericCDIView {
GameBeanLocal
gameBean
;
GameBeanLocal
gameBean
;
ListDataModel
<
Game
>
gamesDataModel
;
ListDataModel
<
Game
>
gamesDataModel
;
ListDataModel
<
GameCode
>
gameCodesDataModel
;
private
Game
currentGame
;
private
Game
currentGame
;
public
void
initView
()
{
public
void
init
Admin
View
()
{
if
(
gamesDataModel
==
null
)
{
if
(
gamesDataModel
==
null
)
{
this
.
currentGame
=
new
Game
();
this
.
currentGame
=
new
Game
();
this
.
currentGame
.
setEvent
(
eventBean
.
getCurrentEvent
());
this
.
currentGame
.
setEvent
(
eventBean
.
getCurrentEvent
());
...
@@ -45,11 +47,22 @@ public class GameCodeView extends GenericCDIView {
...
@@ -45,11 +47,22 @@ public class GameCodeView extends GenericCDIView {
}
}
}
}
public
void
initUserView
()
{
if
(
gamesDataModel
==
null
)
{
this
.
gameCodesDataModel
=
new
ListDataModel
<
GameCode
>(
gameBean
.
findUserCodes
(
user
));
this
.
beginConversation
();
}
}
public
ListDataModel
<
Game
>
getGames
()
{
public
ListDataModel
<
Game
>
getGames
()
{
return
gamesDataModel
;
return
gamesDataModel
;
}
}
public
ListDataModel
<
GameCode
>
getGameCodes
()
{
return
gameCodesDataModel
;
}
public
Game
getCurrentGame
()
{
public
Game
getCurrentGame
()
{
return
this
.
currentGame
;
return
this
.
currentGame
;
...
@@ -71,11 +84,27 @@ public class GameCodeView extends GenericCDIView {
...
@@ -71,11 +84,27 @@ public class GameCodeView extends GenericCDIView {
}
}
public
String
editSelected
()
{
public
String
editSelected
()
{
if
(
gamesDataModel
!=
null
&&
gamesDataModel
.
isRowAvailable
())
{
if
(
gamesDataModel
!=
null
&&
gamesDataModel
.
isRowAvailable
())
{
currentGame
=
gamesDataModel
.
getRowData
();
currentGame
=
gamesDataModel
.
getRowData
();
}
}
return
"manageCodes"
;
return
null
;
}
public
String
openSelectedCode
()
{
if
(
gameCodesDataModel
!=
null
&&
gameCodesDataModel
.
isRowAvailable
())
{
GameCode
code
=
gameCodesDataModel
.
getRowData
();
gameBean
.
accessCode
(
code
,
user
);
}
return
null
;
}
public
boolean
isNoGameCodes
()
{
return
(
getGameCodes
().
getRowCount
()
<=
0
);
}
}
}
}
...
...
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