Commit 71f460e3 by Tuomas Riihimäki

Base for role request UI

1 parent df716303
<!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:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui"
xmlns:orgrole="http://java.sun.com/jsf/composite/cditools/orgrole">
<h:body>
<ui:composition template="#{sessionHandler.template}">
<ui:param name="thispage" value="page.orgrole.list" />
<f:metadata>
<f:event type="preRenderView" listener="#{orgRoleView.permissionList()}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['orgrole.list.title']}</h1>
</ui:define>
<ui:define name="content">
<h:form id="orgrolelist" styleClass="moya_datatable2">
<h:dataTable border="1" id="user" value="#{orgRoleDataView.orgRoles}" var="orgRole">
<h:column>
<f:facet name="header">
<h:outputText value="#" />
</f:facet>
<h:outputText value="#{orgRole.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['orgrole.name']}" />
</f:facet>
<h:outputText value="#{orgRole.name}" />
</h:column>
<h:column>
<h:link outcome="/orgrole/edit" value="#{i18n['orgrole.edit']}">
<f:param name="id" value="#{orgRole.id}" />
</h:link>
</h:column>
</h:dataTable>
</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:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<ui:composition template="#{sessionHandler.template}">
<f:metadata>
<f:event type="preRenderView" listener="#{orgRoleRequestView.initRequest()}" />
</f:metadata>
<ui:define name="content">
<h:form id="orgform">
<h:panelGrid columns="2">
<h:outputLabel for="roleselect" value="#{i18n['orgrolerequest.selectedRole']}" />
<p:selectOneMenu id="roleselect" value="#{orgRoleRequestView.selectedRole}" converter="#{orgRoleConverter}">
<f:selectItems value="#{orgRoleRequestView.orgroles}" var="r" itemLabel="#{r.name}" />
<f:ajax execute="@form" render="orgform:rolecontent" />
</p:selectOneMenu>
<h:outputLabel for="rolecontent" value="#{i18n['orgrolerequest.rolecontent']}" />
<h:outputText id="rolecontent" rendered="#{orgRoleRequestView.selectedRole != null}" value="#{orgRoleRequestView.selectedRole.notes}" />
<h:outputLabel for="requestreason" value="#{i18n['orgrolerequest.requestNotes']}" />
<p:inputTextarea cols="40" rows="10" id="requestreason" value="#{orgRoleRequestView.request.requestNotes}" />
</h:panelGrid>
<h:commandButton id="createrequest" value="#{i18n['orgrole.create']}" action="#{orgRoleView.create()}" />
</h:form>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
package fi.codecrew.moya.web.cdiview.user;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.faces.model.ListDataModel;
import javax.inject.Named;
import fi.codecrew.moya.beans.OrgRoleBeanLocal;
import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.OrgRole;
import fi.codecrew.moya.model.OrgRoleRequest;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named
@ConversationScoped
public class OrgRoleRequestView extends GenericCDIView {
private static final long serialVersionUID = 9196654356396643701L;
private OrgRoleRequest request;
@EJB
private OrgRoleBeanLocal orgrolebean;
private List<OrgRole> orgroles;
private OrgRole selectedRole;
public void initRequest() {
if (super.requirePermissions(UserPermission.REQUEST_ORGROLES) && request == null) {
request = new OrgRoleRequest();
orgroles = orgrolebean.getRequestableRoles();
if (!orgroles.isEmpty()) {
selectedRole = orgroles.get(0);
}
super.beginConversation();
}
}
public void createRequest() {
orgrolebean.createRequest(request);
}
public OrgRoleRequest getRequest() {
return request;
}
public void setRequest(OrgRoleRequest request) {
this.request = request;
}
public List<OrgRole> getOrgroles() {
return orgroles;
}
public void setOrgroles(List<OrgRole> orgroles) {
this.orgroles = orgroles;
}
public OrgRole getSelectedRole() {
return selectedRole;
}
public void setSelectedRole(OrgRole selectedRole) {
this.selectedRole = selectedRole;
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moya.web.converter;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import fi.codecrew.moya.beans.PlaceBeanLocal;
import fi.codecrew.moya.model.EventMap;
import fi.codecrew.moya.utilities.jsf.GenericIntegerEntityConverter;
@Named
@RequestScoped
public class EventMapConverter extends GenericIntegerEntityConverter<EventMap> {
@EJB
private PlaceBeanLocal placebean;
@Override
protected EventMap find(Integer id) {
return placebean.findMap(id);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!