Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 05c013a2
authored
Jul 19, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now manager can manage participants. Also printing style
1 parent
1f78477b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
199 additions
and
14 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/LectureBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/LectureBeanLocal.java
code/MoyaWeb/WebContent/lectureadmin/lectureParticipants.xhtml
code/MoyaWeb/WebContent/lectureadmin/manageParticipants.xhtml
code/MoyaWeb/WebContent/lectures/viewLectures.xhtml
code/MoyaWeb/WebContent/resources/templates/template1/css/print.css
code/MoyaWeb/WebContent/resources/templates/template1/template.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/lecture/LectureReportsView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/LectureBean.java
View file @
05c013a
...
...
@@ -13,6 +13,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.enums.apps.LecturePermission
;
import
fi.codecrew.moya.enums.apps.UserPermission
;
import
fi.codecrew.moya.facade.EventUserFacade
;
import
fi.codecrew.moya.facade.LectureFacade
;
import
fi.codecrew.moya.facade.LectureGroupFacade
;
...
...
@@ -42,6 +43,9 @@ public class LectureBean implements LectureBeanLocal {
@EJB
UserBeanLocal
userBean
;
@EJB
PermissionBean
permBean
;
@Override
public
List
<
Lecture
>
getLecturesByLectureGroup
(
LectureGroup
group
)
{
...
...
@@ -138,16 +142,16 @@ public class LectureBean implements LectureBeanLocal {
@RolesAllowed
({
LecturePermission
.
S_VIEW
,
LecturePermission
.
S_MANAGE
})
public
Lecture
participate
(
EventUser
user
,
Lecture
lecture
)
{
if
(
userLectureSelectsLeft
(
lecture
.
getLectureGroup
(),
user
)
<=
0
)
if
(
userLectureSelectsLeft
(
lecture
.
getLectureGroup
(),
user
)
<=
0
&&
!
permBean
.
hasPermission
(
LecturePermission
.
MANAGE
)
)
return
lecture
;
EventUser
targetUser
=
eventUserFacade
.
reload
(
user
);
lecture
.
getParticipants
().
add
(
targetUser
);
lecture
=
lectureFacade
.
merge
(
lecture
);
targetUser
.
getLectures
().
add
(
lecture
);
if
(!
lecture
.
getParticipants
().
contains
(
targetUser
))
{
lecture
.
getParticipants
().
add
(
targetUser
);
lecture
=
lectureFacade
.
merge
(
lecture
);
targetUser
.
getLectures
().
add
(
lecture
);
}
return
lecture
;
}
...
...
@@ -221,4 +225,9 @@ public class LectureBean implements LectureBeanLocal {
return
lectureFacade
.
findFirstLecture
();
}
@Override
public
Lecture
findLecture
(
Integer
id
)
{
return
lectureFacade
.
find
(
id
);
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
View file @
05c013a
...
...
@@ -299,8 +299,7 @@ public class MenuBean implements MenuBeanLocal {
adminlectures
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/lectureadmin/manageLectureGroups"
),
LecturePermission
.
MANAGE
);
adminlectures
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/lectureadmin/lectureParticipants"
),
LecturePermission
.
MANAGE
);
adminlectures
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/lectureadmin/manageLectures"
),
LecturePermission
.
MANAGE
).
setVisible
(
false
);
adminlectures
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/lectureadmin/manageParticipants"
),
LecturePermission
.
MANAGE
).
setVisible
(
false
);
MenuNavigation
infoviews
=
adminmenu
.
addPage
(
null
,
null
);
...
...
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/LectureBeanLocal.java
View file @
05c013a
...
...
@@ -18,6 +18,8 @@ public interface LectureBeanLocal {
public
LectureGroup
saveLectureGroup
(
LectureGroup
group
);
public
LectureGroup
findLectureGroup
(
Integer
id
);
public
Lecture
findLecture
(
Integer
id
);
public
Lecture
saveLecture
(
Lecture
lecture
);
...
...
code/MoyaWeb/WebContent/lectureadmin/lectureParticipants.xhtml
View file @
05c013a
...
...
@@ -44,10 +44,10 @@
<p:column
style=
"width:16px"
>
<p:rowToggler
/>
</p:column>
<p:column
headerText=
"#{i18n['lecture.name']}"
sortBy=
"#{lecture.name}"
>
<p:column
headerText=
"#{i18n['lecture.name']}"
sortBy=
"#{lecture.name}"
filterBy=
"#{lecture.name}"
>
<h:outputText
value=
"#{lecture.name}"
/>
</p:column>
<p:column
headerText=
"#{i18n['lecture.description']}"
sortBy=
"#{lecture.description}"
>
<p:column
headerText=
"#{i18n['lecture.description']}"
sortBy=
"#{lecture.description}"
filterBy=
"#{lecture.description}"
>
<h:outputText
value=
"#{lecture.description}"
/>
</p:column>
<p:column
headerText=
"#{i18n['lecture.hours']}"
sortBy=
"#{lecture.hours}"
>
...
...
@@ -64,8 +64,13 @@
<p:column>
<h:outputText
value=
"#{i18n['lecture.full']}"
rendered=
"#{lecture.full}"
/>
</p:column>
<p:column>
<h:link
outcome=
"/lectureadmin/manageParticipants"
value=
"#{i18n['lecture.manageParticipants']}"
>
<f:param
name=
"lectureid"
value=
"#{lecture.id}"
/>
</h:link>
</p:column>
<p:rowExpansion>
<p:dataTable
value=
"#{lecture.participants}"
var=
"user"
>
<p:dataTable
value=
"#{lecture.participants}"
var=
"user"
>
<p:column>
<h:outputText
value=
"#{user.user.nick}"
/>
</p:column>
...
...
code/MoyaWeb/WebContent/lectureadmin/manageParticipants.xhtml
0 → 100644
View file @
05c013a
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:products=
"http://java.sun.com/jsf/composite/cditools/products"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"#{sessionHandler.template}"
>
<f:metadata>
<f:viewParam
name=
"lectureid"
value=
"#{lectureReportsView.lectureId}"
/>
<f:event
type=
"preRenderView"
listener=
"#{lectureReportsView.initView()}"
/>
</f:metadata>
<ui:define
rendered=
"#{lectureReportsView.lectureGroupsVisible}"
name=
"title"
>
<h1>
#{i18n['manageparticipants.title']}
</h1>
</ui:define>
<ui:define
name=
"content"
>
<p:fieldset
legend=
"#{lectureReportsView.currentLecture.name}"
>
<p:panelGrid
columns=
"2"
>
<p:outputLabel
value=
"#{i18n['lecture.description']}"
/>
<h:outputText
value=
"#{lectureReportsView.currentLecture.description}"
/>
<p:outputLabel
value=
"#{i18n['lecture.startTime']}"
/>
<h:outputText
value=
"#{lectureReportsView.currentLecture.startTime}"
pattern=
"#{sessionHandler.datetimeFormat}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
<p:outputLabel
value=
"#{i18n['lecture.hours']}"
/>
<h:outputText
value=
"#{lectureReportsView.currentLecture.hours}"
/>
<p:outputLabel
value=
"#{i18n['lecture.participants']}"
/>
<h:outputText
id=
"participants_count"
value=
"#{lectureReportsView.currentLecture.participantsCount} / #{lectureReportsView.currentLecture.maxParticipantsCount}"
/>
</p:panelGrid>
</p:fieldset>
<br
/>
<br
/>
<br
/>
<br
/>
<h:form
id=
"manageParticipants"
>
<p:dataTable
id=
"participants"
value=
"#{lectureReportsView.currentLecture.participants}"
var=
"user"
>
<p:column>
<h:outputText
value=
"#{user.user.nick}"
/>
</p:column>
<p:column>
<h:outputText
value=
"#{user.user.lastname}"
/>
</p:column>
<p:column>
<h:outputText
value=
"#{user.user.firstnames}"
/>
</p:column>
</p:dataTable>
</h:form>
<br
/>
<br
/>
<br
/>
<br
/>
<h:form>
<p:fieldset
styleClass=
"no_print"
legend=
"#{i18n['manageparticipants.addUser']}"
>
<p:autoComplete
size=
"55"
id=
"multiuser"
value=
"#{lectureReportsView.multiSearchUser}"
completeMethod=
"#{lectureReportsView.matchMulti}"
converter=
"#{eventUserConverter}"
var=
"usrx"
itemLabel=
"#{usrx.shortUserDescriptor}"
itemValue=
"#{usrx}"
>
<p:ajax
event=
"itemSelect"
listener=
"#{lectureReportsView.addUserToLecture}"
update=
":manageParticipants:participants multiuser :participants_count"
/>
</p:autoComplete>
</p:fieldset>
</h:form>
<br
/>
<br
/>
<br
/>
<br
/>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/MoyaWeb/WebContent/lectures/viewLectures.xhtml
View file @
05c013a
...
...
@@ -74,10 +74,10 @@
<p:tabView
id=
"availableLectures"
>
<p:tab
title=
"#{i18n['lecture.availableLecturesList']}"
>
<p:dataTable
id=
"lecturelist"
value=
"#{lectureUserView.lectures}"
var=
"lecture"
>
<p:column
headerText=
"#{i18n['lecture.name']}"
sortBy=
"#{lecture.name}"
style=
"width:125px"
>
<p:column
headerText=
"#{i18n['lecture.name']}"
sortBy=
"#{lecture.name}"
filterBy=
"#{lecture.name}"
style=
"width:125px"
>
<h:outputText
value=
"#{lecture.name}"
/>
</p:column>
<p:column
headerText=
"#{i18n['lecture.description']}"
sortBy=
"#{lecture.description}"
>
<p:column
headerText=
"#{i18n['lecture.description']}"
sortBy=
"#{lecture.description}"
filterBy=
"#{lecture.description}"
>
<h:outputText
value=
"#{lecture.description}"
/>
</p:column>
<p:column
headerText=
"#{i18n['lecture.hours']}"
sortBy=
"#{lecture.hours}"
style=
"width:110px"
>
...
...
code/MoyaWeb/WebContent/resources/templates/template1/css/print.css
0 → 100644
View file @
05c013a
@media
print
{
header
,
#menu
,
.flex1
,
#header_left
,
#header_center
,
#header_right
,
nav
,
#menu
,
.languageSelector
{
display
:
none
;
}
#main
{
background
:
none
;
border
:
none
;
}
.no_print
{
display
:
none
;
}
}
\ No newline at end of file
code/MoyaWeb/WebContent/resources/templates/template1/template.xhtml
View file @
05c013a
...
...
@@ -20,6 +20,7 @@
<link
rel=
"stylesheet"
href=
"#{request.contextPath}/resources/templates/template1/css//main.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"#{request.contextPath}/resources/templates/template1/css/style.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"#{request.contextPath}/resources/templates/template1/css/general.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"#{request.contextPath}/resources/templates/template1/css/print.css"
/>
<script
src=
"#{request.contextPath}/resources/templates/template1/js/modernizr-2.6.2.min.js"
></script>
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
View file @
05c013a
This diff is collapsed.
Click to expand it.
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
View file @
05c013a
...
...
@@ -587,6 +587,7 @@ lecture.description = Description
lecture.full
=
Lecture full
lecture.groupFull
=
Limit reached
lecture.hours
=
Duration hours
lecture.manageParticipants
=
Manage participants
lecture.maxParticipantsCount
=
Max participants
lecture.multicreate
=
Create multible in row
lecture.name
=
Name
...
...
@@ -599,6 +600,7 @@ lecture.participating = Participating
lecture.roles
=
Roles
lecture.saveLecture
=
Edit
lecture.selectgroup
=
Select lecturegroup
lecture.showParticipants
=
Show participants
lecture.startTime
=
Start time
lecture.unparticipate
=
Remove participation
...
...
@@ -635,6 +637,10 @@ loginerror.header = Login failed
loginerror.message
=
Username of password incorrect.
loginerror.resetpassword
=
Reset password
manageparticipants.addUser
=
Add participant
manageparticipants.lectureTitle
=
Lecture / course info
manageparticipants.title
=
Participants
map.create
=
Create map
map.createTileMap
=
Create tilemap
map.edit
=
Edit
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
View file @
05c013a
...
...
@@ -597,6 +597,7 @@ lecture.description = Kuvaus
lecture.full
=
Kurssi t
\u
00E4ynn
\u
00E4
lecture.groupFull
=
Kiinti
\u
00F6 t
\u
00E4ynn
\u
00E4
lecture.hours
=
Kesto tunteina
lecture.manageParticipants
=
Hallitse osallistujia
lecture.maxParticipantsCount
=
Osallistujia enint.
lecture.multicreate
=
Luo monta putkeen
lecture.name
=
Nimi
...
...
@@ -645,6 +646,10 @@ loginerror.header = Kirjautuminen ep\u00E4onnistui
loginerror.message
=
K
\u
00E4ytt
\u
00E4j
\u
00E4tunnus tai salasana ei ollut oikein.
loginerror.resetpassword
=
Salasana unohtunut?
manageparticipants.addUser
=
Lis
\u
00E4
\u
00E4 osallistuja
manageparticipants.lectureTitle
=
Kurssin / luennon tiedot
manageparticipants.title
=
Osallistujat
map.create
=
Luo kartta
map.createTileMap
=
Luo tilekartta
map.edit
=
Muokkaa
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/lecture/LectureReportsView.java
View file @
05c013a
...
...
@@ -10,9 +10,13 @@ import javax.inject.Named;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.LectureBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.enums.apps.LecturePermission
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.Lecture
;
import
fi.codecrew.moya.model.LectureGroup
;
import
fi.codecrew.moya.util.UserSearchQuery
;
import
fi.codecrew.moya.utilities.SearchResult
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
fi.codecrew.moya.web.cdiview.user.UserView
;
...
...
@@ -30,6 +34,13 @@ public class LectureReportsView extends GenericCDIView {
@EJB
EventBeanLocal
eventBean
;
@EJB
UserBeanLocal
userBean
;
EventUser
multiSearchUser
=
null
;
ListDataModel
<
LectureGroup
>
lectureGroups
=
null
;
ListDataModel
<
Lecture
>
lectures
=
null
;
...
...
@@ -37,6 +48,12 @@ public class LectureReportsView extends GenericCDIView {
LectureGroup
currentLectureGroup
;
Lecture
currentLecture
=
null
;
Integer
lectureId
;
public
void
initView
()
{
if
(
super
.
requirePermissions
(
LecturePermission
.
MANAGE
))
{
...
...
@@ -93,4 +110,53 @@ public class LectureReportsView extends GenericCDIView {
return
lectureBean
.
userLectureSelects
(
getCurrentLectureGroup
(),
userView
.
getCurrentUser
());
}
public
Integer
getLectureId
()
{
return
lectureId
;
}
public
void
setLectureId
(
Integer
lectureId
)
{
this
.
lectureId
=
lectureId
;
}
public
Lecture
getCurrentLecture
()
{
if
(
currentLecture
==
null
)
{
currentLecture
=
lectureBean
.
findLecture
(
lectureId
);
}
return
currentLecture
;
}
public
void
setCurrentLecture
(
Lecture
currentLecture
)
{
this
.
currentLecture
=
currentLecture
;
}
public
List
<
EventUser
>
matchMulti
(
String
what
)
{
UserSearchQuery
usq
=
new
UserSearchQuery
();
usq
.
setSearch
(
what
);
SearchResult
<
EventUser
>
sr
=
userBean
.
getThisEventsUsers
(
usq
);
return
sr
.
getResults
();
}
public
EventUser
getMultiSearchUser
()
{
return
multiSearchUser
;
}
public
void
setMultiSearchUser
(
EventUser
multiSearchUser
)
{
this
.
multiSearchUser
=
multiSearchUser
;
}
public
void
addUserToLecture
()
{
if
(
multiSearchUser
!=
null
)
{
lectureBean
.
participate
(
multiSearchUser
,
currentLecture
);
super
.
addFaceMessage
(
"lecture.participated"
);
multiSearchUser
=
null
;
}
}
}
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