Commit 39d85ac6 by Juho Juopperi

Merge branch 'manageParticipants' into 'master'

Manage participants and printing style

Topic tells it all.
2 parents f2a58344 65fee7e9
......@@ -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;
......@@ -43,6 +44,9 @@ public class LectureBean implements LectureBeanLocal {
@EJB
UserBeanLocal userBean;
@EJB
PermissionBean permBean;
@Override
public List<Lecture> getLecturesByLectureGroup(LectureGroup group) {
LectureGroup sourceGroup = lectureGroupFacade.reload(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);
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);
}
}
......@@ -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);
......
......@@ -19,6 +19,8 @@ public interface LectureBeanLocal {
public LectureGroup findLectureGroup(Integer id);
public Lecture findLecture(Integer id);
public Lecture saveLecture(Lecture lecture);
public List<Lecture> findAvailableLectures(LectureGroup group, EventUser user);
......
......@@ -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>
......
<!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
......@@ -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">
......
@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
......@@ -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>
......
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Sat Mar 30 17:56:44 EET 2013
actionlog.create.header = Create new actionmessage
actionlog.create.message = Message
actionlog.create.role = Target role
......@@ -14,6 +15,7 @@ actionlog.task = Task
actionlog.tasklist.header = Tasklist
actionlog.time = Time
actionlog.user = User
adduser.newphoto = Take new photo
adduser.newuser = Create new user
adduser.takePhoto = Take photo
......@@ -21,6 +23,7 @@ adduser.tostart = Back to start
adduser.update = Update profile picture
adduser.welcome = Welcome
adduser.welcometext = Here you can add new user or update your current user profile image. Please select desired action below.
bill.billAmount = Amount
bill.billNumber = Number
bill.cancel = Cancel bill
......@@ -30,7 +33,9 @@ bill.markPaid.show = Show Mark paid -buttons
bill.notes.title = Lis\u00E4tietoja
bill.save = Save
bill.showPayButtons = Show pay buttons
billine.vatp = vat-%
bortalApplication.BILL = Creating, and managing bills
bortalApplication.COMPO = Managing compos
bortalApplication.CONTENT = Product & shop management
......@@ -101,17 +106,27 @@ bortalApplication.user.VIEW_SELF = Can view self
bortalApplication.user.VITUTTAAKO = Can send feedback
bortalApplication.user.WRITE_ORGROLES = Modify organization roles
bortalApplication.user.WRITE_ROLES = Modify roles
card.massprint.title = Print all
cardCode.code = Koodi
cardCode.type = Tyyppi
cardTemplate.emptyCardTemplate = ----
code.inputfield = Sy\u00F6t\u00E4 viivakoodi
create = Luo
delete = Poista
edit = Muokkaa
error = Virhe
error.contact = If this happens again, contact Info with the following code:
error.error = You have encountered an error.
event.domains.title = Domain
event.edit = Edit
event.endTime = End time
......@@ -123,13 +138,18 @@ event.properties.title = Properties
event.referenceNumberBase = Reference number base
event.save = Save
event.startTime = Start time
eventdomain.add = Add event domain
eventdomain.domainname = Domain
eventdomain.remove = Remove
eventmap.active = Active
eventorg.create = Create
foodWave.closeNow = Close now
foodWave.openNow = Open now
game.active = Aktiivinen
game.codecount = Avattuja
game.codes.available = Lisenssikoodit
......@@ -138,19 +158,24 @@ game.create = Create
game.edit = Edit
game.out = Gamecodes are out, pleace contact administration
game.product = Tuote
generic.sure.header = Confirmation
generic.sure.message = Are you sure?
generic.sure.no = No
generic.sure.yes = Yes
global.cancel = Cancel
global.copyright = Codecrew Ry
global.notAuthorizedExecute = You are not authorized to do that!!
global.notauthorized = You don't have enough rights to enter this site.
global.save = Save
httpsession.creationTime = Created
incomingView.attach = Liit\u00E4
incomingView.attachDialogTitle = Liit\u00E4 koodi k\u00E4ytt\u00E4j\u00E4\u00E4n
incomingView.cancel = Peruuta
incomingflow.alreadyShowingUser.message = Piipattu k\u00E4ytt\u00E4j\u00E4 on jo n\u00E4kyviss\u00E4
incomingflow.alreadyShowingUser.title = Valmiiksi valittu
incomingflow.cardCodes = Kortin koodit
......@@ -164,15 +189,18 @@ incomingflow.printedCard = Kortti
incomingflow.usereditor = K\u00E4ytt\u00E4j\u00E4
incomingflow.usereditor.info = Tiedot
incomingflow.usereditor.picture = Kuvanotto
lanEventPrivateProperty.defaultValue = Default value
lanEventPrivateProperty.editProperty = Edit property
lanEventPrivateProperty.save = Save
lanEventPrivateProperty.textValue = Text value
lanEventPrivateProperty.valueIsRawdataWarning = Raw value
lanEventProperty.booleanValue = Boolean value
lanEventProperty.defaultValue = Default value
lanEventProperty.save = Save
lanEventProperty.textValue = Text value
lecture.availableLectures = Aihealueen kurssit ja luennot
lecture.availableLecturesCalendar = Kalenterina
lecture.availableLecturesList = Listana
......@@ -182,6 +210,7 @@ lecture.description = Kuvaus
lecture.full = Kurssi t\u00E4ynn\u00E4
lecture.groupFull = Kiinti\u00F6 t\u00E4ynn\u00E4
lecture.hours = Kesto, tunteja
lecture.manageParticipants = Hallitse osallistujia
lecture.maxParticipantsCount = Max. osallistujia
lecture.multicreate = Luo monta putkeen
lecture.name = Nimi
......@@ -194,8 +223,10 @@ lecture.participating = Osallistumassa
lecture.roles = Roolit
lecture.saveLecture = Muokkaa
lecture.selectgroup = Valitse aihealue
lecture.showParticipants = N\u00E4yt\u00E4 osallistujat
lecture.startTime = Aloitusaika
lecture.unparticipate = Poista ilmoittautuminen
lectureGroup.createLectureGroup = Luo kurssikokonaisuus
lectureGroup.createNew = Luo uusi
lectureGroup.description = Kuvaus
......@@ -205,61 +236,91 @@ lectureGroup.saveLectureGroup = Muokkaa kurssikokonaisuutta
lectureGroup.selectCount = Montako kurssia saa valita
lectureGroup.selectCountUserInfo = Yhden osallistujan kiinti\u00F6
lectureGroup.view = Tarkastele
lecturegroup.create.success = Kurssiryhm\u00E4 luotu onnistuneesti.
lecturegroup.list.title = Luennot
lecturegroup.save.success = Kurssiryhm\u00E4 tallennettu onnistuneesti.
login.login = Login
login.logout = Logout
login.logoutmessage = You have logged out of the system
login.password = Password
login.submit = Login
login.username = Username
loginerror.header = Login failed
loginerror.message = Username of password incorrect.
loginerror.resetpassword = Reset password
manageparticipants.addUser = Lis\u00E4\u00E4 osallistuja
manageparticipants.lectureTitle = Kurssin / luennon tiedot
manageparticipants.title = Osallistujat
map.id = #
navi.auth.login = frontpage
navi.auth.loginerror = frontpage
navi.auth.logout = frontpage
off = Poissa
on = P\u00E4\u00E4ll\u00E4
page.bill.billSummary.header = Summary of bills
page.bill.edit.header = Edit bill
page.bill.list.header = Bills
page.bill.listAll.header = Bills
page.bill.placemap.header = Place map
page.bill.show.header = Bill info
pagegroup.auth.login = frontpage
passwordChanged.body = You can now login with the new password.
passwordChanged.header = Password changed successfully.
passwordReset.errorChanging = Unexpected error whilst password reset. Contact your administrator.
passwordReset.hashNotFound = Password change token has expired. Please send the query again.
permissiondenied.alreadyLoggedIn = You don't have enough rights
permissiondenied.header = Access denied
permissiondenied.notLoggedIn = You don't have enough rights to enter this site.
placegroupview.toptext = \
poll.edit = edit
print = Print
product.providedRole = Product defines role
product.returnProductEdit = Return to product:
product.saved = Product saved
productshop.minusOne = -1
productshop.minusTen = -10
productshop.plusOne = +1
productshop.plusTen = +10
reader.autopoll = Jatkuva lukijan seuraaminen
refresh = P\u00E4ivit\u00E4
registerleaflet.title = Rekisteriseloste
resetMail.header = Reset lost password
resetMail.username = Username
resetmailSent.body = Email has been sent containing a link where you can change the password.
resetmailSent.header = Email sent
role.userSelectableRole = K\u00E4ytt\u00E4j\u00E4n valittavissaoleva rooli
roleView.adduser = Lis\u00E4\u00E4 k\u00E4ytt\u00E4j\u00E4
roleView.hidePermissioneditor = Piilota oikeusasetukset
roleView.members = K\u00E4ytt\u00E4j\u00E4t
roleView.showPermissioneditor = N\u00E4yt\u00E4 oikeusasetukset
save = Tallenna
submenu.NotImplementedYet = Not implemented
submenu.admin.adduser = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys
submenu.admin.adduser.index = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys
......@@ -270,12 +331,16 @@ submenu.info.shop = Kauppa
submenu.lectureadmin.lectureParticipants = Tarkastele osallistujia
submenu.lectureadmin.manageLectureGroups = Hallinnoi
submenu.lectures.viewLectures = Ilmoittaudu
subnavi.cards = \u0009\u0009
subnavi.info = Info
success = Onnistui
topnavi.adminlectures = Kurssit ja luennot
topnavi.license = Lisenssikoodit
topnavi.userlectures = Kurssit ja luennot
user.cropImage = Crop
user.imageUpload.imageNotFound = Select image to upload
user.saveUserSelectableRoles = Tallenna
......@@ -295,6 +360,8 @@ user.shirt.select = Valitse yksi
user.shirtSize = Paidan koko
user.unauthenticated = Kirjautumaton
user.userSelectableRoles = Valitse yksi
usercart.downloadCsv = CSV
usercart.showoverview = Vie tarkastusn\u00E4kym\u00E4\u00E4n
viewlectures.title = Kurssit ja luennot
......@@ -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;
......@@ -31,12 +35,25 @@ public class LectureReportsView extends GenericCDIView {
@EJB
EventBeanLocal eventBean;
@EJB
UserBeanLocal userBean;
EventUser multiSearchUser = null;
ListDataModel<LectureGroup> lectureGroups = null;
ListDataModel<Lecture> lectures = null;
ListDataModel<Lecture> participatedLectures = null;
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;
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!