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 36cd54be
authored
May 12, 2012
by
Juho Salli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compocreate UI toimii
1 parent
c1253309
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
15 deletions
code/LanBortalWeb/WebContent/voting/create.xhtml
code/LanBortalWeb/src/ValidationMessages_en.properties
code/LanBortalWeb/src/ValidationMessages_fi.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/GenericCDIView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/ActionLogCreateView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCreateView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingDateValidator.java
code/LanBortalWeb/WebContent/voting/create.xhtml
View file @
36cd54b
...
@@ -19,43 +19,43 @@
...
@@ -19,43 +19,43 @@
<div>
<div>
<h:form>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"
Name
"
for=
"name"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.name']}:
"
for=
"name"
/>
<h:inputText
value=
"#{votingCreateView.name}"
id=
"name"
/>
<h:inputText
value=
"#{votingCreateView.name}"
id=
"name"
/>
<h:message
for=
"name"
/>
<h:message
for=
"name"
/>
<h:outputLabel
value=
"
Kuvaus
:"
for=
"desc"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.description']}
:"
for=
"desc"
/>
<h:inputText
value=
"#{votingCreateView.description}"
id=
"desc"
/>
<h:inputText
value=
"#{votingCreateView.description}"
id=
"desc"
/>
<h:message
for=
"desc"
/>
<h:message
for=
"desc"
/>
<h:outputLabel
value=
"
Max osallistujat
:"
for=
"maxPar"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.maxParticipants']}
:"
for=
"maxPar"
/>
<h:inputText
value=
"#{votingCreateView.maxParticipants}"
id=
"maxPar"
/>
<h:inputText
value=
"#{votingCreateView.maxParticipants}"
id=
"maxPar"
/>
<h:message
for=
"maxPar"
/>
<h:message
for=
"maxPar"
/>
<h:outputLabel
value=
"
Compo start
"
for=
"cStart"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.compoStart']}:
"
for=
"cStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveCStart}"
value=
"#{votingCreateView.compoStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveCStart}"
value=
"#{votingCreateView.compoStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cStart"
/>
<h:message
for=
"cStart"
/>
<h:message
for=
"cStart"
/>
<h:outputLabel
value=
"
Compo end
"
for=
"cEnd"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.compoEnd']}:
"
for=
"cEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateCompo}"
value=
"#{votingCreateView.compoEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateCompo}"
value=
"#{votingCreateView.compoEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cEnd"
/>
<h:message
for=
"cEnd"
/>
<h:message
for=
"cEnd"
/>
<h:outputLabel
value=
"
Vote start
"
for=
"vStart"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.voteStart']}:
"
for=
"vStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveVStart}"
value=
"#{votingCreateView.voteStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveVStart}"
value=
"#{votingCreateView.voteStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vStart"
/>
<h:message
for=
"vStart"
/>
<h:message
for=
"vStart"
/>
<h:outputLabel
value=
"
Vote end
"
for=
"vEnd"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.voteEnd']}:
"
for=
"vEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateVote}"
value=
"#{votingCreateView.voteEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateVote}"
value=
"#{votingCreateView.voteEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vEnd"
/>
<h:message
for=
"vEnd"
/>
<h:message
for=
"vEnd"
/>
<h:outputLabel
value=
"
Submit start
"
for=
"sStart"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.submitStart']}:
"
for=
"sStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveSStart}"
value=
"#{votingCreateView.submitStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveSStart}"
value=
"#{votingCreateView.submitStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sStart"
/>
<h:message
for=
"sStart"
/>
<h:message
for=
"sStart"
/>
<h:outputLabel
value=
"
Submit end
"
for=
"sEnd"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.submitEnd']}:
"
for=
"sEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateSubmit}"
value=
"#{votingCreateView.submitEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateSubmit}"
value=
"#{votingCreateView.submitEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sEnd"
/>
<h:message
for=
"sEnd"
/>
<h:message
for=
"sEnd"
/>
<h:commandButton
value=
"
Luo
"
/>
<h:commandButton
value=
"
#{i18n['voting.create.createButton']}
"
/>
</h:panelGrid>
</h:panelGrid>
</h:form>
</h:form>
...
...
code/LanBortalWeb/src/ValidationMessages_en.properties
View file @
36cd54b
...
@@ -2,3 +2,5 @@ user.nickSizeMessage=Nick has to be at least {min} characters long.
...
@@ -2,3 +2,5 @@ user.nickSizeMessage=Nick has to be at least {min} characters long.
user.emailregex
=
Field must contain an email address.
user.emailregex
=
Field must contain an email address.
javax.validation.constraints.NotNull.message
=
Field can not be empty
javax.validation.constraints.NotNull.message
=
Field can not be empty
voting.create.participantsError
=
Value must be 1 or over.
voting.create.nameError
=
Name must be longer than 3 chars.
code/LanBortalWeb/src/ValidationMessages_fi.properties
View file @
36cd54b
...
@@ -2,3 +2,5 @@ user.nickSizeMessage=Nimimerkin pit olla vhintn {min} merkki pitk.
...
@@ -2,3 +2,5 @@ user.nickSizeMessage=Nimimerkin pit olla vhintn {min} merkki pitk.
user.emailregex
=
Kentss pit olla shkpostiosoite.
user.emailregex
=
Kentss pit olla shkpostiosoite.
javax.validation.constraints.NotNull.message
=
Kentt ei saa olla tyhj
javax.validation.constraints.NotNull.message
=
Kentt ei saa olla tyhj
actionlog.message.tooshort
=
Kahva ei kelpaa! (Viestisi on liian lyhyt :)
actionlog.message.tooshort
=
Kahva ei kelpaa! (Viestisi on liian lyhyt :)
voting.create.participantsError
=
Osallistujia pit olla yksi tai enemmn.
voting.create.nameError
=
Nimen pit olla yli 3 merkki pitk.
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_en.properties
View file @
36cd54b
...
@@ -525,3 +525,16 @@ userview.userExists = Username already exists! please select another.
...
@@ -525,3 +525,16 @@ userview.userExists = Username already exists! please select another.
viewexpired.body
=
Please login again.
viewexpired.body
=
Please login again.
viewexpired.title
=
Login expired. Please login again.
viewexpired.title
=
Login expired. Please login again.
voting.create.compoEnd
=
End time
voting.create.compoStart
=
Start time
voting.create.createButton
=
Create
voting.create.dateValidatorEndDate
=
End time before start time.
voting.create.description
=
Description
voting.create.header
=
Create compo
voting.create.maxParticipants
=
Max participants
voting.create.name
=
Name
voting.create.submitEnd
=
Submit close
voting.create.submitStart
=
Submit start
voting.create.voteEnd
=
Voting close
voting.create.voteStart
=
Voting start
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
36cd54b
This diff is collapsed.
Click to expand it.
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/GenericCDIView.java
View file @
36cd54b
...
@@ -90,6 +90,7 @@ public abstract class GenericCDIView implements Serializable {
...
@@ -90,6 +90,7 @@ public abstract class GenericCDIView implements Serializable {
}
}
protected
void
addFaceMessage
(
String
string
,
Object
...
params
)
{
protected
void
addFaceMessage
(
String
string
,
Object
...
params
)
{
FacesContext
.
getCurrentInstance
().
addMessage
(
null
,
new
FacesMessage
(
I18n
.
get
(
string
,
params
)));
FacesContext
.
getCurrentInstance
().
addMessage
(
null
,
new
FacesMessage
(
I18n
.
get
(
string
,
params
)));
}
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/ActionLogCreateView.java
View file @
36cd54b
...
@@ -19,6 +19,7 @@ public class ActionLogCreateView extends GenericCDIView {
...
@@ -19,6 +19,7 @@ public class ActionLogCreateView extends GenericCDIView {
@EJB
@EJB
private
ActionLogBeanLocal
actionLogBean
;
private
ActionLogBeanLocal
actionLogBean
;
@Size
(
min
=
4
,
message
=
"{actionlog.message.tooshort}"
)
@Size
(
min
=
4
,
message
=
"{actionlog.message.tooshort}"
)
private
String
message
;
private
String
message
;
private
Role
role
;
private
Role
role
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCreateView.java
View file @
36cd54b
...
@@ -7,6 +7,9 @@ import javax.faces.bean.ManagedBean;
...
@@ -7,6 +7,9 @@ import javax.faces.bean.ManagedBean;
import
javax.faces.bean.RequestScoped
;
import
javax.faces.bean.RequestScoped
;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.Size
;
import
org.hibernate.validator.constraints.Length
;
import
fi.insomnia.bortal.beans.VotingBeanLocal
;
import
fi.insomnia.bortal.beans.VotingBeanLocal
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
...
@@ -24,10 +27,10 @@ public class VotingCreateView extends GenericCDIView {
...
@@ -24,10 +27,10 @@ public class VotingCreateView extends GenericCDIView {
@EJB
@EJB
private
VotingBeanLocal
votbean
;
private
VotingBeanLocal
votbean
;
@
Min
(
value
=
4
,
message
=
"Nimen pitää olla pidempi kuin 4 merkkiä.
"
)
@
Size
(
min
=
4
,
message
=
"{voting.create.nameError}
"
)
private
String
name
;
private
String
name
;
private
String
description
;
private
String
description
;
@Min
(
value
=
1
,
message
=
"
Min osallistujia 1.
"
)
@Min
(
value
=
1
,
message
=
"
{voting.create.participantsError}
"
)
private
Integer
maxParticipants
;
private
Integer
maxParticipants
;
private
Date
compoStart
;
private
Date
compoStart
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingDateValidator.java
View file @
36cd54b
...
@@ -10,11 +10,14 @@ import javax.faces.context.FacesContext;
...
@@ -10,11 +10,14 @@ import javax.faces.context.FacesContext;
import
javax.faces.validator.ValidatorException
;
import
javax.faces.validator.ValidatorException
;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
javax.servlet.jsp.tagext.ValidationMessage
;
import
org.eclipse.persistence.exceptions.ValidationException
;
import
org.eclipse.persistence.exceptions.ValidationException
;
import
org.hibernate.validator.util.LoggerFactory
;
import
org.hibernate.validator.util.LoggerFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
fi.insomnia.bortal.utilities.I18n
;
@Named
@Named
@RequestScoped
@RequestScoped
...
@@ -34,7 +37,8 @@ public class VotingDateValidator implements Serializable {
...
@@ -34,7 +37,8 @@ public class VotingDateValidator implements Serializable {
//UIComponent foo = ui.findComponent("cStart");
//UIComponent foo = ui.findComponent("cStart");
//logger.info("uielement {} ", foo);
//logger.info("uielement {} ", foo);
if
(
endDate
.
before
(
cStart
))
{
if
(
endDate
.
before
(
cStart
))
{
message
(
new
FacesMessage
(
"Loppumispvm ennen alkua. KORJAA SE."
));
message
(
new
FacesMessage
(
I18n
.
get
(
"voting.create.dateValidatorEndDate"
)));
}
}
}
}
...
@@ -47,7 +51,7 @@ public class VotingDateValidator implements Serializable {
...
@@ -47,7 +51,7 @@ public class VotingDateValidator implements Serializable {
public
void
validateVote
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
public
void
validateVote
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
Date
endDate
=
(
Date
)
object
;
Date
endDate
=
(
Date
)
object
;
if
(
endDate
.
before
(
vStart
))
{
if
(
endDate
.
before
(
vStart
))
{
message
(
new
FacesMessage
(
"Loppumispvm ennen alkua. NOT VALID."
));
message
(
new
FacesMessage
(
I18n
.
get
(
"voting.create.dateValidatorEndDate"
)
));
}
}
}
}
...
@@ -58,7 +62,7 @@ public class VotingDateValidator implements Serializable {
...
@@ -58,7 +62,7 @@ public class VotingDateValidator implements Serializable {
public
void
validateSubmit
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
public
void
validateSubmit
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
Date
endDate
=
(
Date
)
object
;
Date
endDate
=
(
Date
)
object
;
if
(
endDate
.
before
(
sStart
))
{
if
(
endDate
.
before
(
sStart
))
{
message
(
new
FacesMessage
(
"Loppumispvm ennen aloitusta. IS AN ERROR."
));
message
(
new
FacesMessage
(
I18n
.
get
(
"voting.create.dateValidatorEndDate"
)
));
}
}
}
}
...
...
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