Commit d44b5f69 authored by michael.simon's avatar michael.simon
Browse files

Show text per service on deregister page for user

closes #64
parent 98a0abd4
......@@ -103,6 +103,11 @@ public class ServiceEntity extends AbstractBaseEntity {
@Column(name = "short_description", length = 2048)
private String shortDescription;
@Column(name = "deregister_text")
@Lob
@Type(type = "org.hibernate.type.TextType")
private String deregisterText;
@Column(name = "published")
private Boolean published;
......@@ -280,4 +285,12 @@ public class ServiceEntity extends AbstractBaseEntity {
this.hidden = hidden;
}
public String getDeregisterText() {
return deregisterText;
}
public void setDeregisterText(String deregisterText) {
this.deregisterText = deregisterText;
}
}
......@@ -29,6 +29,7 @@ import edu.kit.scc.webreg.service.RegistryService;
import edu.kit.scc.webreg.service.UserService;
import edu.kit.scc.webreg.service.reg.RegisterUserService;
import edu.kit.scc.webreg.session.SessionManager;
import edu.kit.scc.webreg.util.BBCodeConverter;
import edu.kit.scc.webreg.util.ViewIds;
@ManagedBean
......@@ -56,6 +57,11 @@ public class DeregisterServiceBean implements Serializable {
@Inject
private UserService userService;
@Inject
private BBCodeConverter bbCodeConverter;
private String deregisterTextBB;
public void preRenderView(ComponentSystemEvent ev) {
if (! initialzed) {
......@@ -69,6 +75,8 @@ public class DeregisterServiceBean implements Serializable {
if (! registry.getUser().getId().equals(userEntity.getId()))
throw new NotAuthorizedException("Not authorized to view this item");
deregisterTextBB = bbCodeConverter.convert(registry.getService().getDeregisterText());
initialzed = true;
}
}
......@@ -104,4 +112,8 @@ public class DeregisterServiceBean implements Serializable {
public ServiceEntity getService() {
return registry.getService();
}
public String getDeregisterTextBB() {
return deregisterTextBB;
}
}
......@@ -49,13 +49,16 @@ public class ShowServiceBean implements Serializable {
private ServiceEntity entity;
private String serviceDescBB;
private String deregisterTextBB;
private Long id;
public void preRenderView(ComponentSystemEvent ev) {
if (entity == null) {
entity = serviceService.findByIdWithServiceProps(id);
serviceDescBB = bbCodeConverter.convert(entity.getDescription());
deregisterTextBB = bbCodeConverter.convert(entity.getDeregisterText());
}
}
......@@ -85,4 +88,8 @@ public class ShowServiceBean implements Serializable {
public String getServiceDescBB() {
return serviceDescBB;
}
public String getDeregisterTextBB() {
return deregisterTextBB;
}
}
......@@ -92,6 +92,7 @@ deny=Ablehnen
deregister=Abbestellen
deregister_desc_long=Wenn Sie diesen Dialog best\u00E4tigen, k\u00F6nnen Sie nicht mehr auf den Dienst zugreifen.
deregister_desc=Sie m\u00F6chten diesen Dienst nicht l\u00E4nger nutzen.
deregister_text=Text bei Deregistrierung
deregistered=Deregistriert
description=Beschreibung
detail=Detail
......
......@@ -101,6 +101,7 @@ deregister=Deregister
deregistered=Deregistered
deregister_desc=You no longer want to use this service.
deregister_desc_long=If you confirm this dialog, you will no longer be able to use this service.
deregister_text=Text shown on deregister
description=Description
detail=Detail
disabled=Disabled
......
......@@ -158,6 +158,10 @@
<h:inputTextarea id="desc" rows="12" cols="60"
value="#{editServiceBean.entity.description}"/>
<h:outputText value="#{messages.deregister_text}:"/>
<h:inputTextarea id="dereg_text" rows="12" cols="60"
value="#{editServiceBean.entity.deregisterText}"/>
</p:panelGrid>
<p:commandButton id="cancel" action="#{editServiceBean.cancel}" value="#{messages.cancel}"
......
......@@ -143,6 +143,9 @@
<p:outputLabel for="descText" value="#{messages.service_desc}"/>
<h:outputText id="descText" value="#{showServiceBean.serviceDescBB}" />
<p:outputLabel for="deregText" value="#{messages.deregister_text}"/>
<h:outputText id="deregText" value="#{showServiceBean.deregisterTextBB}" />
</h:panelGrid>
</p:panel>
</div>
......
......@@ -38,6 +38,10 @@
<h:outputText value="#{messages.deregister_desc_long}"/>
</div>
<div>
<h:outputText value="#{deregisterServiceBean.deregisterTextBB}" escape="false"/>
</div>
<div style="margin-top: 16px;">
<p:commandButton id="save" action="#{deregisterServiceBean.deregisterUser}"
value="#{messages.deregister}" style="color: red;"/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment