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 2fb04eec
authored
May 16, 2014
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'compostuff' into 'master'
Compostuff
2 parents
e0c7dc90
7bc2dc0c
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
758 additions
and
668 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/UserBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/VotingBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/CompoFacade.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/OrgRoleFacade.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/VotingBeanLocal.java
code/MoyaDatabase/src/fi/codecrew/moya/model/Compo.java
code/MoyaDatabase/src/fi/codecrew/moya/model/CompoEntry.java
code/MoyaDatabase/src/fi/codecrew/moya/model/CompoEntryFile.java
code/MoyaWeb/WebContent/resources/cditools/compo/editCompo.xhtml
code/MoyaWeb/WebContent/voting/admincompolist.xhtml
code/MoyaWeb/WebContent/voting/create.xhtml
code/MoyaWeb/WebContent/voting/details.xhtml
code/MoyaWeb/WebContent/voting/submitEntry.xhtml
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/organisation/EventOrgView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/CompoFileDownloadView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/VotingDetailsView.java → code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/CompoMgmtView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/CompoView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/VotingCreateView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/VotingDateValidator.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
View file @
2fb04ee
...
@@ -57,6 +57,9 @@ public class BootstrapBean implements BootstrapBeanLocal {
...
@@ -57,6 +57,9 @@ public class BootstrapBean implements BootstrapBeanLocal {
"delete from menu_navigation where item_id in (select id from menuitem where url in ( '/actionlog/messagelist'))"
,
"delete from menu_navigation where item_id in (select id from menuitem where url in ( '/actionlog/messagelist'))"
,
"delete from menuitem where url in ('/actionlog/messagelist')"
,
"delete from menuitem where url in ('/actionlog/messagelist')"
,
});
});
dbUpdates
.
add
(
new
String
[]
{
"alter table compos add hidden boolean default false not null"
});
}
}
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/UserBean.java
View file @
2fb04ee
...
@@ -477,8 +477,9 @@ public class UserBean implements UserBeanLocal {
...
@@ -477,8 +477,9 @@ public class UserBean implements UserBeanLocal {
@Override
@Override
@RolesAllowed
(
UserPermission
.
S_INVITE_USERS
)
@RolesAllowed
(
UserPermission
.
S_INVITE_USERS
)
public
boolean
invite
(
String
invitemail
,
String
url
)
{
public
boolean
invite
(
String
invitemail
,
String
url
)
{
invitemail
=
invitemail
.
trim
();
List
<
User
>
usercheck
=
userFacade
.
findByEmail
(
invitemail
.
trim
()
);
List
<
User
>
usercheck
=
userFacade
.
findByEmail
(
invitemail
);
if
(
usercheck
.
size
()
>
0
)
{
if
(
usercheck
.
size
()
>
0
)
{
return
false
;
return
false
;
}
}
...
@@ -486,7 +487,7 @@ public class UserBean implements UserBeanLocal {
...
@@ -486,7 +487,7 @@ public class UserBean implements UserBeanLocal {
LanEvent
ev
=
eventBean
.
getCurrentEvent
();
LanEvent
ev
=
eventBean
.
getCurrentEvent
();
PlaceGroup
pg
=
new
PlaceGroup
(
ev
,
Calendar
.
getInstance
(),
Calendar
.
getInstance
(),
false
);
PlaceGroup
pg
=
new
PlaceGroup
(
ev
,
Calendar
.
getInstance
(),
Calendar
.
getInstance
(),
false
);
pg
.
setCreator
(
creator
);
pg
.
setCreator
(
creator
);
pg
.
setName
(
"Invite
bean"
);
pg
.
setName
(
"Invite
to "
+
invitemail
);
String
token
=
PasswordFunctions
.
generateRandomString
(
30
,
PasswordFunctions
.
ALL_CHARS
);
String
token
=
PasswordFunctions
.
generateRandomString
(
30
,
PasswordFunctions
.
ALL_CHARS
);
pg
.
getMembers
().
add
(
new
GroupMembership
(
pg
,
null
,
token
));
pg
.
getMembers
().
add
(
new
GroupMembership
(
pg
,
null
,
token
));
pgfacade
.
create
(
pg
);
pgfacade
.
create
(
pg
);
...
@@ -526,6 +527,8 @@ public class UserBean implements UserBeanLocal {
...
@@ -526,6 +527,8 @@ public class UserBean implements UserBeanLocal {
@Override
@Override
@PermitAll
@PermitAll
public
boolean
createFromInviteToken
(
EventUser
user
,
String
token
)
{
public
boolean
createFromInviteToken
(
EventUser
user
,
String
token
)
{
if
(
user
==
null
||
user
.
getLogin
()
==
null
)
return
false
;
GroupMembership
gm
=
findToken
(
token
);
GroupMembership
gm
=
findToken
(
token
);
// Check that invite has not already been accepted!
// Check that invite has not already been accepted!
if
(
gm
==
null
||
gm
.
getUser
()
!=
null
||
gm
.
getInviteAccepted
()
!=
null
)
{
if
(
gm
==
null
||
gm
.
getUser
()
!=
null
||
gm
.
getInviteAccepted
()
!=
null
)
{
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/VotingBean.java
View file @
2fb04ee
...
@@ -59,6 +59,7 @@ public class VotingBean implements VotingBeanLocal {
...
@@ -59,6 +59,7 @@ public class VotingBean implements VotingBeanLocal {
voteFacade
.
create
(
v
);
voteFacade
.
create
(
v
);
}
}
@RolesAllowed
(
CompoPermission
.
S_MANAGE
)
public
void
createCompo
(
Compo
c
)
{
public
void
createCompo
(
Compo
c
)
{
c
.
setEvent
(
eventBean
.
getCurrentEvent
());
c
.
setEvent
(
eventBean
.
getCurrentEvent
());
compoFacade
.
create
(
c
);
compoFacade
.
create
(
c
);
...
@@ -73,15 +74,15 @@ public class VotingBean implements VotingBeanLocal {
...
@@ -73,15 +74,15 @@ public class VotingBean implements VotingBeanLocal {
c
.
getCompoEntries
().
add
(
compoEntry
);
c
.
getCompoEntries
().
add
(
compoEntry
);
compoFacade
.
flush
();
compoFacade
.
flush
();
compoEntryFile
.
setEntriesId
(
compoEntry
);
compoEntryFile
.
setEntriesId
(
compoEntry
);
compoEntry
.
getFiles
().
add
(
compoEntryFile
);
//
compoEntry.getFiles().add(compoEntryFile);
}
}
public
Compo
getCompoById
(
Integer
compoId
)
{
public
Compo
getCompoById
(
Integer
compoId
)
{
return
compoFacade
.
find
(
compoId
);
return
compoFacade
.
find
(
compoId
);
}
}
public
List
<
Compo
>
getCompoList
()
{
public
List
<
Compo
>
getCompoList
(
boolean
showHidden
)
{
return
compoFacade
.
getList
();
return
compoFacade
.
getList
(
showHidden
);
}
}
@Override
@Override
...
@@ -129,16 +130,17 @@ public class VotingBean implements VotingBeanLocal {
...
@@ -129,16 +130,17 @@ public class VotingBean implements VotingBeanLocal {
return
compoEntryFacade
.
find
(
entryId
);
return
compoEntryFacade
.
find
(
entryId
);
}
}
@Override
//
@Override
public
CompoEntry
findEntryWithFiles
(
Integer
entryId
)
{
//
public CompoEntry findEntryWithFiles(Integer entryId) {
CompoEntry
ret
=
compoEntryFacade
.
find
(
entryId
);
//
CompoEntry ret = compoEntryFacade.find(entryId);
logger
.
debug
(
"Found files {}"
,
ret
.
getFiles
().
size
());
// //
logger.debug("Found files {}", ret.getFiles().size());
//
return
ret
;
//
return ret;
//
}
//
}
@Override
@Override
@RolesAllowed
(
CompoPermission
.
S_MANAGE
)
public
CompoEntry
saveSort
(
CompoEntry
e
)
{
public
CompoEntry
saveSort
(
CompoEntry
e
)
{
CompoEntry
entry
=
compoEntryFacade
.
find
(
e
.
getId
());
CompoEntry
entry
=
compoEntryFacade
.
find
(
e
.
getId
());
entry
.
setSort
(
e
.
getSort
());
entry
.
setSort
(
e
.
getSort
());
...
@@ -177,4 +179,15 @@ public class VotingBean implements VotingBeanLocal {
...
@@ -177,4 +179,15 @@ public class VotingBean implements VotingBeanLocal {
return
voteEntity
;
return
voteEntity
;
}
}
@Override
@RolesAllowed
(
CompoPermission
.
S_MANAGE
)
public
Compo
saveCompo
(
Compo
compo
)
{
return
compoFacade
.
merge
(
compo
);
}
@Override
public
void
create
(
CompoEntryFile
cef
)
{
compoEntryFileFacade
.
create
(
cef
);
}
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/CompoFacade.java
View file @
2fb04ee
package
fi
.
codecrew
.
moya
.
facade
;
package
fi
.
codecrew
.
moya
.
facade
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
...
@@ -7,11 +8,12 @@ import javax.ejb.LocalBean;
...
@@ -7,11 +8,12 @@ import javax.ejb.LocalBean;
import
javax.ejb.Stateless
;
import
javax.ejb.Stateless
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
javax.persistence.criteria.Root
;
import
fi.codecrew.moya.model.Compo_
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.model.Compo
;
import
fi.codecrew.moya.model.Compo
;
import
fi.codecrew.moya.model.Compo_
;
@Stateless
@Stateless
@LocalBean
@LocalBean
...
@@ -23,11 +25,17 @@ public class CompoFacade extends IntegerPkGenericFacade<Compo> {
...
@@ -23,11 +25,17 @@ public class CompoFacade extends IntegerPkGenericFacade<Compo> {
super
(
Compo
.
class
);
super
(
Compo
.
class
);
}
}
public
List
<
Compo
>
getList
()
{
public
List
<
Compo
>
getList
(
boolean
showHidden
)
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
Compo
>
cq
=
cb
.
createQuery
(
Compo
.
class
);
CriteriaQuery
<
Compo
>
cq
=
cb
.
createQuery
(
Compo
.
class
);
Root
<
Compo
>
root
=
cq
.
from
(
Compo
.
class
);
Root
<
Compo
>
root
=
cq
.
from
(
Compo
.
class
);
cq
.
where
(
cb
.
equal
(
root
.
get
(
Compo_
.
event
),
eventbean
.
getCurrentEvent
()));
ArrayList
<
Predicate
>
preds
=
new
ArrayList
<>();
preds
.
add
(
cb
.
equal
(
root
.
get
(
Compo_
.
event
),
eventbean
.
getCurrentEvent
()));
if
(!
showHidden
)
{
preds
.
add
(
cb
.
isFalse
(
root
.
get
(
Compo_
.
hidden
)));
}
cq
.
where
(
preds
.
toArray
(
new
Predicate
[
preds
.
size
()]));
cq
.
orderBy
(
cb
.
desc
(
root
.
get
(
Compo_
.
startTime
)));
cq
.
orderBy
(
cb
.
desc
(
root
.
get
(
Compo_
.
startTime
)));
List
<
Compo
>
ret
=
getEm
().
createQuery
(
cq
).
getResultList
();
List
<
Compo
>
ret
=
getEm
().
createQuery
(
cq
).
getResultList
();
return
ret
;
return
ret
;
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/OrgRoleFacade.java
View file @
2fb04ee
...
@@ -9,10 +9,10 @@ import javax.persistence.criteria.CriteriaBuilder;
...
@@ -9,10 +9,10 @@ import javax.persistence.criteria.CriteriaBuilder;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
import
javax.persistence.criteria.Root
;
import
fi.codecrew.moya.model.OrgRole_
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.model.EventOrganiser
;
import
fi.codecrew.moya.model.EventOrganiser
;
import
fi.codecrew.moya.model.OrgRole
;
import
fi.codecrew.moya.model.OrgRole
;
import
fi.codecrew.moya.model.OrgRole_
;
import
fi.codecrew.moya.model.User
;
import
fi.codecrew.moya.model.User
;
/**
/**
...
@@ -29,17 +29,19 @@ public class OrgRoleFacade extends IntegerPkGenericFacade<OrgRole> {
...
@@ -29,17 +29,19 @@ public class OrgRoleFacade extends IntegerPkGenericFacade<OrgRole> {
super
(
OrgRole
.
class
);
super
(
OrgRole
.
class
);
}
}
public
List
<
OrgRole
>
findForUser
(
User
user
)
{
public
List
<
OrgRole
>
findForUser
(
User
user
,
EventOrganiser
organisation
)
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
OrgRole
>
cq
=
cb
.
createQuery
(
OrgRole
.
class
);
CriteriaQuery
<
OrgRole
>
cq
=
cb
.
createQuery
(
OrgRole
.
class
);
Root
<
OrgRole
>
root
=
cq
.
from
(
OrgRole
.
class
);
Root
<
OrgRole
>
root
=
cq
.
from
(
OrgRole
.
class
);
cq
.
where
(
cb
.
equal
(
root
.
get
(
OrgRole_
.
eventOrganisation
),
eventBean
cq
.
where
(
cb
.
equal
(
root
.
get
(
OrgRole_
.
eventOrganisation
),
organisation
),
cb
.
isMember
(
user
,
root
.
get
(
OrgRole_
.
users
)));
.
getCurrentEvent
().
getOrganiser
()),
cb
.
isMember
(
user
,
root
.
get
(
OrgRole_
.
users
)));
return
getEm
().
createQuery
(
cq
).
getResultList
();
return
getEm
().
createQuery
(
cq
).
getResultList
();
}
}
public
List
<
OrgRole
>
findForUser
(
User
user
)
{
return
findForUser
(
user
,
eventBean
.
getCurrentEvent
().
getOrganiser
());
}
public
OrgRole
createRole
(
EventOrganiser
org
,
String
roleName
)
{
public
OrgRole
createRole
(
EventOrganiser
org
,
String
roleName
)
{
OrgRole
ret
=
new
OrgRole
();
OrgRole
ret
=
new
OrgRole
();
ret
.
setEventOrganisation
(
org
);
ret
.
setEventOrganisation
(
org
);
...
...
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/VotingBeanLocal.java
View file @
2fb04ee
...
@@ -15,7 +15,7 @@ public interface VotingBeanLocal {
...
@@ -15,7 +15,7 @@ public interface VotingBeanLocal {
public
void
addEntry
(
CompoEntry
compoEntry
,
CompoEntryFile
compoEntryFile
);
public
void
addEntry
(
CompoEntry
compoEntry
,
CompoEntryFile
compoEntryFile
);
public
List
<
Compo
>
getCompoList
();
public
List
<
Compo
>
getCompoList
(
boolean
showHidden
);
public
Compo
getCompoById
(
Integer
compoId
);
public
Compo
getCompoById
(
Integer
compoId
);
...
@@ -33,6 +33,10 @@ public interface VotingBeanLocal {
...
@@ -33,6 +33,10 @@ public interface VotingBeanLocal {
public
Vote
saveVote
(
CompoEntry
entry
,
Integer
vote
);
public
Vote
saveVote
(
CompoEntry
entry
,
Integer
vote
);
public
CompoEntry
findEntryWithFiles
(
Integer
entryId
);
//public CompoEntry findEntryWithFiles(Integer entryId);
public
Compo
saveCompo
(
Compo
compo
);
public
void
create
(
CompoEntryFile
cef
);
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/Compo.java
View file @
2fb04ee
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
package
fi
.
codecrew
.
moya
.
model
;
package
fi
.
codecrew
.
moya
.
model
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -31,200 +30,212 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
...
@@ -31,200 +30,212 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
@Table
(
name
=
"compos"
)
@Table
(
name
=
"compos"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
Compo
extends
GenericEntity
{
public
class
Compo
extends
GenericEntity
{
private
static
final
long
serialVersionUID
=
2L
;
private
static
final
long
serialVersionUID
=
2L
;
/**
/**
* Name of the competition.
* Name of the competition.
*/
*/
@Column
(
name
=
"compo_name"
,
nullable
=
false
)
@Column
(
name
=
"compo_name"
,
nullable
=
false
)
private
String
name
;
private
String
name
;
public
static
final
String
EVENT_ID_COLUMN
=
"event_id"
;
public
static
final
String
EVENT_ID_COLUMN
=
"event_id"
;
@ManyToOne
()
@ManyToOne
()
@JoinColumn
(
name
=
EVENT_ID_COLUMN
,
nullable
=
false
)
@JoinColumn
(
name
=
EVENT_ID_COLUMN
,
nullable
=
false
)
private
LanEvent
event
;
private
LanEvent
event
;
/**
/**
* Start time of the competition Submitting entries should be disabled after
* Start time of the competition Submitting entries should be disabled after
* this time.
* this time.
*/
*/
@Column
(
name
=
"compo_start"
)
@Column
(
name
=
"compo_start"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
startTime
;
private
Date
startTime
;
@Column
(
name
=
"compo_end"
)
@Column
(
name
=
"compo_end"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
endTime
;
private
Date
endTime
;
/**
/**
* When the voting should start
* When the voting should start
*
*
* @see {@link #holdVoting}
* @see {@link #holdVoting}
*/
*/
@Column
(
name
=
"vote_start"
)
@Column
(
name
=
"vote_start"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
voteStart
;
private
Date
voteStart
;
@Column
(
name
=
"vote_end"
)
@Column
(
name
=
"vote_end"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
voteEnd
;
private
Date
voteEnd
;
@Column
(
name
=
"submit_start"
)
@Column
(
name
=
"submit_start"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
submitStart
;
private
Date
submitStart
;
@Column
(
name
=
"submit_end"
)
@Column
(
name
=
"submit_end"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
submitEnd
;
private
Date
submitEnd
;
@Lob
@Lob
@Column
(
name
=
"description"
)
@Column
(
name
=
"description"
)
private
String
description
;
private
String
description
;
@Column
(
name
=
"max_participant_count"
)
@Column
(
name
=
"max_participant_count"
)
private
int
maxParticipantCount
;
private
int
maxParticipantCount
;
/**
/**
* If ( for some unimaginable reason ) compo is delayed hold voting can be
* If ( for some unimaginable reason ) compo is delayed hold voting can be
* used to postpone the start of the voting from the time specified in
* used to postpone the start of the voting from the time specified in
* {@link #voteStart}
* {@link #voteStart}
*/
*/
@Column
(
name
=
"hold_voting"
,
nullable
=
false
)
@Column
(
name
=
"hold_voting"
,
nullable
=
false
)
private
boolean
holdVoting
=
true
;
private
boolean
holdVoting
=
false
;
/**
@Column
(
name
=
"hidden"
,
nullable
=
false
)
* Entries submitted to participate this compo.
private
boolean
hidden
=
false
;
*/
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"compo"
)
public
boolean
isHidden
()
{
@OrderBy
(
"sort"
)
return
hidden
;
private
List
<
CompoEntry
>
compoEntries
;
}
public
Compo
(
String
compoName
,
boolean
holdVoting
)
{
public
void
setHidden
(
boolean
hidden
)
{
this
();
this
.
hidden
=
hidden
;
}
this
.
name
=
compoName
;
this
.
holdVoting
=
holdVoting
;
/**
}
* Entries submitted to participate this compo.
*/
public
boolean
isSubmit
()
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"compo"
)
{
@OrderBy
(
"sort"
)
Calendar
now
=
Calendar
.
getInstance
();
private
List
<
CompoEntry
>
compoEntries
;
return
now
.
after
(
getSubmitStart
())
&&
now
.
before
(
getSubmitEnd
());
}
public
Compo
(
String
compoName
,
boolean
holdVoting
)
{
this
();
public
boolean
isVote
()
{
this
.
name
=
compoName
;
Calendar
now
=
Calendar
.
getInstance
();
this
.
holdVoting
=
holdVoting
;
return
!
getHoldVoting
()
&&
}
now
.
after
(
getVoteStart
())
&&
now
.
before
(
getVoteEnd
());
public
boolean
isSubmit
()
}
{
Date
now
=
new
Date
();
public
Compo
()
{
return
now
.
after
(
getSubmitStart
())
&&
now
.
before
(
getSubmitEnd
());
super
();
}
}
public
boolean
isVote
()
public
String
getName
()
{
{
return
name
;
Date
now
=
new
Date
();
}
return
!
getHoldVoting
()
&&
now
.
after
(
getVoteStart
())
&&
public
void
setName
(
String
compoName
)
{
now
.
before
(
getVoteEnd
());
this
.
name
=
compoName
;
}
}
public
Compo
()
{
public
Date
getStartTime
()
{
super
();
return
startTime
;
}
}
public
String
getName
()
{
public
void
setStartTime
(
Date
compoStart
)
{
return
name
;
this
.
startTime
=
compoStart
;
}
}
public
void
setName
(
String
compoName
)
{
public
Date
getVoteStart
()
{
this
.
name
=
compoName
;
return
voteStart
;
}
}
public
Date
getStartTime
()
{
public
void
setVoteStart
(
Date
voteStart
)
{
return
startTime
;
this
.
voteStart
=
voteStart
;
}
}
public
void
setStartTime
(
Date
compoStart
)
{
public
Date
getVoteEnd
()
{
this
.
startTime
=
compoStart
;
return
voteEnd
;
}
}
public
Date
getVoteStart
()
{
public
void
setVoteEnd
(
Date
voteEnd
)
{
return
voteStart
;
this
.
voteEnd
=
voteEnd
;
}
}
public
void
setVoteStart
(
Date
voteStart
)
{
public
Date
getSubmitStart
()
{
this
.
voteStart
=
voteStart
;
return
submitStart
;
}
}
public
Date
getVoteEnd
()
{
public
void
setSubmitStart
(
Date
submitStart
)
{
return
voteEnd
;
this
.
submitStart
=
submitStart
;
}
}
public
void
setVoteEnd
(
Date
voteEnd
)
{
public
Date
getSubmitEnd
()
{
this
.
voteEnd
=
voteEnd
;
return
submitEnd
;
}
}
public
Date
getSubmitStart
()
{
public
void
setSubmitEnd
(
Date
submitEnd
)
{
return
submitStart
;
this
.
submitEnd
=
submitEnd
;
}
}
public
void
setSubmitStart
(
Date
submitStart
)
{
public
boolean
getHoldVoting
()
{
this
.
submitStart
=
submitStart
;
return
holdVoting
;
}
}
public
Date
getSubmitEnd
()
{
public
void
setHoldVoting
(
boolean
holdVoting
)
{
return
submitEnd
;
this
.
holdVoting
=
holdVoting
;
}
}
public
void
setSubmitEnd
(
Date
submitEnd
)
{
public
List
<
CompoEntry
>
getCompoEntries
()
{
this
.
submitEnd
=
submitEnd
;
return
compoEntries
;
}
}
public
boolean
getHoldVoting
()
{
public
void
setCompoEntries
(
List
<
CompoEntry
>
compoEntryList
)
{
return
holdVoting
;
this
.
compoEntries
=
compoEntryList
;
}
}
public
void
setHoldVoting
(
boolean
holdVoting
)
{
public
void
setDescription
(
String
description
)
{
this
.
holdVoting
=
holdVoting
;
this
.
description
=
description
;
}
}
public
List
<
CompoEntry
>
getCompoEntries
()
{
public
String
getDescription
()
{
return
compoEntries
;
return
description
;
}
}
public
void
setCompoEntries
(
List
<
CompoEntry
>
compoEntryList
)
{
/**
this
.
compoEntries
=
compoEntryList
;
* @return the maxParticipantCount
}
*/
public
int
getMaxParticipantCount
()
{
public
void
setDescription
(
String
description
)
{
return
maxParticipantCount
;
this
.
description
=
description
;
}
}
/**
public
String
getDescription
()
{
* @param maxParticipantCount
return
description
;
* the maxParticipantCount to set
}
*/
public
void
setMaxParticipantCount
(
int
maxParticipantCount
)
{
/**
this
.
maxParticipantCount
=
maxParticipantCount
;
* @return the maxParticipantCount
}
*/
public
int
getMaxParticipantCount
()
{
public
LanEvent
getEvent
()
{
return
maxParticipantCount
;
return
event
;
}
}
/**
public
void
setEvent
(
LanEvent
event
)
{
* @param maxParticipantCount
this
.
event
=
event
;
* the maxParticipantCount to set
}
*/
public
void
setMaxParticipantCount
(
int
maxParticipantCount
)
{
public
Date
getEndTime
()
{
this
.
maxParticipantCount
=
maxParticipantCount
;
return
endTime
;
}
}
public
LanEvent
getEvent
()
{
public
void
setEndTime
(
Date
endTime
)
{
return
event
;
this
.
endTime
=
endTime
;
}
}
public
void
setEvent
(
LanEvent
event
)
{
this
.
event
=
event
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/CompoEntry.java
View file @
2fb04ee
...
@@ -11,7 +11,6 @@ import java.util.List;
...
@@ -11,7 +11,6 @@ import java.util.List;
import
javax.persistence.CascadeType
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.Lob
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
...
@@ -23,7 +22,6 @@ import javax.persistence.TemporalType;
...
@@ -23,7 +22,6 @@ import javax.persistence.TemporalType;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
import
org.eclipse.persistence.annotations.PrivateOwned
;
/**
/**
*
*
...
@@ -32,170 +30,155 @@ import org.eclipse.persistence.annotations.PrivateOwned;
...
@@ -32,170 +30,155 @@ import org.eclipse.persistence.annotations.PrivateOwned;
@Table
(
name
=
"compo_entries"
)
@Table
(
name
=
"compo_entries"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
CompoEntry
extends
GenericEntity
{
public
class
CompoEntry
extends
GenericEntity
{
private
static
final
long
serialVersionUID
=
2L
;
private
static
final
long
serialVersionUID
=
2L
;
@JoinColumn
(
name
=
"compo_id"
,
referencedColumnName
=
"id"
,
nullable
=
false
)
@JoinColumn
(
name
=
"compo_id"
,
referencedColumnName
=
"id"
,
nullable
=
false
)
@ManyToOne
(
optional
=
false
)
@ManyToOne
(
optional
=
false
)
private
Compo
compo
;
private
Compo
compo
;
@Column
(
name
=
"entry_created"
,
nullable
=
false
)
@Column
(
name
=
"entry_created"
,
nullable
=
false
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
created
=
Calendar
.
getInstance
();
private
Calendar
created
=
Calendar
.
getInstance
();
@Column
(
name
=
"title"
,
nullable
=
false
)
private
String
title
=
""
;
@Column
(
name
=
"author"
)
private
String
author
=
""
;
@Lob
@Column
(
name
=
"notes"
)
private
String
notes
=
""
;
@Lob
@Column
(
name
=
"screen_message"
)
private
String
screenMessage
=
""
;
@Column
(
name
=
"sort"
)
private
Integer
sort
=
10
;
@Column
(
name
=
"title"
,
nullable
=
false
)
@Column
(
name
=
"final_position"
)
private
String
title
=
""
;
private
Integer
finalPosition
;
@Column
(
name
=
"author"
)
@JoinColumn
(
name
=
"current_file_id"
,
referencedColumnName
=
CompoEntryFile
.
ID_COLUMN
)
private
String
author
=
""
;
@OneToOne
private
CompoEntryFile
currentFile
;
@Lob
@Column
(
name
=
"notes"
)
@OneToMany
(
mappedBy
=
"compoEntry"
)
private
String
notes
=
""
;
private
List
<
Vote
>
votes
;
//
@Lob
// @PrivateOwned
@Column
(
name
=
"screen_message"
)
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "entry", fetch =
private
String
screenMessage
=
""
;
// FetchType.LAZY)
// private List<CompoEntryFile> files;
@Column
(
name
=
"sort"
)
private
Integer
sort
=
10
;
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"entry"
)
private
List
<
CompoEntryParticipant
>
participants
;
@Column
(
name
=
"final_position"
)
private
Integer
finalPosition
;
@JoinColumn
(
name
=
"creator_eventuser_id"
,
referencedColumnName
=
EventUser
.
ID_COLUMN
,
nullable
=
false
)
@ManyToOne
@JoinColumn
(
name
=
"current_file_id"
,
referencedColumnName
=
CompoEntryFile
.
ID_COLUMN
)
private
EventUser
creator
;
@OneToOne
private
CompoEntryFile
currentFile
;
public
Integer
getVotetotal
()
{
@OneToMany
(
mappedBy
=
"compoEntry"
)
int
votetotal
=
0
;
private
List
<
Vote
>
votes
;
for
(
Vote
v
:
getVotes
())
{
votetotal
+=
v
.
getScore
();
@PrivateOwned
}
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"entry"
,
fetch
=
FetchType
.
LAZY
)
return
votetotal
;
private
List
<
CompoEntryFile
>
files
;
}
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"entry"
)
public
CompoEntry
()
{
private
List
<
CompoEntryParticipant
>
participants
;
super
();
}
@JoinColumn
(
name
=
"creator_eventuser_id"
,
referencedColumnName
=
EventUser
.
ID_COLUMN
,
nullable
=
false
)
@ManyToOne
public
Calendar
getCreated
()
{
private
EventUser
creator
;
return
created
;
}
public
Integer
getVotetotal
()
{
public
void
setCreated
(
Calendar
entryCreated
)
{
int
votetotal
=
0
;
this
.
created
=
entryCreated
;
for
(
Vote
v
:
getVotes
())
{
}
votetotal
+=
v
.
getScore
();
}
public
String
getNotes
()
{
return
votetotal
;
return
notes
;
}
}
public
CompoEntry
()
{
public
void
setNotes
(
String
notes
)
{
super
();
this
.
notes
=
notes
;
}
}
public
Calendar
getCreated
()
{
public
String
getScreenMessage
()
{
return
created
;
return
screenMessage
;
}
}
public
void
setCreated
(
Calendar
entryCreated
)
{
public
void
setScreenMessage
(
String
screenMessage
)
{
this
.
created
=
entryCreated
;
this
.
screenMessage
=
screenMessage
;
}
}
public
String
getNotes
()
{
public
Integer
getSort
()
{
return
notes
;
return
sort
;
}
}
public
void
setNotes
(
String
notes
)
{
public
void
setSort
(
Integer
sort
)
{
this
.
notes
=
notes
;
this
.
sort
=
sort
;
}
}
public
String
getScreenMessage
()
{
public
List
<
Vote
>
getVotes
()
{
return
screenMessage
;
return
votes
;
}
}
public
void
setScreenMessage
(
String
screenMessage
)
{
public
void
setVotes
(
List
<
Vote
>
voteList
)
{
this
.
screenMessage
=
screenMessage
;
this
.
votes
=
voteList
;
}
}
public
Integer
getSort
()
{
public
List
<
CompoEntryParticipant
>
getParticipants
()
{
return
sort
;
return
participants
;
}
}
public
void
setSort
(
Integer
sort
)
{
public
void
setParticipants
(
this
.
sort
=
sort
;
List
<
CompoEntryParticipant
>
compoEntryParticipantList
)
{
}
this
.
participants
=
compoEntryParticipantList
;
}
public
List
<
Vote
>
getVotes
()
{
return
votes
;
public
Compo
getCompo
()
{
}
return
compo
;
}
public
void
setVotes
(
List
<
Vote
>
voteList
)
{
this
.
votes
=
voteList
;
public
void
setCompo
(
Compo
composId
)
{
}
this
.
compo
=
composId
;
}
public
List
<
CompoEntryFile
>
getFiles
()
{
return
files
;
public
EventUser
getCreator
()
{
}
return
creator
;
}
public
void
setFiles
(
List
<
CompoEntryFile
>
compoEntryFileList
)
{
this
.
files
=
compoEntryFileList
;
public
void
setCreator
(
EventUser
creator
)
{
}
this
.
creator
=
creator
;
}
public
List
<
CompoEntryParticipant
>
getParticipants
()
{
return
participants
;
public
void
setFinalPosition
(
Integer
finalPosition
)
{
}
this
.
finalPosition
=
finalPosition
;
}
public
void
setParticipants
(
List
<
CompoEntryParticipant
>
compoEntryParticipantList
)
{
public
Integer
getFinalPosition
()
{
this
.
participants
=
compoEntryParticipantList
;
return
finalPosition
;
}
}
public
Compo
getCompo
()
{
public
String
getTitle
()
{
return
compo
;
return
title
;
}
}
public
void
setCompo
(
Compo
composId
)
{
public
void
setTitle
(
String
title
)
{
this
.
compo
=
composId
;
this
.
title
=
title
;
}
}
public
EventUser
getCreator
()
{
public
String
getAuthor
()
{
return
creator
;
return
author
;
}
}
public
void
setCreator
(
EventUser
creator
)
{
public
void
setAuthor
(
String
author
)
{
this
.
creator
=
creator
;
this
.
author
=
author
;
}
}
public
void
setFinalPosition
(
Integer
finalPosition
)
{
this
.
finalPosition
=
finalPosition
;
}
public
Integer
getFinalPosition
()
{
return
finalPosition
;
}
public
void
setCurrentFile
(
CompoEntryFile
currentFile
)
{
this
.
currentFile
=
currentFile
;
}
public
CompoEntryFile
getCurrentFile
()
{
return
currentFile
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getAuthor
()
{
return
author
;
}
public
void
setAuthor
(
String
author
)
{
this
.
author
=
author
;
}
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/CompoEntryFile.java
View file @
2fb04ee
...
@@ -5,10 +5,14 @@
...
@@ -5,10 +5,14 @@
package
fi
.
codecrew
.
moya
.
model
;
package
fi
.
codecrew
.
moya
.
model
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
javax.persistence.Basic
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.Lob
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
...
@@ -16,8 +20,11 @@ import javax.persistence.Table;
...
@@ -16,8 +20,11 @@ import javax.persistence.Table;
import
javax.persistence.Temporal
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
javax.persistence.TemporalType
;
import
org.apache.commons.codec.binary.Hex
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
/**
*
*
...
@@ -26,94 +33,110 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
...
@@ -26,94 +33,110 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
@Table
(
name
=
"compo_entry_files"
)
@Table
(
name
=
"compo_entry_files"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
CompoEntryFile
extends
GenericEntity
{
public
class
CompoEntryFile
extends
GenericEntity
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@Column
(
name
=
"mime_type"
)
@Column
(
name
=
"mime_type"
)
private
String
mimeType
;
private
String
mimeType
;
@Column
(
name
=
"file_name"
)
@Column
(
name
=
"file_name"
)
private
String
fileName
;
private
String
fileName
;
@Lob
@Lob
@Column
(
name
=
"description"
)
@Column
(
name
=
"description"
)
private
String
description
;
private
String
description
;
@Column
(
name
=
"hash"
)
@Column
(
name
=
"hash"
,
updatable
=
false
)
private
String
hash
;
private
String
hash
;
@Lob
@Lob
@Column
(
name
=
"file_data"
)
@Column
(
name
=
"file_data"
,
updatable
=
false
)
private
byte
[]
fileData
;
@Basic
(
fetch
=
FetchType
.
LAZY
)
private
byte
[]
fileData
;
@Column
(
name
=
"uploaded"
,
nullable
=
false
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"uploaded"
,
nullable
=
false
)
private
Calendar
uploaded
=
Calendar
.
getInstance
();
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
uploaded
=
Calendar
.
getInstance
();
@JoinColumn
(
name
=
"entry_id"
,
referencedColumnName
=
"id"
,
nullable
=
false
,
updatable
=
false
)
@ManyToOne
(
optional
=
false
)
@JoinColumn
(
name
=
"entry_id"
,
referencedColumnName
=
"id"
,
nullable
=
false
,
updatable
=
false
)
private
CompoEntry
entry
;
@ManyToOne
(
optional
=
false
)
private
CompoEntry
entry
;
public
CompoEntryFile
()
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CompoEntryFile
.
class
);
super
();
}
public
CompoEntryFile
()
{
super
();
public
CompoEntryFile
(
CompoEntry
entry
)
{
}
this
.
entry
=
entry
;
}
public
CompoEntryFile
(
CompoEntry
entry
)
{
this
.
entry
=
entry
;
public
String
getMimeType
()
{
}
return
mimeType
;
}
public
String
getMimeType
()
{
return
mimeType
;
public
void
setMimeType
(
String
mimeType
)
{
}
this
.
mimeType
=
mimeType
;
}
public
void
setMimeType
(
String
mimeType
)
{
this
.
mimeType
=
mimeType
;
public
String
getFileName
()
{
}
return
fileName
;
}
public
String
getFileName
()
{
return
fileName
;
public
void
setFileName
(
String
fileName
)
{
}
this
.
fileName
=
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
public
String
getDescription
()
{
}
return
description
;
}
public
String
getDescription
()
{
return
description
;
public
void
setDescription
(
String
description
)
{
}
this
.
description
=
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
public
String
getHash
()
{
}
return
hash
;
}
public
String
getHash
()
{
return
hash
;
public
void
setHash
(
String
hash
)
{
}
this
.
hash
=
hash
;
}
public
void
setHash
(
String
hash
)
{
this
.
hash
=
hash
;
public
byte
[]
getFileData
()
{
}
return
fileData
;
}
public
byte
[]
getFileData
()
{
return
fileData
;
public
void
setFileData
(
byte
[]
fileData
)
{
}
this
.
fileData
=
fileData
;
}
public
void
setFileData
(
byte
[]
fileData
)
{
this
.
fileData
=
fileData
;
public
Calendar
getUploaded
()
{
this
.
hash
=
getShaChecksum
(
fileData
);
return
uploaded
;
}
}
public
Calendar
getUploaded
()
{
public
void
setUploaded
(
Calendar
uploaded
)
{
return
uploaded
;
this
.
uploaded
=
uploaded
;
}
}
public
void
setUploaded
(
Calendar
uploaded
)
{
public
CompoEntry
getEntriesId
()
{
this
.
uploaded
=
uploaded
;
return
entry
;
}
}
public
CompoEntry
getEntriesId
()
{
public
void
setEntriesId
(
CompoEntry
entriesId
)
{
return
entry
;
this
.
entry
=
entriesId
;
}
}
public
void
setEntriesId
(
CompoEntry
entriesId
)
{
this
.
entry
=
entriesId
;
}
public
static
String
getShaChecksum
(
byte
[]
data
)
{
String
ret
=
"ERROR CALCULATING CHECKSUM!"
;
try
{
MessageDigest
algo
=
MessageDigest
.
getInstance
(
"SHA"
);
algo
.
update
(
data
);
ret
=
new
String
(
Hex
.
encodeHex
(
algo
.
digest
())).
toLowerCase
();
}
catch
(
NoSuchAlgorithmException
e
)
{
logger
.
warn
(
"Error calculating checksum"
,
e
);
}
return
ret
;
}
}
}
code/MoyaWeb/WebContent/resources/cditools/compo/editCompo.xhtml
0 → 100644
View file @
2fb04ee
<?xml version='1.0' encoding='UTF-8' ?>
<!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:p=
"http://primefaces.org/ui"
>
<composite:interface>
<composite:attribute
name=
"commitValue"
required=
"true"
/>
<composite:attribute
name=
"commitAction"
method-signature=
"java.lang.String action()"
required=
"true"
/>
</composite:interface>
<composite:implementation>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"#{i18n['voting.create.name']}:"
for=
"name"
/>
<h:inputText
value=
"#{compoMgmtView.compo.name}"
id=
"name"
/>
<h:message
for=
"name"
/>
<h:outputLabel
value=
"#{i18n['voting.create.description']}:"
for=
"desc"
/>
<h:inputText
value=
"#{compoMgmtView.compo.description}"
id=
"desc"
/>
<h:message
for=
"desc"
/>
<h:outputLabel
value=
"#{i18n['voting.create.maxParticipants']}:"
for=
"maxPar"
/>
<h:inputText
value=
"#{compoMgmtView.compo.maxParticipantCount}"
id=
"maxPar"
/>
<h:message
for=
"maxPar"
/>
<h:outputLabel
value=
"#{i18n['voting.create.holdVoting']}:"
for=
"holdVoting"
/>
<h:selectBooleanCheckbox
value=
"#{compoMgmtView.compo.holdVoting}"
id=
"holdVoting"
/>
<h:message
for=
"holdVoting"
/>
<h:outputLabel
value=
"#{i18n['voting.create.hidden']}:"
for=
"hidden"
/>
<h:selectBooleanCheckbox
value=
"#{compoMgmtView.compo.hidden}"
id=
"hidden"
/>
<h:message
for=
"hidden"
/>
<h:outputLabel
value=
"#{i18n['voting.create.compoStart']}:"
for=
"cStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveCStart}"
value=
"#{compoMgmtView.compo.startTime}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cStart"
/>
<h:message
for=
"cStart"
/>
<h:outputLabel
value=
"#{i18n['voting.create.compoEnd']}:"
for=
"cEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateCompo}"
value=
"#{compoMgmtView.compo.endTime}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cEnd"
/>
<h:message
for=
"cEnd"
/>
<h:outputLabel
value=
"#{i18n['voting.create.voteStart']}:"
for=
"vStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveVStart}"
value=
"#{compoMgmtView.compo.voteStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vStart"
/>
<h:message
for=
"vStart"
/>
<h:outputLabel
value=
"#{i18n['voting.create.voteEnd']}:"
for=
"vEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateVote}"
value=
"#{compoMgmtView.compo.voteEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vEnd"
/>
<h:message
for=
"vEnd"
/>
<h:outputLabel
value=
"#{i18n['voting.create.submitStart']}:"
for=
"sStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveSStart}"
value=
"#{compoMgmtView.compo.submitStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sStart"
/>
<h:message
for=
"sStart"
/>
<h:outputLabel
value=
"#{i18n['voting.create.submitEnd']}:"
for=
"sEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateSubmit}"
value=
"#{compoMgmtView.compo.submitEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sEnd"
/>
<h:message
for=
"sEnd"
/>
<h:commandButton
action=
"#{cc.attrs.commitAction}"
id=
"commitbutton"
value=
"#{cc.attrs.commitValue}"
/>
</h:panelGrid>
</h:form>
</composite:implementation>
</html>
code/MoyaWeb/WebContent/voting/admincompolist.xhtml
View file @
2fb04ee
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<h:body>
<h:body>
<ui:composition
template=
"#{sessionHandler.template}"
>
<ui:composition
template=
"#{sessionHandler.template}"
>
<f:metadata>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{compoView.initListView()}"
/>
<f:event
type=
"preRenderView"
listener=
"#{compoView.init
Admin
ListView()}"
/>
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<h:outputStylesheet
library=
"style"
name=
"insomnia2/css/actionlog.css"
/>
<h:outputStylesheet
library=
"style"
name=
"insomnia2/css/actionlog.css"
/>
...
@@ -15,13 +15,10 @@
...
@@ -15,13 +15,10 @@
<p>
#{i18n['voting.allcompos.description']}
</p>
<p>
#{i18n['voting.allcompos.description']}
</p>
<h:form>
<h:form>
<h:dataTable
styleClass=
"bordertable"
rowClasses=
"roweven,rowodd"
id=
"compolisttable"
value=
"#{compoView.compos}"
var=
"compo"
>
<p:dataTable
styleClass=
"bordertable"
rowClasses=
"roweven,rowodd"
id=
"compolisttable"
value=
"#{compoView.compos}"
var=
"compo"
>
<h:column>
<p:column
headerText=
"#{i18n['voting.allcompos.name']}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['voting.allcompos.name']}"
/>
</f:facet>
<h:outputText
value=
"#{compo.name}"
/>
<h:outputText
value=
"#{compo.name}"
/>
</
h
:column>
</
p
:column>
<!-- <h:column rendered="#{compoView.curEntries}"> -->
<!-- <h:column rendered="#{compoView.curEntries}"> -->
<!-- <f:facet name="header"> -->
<!-- <f:facet name="header"> -->
...
@@ -35,45 +32,42 @@
...
@@ -35,45 +32,42 @@
<!-- </f:facet> -->
<!-- </f:facet> -->
<!-- <h:outputText value="#{compo.maxParticipantCount}" /> -->
<!-- <h:outputText value="#{compo.maxParticipantCount}" /> -->
<!-- </h:column> -->
<!-- </h:column> -->
<h:column>
<p:column
headerText=
"#{i18n['voting.allcompos.startTime']}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['voting.allcompos.startTime']}"
/>
</f:facet>
<h:outputText
value=
"#{compo.startTime.time}"
>
<h:outputText
value=
"#{compo.startTime.time}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
</h:outputText>
</
h
:column>
</
p
:column>
<h:column>
<p:column
headerText=
"#{i18n['voting.allcompos.voteEnd']}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['voting.allcompos.voteEnd']}"
/>
</f:facet>
<h:outputText
value=
"#{compo.voteEnd.time}"
>
<h:outputText
value=
"#{compo.voteEnd.time}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
</h:outputText>
</
h
:column>
</
p
:column>
<h:column>
<p:column
headerText=
"#{i18n['voting.allcompos.submitEnd']}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['voting.allcompos.submitEnd']}"
/>
</f:facet>
<h:outputText
value=
"#{compo.submitEnd.time}"
>
<h:outputText
value=
"#{compo.submitEnd.time}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
</h:outputText>
</h:column>
</p:column>
<h:column>
<p:column
headerText=
"#{i18n['voting.allcompos.holdVoting']}"
>
<h:outputText
value=
"#{compo.holdVoting}"
/>
</p:column>
<p:column
headerText=
"#{i18n['voting.allcompos.hidden']}"
>
<h:outputText
value=
"#{compo.hidden}"
/>
</p:column>
<p:column>
<h:commandButton
rendered=
"#{compo.vote or compoView.manage}"
action=
"#{compoView.startVote()}"
value=
"#{i18n['voting.compo.vote']}"
/>
<h:commandButton
rendered=
"#{compo.vote or compoView.manage}"
action=
"#{compoView.startVote()}"
value=
"#{i18n['voting.compo.vote']}"
/>
</
h
:column>
</
p
:column>
<
h
:column>
<
p
:column>
<h:commandButton
rendered=
"#{compo.submit or compoView.manage}"
action=
"#{compoView.submitEntry()}"
value=
"#{i18n['voting.compo.submit']}"
/>
<h:commandButton
rendered=
"#{compo.submit or compoView.manage}"
action=
"#{compoView.submitEntry()}"
value=
"#{i18n['voting.compo.submit']}"
/>
</
h
:column>
</
p
:column>
<
h
:column
rendered=
"#{compoView.manage}"
>
<
p
:column
rendered=
"#{compoView.manage}"
>
<h:link
outcome=
"details"
value=
"#{i18n['compo.edit']}"
>
<h:link
outcome=
"details"
value=
"#{i18n['compo.edit']}"
>
<f:param
name=
"compoId"
value=
"#{compo.id}"
/>
<f:param
name=
"compoId"
value=
"#{compo.id}"
/>
</h:link>
</h:link>
</
h
:column>
</
p
:column>
</
h
:dataTable>
</
p
:dataTable>
</h:form>
</h:form>
</ui:define>
</ui:define>
...
...
code/MoyaWeb/WebContent/voting/create.xhtml
View file @
2fb04ee
<!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: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:compo=
"http://java.sun.com/jsf/composite/cditools/compo"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<h:body>
<ui:composition
template=
"#{sessionHandler.template}"
>
<ui:composition
template=
"#{sessionHandler.template}"
>
<f:metadata>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{
votingCreate
View.initCreate}"
/>
<f:event
type=
"preRenderView"
listener=
"#{
compoMgmt
View.initCreate}"
/>
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
#{i18n['voting.create.header']}
</h1>
<h1>
#{i18n['voting.create.header']}
</h1>
<p>
#{i18n['voting.create.description']}
</p>
<p>
#{i18n['voting.create.description']}
</p>
<div>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"#{i18n['voting.create.name']}:"
for=
"name"
/>
<h:inputText
value=
"#{votingCreateView.compo.name}"
id=
"name"
/>
<h:message
for=
"name"
/>
<h:outputLabel
value=
"#{i18n['voting.create.description']}:"
for=
"desc"
/>
<compo:editCompo
commitAction=
"#{compoMgmtView.createCompo}"
commitValue=
"#{i18n['voting.create.createButton']}"
/>
<h:inputText
value=
"#{votingCreateView.compo.description}"
id=
"desc"
/>
<h:message
for=
"desc"
/>
<h:outputLabel
value=
"#{i18n['voting.create.maxParticipants']}:"
for=
"maxPar"
/>
<h:inputText
value=
"#{votingCreateView.compo.maxParticipantCount}"
id=
"maxPar"
/>
<h:message
for=
"maxPar"
/>
<h:outputLabel
value=
"#{i18n['voting.create.compoStart']}:"
for=
"cStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveCStart}"
value=
"#{votingCreateView.compo.startTime}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cStart"
/>
<h:message
for=
"cStart"
/>
<h:outputLabel
value=
"#{i18n['voting.create.compoEnd']}:"
for=
"cEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateCompo}"
value=
"#{votingCreateView.compo.endTime}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cEnd"
/>
<h:message
for=
"cEnd"
/>
<h:outputLabel
value=
"#{i18n['voting.create.voteStart']}:"
for=
"vStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveVStart}"
value=
"#{votingCreateView.compo.voteStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vStart"
/>
<h:message
for=
"vStart"
/>
<h:outputLabel
value=
"#{i18n['voting.create.voteEnd']}:"
for=
"vEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateVote}"
value=
"#{votingCreateView.compo.voteEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vEnd"
/>
<h:message
for=
"vEnd"
/>
<h:outputLabel
value=
"#{i18n['voting.create.submitStart']}:"
for=
"sStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveSStart}"
value=
"#{votingCreateView.compo.submitStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sStart"
/>
<h:message
for=
"sStart"
/>
<h:outputLabel
value=
"#{i18n['voting.create.submitEnd']}:"
for=
"sEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateSubmit}"
value=
"#{votingCreateView.compo.submitEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sEnd"
/>
<h:message
for=
"sEnd"
/>
<h:commandButton
action=
"#{votingCreateView.create}"
value=
"#{i18n['voting.create.createButton']}"
/>
</h:panelGrid>
</h:form>
</div>
<div
class=
"clearfix"
></div>
</ui:define>
</ui:define>
</ui:composition>
</ui:composition>
</h:body>
</h:body>
...
...
code/MoyaWeb/WebContent/voting/details.xhtml
View file @
2fb04ee
...
@@ -2,23 +2,26 @@
...
@@ -2,23 +2,26 @@
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"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
<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:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
xmlns:
compo=
"http://java.sun.com/jsf/composite/cditools/compo"
xmlns:
tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<h:body>
<ui:composition
template=
"#{sessionHandler.template}"
>
<ui:composition
template=
"#{sessionHandler.template}"
>
<f:metadata>
<f:metadata>
<f:viewParam
name=
"compoId"
value=
"#{
votingDetails
View.compoId}"
/>
<f:viewParam
name=
"compoId"
value=
"#{
compoMgmt
View.compoId}"
/>
<!-- <f:viewParam name="compoId" value="#{
votingDetails
View.compoId2}" /> -->
<!-- <f:viewParam name="compoId" value="#{
compoMgmt
View.compoId2}" /> -->
<f:event
type=
"preRenderView"
listener=
"#{
votingDetails
View.initView}"
/>
<f:event
type=
"preRenderView"
listener=
"#{
compoMgmt
View.initView}"
/>
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
Compo: #{
votingDetails
View.compo.name}
</h1>
<h1>
Compo: #{
compoMgmt
View.compo.name}
</h1>
<p>
Infoa compon entryistä
</p>
<p>
Infoa compon entryistä
</p>
<compo:editCompo
commitAction=
"#{compoMgmtView.saveCompo}"
commitValue=
"#{i18n['voting.create.saveCompo']}"
/>
<h2>
#{i18n['compoMgmtView.compo.entries']}
</h2>
<h:form>
<h:form>
<h:dataTable
styleClass=
"bordertable"
rowClasses=
"roweven,rowodd"
id=
"compolisttable"
value=
"#{
votingDetails
View.entries}"
var=
"entry"
>
<h:dataTable
styleClass=
"bordertable"
rowClasses=
"roweven,rowodd"
id=
"compolisttable"
value=
"#{
compoMgmt
View.entries}"
var=
"entry"
>
<h:column>
<h:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"Title"
/>
<h:outputText
value=
"Title"
/>
...
@@ -77,7 +80,7 @@
...
@@ -77,7 +80,7 @@
</h:column>
</h:column>
</h:dataTable>
</h:dataTable>
<h:commandButton
action=
"#{
votingDetails
View.saveSort}"
value=
"#{i18n['compo.savesort']}"
/>
<h:commandButton
action=
"#{
compoMgmt
View.saveSort}"
value=
"#{i18n['compo.savesort']}"
/>
</h:form>
</h:form>
...
...
code/MoyaWeb/WebContent/voting/submitEntry.xhtml
View file @
2fb04ee
...
@@ -14,12 +14,15 @@
...
@@ -14,12 +14,15 @@
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
#{i18n['voting.compoentryadd.title']}
</h1>
<h1>
#{i18n['voting.compoentryadd.title']}
</h1>
<p>
#{i18n['voting.compoentryadd.description']}
<h:outputText
value=
"#{compoView.compo.name}"
/></p>
<p>
<p>
#{i18n['voting.compoentryadd.description']}
<h:outputText
value=
"#{compoView.compo.description}"
/>
<h:outputText
value=
"#{compoView.compo.name}"
/>
</p>
</p>
<p>
<h:outputText
value=
"#{compoView.compo.description}"
/>
</p>
<h:form>
<h:form>
<
!-- <
h:panelGrid columns="3">
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"Title"
for=
"name"
/>
<h:outputLabel
value=
"Title"
for=
"name"
/>
<h:inputText
value=
"#{compoView.entry.title}"
id=
"name"
/>
<h:inputText
value=
"#{compoView.entry.title}"
id=
"name"
/>
<h:message
for=
"name"
/>
<h:message
for=
"name"
/>
...
@@ -36,17 +39,17 @@
...
@@ -36,17 +39,17 @@
<h:inputTextarea
value=
"#{compoView.entry.screenMessage}"
id=
"screenmessage"
/>
<h:inputTextarea
value=
"#{compoView.entry.screenMessage}"
id=
"screenmessage"
/>
<h:message
for=
"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.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:panelGrid>
-->
<h:commandButton
rendered=
"#{empty compoView.entry.id}"
action=
"#{compoView.createEntry()}"
value=
"Ilmoittaudu kilpailuun"
/>
<h:commandButton
rendered=
"#{empty compoView.entry.id}"
action=
"#{compoView.createEntry()}"
value=
"Ilmoittaudu kilpailuun"
/>
</h:form>
</h:form>
<ui:fragment
rendered=
"#{!empty compoView.entry.id}"
>
<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"
/>
<p:fileUpload
value=
"#{compoView.uploadedFile}"
id=
"uploadedfile"
mode=
"simple"
/>
<h:commandButton
action=
"#{compoView.submitEntryfile}"
value=
"#{i18n['compofile.upload']}"
/>
<h:commandButton
action=
"#{compoView.submitEntryfile}"
value=
"#{i18n['compofile.upload']}"
/>
</h:form>
</h:form>
...
@@ -54,15 +57,25 @@
...
@@ -54,15 +57,25 @@
<h2>
<h2>
<h:outputText
value=
"#{i18n['compofile.download.header']}"
/>
<h:outputText
value=
"#{i18n['compofile.download.header']}"
/>
</h2>
</h2>
<h:selectOneRadio layout="pageDirection" value="#{compoFileDownloadView.file}" converter="#{compoFileConverter}">
<p:dataTable
value=
"#{compoFileDownloadView.files}"
var=
"fi"
>
<f:selectItems var="fi" value="#{compoFileDownloadView.files}" itemLabel="#{fi.fileName} / #{fi.uploaded.time}" />
<p:column
headerText=
"#{i18n['compofile.fileName']}"
>
</h:selectOneRadio>
<h:outputText
value=
"#{fi.fileName}"
/>
<h:commandButton value="#{i18n['compofile.download']}">
</p:column>
<p:fileDownload value="#{compoFileDownloadView.dlfile}" />
<p:column
headerText=
"#{i18n['compofile.uploadTime']}"
>
</h:commandButton>
<h:outputText
value=
"#{fi.uploaded.time}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.shortDatetimeFormat}"
/>
</h:outputText>
</p:column>
<p:column
headerText=
"#{i18n['compofile.shaChecksum']}"
>
<h:outputText
value=
"#{fi.hash}"
/>
</p:column>
<p:column>
<p:commandButton
ajax=
"false"
value=
"#{i18n['compofile.download']}"
actionListener=
"#{compoFileDownloadView.selectDownloadedFile}"
>
<p:fileDownload
value=
"#{compoFileDownloadView.dlfile}"
/>
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
</h:form>
-->
Ilmoittautuminen otettu vastaan.
</ui:fragment>
</ui:fragment>
</ui:define>
</ui:define>
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
View file @
2fb04ee
...
@@ -218,14 +218,19 @@ checkout.return.successMessage = Payment confirmed. Your products have been paid
...
@@ -218,14 +218,19 @@ checkout.return.successMessage = Payment confirmed. Your products have been paid
code.inputfield
=
Give readercode
code.inputfield
=
Give readercode
compo.edit
=
Edit compo
compo.edit
=
Edit compo
compo.saveVotes
=
Save votes
compo.saveVotes
=
Save votes
compo.savesort
=
Save order
compo.savesort
=
Save order
compo.votesSaved
=
Votes saved
compo.votesSaved
=
Votes saved
compoMgmtView.compo.entries
=
Entries
compofile.download
=
Download
compofile.download
=
Download
compofile.download.header
=
Download file
compofile.download.header
=
Download file
compofile.fileName
=
Filename
compofile.shaChecksum
=
SHA checksum
compofile.upload
=
Upload file
compofile.upload
=
Upload file
compofile.uploadTime
=
Upload time
content.showContentEditLinks
=
Show content edit links
content.showContentEditLinks
=
Show content edit links
...
@@ -1297,6 +1302,8 @@ voting.allcompos.descri = Description
...
@@ -1297,6 +1302,8 @@ voting.allcompos.descri = Description
voting.allcompos.description
=
List of all compos and theirs information.
voting.allcompos.description
=
List of all compos and theirs information.
voting.allcompos.endTime
=
End time
voting.allcompos.endTime
=
End time
voting.allcompos.header
=
All compos
voting.allcompos.header
=
All compos
voting.allcompos.hidden
=
Hidden
voting.allcompos.holdVoting
=
Hold voting
voting.allcompos.maxParts
=
Max participants
voting.allcompos.maxParts
=
Max participants
voting.allcompos.name
=
Name
voting.allcompos.name
=
Name
voting.allcompos.startTime
=
Start time
voting.allcompos.startTime
=
Start time
...
@@ -1322,8 +1329,11 @@ voting.create.createButton = Create
...
@@ -1322,8 +1329,11 @@ voting.create.createButton = Create
voting.create.dateValidatorEndDate
=
End time before start time.
voting.create.dateValidatorEndDate
=
End time before start time.
voting.create.description
=
Description
voting.create.description
=
Description
voting.create.header
=
Create compo
voting.create.header
=
Create compo
voting.create.hidden
=
Hidden
voting.create.holdVoting
=
Hold voting
voting.create.maxParticipants
=
Max participants
voting.create.maxParticipants
=
Max participants
voting.create.name
=
Name
voting.create.name
=
Name
voting.create.saveCompo
=
Save compo
voting.create.submitEnd
=
Submit close
voting.create.submitEnd
=
Submit close
voting.create.submitStart
=
Submit start
voting.create.submitStart
=
Submit start
voting.create.voteEnd
=
Voting close
voting.create.voteEnd
=
Voting close
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
View file @
2fb04ee
...
@@ -220,14 +220,19 @@ checkout.return.successMessage = Maksu vahvistettu. Tuotteet on maksettu. Voit s
...
@@ -220,14 +220,19 @@ checkout.return.successMessage = Maksu vahvistettu. Tuotteet on maksettu. Voit s
code.inputfield
=
Sy
\u
00F6t
\u
00E4 viivakoodi
code.inputfield
=
Sy
\u
00F6t
\u
00E4 viivakoodi
compo.edit
=
Muokkaa compoa
compo.edit
=
Muokkaa compoa
compo.saveVotes
=
Tallenna
\u
00E4
\u
00E4net
compo.saveVotes
=
Tallenna
\u
00E4
\u
00E4net
compo.savesort
=
Tallenna j
\u
00E4rjestys
compo.savesort
=
Tallenna j
\u
00E4rjestys
compo.votesSaved
=
\u
00C4
\u
00E4net tallennettu
compo.votesSaved
=
\u
00C4
\u
00E4net tallennettu
compofile.download
=
lataa
compoMgmtView.compo.entries
=
Entryt
compofile.download
=
Lataa
compofile.download.header
=
Lataa tiedosto
compofile.download.header
=
Lataa tiedosto
compofile.fileName
=
Tiedoston nimi
compofile.shaChecksum
=
SHA tarkistesumma
compofile.upload
=
L
\u
00E4het
\u
00E4 tiedosto
compofile.upload
=
L
\u
00E4het
\u
00E4 tiedosto
compofile.uploadTime
=
Tallennusaika
content.showContentEditLinks
=
N
\u
00E4yt
\u
00E4 sis
\u
00E4ll
\u
00F6nmuokkauslinkit
content.showContentEditLinks
=
N
\u
00E4yt
\u
00E4 sis
\u
00E4ll
\u
00F6nmuokkauslinkit
...
@@ -1278,6 +1283,8 @@ voting.allcompos.descri = Kuvaus
...
@@ -1278,6 +1283,8 @@ voting.allcompos.descri = Kuvaus
voting.allcompos.description
=
Compojen informaatiot.
voting.allcompos.description
=
Compojen informaatiot.
voting.allcompos.endTime
=
Lopetusaika
voting.allcompos.endTime
=
Lopetusaika
voting.allcompos.header
=
Kaikki compot
voting.allcompos.header
=
Kaikki compot
voting.allcompos.hidden
=
Piilotettu
voting.allcompos.holdVoting
=
Hold voting
voting.allcompos.maxParts
=
Max osallistujam
\u
00E4
\u
00E4r
\u
00E4
voting.allcompos.maxParts
=
Max osallistujam
\u
00E4
\u
00E4r
\u
00E4
voting.allcompos.name
=
Nimi
voting.allcompos.name
=
Nimi
voting.allcompos.startTime
=
Aloitusaika
voting.allcompos.startTime
=
Aloitusaika
...
@@ -1303,8 +1310,11 @@ voting.create.createButton = Luo
...
@@ -1303,8 +1310,11 @@ voting.create.createButton = Luo
voting.create.dateValidatorEndDate
=
Loppumisaika ennen alkua.
voting.create.dateValidatorEndDate
=
Loppumisaika ennen alkua.
voting.create.description
=
Kuvaus
voting.create.description
=
Kuvaus
voting.create.header
=
Compon luonti
voting.create.header
=
Compon luonti
voting.create.hidden
=
Piilotettu
voting.create.holdVoting
=
Hold voting
voting.create.maxParticipants
=
Max osallistujat
voting.create.maxParticipants
=
Max osallistujat
voting.create.name
=
Nimi
voting.create.name
=
Nimi
voting.create.saveCompo
=
Tallenna
voting.create.submitEnd
=
Submit kiinni
voting.create.submitEnd
=
Submit kiinni
voting.create.submitStart
=
Submit auki
voting.create.submitStart
=
Submit auki
voting.create.voteEnd
=
\u
00C4
\u
00E4nestys kiinni
voting.create.voteEnd
=
\u
00C4
\u
00E4nestys kiinni
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/organisation/EventOrgView.java
View file @
2fb04ee
...
@@ -82,8 +82,10 @@ public class EventOrgView extends GenericCDIView {
...
@@ -82,8 +82,10 @@ public class EventOrgView extends GenericCDIView {
}
}
public
void
initEdit
()
{
public
void
initEdit
()
{
if
(
orgId
==
null
)
{
if
((
super
.
requirePermissions
(
eventorgbean
.
hasOrgPermission
(
orgId
)
||
user
.
getUser
().
isSuperadmin
()))
&&
eventorg
==
null
)
{
orgId
=
eventbean
.
getCurrentEvent
().
getOrganiser
().
getId
();
}
if
(
super
.
requirePermissions
(
eventorgbean
.
hasOrgPermission
(
orgId
)
||
user
.
getUser
().
isSuperadmin
())
&&
eventorg
==
null
)
{
eventorg
=
eventorgbean
.
find
(
orgId
);
eventorg
=
eventorgbean
.
find
(
orgId
);
super
.
beginConversation
();
super
.
beginConversation
();
}
}
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/CompoFileDownloadView.java
View file @
2fb04ee
...
@@ -46,6 +46,12 @@ public class CompoFileDownloadView extends GenericCDIView {
...
@@ -46,6 +46,12 @@ public class CompoFileDownloadView extends GenericCDIView {
return
file
;
return
file
;
}
}
public
void
selectDownloadedFile
()
{
file
=
files
.
getRowData
();
dlfile
=
new
DefaultStreamedContent
(
new
ByteArrayInputStream
(
file
.
getFileData
()),
file
.
getMimeType
(),
file
.
getFileName
());
}
public
void
setFile
(
CompoEntryFile
file
)
{
public
void
setFile
(
CompoEntryFile
file
)
{
this
.
file
=
file
;
this
.
file
=
file
;
if
(
file
!=
null
)
if
(
file
!=
null
)
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/
VotingDetails
View.java
→
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/
CompoMgmt
View.java
View file @
2fb04ee
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
voting
;
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
voting
;
import
java.util.Date
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.faces.model.ListDataModel
;
import
javax.faces.model.ListDataModel
;
...
@@ -16,7 +18,7 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
...
@@ -16,7 +18,7 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named
@Named
@ConversationScoped
@ConversationScoped
public
class
VotingDetails
View
extends
GenericCDIView
{
public
class
CompoMgmt
View
extends
GenericCDIView
{
/**
/**
*
*
...
@@ -34,12 +36,40 @@ public class VotingDetailsView extends GenericCDIView {
...
@@ -34,12 +36,40 @@ public class VotingDetailsView extends GenericCDIView {
private
transient
ListDataModel
<
CompoEntry
>
entries
;
private
transient
ListDataModel
<
CompoEntry
>
entries
;
@SuppressWarnings
(
"unused"
)
@SuppressWarnings
(
"unused"
)
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
VotingDetails
View
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CompoMgmt
View
.
class
);
public
Integer
getCompoId
()
{
public
Integer
getCompoId
()
{
return
compoId
;
return
compoId
;
}
}
public
void
initCreate
()
{
if
(
super
.
requirePermissions
(
fi
.
codecrew
.
moya
.
enums
.
apps
.
CompoPermission
.
MANAGE
)
&&
compo
==
null
)
{
compo
=
new
Compo
();
Date
now
=
new
Date
();
compo
.
setStartTime
(
now
);
compo
.
setEndTime
(
now
);
compo
.
setSubmitStart
(
now
);
compo
.
setSubmitEnd
(
now
);
compo
.
setVoteStart
(
now
);
compo
.
setVoteEnd
(
now
);
super
.
beginConversation
();
}
}
public
String
createCompo
()
{
votingBean
.
createCompo
(
compo
);
return
"details"
;
}
public
String
saveCompo
()
{
compo
=
votingBean
.
saveCompo
(
compo
);
return
null
;
}
public
String
saveSort
()
public
String
saveSort
()
{
{
for
(
CompoEntry
e
:
entries
)
for
(
CompoEntry
e
:
entries
)
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/CompoView.java
View file @
2fb04ee
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
voting
;
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
voting
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.ConversationScoped
;
...
@@ -155,8 +154,10 @@ public class CompoView extends GenericCDIView {
...
@@ -155,8 +154,10 @@ public class CompoView extends GenericCDIView {
byte
[]
contents
=
null
;
byte
[]
contents
=
null
;
if
(
file
.
getContents
()
!=
null
)
{
if
(
file
.
getContents
()
!=
null
)
{
contents
=
file
.
getContents
();
contents
=
file
.
getContents
();
logger
.
info
(
"Got file contents from .confents()"
);
}
else
{
}
else
{
contents
=
new
byte
[(
int
)
file
.
getSize
()];
contents
=
new
byte
[(
int
)
file
.
getSize
()];
logger
.
info
(
"Read {} bytes from stream in file {}"
,
file
.
getSize
(),
file
.
getFileName
());
try
{
try
{
file
.
getInputstream
().
read
(
contents
);
file
.
getInputstream
().
read
(
contents
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -176,21 +177,31 @@ public class CompoView extends GenericCDIView {
...
@@ -176,21 +177,31 @@ public class CompoView extends GenericCDIView {
logger
.
info
(
"Got file name {} length {}"
,
getUploadedFile
().
getFileName
(),
cef
.
getFileData
().
length
);
logger
.
info
(
"Got file name {} length {}"
,
getUploadedFile
().
getFileName
(),
cef
.
getFileData
().
length
);
cef
.
setFileName
(
getUploadedFile
().
getFileName
());
cef
.
setFileName
(
getUploadedFile
().
getFileName
());
cef
.
setMimeType
(
getUploadedFile
().
getContentType
());
cef
.
setMimeType
(
getUploadedFile
().
getContentType
());
if
(
getEntry
().
getFiles
()
==
null
)
{
getEntry
().
setFiles
(
new
ArrayList
<
CompoEntryFile
>());
}
getEntry
().
getFiles
().
add
(
cef
);
getEntry
().
setCurrentFile
(
cef
);
setEntry
(
votbean
.
saveEntry
(
getEntry
()));
// getEntry().setCurrentFile(cef);
votbean
.
create
(
cef
);
return
null
;
return
null
;
}
}
public
void
initAdminListView
()
{
if
(
requirePermissions
(
CompoPermission
.
MANAGE
)
&&
compolist
==
null
)
{
compolist
=
new
ListDataModel
<
Compo
>(
votbean
.
getCompoList
(
true
));
setManage
(
hasPermission
(
CompoPermission
.
MANAGE
));
logger
.
info
(
"Permission to view full compo listing."
);
super
.
beginConversation
();
}
else
{
logger
.
info
(
"Not enough rights to view full compo listing."
);
}
}
public
void
initListView
()
{
public
void
initListView
()
{
if
(
requirePermissions
(
CompoPermission
.
VIEW_COMPOS
)
&&
compolist
==
null
)
{
if
(
requirePermissions
(
CompoPermission
.
VIEW_COMPOS
)
&&
compolist
==
null
)
{
compolist
=
new
ListDataModel
<
Compo
>(
votbean
.
getCompoList
());
compolist
=
new
ListDataModel
<
Compo
>(
votbean
.
getCompoList
(
false
));
setManage
(
hasPermission
(
CompoPermission
.
MANAGE
));
setManage
(
hasPermission
(
CompoPermission
.
MANAGE
));
logger
.
info
(
"Permission to view full compo listing."
);
logger
.
info
(
"Permission to view full compo listing."
);
super
.
beginConversation
();
super
.
beginConversation
();
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/VotingCreateView.java
deleted
100644 → 0
View file @
e0c7dc9
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
voting
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.inject.Named
;
import
fi.codecrew.moya.beans.VotingBeanLocal
;
import
fi.codecrew.moya.model.Compo
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
@Named
@ConversationScoped
public
class
VotingCreateView
extends
GenericCDIView
{
/**
*
*/
private
static
final
long
serialVersionUID
=
4677679766671547462L
;
@EJB
private
transient
VotingBeanLocal
votbean
;
private
Compo
compo
;
public
void
initCreate
()
{
if
(
super
.
requirePermissions
(
fi
.
codecrew
.
moya
.
enums
.
apps
.
CompoPermission
.
MANAGE
)
&&
compo
==
null
)
{
compo
=
new
Compo
();
super
.
beginConversation
();
}
}
public
String
create
()
{
votbean
.
createCompo
(
compo
);
return
"success"
;
}
public
Compo
getCompo
()
{
return
compo
;
}
public
void
setCompo
(
Compo
compo
)
{
this
.
compo
=
compo
;
}
}
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/voting/VotingDateValidator.java
View file @
2fb04ee
...
@@ -8,7 +8,6 @@ import javax.faces.application.FacesMessage;
...
@@ -8,7 +8,6 @@ import javax.faces.application.FacesMessage;
import
javax.faces.component.UIComponent
;
import
javax.faces.component.UIComponent
;
import
javax.faces.context.FacesContext
;
import
javax.faces.context.FacesContext
;
import
javax.faces.validator.ValidatorException
;
import
javax.faces.validator.ValidatorException
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -21,10 +20,7 @@ import fi.codecrew.moya.utilities.I18n;
...
@@ -21,10 +20,7 @@ import fi.codecrew.moya.utilities.I18n;
public
class
VotingDateValidator
implements
Serializable
{
public
class
VotingDateValidator
implements
Serializable
{
private
static
final
long
serialVersionUID
=
8006543114365700277L
;
private
static
final
long
serialVersionUID
=
8006543114365700277L
;
@Inject
private
VotingCreateView
view
;
@SuppressWarnings
(
"unused"
)
@SuppressWarnings
(
"unused"
)
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
VotingDateValidator
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
VotingDateValidator
.
class
);
...
@@ -75,12 +71,4 @@ public class VotingDateValidator implements Serializable {
...
@@ -75,12 +71,4 @@ public class VotingDateValidator implements Serializable {
throw
new
ValidatorException
(
msg
);
throw
new
ValidatorException
(
msg
);
}
}
public
VotingCreateView
getView
()
{
return
view
;
}
public
void
setView
(
VotingCreateView
view
)
{
this
.
view
=
view
;
}
}
}
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