Commit 0fc83f6c by Tuukka Kivilahti Committed by Tuukka Kivilahti

lecturegroup edit is now ready, lectures are not fully done

1 parent 1b122d4e
...@@ -192,8 +192,9 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -192,8 +192,9 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE network_associations ALTER COLUMN meta TYPE json USING (meta::json);" "ALTER TABLE network_associations ALTER COLUMN meta TYPE json USING (meta::json);"
}); });
dbUpdates.add(new String[] {"CREATE TABLE lecture_groups (id SERIAL NOT NULL, description TEXT, name TEXT, select_count INTEGER, PRIMARY KEY (id))",
"CREATE TABLE lectures (id SERIAL NOT NULL, description TEXT, end_time TIMESTAMPTZ, max_participants_count INTEGER, name TEXT, start_time TIMESTAMPTZ, lecture_group_id INTEGER, PRIMARY KEY (id))", dbUpdates.add(new String[] {"CREATE TABLE lecture_groups (id SERIAL NOT NULL, event_id integer NOT NULL, description TEXT, name TEXT, select_count INTEGER, meta json, PRIMARY KEY (id))",
"CREATE TABLE lectures (id SERIAL NOT NULL, description TEXT, end_time TIMESTAMPTZ, max_participants_count INTEGER, name TEXT, start_time TIMESTAMPTZ, lecture_group_id INTEGER, meta json, PRIMARY KEY (id))",
"CREATE TABLE lecture_roles (role_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (role_id, lecture_id))", "CREATE TABLE lecture_roles (role_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (role_id, lecture_id))",
"CREATE TABLE lecture_participants (eventuser_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (eventuser_id, lecture_id))", "CREATE TABLE lecture_participants (eventuser_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (eventuser_id, lecture_id))",
"ALTER TABLE lectures ADD CONSTRAINT FK_lectures_lecture_group_id FOREIGN KEY (lecture_group_id) REFERENCES lecture_groups (id)", "ALTER TABLE lectures ADD CONSTRAINT FK_lectures_lecture_group_id FOREIGN KEY (lecture_group_id) REFERENCES lecture_groups (id)",
...@@ -202,7 +203,6 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -202,7 +203,6 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_eventuser_id FOREIGN KEY (eventuser_id) REFERENCES event_users (id)", "ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_eventuser_id FOREIGN KEY (eventuser_id) REFERENCES event_users (id)",
"ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_lecture_id FOREIGN KEY (lecture_id) REFERENCES lectures (id)"}); "ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_lecture_id FOREIGN KEY (lecture_id) REFERENCES lectures (id)"});
} }
@EJB @EJB
......
package fi.codecrew.moya.beans; package fi.codecrew.moya.beans;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.security.DeclareRoles; import javax.annotation.security.DeclareRoles;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import fi.codecrew.moya.enums.apps.LecturePermission; import fi.codecrew.moya.enums.apps.LecturePermission;
import fi.codecrew.moya.facade.FoodWaveTemplateFacade;
import fi.codecrew.moya.facade.LectureFacade; import fi.codecrew.moya.facade.LectureFacade;
import fi.codecrew.moya.facade.LectureGroupFacade; import fi.codecrew.moya.facade.LectureGroupFacade;
import fi.codecrew.moya.model.Lecture;
import fi.codecrew.moya.model.LectureGroup;
/** /**
* Session Bean implementation class FoodWaveBean * Session Bean implementation class FoodWaveBean
...@@ -17,12 +21,42 @@ import fi.codecrew.moya.facade.LectureGroupFacade; ...@@ -17,12 +21,42 @@ import fi.codecrew.moya.facade.LectureGroupFacade;
public class LectureBean implements LectureBeanLocal { public class LectureBean implements LectureBeanLocal {
@EJB @EJB
private FoodWaveTemplateFacade fwtFacade; LectureFacade lectureFacade;
@EJB @EJB
private LectureFacade lectureFacade; LectureGroupFacade lectureGroupFacade;
@EJB @EJB
private LectureGroupFacade lectureGroupFacade; EventBean eventBean;
@Override
public List<Lecture> getLecturesByLectureGroup(LectureGroup group) {
return new ArrayList<Lecture>();
}
@Override
public List<LectureGroup> getLectureGroups() {
return lectureGroupFacade.getLectureGroups();
}
@Override
public LectureGroup saveLectureGroup(LectureGroup group) {
if (group.getId() == null)
{
if (group.getEvent() == null)
group.setEvent(eventBean.getCurrentEvent());
group = lectureGroupFacade.create(group);
} else {
group = lectureGroupFacade.merge(group);
}
return group;
}
@Override
public LectureGroup findLectureGroup(Integer id) {
return lectureGroupFacade.find(id);
}
} }
package fi.codecrew.moya.facade; package fi.codecrew.moya.facade;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.LocalBean; import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.model.LectureGroup; import fi.codecrew.moya.model.LectureGroup;
import fi.codecrew.moya.model.LectureGroup_;
@Stateless @Stateless
@LocalBean @LocalBean
...@@ -11,4 +19,17 @@ public class LectureGroupFacade extends IntegerPkGenericFacade<LectureGroup> { ...@@ -11,4 +19,17 @@ public class LectureGroupFacade extends IntegerPkGenericFacade<LectureGroup> {
public LectureGroupFacade() { public LectureGroupFacade() {
super(LectureGroup.class); super(LectureGroup.class);
} }
@EJB
EventBeanLocal eventBean;
public List<LectureGroup> getLectureGroups() {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<LectureGroup> cq = cb.createQuery(LectureGroup.class);
Root<LectureGroup> root = cq.from(LectureGroup.class);
cq.where(cb.equal(root.get(LectureGroup_.event), eventBean.getCurrentEvent() ) );
return getEm().createQuery(cq).getResultList();
}
} }
package fi.codecrew.moya.beans; package fi.codecrew.moya.beans;
import java.util.List;
import javax.ejb.Local; import javax.ejb.Local;
import fi.codecrew.moya.model.Lecture;
import fi.codecrew.moya.model.LectureGroup;
@Local @Local
public interface LectureBeanLocal { public interface LectureBeanLocal {
public List<Lecture> getLecturesByLectureGroup(LectureGroup group);
public List<LectureGroup> getLectureGroups();
public LectureGroup saveLectureGroup(LectureGroup group);
public LectureGroup findLectureGroup(Integer id);
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<property name="eclipselink.ddl-generation" value="create-tables" /> <property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.cache.size.default" value="16384" /> <property name="eclipselink.cache.size.default" value="16384" />
<property name="eclipselink.ddl-generation.output-mode" <property name="eclipselink.ddl-generation.output-mode"
value="sql-script" /> value="both" />
<property name="eclipselink.logging.logger" value="ServerLogger" /> <property name="eclipselink.logging.logger" value="ServerLogger" />
<property name="eclipselink.jdbc.uppercase-columns" value="false" /> <property name="eclipselink.jdbc.uppercase-columns" value="false" />
<property name="eclipselink.target-database" <property name="eclipselink.target-database"
......
...@@ -8,7 +8,9 @@ import java.util.List; ...@@ -8,7 +8,9 @@ import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
...@@ -24,7 +26,13 @@ import org.eclipse.persistence.annotations.OptimisticLockingType; ...@@ -24,7 +26,13 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
public class LectureGroup extends GenericEntity { public class LectureGroup extends GenericEntity {
private static final long serialVersionUID = 3L; private static final long serialVersionUID = 4L;
@ManyToOne()
@JoinColumn(name = "event_id", nullable = false)
private LanEvent event;
@Column(name = "select_count") @Column(name = "select_count")
private Integer selectCount; private Integer selectCount;
...@@ -49,6 +57,12 @@ public class LectureGroup extends GenericEntity { ...@@ -49,6 +57,12 @@ public class LectureGroup extends GenericEntity {
public LectureGroup() { public LectureGroup() {
super(); super();
} }
public LectureGroup(LanEvent event) {
this();
this.event = event;
}
public Integer getSelectCount() { public Integer getSelectCount() {
return selectCount; return selectCount;
...@@ -78,5 +92,21 @@ public class LectureGroup extends GenericEntity { ...@@ -78,5 +92,21 @@ public class LectureGroup extends GenericEntity {
this.description = description; this.description = description;
} }
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
public List<Lecture> getLectures() {
return lectures;
}
public void setLectures(List<Lecture> lectures) {
this.lectures = lectures;
}
} }
...@@ -4,8 +4,9 @@ import fi.codecrew.moya.enums.apps.BillPermission; ...@@ -4,8 +4,9 @@ import fi.codecrew.moya.enums.apps.BillPermission;
import fi.codecrew.moya.enums.apps.CompoPermission; import fi.codecrew.moya.enums.apps.CompoPermission;
import fi.codecrew.moya.enums.apps.ContentPermission; import fi.codecrew.moya.enums.apps.ContentPermission;
import fi.codecrew.moya.enums.apps.EventPermission; import fi.codecrew.moya.enums.apps.EventPermission;
import fi.codecrew.moya.enums.apps.LicensePermission;
import fi.codecrew.moya.enums.apps.IAppPermission; import fi.codecrew.moya.enums.apps.IAppPermission;
import fi.codecrew.moya.enums.apps.LecturePermission;
import fi.codecrew.moya.enums.apps.LicensePermission;
import fi.codecrew.moya.enums.apps.MapPermission; import fi.codecrew.moya.enums.apps.MapPermission;
import fi.codecrew.moya.enums.apps.NetworkAssociationPermission; import fi.codecrew.moya.enums.apps.NetworkAssociationPermission;
import fi.codecrew.moya.enums.apps.PollPermission; import fi.codecrew.moya.enums.apps.PollPermission;
......
<!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">
<h:body>
<ui:composition template="#{sessionHandler.template}">
<f:metadata>
<f:viewParam name="id" value="#{foodWaveView.templateId}" />
<f:event type="preRenderView" listener="#{foodWaveView.initTemplateList()}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['foodwave.template.list.title']}</h1>
</ui:define>
<ui:define name="content">
<h:dataTable var="foodwaveTemplate" value="#{foodWaveView.templates}">
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['foodwaveTemplate.name']}" />
</f:facet>
<h:outputText value="#{foodwaveTemplate.name}" />
</h:column>
<h:column>
<h:link value="#{i18n['foodadmin.editTemplate']}" outcome="/foodadmin/editTemplate">
<f:param value="#{foodwaveTemplate.id}" name="id"/>
</h:link>
</h:column>
</h:dataTable>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!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:event type="preRenderView" listener="#{lectureGroupView.initView()}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['lecturegroup.list.title']}</h1>
</ui:define>
<ui:define name="content">
<h:form>
<p:dataTable id="lecturegroups" var="lectureGroup" value="#{lectureGroupView.lectureGroups}">
<p:column headerText="#{i18n['lectureGroup.name']}">
<h:outputText value="#{lectureGroup.name}" />
</p:column>
<p:column headerText="#{i18n['lectureGroup.selectCount']}">
<h:outputText value="#{lectureGroup.selectCount}" />
</p:column>
<p:column headerText="#{i18n['lectureGroup.description']}">
<h:outputText value="#{lectureGroup.description}" />
</p:column>
<p:column>
<p:commandButton value="#{i18n['edit']}" actionListener="#{lectureGroupView.editCurrent}" update="editcreate" />
</p:column>
</p:dataTable>
<p:commandButton value="#{i18n['lectureGroup.createNew']}" actionListener="#{lectureGroupView.createNew}" update="editcreate" />
<br /><br /><br />
<p:fieldset legend="#{lectureGroupView.editPanelTitle}" id="editcreate">
<p:panelGrid columns="2">
<p:outputLabel value="#{i18n['lectureGroup.name']}" />
<p:inputText value="#{lectureGroupView.currentLectureGroup.name}" />
<p:outputLabel value="#{i18n['lectureGroup.selectCount']}" />
<p:inputText value="#{lectureGroupView.currentLectureGroup.selectCount}" />
<p:outputLabel value="#{i18n['lectureGroup.description']}" />
<p:inputTextarea value="#{lectureGroupView.currentLectureGroup.description}" />
<p:commandButton rendered="#{!lectureGroupView.creatingLectureGroup}" actionListener="#{lectureGroupView.saveLectureGroup}" value="#{i18n['save']}" update="lecturegroups" />
<p:commandButton rendered="#{lectureGroupView.creatingLectureGroup}" actionListener="#{lectureGroupView.saveLectureGroup}" value="#{i18n['create']}" update="lecturegroups" />
</p:panelGrid>
</p:fieldset>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!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:event type="preRenderView" listener="#{lectureGroupView.initView()}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['lecturegroup.list.title']}</h1>
</ui:define>
<ui:define name="content">
<h:form>
<p:fieldset legend="#{lectureView.currentLectureGroup.name}" id="lectures">
<p:dataTable var="lecture" value="#{lectureView.lectures}">
<p:column headerText="#{i18n['lecture.name']}">
<h:outputText value="#{lecture.name}" />
</p:column>
<p:column headerText="#{i18n['lecture.']}">
<h:outputText value="#{lecture.}" />
</p:column>
<p:column headerText="#{i18n['lecture.']}">
<h:outputText value="#{lecture.}" />
</p:column>
<p:column headerText="#{i18n['lecture.']}">
<h:outputText value="#{lecture.}" />
</p:column>
<p:column>
<p:commandButton value="#{i18n['edit']}" actionListener="#{lectureGroupView.editCurrent}" update="editcreate" />
</p:column>
</p:dataTable>
</p:fieldset>
<p:commandButton value="#{i18n['lectureGroup.createNew']}" actionListener="#{lectureGroupView.createNew}" update="editcreate" />
<br />
<br />
<br />
<p:fieldset legend="#{lectureGroupView.editPanelTitle}" id="editcreate">
<p:panelGrid columns="2">
<p:outputLabel value="#{i18n['lectureGroup.name']}" />
<p:inputText value="#{lectureGroupView.currentLectureGroup.name}" />
<p:outputLabel value="#{i18n['lectureGroup.selectCount']}" />
<p:inputText value="#{lectureGroupView.currentLectureGroup.selectCount}" />
<p:outputLabel value="#{i18n['lectureGroup.description']}" />
<p:inputTextarea value="#{lectureGroupView.currentLectureGroup.description}" />
<p:commandButton rendered="#{!lectureGroupView.creatingLectureGroup}" actionListener="#{lectureGroupView.saveLectureGroup}" value="#{i18n['save']}" update="lecturegroups" />
<p:commandButton rendered="#{lectureGroupView.creatingLectureGroup}" actionListener="#{lectureGroupView.saveLectureGroup}" value="#{i18n['create']}" update="lecturegroups" />
</p:panelGrid>
</p:fieldset>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
...@@ -116,8 +116,12 @@ cardTemplate.emptyCardTemplate = ---- ...@@ -116,8 +116,12 @@ cardTemplate.emptyCardTemplate = ----
code.inputfield = Sy\u00F6t\u00E4 viivakoodi code.inputfield = Sy\u00F6t\u00E4 viivakoodi
delete = Poista delete = Poista
error = Virhe
error.contact = If this happens again, contact Info with the following code: error.contact = If this happens again, contact Info with the following code:
error.error = You have encountered an error. error.error = You have encountered an error.
...@@ -195,6 +199,9 @@ lanEventProperty.defaultValue = Default value ...@@ -195,6 +199,9 @@ lanEventProperty.defaultValue = Default value
lanEventProperty.save = Save lanEventProperty.save = Save
lanEventProperty.textValue = Text value lanEventProperty.textValue = Text value
lecturegroup.create.success = Kurssiryhm\u00E4 luotu onnistuneesti.
lecturegroup.save.success = Kurssiryhm\u00E4 tallennettu onnistuneesti.
login.login = Login login.login = Login
login.logout = Logout login.logout = Logout
login.logoutmessage = You have logged out of the system login.logoutmessage = You have logged out of the system
...@@ -264,13 +271,21 @@ submenu.NotImplementedYet = Not implemented ...@@ -264,13 +271,21 @@ submenu.NotImplementedYet = Not implemented
submenu.admin.adduser = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys submenu.admin.adduser = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys
submenu.admin.adduser.index = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys submenu.admin.adduser.index = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys
submenu.frontpage = Frontpage submenu.frontpage = Frontpage
submenu.info.incoming = Sis\u00E4\u00E4ntulo submenu.info.incoming = Sis\u00E4\u00E4ntulo
submenu.info.index = Infon\u00E4kym\u00E4 submenu.info.index = Infon\u00E4kym\u00E4
submenu.info.shop = Kauppa submenu.info.shop = Kauppa
submenu.info.index = Infon\u00E4kym\u00E4
subnavi.cards = \u0009\u0009 subnavi.cards = \u0009\u0009
subnavi.info = Info subnavi.info = Info
success = Onnistui
topnavi.license = Lisenssikoodit topnavi.license = Lisenssikoodit
user.cropImage = Crop user.cropImage = Crop
......
...@@ -310,6 +310,8 @@ editplacegroup.header = Placegroup information ...@@ -310,6 +310,8 @@ editplacegroup.header = Placegroup information
entry.edit = Edit entry entry.edit = Edit entry
error = Error
error.contact = If this happens again, contact Info with the following code: error.contact = If this happens again, contact Info with the following code:
error.error = You have encountered an error. error.error = You have encountered an error.
...@@ -547,6 +549,9 @@ layout.editBottom = Edit bottom content ...@@ -547,6 +549,9 @@ layout.editBottom = Edit bottom content
layout.editContent = Edit center layout.editContent = Edit center
layout.editTop = Edit topcontent layout.editTop = Edit topcontent
lecturegroup.create.success = Lecturegroup created successfully.
lecturegroup.save.success = Lecturegroup saved succesfully.
license.active = Active license.active = Active
license.description = Description license.description = Description
license.name = Name license.name = Name
...@@ -1114,6 +1119,8 @@ subnavi.products = Products ...@@ -1114,6 +1119,8 @@ subnavi.products = Products
subnavi.readers = Readers subnavi.readers = Readers
subnavi.roles = Roles subnavi.roles = Roles
success = Success
supernavi.admin = Adminview supernavi.admin = Adminview
supernavi.user = Userview supernavi.user = Userview
......
...@@ -197,6 +197,7 @@ card.massprint.title = Tulosta kaikki ...@@ -197,6 +197,7 @@ card.massprint.title = Tulosta kaikki
cardCode.code = Koodi cardCode.code = Koodi
cardCode.type = Tyyppi cardCode.type = Tyyppi
cardObjectData.create = Liit\u00E4 kuvia cardObjectData.create = Liit\u00E4 kuvia
cardObjectData.edit = Muokkaa cardObjectData.edit = Muokkaa
cardObjectData.save = Tallenna cardObjectData.save = Tallenna
...@@ -311,6 +312,8 @@ editplacegroup.header = Paikkaryhm\u00E4n tiedot ...@@ -311,6 +312,8 @@ editplacegroup.header = Paikkaryhm\u00E4n tiedot
entry.edit = Muokkaa entry.edit = Muokkaa
error = Virhe
error.contact = Jos t\u00E4m\u00E4 toistuu, ota seuraava koodi talteen ja ota yhteys Infoon: error.contact = Jos t\u00E4m\u00E4 toistuu, ota seuraava koodi talteen ja ota yhteys Infoon:
error.error = Olet kohdannut virheen. error.error = Olet kohdannut virheen.
...@@ -557,6 +560,9 @@ layout.editBottom = Muokkaa alasis\u00E4lt\u00F6\u00E4 ...@@ -557,6 +560,9 @@ layout.editBottom = Muokkaa alasis\u00E4lt\u00F6\u00E4
layout.editContent = Muokkaa sis\u00E4lt\u00F6\u00E4 layout.editContent = Muokkaa sis\u00E4lt\u00F6\u00E4
layout.editTop = Muokkaa yl\u00E4sis\u00E4lt\u00F6\u00E4 layout.editTop = Muokkaa yl\u00E4sis\u00E4lt\u00F6\u00E4
lecturegroup.create.success = Kurssiryhm\u00E4 luotu onnistuneesti.
lecturegroup.save.success = Kurssiryhm\u00E4 tallennettu onnistuneesti.
license.active = Aktiivinen license.active = Aktiivinen
license.description = Kuvaus license.description = Kuvaus
license.name = Nimi license.name = Nimi
...@@ -1097,6 +1103,8 @@ subnavi.products = Tuotteet ...@@ -1097,6 +1103,8 @@ subnavi.products = Tuotteet
subnavi.readers = Lukijat subnavi.readers = Lukijat
subnavi.roles = Roolit subnavi.roles = Roolit
success = Onnistui
supernavi.admin = Yll\u00E4piton\u00E4kym\u00E4 supernavi.admin = Yll\u00E4piton\u00E4kym\u00E4
supernavi.user = K\u00E4ytt\u00E4j\u00E4n\u00E4kym\u00E4 supernavi.user = K\u00E4ytt\u00E4j\u00E4n\u00E4kym\u00E4
......
package fi.codecrew.moya.web.cdiview.lecture;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.model.ListDataModel;
import javax.inject.Named;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.LectureBeanLocal;
import fi.codecrew.moya.model.LectureGroup;
import fi.codecrew.moya.utilities.I18n;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named
@ConversationScoped
public class LectureGroupView extends GenericCDIView {
private static final long serialVersionUID = 1L;
@EJB
LectureBeanLocal lectureBean;
@EJB
EventBeanLocal eventBean;
private LectureGroup currentLectureGroup;
private boolean creatingLectureGroup = true;
private ListDataModel<LectureGroup> lectureGroupModel = null;
public void initView() {
super.beginConversation();
}
public void saveLectureGroup() {
FacesContext context = FacesContext.getCurrentInstance();
if(currentLectureGroup == null) {
// this should never happen, so no internatiolazion here.
context.addMessage(null, new FacesMessage(I18n.get("error"), "There was some internal error when saving lecture group, basicly there was no lecturegroup to save.") );
return ;
}
currentLectureGroup = lectureBean.saveLectureGroup(currentLectureGroup);
if(creatingLectureGroup)
context.addMessage(null, new FacesMessage(I18n.get("success"), I18n.get("lecturegroup.create.success")) );
else
context.addMessage(null, new FacesMessage(I18n.get("success"), I18n.get("lecturegroup.save.success")) );
this.creatingLectureGroup = false;
lectureGroupModel = null;
}
public void editCurrent() {
if(lectureGroupModel != null && lectureGroupModel.isRowAvailable()) {
this.creatingLectureGroup = false;
currentLectureGroup = lectureGroupModel.getRowData();
}
}
public void createNew() {
currentLectureGroup = null;
setCreatingLectureGroup(true);
}
public ListDataModel<LectureGroup> getLectureGroups() {
if(lectureGroupModel == null) {
lectureGroupModel = new ListDataModel<LectureGroup>(lectureBean.getLectureGroups());
}
return lectureGroupModel;
}
public boolean isCreatingLectureGroup() {
return creatingLectureGroup;
}
public void setCreatingLectureGroup(boolean creatingLectureGroup) {
this.creatingLectureGroup = creatingLectureGroup;
}
public LectureGroup getCurrentLectureGroup() {
if(currentLectureGroup == null) {
currentLectureGroup = new LectureGroup(eventBean.getCurrentEvent());
}
return currentLectureGroup;
}
public void setCurrentLectureGroup(LectureGroup currentLectureGroup) {
this.currentLectureGroup = currentLectureGroup;
this.creatingLectureGroup = false;
}
public String getEditPanelTitle() {
if(isCreatingLectureGroup()) {
return I18n.get("lectureGroup.createLectureGroup");
} else {
return I18n.get("lectureGroup.saveLectureGroup");
}
}
}
package fi.codecrew.moya.web.cdiview.lecture;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.faces.model.ListDataModel;
import javax.inject.Named;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.LectureBeanLocal;
import fi.codecrew.moya.model.Lecture;
import fi.codecrew.moya.model.LectureGroup;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named
@ConversationScoped
public class LectureView extends GenericCDIView {
private static final long serialVersionUID = 1L;
@EJB
LectureBeanLocal lectureBean;
@EJB
EventBeanLocal eventBean;
private LectureGroup currentLectureGroup;
private boolean creatingLecture = true;
private ListDataModel<Lecture> lectures;
public void initView() {
super.beginConversation();
}
public Integer getLectureGroupId() {
if(currentLectureGroup != null && currentLectureGroup.getId() != null)
return currentLectureGroup.getId();
return null;
}
public void setLectureGroupId(Integer lectureGroupId) {
if(lectureGroupId == null)
currentLectureGroup = null;
else
currentLectureGroup = lectureBean.findLectureGroup(lectureGroupId);
}
public ListDataModel<Lecture> getLectures() {
if(lectures == null && currentLectureGroup != null) {
lectures = new ListDataModel<Lecture>(currentLectureGroup.getLectures());
}
return lectures;
}
public void setLectures(ListDataModel<Lecture> lectures) {
this.lectures = lectures;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!