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 08c88ff6
authored
Feb 08, 2014
by
Antti Tönkyrä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add edits for tournament rules.
Closes #5
1 parent
5ae54e65
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
149 additions
and
4 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/TournamentBean.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/TournamentBeanLocal.java
code/MoyaWeb/WebContent/tournaments/admin/editrules.xhtml
code/MoyaWeb/WebContent/tournaments/admin/index.xhtml
code/MoyaWeb/WebContent/tournaments/showrules.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/tournaments/TournamentEditRulesView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentRulesView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
View file @
08c88ff
...
@@ -268,6 +268,7 @@ public class MenuBean implements MenuBeanLocal {
...
@@ -268,6 +268,7 @@ public class MenuBean implements MenuBeanLocal {
tournamentsadm
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/tournaments/admin/view_tournament_team"
),
TournamentPermission
.
MANAGE_ALL
).
setVisible
(
false
);
tournamentsadm
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/tournaments/admin/view_tournament_team"
),
TournamentPermission
.
MANAGE_ALL
).
setVisible
(
false
);
tournamentsadm
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/tournaments/admin/edit"
),
TournamentPermission
.
MANAGE_ALL
).
setVisible
(
false
);
tournamentsadm
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/tournaments/admin/edit"
),
TournamentPermission
.
MANAGE_ALL
).
setVisible
(
false
);
tournamentsadm
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/tournaments/admin/delete"
),
TournamentPermission
.
MANAGE_ALL
).
setVisible
(
false
);
tournamentsadm
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/tournaments/admin/delete"
),
TournamentPermission
.
MANAGE_ALL
).
setVisible
(
false
);
tournamentsadm
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/tournaments/admin/editrules"
),
TournamentPermission
.
MANAGE_ALL
).
setVisible
(
false
);
/*
/*
* MenuNavigation profileTopmenu = new MenuNavigation(ev,
* MenuNavigation profileTopmenu = new MenuNavigation(ev,
* "topnavi.profile", menusort = +10);
* "topnavi.profile", menusort = +10);
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/TournamentBean.java
View file @
08c88ff
...
@@ -100,6 +100,17 @@ public class TournamentBean implements TournamentBeanLocal {
...
@@ -100,6 +100,17 @@ public class TournamentBean implements TournamentBeanLocal {
else
else
throw
new
Exception
(
"tournament.invalid_event"
);
throw
new
Exception
(
"tournament.invalid_event"
);
}
}
@Override
@RolesAllowed
(
TournamentPermission
.
S_MANAGE_ALL
)
public
void
updateTournamentRules
(
TournamentRule
tr
)
throws
Exception
{
// Assert correct event
if
(
eventBean
.
getCurrentEvent
().
equals
(
tr
.
getTournamentGame
().
getLanEvent
()))
{
tournamentRuleFacade
.
merge
(
tr
);
}
else
{
throw
new
Exception
(
"tournament.invalid_event"
);
}
}
@Override
@Override
@RolesAllowed
(
TournamentPermission
.
S_VIEW
)
@RolesAllowed
(
TournamentPermission
.
S_VIEW
)
...
...
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/TournamentBeanLocal.java
View file @
08c88ff
...
@@ -32,5 +32,6 @@ public interface TournamentBeanLocal {
...
@@ -32,5 +32,6 @@ public interface TournamentBeanLocal {
boolean
useTimeConstraints
,
boolean
invertMatch
);
boolean
useTimeConstraints
,
boolean
invertMatch
);
List
<
TournamentParticipant
>
findOwnParticipations
();
List
<
TournamentParticipant
>
findOwnParticipations
();
void
deleteParticipationById
(
Integer
tpid
)
throws
Exception
;
void
deleteParticipationById
(
Integer
tpid
)
throws
Exception
;
void
updateTournamentRules
(
TournamentRule
tr
)
throws
Exception
;
}
}
code/MoyaWeb/WebContent/tournaments/admin/editrules.xhtml
0 → 100644
View file @
08c88ff
<!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:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:p=
"http://primefaces.org/ui"
xmlns:f=
"http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition
template=
"#{sessionHandler.template}"
>
<f:metadata>
<f:viewParam
name=
"tournament_id"
value=
"#{tournamentEditRulesView.tournamentId}"
/>
<f:event
type=
"preRenderView"
listener=
"#{tournamentEditRulesView.initView()}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<h:form>
<h1>
#{i18n['tournaments.admin.edit_rules']}
</h1>
<h:panelGrid
columns=
"1"
>
<p:inputText
value=
"#{tournamentEditRulesView.selectedRules.name}"
/>
<p:inputTextarea
value=
"#{tournamentEditRulesView.selectedRules.rules}"
/>
<p:commandButton
value=
"#{i18n['tournament.admin.edit']}"
action=
"#{tournamentEditRulesView.commit()}"
ajax=
"false"
/>
</h:panelGrid>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/MoyaWeb/WebContent/tournaments/admin/index.xhtml
View file @
08c88ff
...
@@ -54,7 +54,9 @@
...
@@ -54,7 +54,9 @@
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['tournament.rules']}"
/>
<h:outputText
value=
"#{i18n['tournament.rules']}"
/>
</f:facet>
</f:facet>
<h:outputText
value=
"#{tournament.rules.name}"
/>
<h:link
value=
"#{tournament.rules.name}"
outcome=
"/tournaments/showrules.xhtml"
>
<f:param
name=
"tournament_id"
value=
"#{tournament.id}"
/>
</h:link>
</p:column>
</p:column>
<p:column>
<p:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
...
...
code/MoyaWeb/WebContent/tournaments/showrules.xhtml
View file @
08c88ff
...
@@ -10,15 +10,24 @@
...
@@ -10,15 +10,24 @@
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<h:form>
<p>
<p>
<h:link
outcome=
"/tournaments/index.xhtml"
value=
"#{i18n['tournaments.back_to_tournament_list']}"
/>
<h:link
outcome=
"/tournaments/index.xhtml"
value=
"#{i18n['tournaments.back_to_tournament_list']}"
/>
</p>
</p>
<h1>
#{i18n['tournament.rules_for_tournament']} #{tournamentRulesView.tournament.tournamentName} (#{tournamentRulesView.tournament.rules.name})
</h1>
<h1>
#{i18n['tournament.rules_for_tournament']} #{tournamentRulesView.tournament.tournamentName} (#{tournamentRulesView.tournament.rules.name})
</h1>
<h:outputText
value=
"#{tournamentRulesView.tournament.rules.rules}"
escape=
"false"
/>
<h:panelGroup
layout=
"block"
rendered=
"#{tournamentRulesView.canEdit}"
style=
"margin-bottom: 16px;"
>
<p:button
value=
"#{i18n['tournaments.admin.edit_rules']}"
outcome=
"/tournaments/admin/editrules.xhtml"
>
<f:param
name=
"tournament_id"
value=
"#{tournamentRulesView.tournamentId}"
/>
</p:button>
</h:panelGroup>
<div>
<h:outputText
value=
"#{tournamentRulesView.tournament.rules.rules}"
escape=
"false"
/>
</div>
<p>
<p>
<h:link
outcome=
"/tournaments/index.xhtml"
value=
"#{i18n['tournaments.back_to_tournament_list']}"
/>
<h:link
outcome=
"/tournaments/index.xhtml"
value=
"#{i18n['tournaments.back_to_tournament_list']}"
/>
</p>
</p>
</ui:define>
</h:form>
</ui:define>
</ui:composition>
</ui:composition>
</h:body>
</h:body>
</html>
</html>
\ No newline at end of file
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
View file @
08c88ff
...
@@ -157,7 +157,7 @@ global.save = Save
...
@@ -157,7 +157,7 @@ global.save = Save
httpsession.creationTime
=
Created
httpsession.creationTime
=
Created
incomingflow.giveplace
=
Merkitse annetuksi
incomingflow.giveplace
=
Merkitse annetuksi
lanEventPrivateProperty.defaultValue
=
Default value
lanEventPrivateProperty.defaultValue
=
Default value
lanEventPrivateProperty.editProperty
=
Edit property
lanEventPrivateProperty.editProperty
=
Edit property
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
View file @
08c88ff
...
@@ -1044,6 +1044,8 @@ tournament.admin.delete_cancel = Cancel Deletio
...
@@ -1044,6 +1044,8 @@ tournament.admin.delete_cancel = Cancel Deletio
tournament.admin.delete_confirm
=
Confirm Deletion
tournament.admin.delete_confirm
=
Confirm Deletion
tournament.admin.edit
=
Edit
tournament.admin.edit
=
Edit
tournament.admin.tournament_edited_successfully
=
Edited successfully
tournament.admin.tournament_edited_successfully
=
Edited successfully
tournament.admin.tournament_rules_edit_failed
=
Rule Edit Failed
tournament.admin.tournament_rules_edited_successfully
=
Rules successfully edited
tournament.admin.view
=
View
tournament.admin.view
=
View
tournament.already_participated_into_tournament
=
Already participated into the selected tournament!
tournament.already_participated_into_tournament
=
Already participated into the selected tournament!
tournament.backup_player_successfully_added_to_team
=
Backup player added
tournament.backup_player_successfully_added_to_team
=
Backup player added
...
@@ -1094,6 +1096,7 @@ tournaments.admin.create_new_ruleset = Create a new r
...
@@ -1094,6 +1096,7 @@ tournaments.admin.create_new_ruleset = Create a new r
tournaments.admin.create_tournament
=
Create a tournament
tournaments.admin.create_tournament
=
Create a tournament
tournaments.admin.description
=
Manage tournaments
tournaments.admin.description
=
Manage tournaments
tournaments.admin.edit
=
Edit tournament
tournaments.admin.edit
=
Edit tournament
tournaments.admin.edit_rules
=
Edit Rules
tournaments.admin.edit_tournament
=
Edit Tournament
tournaments.admin.edit_tournament
=
Edit Tournament
tournaments.admin.game_description
=
Game description
tournaments.admin.game_description
=
Game description
tournaments.admin.game_name
=
Game name
tournaments.admin.game_name
=
Game name
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
View file @
08c88ff
...
@@ -1029,6 +1029,8 @@ tournament.admin.delete_cancel = Peruuta
...
@@ -1029,6 +1029,8 @@ tournament.admin.delete_cancel = Peruuta
tournament.admin.delete_confirm
=
Vahvista Poisto
tournament.admin.delete_confirm
=
Vahvista Poisto
tournament.admin.edit
=
Muokkaa
tournament.admin.edit
=
Muokkaa
tournament.admin.tournament_edited_successfully
=
Turnauksen asetuksia muutettu
tournament.admin.tournament_edited_successfully
=
Turnauksen asetuksia muutettu
tournament.admin.tournament_rules_edit_failed
=
S
\u
00E4
\u
00E4nt
\u
00F6jen muutos ep
\u
00E4onnistui
tournament.admin.tournament_rules_edited_successfully
=
S
\u
00E4
\u
00E4nt
\u
00F6jen muutos tehty
tournament.admin.view
=
Tarkastele
tournament.admin.view
=
Tarkastele
tournament.already_participated_into_tournament
=
Olet jo osallistunut valittuun turnaukseen!
tournament.already_participated_into_tournament
=
Olet jo osallistunut valittuun turnaukseen!
tournament.backup_player_successfully_added_to_team
=
Varapelaaja lis
\u
00E4tty
tournament.backup_player_successfully_added_to_team
=
Varapelaaja lis
\u
00E4tty
...
@@ -1079,6 +1081,7 @@ tournaments.admin.create_new_ruleset = Luo uusi s\u00
...
@@ -1079,6 +1081,7 @@ tournaments.admin.create_new_ruleset = Luo uusi s\u00
tournaments.admin.create_tournament
=
Luo turnaus
tournaments.admin.create_tournament
=
Luo turnaus
tournaments.admin.description
=
Hallinnoi turnauksia
tournaments.admin.description
=
Hallinnoi turnauksia
tournaments.admin.edit
=
Muokkaa turnausta
tournaments.admin.edit
=
Muokkaa turnausta
tournaments.admin.edit_rules
=
Editoi s
\u
00E4
\u
00E4nt
\u
00F6j
\u
00E4
tournaments.admin.edit_tournament
=
Muokkaa turnausta
tournaments.admin.edit_tournament
=
Muokkaa turnausta
tournaments.admin.game_description
=
Pelin kuvaus
tournaments.admin.game_description
=
Pelin kuvaus
tournaments.admin.game_name
=
Pelin nimi
tournaments.admin.game_name
=
Pelin nimi
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentEditRulesView.java
0 → 100644
View file @
08c88ff
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
tournaments
;
import
java.io.IOException
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.RequestScoped
;
import
javax.faces.context.FacesContext
;
import
javax.inject.Named
;
import
fi.codecrew.moya.beans.TournamentBeanLocal
;
import
fi.codecrew.moya.enums.TournamentType
;
import
fi.codecrew.moya.enums.apps.TournamentPermission
;
import
fi.codecrew.moya.model.Tournament
;
import
fi.codecrew.moya.model.TournamentRule
;
import
fi.codecrew.moya.utilities.I18n
;
import
fi.codecrew.moya.utilities.jsf.MessageHelper
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
@Named
@ConversationScoped
public
class
TournamentEditRulesView
extends
GenericCDIView
{
/**
*
*/
private
static
final
long
serialVersionUID
=
-
2655058086651272660L
;
@EJB
private
TournamentBeanLocal
tournamentBean
;
private
Tournament
tournament
=
null
;
private
Integer
tournamentId
;
private
TournamentRule
selectedRules
=
null
;
public
void
initView
()
{
if
(
super
.
requirePermissions
(
TournamentPermission
.
MANAGE_ALL
)
&&
selectedRules
==
null
)
{
super
.
beginConversation
();
tournament
=
tournamentBean
.
getTournamentById
(
tournamentId
);
selectedRules
=
tournament
.
getRules
();
System
.
out
.
println
(
this
.
selectedRules
.
getName
());
}
}
public
Integer
getTournamentId
()
{
return
tournamentId
;
}
public
void
setTournamentId
(
Integer
tournamentId
)
{
this
.
tournamentId
=
tournamentId
;
}
public
Tournament
getTournament
()
{
return
tournament
;
}
public
void
setTournament
(
Tournament
tournament
)
{
this
.
tournament
=
tournament
;
}
public
TournamentRule
getSelectedRules
()
{
return
selectedRules
;
}
public
void
setSelectedRules
(
TournamentRule
selectedRules
)
{
this
.
selectedRules
=
selectedRules
;
}
public
String
commit
()
{
if
(
this
.
selectedRules
!=
null
)
{
try
{
this
.
tournamentBean
.
updateTournamentRules
(
selectedRules
);
MessageHelper
.
info
(
"tournament.admin.tournament_rules_edited_successfully"
);
}
catch
(
Exception
e
)
{
MessageHelper
.
err
(
"tournament.admin.tournament_rules_edit_failed"
);
}
}
else
{
MessageHelper
.
err
(
"tournament.admin.tournament_rules_edit_failed"
);
}
this
.
endConversation
();
return
"/tournaments/admin/index.xhtml"
;
}
}
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentRulesView.java
View file @
08c88ff
...
@@ -45,4 +45,8 @@ public class TournamentRulesView extends GenericCDIView {
...
@@ -45,4 +45,8 @@ public class TournamentRulesView extends GenericCDIView {
public
void
setTournament
(
Tournament
tournament
)
{
public
void
setTournament
(
Tournament
tournament
)
{
this
.
tournament
=
tournament
;
this
.
tournament
=
tournament
;
}
}
public
Boolean
getCanEdit
()
{
return
super
.
hasPermission
(
TournamentPermission
.
MANAGE_ALL
);
}
}
}
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