Commit a843611a by Tuomas Riihimäki

Merge branch 'master' of codecrew.fi:bortal

2 parents 1a2237f0 e2967700
......@@ -132,6 +132,15 @@
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>useradmin/sendPicture</display-name>
<from-view-id>/useradmin/sendPicture.xhtml</from-view-id>
<navigation-case>
<from-outcome>accepted</from-outcome>
<to-view-id>/useradmin/edit.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>voting/create</display-name>
<from-view-id>/voting/create.xhtml</from-view-id>
<navigation-case>
......
......@@ -6,7 +6,7 @@
<title>Error</title>
</h:head>
<h:body>
<!-- <c:if test="#{sessionHandler.isInDevelopmentMode() eq true}"> -->
<!-- <c:if test="#{sessionHandler.isInDevelopmentMode() eq false}"> -->
<h1>#{i18n['error.error']}</h1>
<p>${i18n['error.contact']}
<br/><h:outputText escape="false" style="color: red;" value="#{errorPageView.time}" /><br/><br/>
......
......@@ -16,8 +16,8 @@
<h:outputText
rendered="#{salespointListView.salespoints.rowCount le 0}"
value="#{i18n['salespoint.noSalespoints']}" />
value="#{i18n['salespoint.noSalesPoints']}" />
<h:form rendered="#{salespointListView.salespoints.rowCount gt 0}">
<h:dataTable styleClass="bordertable" id="salespointList"
value="#{salespointListView.salespoints}" var="salespoint">
......
......@@ -10,6 +10,7 @@
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
<f:event type="preRenderView" listener="#{userView.prepareCardDownload}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['sendPicture.header']}</h1>
......@@ -62,6 +63,12 @@
<ui:fragment rendered="#{userView.canManage()}">
<h2>Ylläpito</h2>
<h:form>
<p:commandButton action="#{userView.prepareCardDownload()}" rendered="#{userView.waitForAcceptance==false}" value="print card" ajax="true" update="@form" onclick="PrimeFaces.monitorDownload(start, stop)">
<p:fileDownload value="#{userView.streamedFile}" />
</p:commandButton>
<p:commandButton action="#{userView.acceptPrintedCard()}" value="accept printed card" />
</h:form>
<!-- <h:form>
<h:commandButton action="#{userView.makeCard()}" value="#{i18n['user.makeCard']}" />
<h:dataTable var="card" value="#{userCardView.printedCards}">
<h:column>
......@@ -77,7 +84,7 @@
</h:column>
</h:dataTable>
</h:form>
</h:form>-->
<h3>RFID</h3>
<h:form rendered="#{empty readerNameContainer.readerId}">
......
......@@ -20,7 +20,7 @@
<h:commandButton action="#{userCartView.removeCurrent()}" value="#{i18n['usercart.removeCurrent']}" />
<h:commandButton action="#{userCartView.next()}" value="#{i18n['usercart.next']}" rendered="#{userCartView.userCartSize > (userCartView.current+1)}" /></h:form>
<h:link outcome="/card/massprint" value="yarr">
<h:link outcome="/card/massprint" value="Mass Print">
<f:param name="cid" value="#{javax.enterprise.context.conversation.id}"/>
</h:link>
......
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Bill number
# Validationmessages
actionlog.create.header = Create new actionmessage
actionlog.create.message = Message
actionlog.create.role = Target role
actionlog.create.submitbutton = Send
actionlog.create.taskradio = Task
actionlog.crew = Crew
actionlog.message = Event
actionlog.messagelist.description = You can follow and create new action messages in this view
actionlog.messagelist.header = Messagelist
actionlog.state = State
actionlog.task = Task
actionlog.tasklist.header = Tasklist
actionlog.time = Time
actionlog.user = User
bill.billMarkedPaidMail.message = Your deposit number {0} has been marked as paid.
bill.billMarkedPaidMail.subject = [Streamparty] Your credits have been updated
error.contact = If this happens again, contact Info with the following code:
error.error = You have encountered an error.
eventorg.create = Create
eventorg.edit = Edit
global.cancel = Cancel
global.copyright = Codecrew Ry
global.infomail = info@streamparty.org
global.notAuthorizedExecute = You are not authorized to execute that!!
global.notauthorized = You don't have enough rights to enter this site.
global.save = Save
global.webpage = http://www.streamparty.org
httpsession.creationTime = Created
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
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.
resetMail.body = You can change a forgotten password by inserting your username to the field below. A link where you can change the password will be sent to the email address associated to that.
resetMail.header = Reset lost password
resetMail.send = Send email
resetMail.username = Username
resetmailSent.body = Email has been sent containing a link where you can change the password.
resetmailSent.header = Email sent
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Bill number
# Validationmessages
actionlog.create.header = Create new actionmessage
actionlog.create.message = Message
actionlog.create.role = Target role
actionlog.create.submitbutton = Send
actionlog.create.taskradio = Task
actionlog.crew = Crew
actionlog.message = Event
actionlog.messagelist.description = You can follow and create new action messages in this view
actionlog.messagelist.header = Messagelist
actionlog.state = State
actionlog.task = Task
actionlog.tasklist.header = Tasklist
actionlog.time = Time
actionlog.user = User
bill.billMarkedPaidMail.message = Your deposit number {0} has been marked as paid.
bill.billMarkedPaidMail.subject = [Streamparty] Your credits have been updated
error.contact = If this happens again, contact Info with the following code:
error.error = You have encountered an error.
eventorg.create = Create
eventorg.edit = Edit
global.cancel = Cancel
global.copyright = Codecrew Ry
global.infomail = info@streamparty.org
global.notAuthorizedExecute = You are not authorized to execute that!!
global.notauthorized = You don't have enough rights to enter this site.
global.save = Save
global.webpage = http://www.streamparty.org
httpsession.creationTime = Created
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
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.
resetMail.body = You can change a forgotten password by inserting your username to the field below. A link where you can change the password will be sent to the email address associated to that.
resetMail.header = Reset lost password
resetMail.send = Send email
resetMail.username = Username
resetmailSent.body = Email has been sent containing a link where you can change the password.
resetmailSent.header = Email sent
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Bill number
# Validationmessages
actionlog.create.header = Luo uusi ActionMessage
actionlog.create.message = Viesti
actionlog.create.role = Kohderooli
actionlog.create.submitbutton = L\u00E4het\u00E4
actionlog.create.taskradio = Teht\u00E4v\u00E4
actionlog.crew = Crew
actionlog.message = Tapahtuma
actionlog.messagelist.description = Voit seurata sek\u00E4 luoda uusia ActionMessageja t\u00E4ss\u00E4 n\u00E4kym\u00E4ss\u00E4.
actionlog.messagelist.header = Viestilista
actionlog.state = Tila
actionlog.task = Teht\u00E4v\u00E4
actionlog.tasklist.header = Teht\u00E4v\u00E4lista
actionlog.time = Aika
actionlog.user = Tekij\u00E4
bill.billMarkedPaidMail.message = Laskusi numero {0} on merkitty maksetuksi. Voit nyt siirty\u00E4 lippukauppaan varamaamaan haluamasi paikat. \nTervetuloa tapahtumaan!\n\nTerveisin,\nInsomnia lippupalvelu\nwww.insomnia.fi
bill.billMarkedPaidMail.subject = [INSOMNIA] Lasku merkitty maksetuksi
error.contact = Jos t\u00E4m\u00E4 toistuu, ota seuraava koodi talteen ja ota yhteys Infoon:
error.error = Olet kohdannut virheen.
eventorg.create = Luo
eventorg.edit = Muokkaa
global.cancel = Peruuta
global.copyright = Codecrew Ry
global.infomail = info@insomnia.fi
global.notAuthorizedExecute = Sinulla ei ole riitt\u00E4v\u00E4sti oikeuksia suorittaa t\u00E4t\u00E4 toimenpidett\u00E4!
global.notauthorized = Sinulla ei ole riitt\u00E4vi\u00E4 oikeuksia t\u00E4lle sivulle.
global.save = Tallenna
global.webpage = http://www.insomnia.fi
httpsession.creationTime = Luotu
login.login = Kirjaudu sis\u00E4\u00E4n
login.logout = Kirjaudu ulos
login.logoutmessage = Olet kirjautunut ulos j\u00E4rjestelm\u00E4st\u00E4.
login.password = Salasana
login.submit = Kirjaudu sis\u00E4\u00E4n
login.username = K\u00E4ytt\u00E4j\u00E4tunnus
loginerror.header = Kirjautuminen ep\u00E4onnistui
loginerror.message = K\u00E4ytt\u00E4j\u00E4tunnus tai salasana ei ollut oikein.
loginerror.resetpassword = Salasana unohtunut?
passwordChanged.body = Voit nyt kirjautua k\u00E4ytt\u00E4j\u00E4tunnuksella ja uudella salasanalla sis\u00E4\u00E4n j\u00E4rjestelm\u00E4\u00E4n.
passwordChanged.header = Salasana vaihdettu onnistuneesti
passwordReset.errorChanging = Odotamaton virhe. Ota yhteytt\u00E4 yll\u00E4pitoon.
passwordReset.hashNotFound = Salasanan vaihto on vanhentunut. Jos haluat vaihtaa salasanan l\u00E4het\u00E4 vaihtopyynt\u00F6 uudelleen.
permissiondenied.alreadyLoggedIn = Sinulla ei ole riitt\u00E4v\u00E4sti oikeuksia!
permissiondenied.header = P\u00E4\u00E4sy kielletty
permissiondenied.notLoggedIn = Sinulla ei ole riitt\u00E4v\u00E4sti oikeuksia t\u00E4lle sivulle.
resetMail.body = Voit vaihtaa unohtuneen salasanan sy\u00F6tt\u00E4m\u00E4ll\u00E4 k\u00E4ytt\u00E4j\u00E4tunnuksesi allaolevaan kentt\u00E4\u00E4n. Tunnukseen liitettyyn s\u00E4hk\u00F6postiosoitteeseen l\u00E4hetet\u00E4\u00E4n kertak\u00E4ytt\u00F6inen osoite jossa voit vaihtaa sy\u00F6tt\u00E4m\u00E4si k\u00E4ytt\u00E4j\u00E4tunnuksen salasanan.
resetMail.header = Salasana unohtunut?
resetMail.send = L\u00E4het\u00E4 s\u00E4hk\u00F6posti
resetmailSent.body = Antamasi k\u00E4ytt\u00E4j\u00E4tunnuksen s\u00E4hk\u00F6postiosoitteeseen on l\u00E4hetetty osoite jossa voit vaihtaa tunnuksen salasanan.
resetmailSent.header = S\u00E4hk\u00F6posti l\u00E4hetetty
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Bill number
# Validationmessages
actionlog.create.header = Luo uusi ActionMessage
actionlog.create.message = Viesti
actionlog.create.role = Kohderooli
actionlog.create.submitbutton = L\u00E4het\u00E4
actionlog.create.taskradio = Teht\u00E4v\u00E4
actionlog.crew = Crew
actionlog.message = Tapahtuma
actionlog.messagelist.description = Voit seurata sek\u00E4 luoda uusia ActionMessageja t\u00E4ss\u00E4 n\u00E4kym\u00E4ss\u00E4.
actionlog.messagelist.header = Viestilista
actionlog.state = Tila
actionlog.task = Teht\u00E4v\u00E4
actionlog.tasklist.header = Teht\u00E4v\u00E4lista
actionlog.time = Aika
actionlog.user = Tekij\u00E4
bill.billMarkedPaidMail.message = Laskusi numero {0} on merkitty maksetuksi. Voit nyt siirty\u00E4 lippukauppaan varamaamaan haluamasi paikat. \nTervetuloa tapahtumaan!\n\nTerveisin,\nInsomnia lippupalvelu\nwww.insomnia.fi
bill.billMarkedPaidMail.subject = [INSOMNIA] Lasku merkitty maksetuksi
error.contact = Jos t\u00E4m\u00E4 toistuu, ota seuraava koodi talteen ja ota yhteys Infoon:
error.error = Olet kohdannut virheen.
eventorg.create = Luo
eventorg.edit = Muokkaa
global.cancel = Peruuta
global.copyright = Codecrew Ry
global.infomail = info@insomnia.fi
global.notAuthorizedExecute = Sinulla ei ole riitt\u00E4v\u00E4sti oikeuksia suorittaa t\u00E4t\u00E4 toimenpidett\u00E4!
global.notauthorized = Sinulla ei ole riitt\u00E4vi\u00E4 oikeuksia t\u00E4lle sivulle.
global.save = Tallenna
global.webpage = http://www.insomnia.fi
httpsession.creationTime = Luotu
login.login = Kirjaudu sis\u00E4\u00E4n
login.logout = Kirjaudu ulos
login.logoutmessage = Olet kirjautunut ulos j\u00E4rjestelm\u00E4st\u00E4.
login.password = Salasana
login.submit = Kirjaudu sis\u00E4\u00E4n
login.username = K\u00E4ytt\u00E4j\u00E4tunnus
loginerror.header = Kirjautuminen ep\u00E4onnistui
loginerror.message = K\u00E4ytt\u00E4j\u00E4tunnus tai salasana ei ollut oikein.
loginerror.resetpassword = Salasana unohtunut?
passwordChanged.body = Voit nyt kirjautua k\u00E4ytt\u00E4j\u00E4tunnuksella ja uudella salasanalla sis\u00E4\u00E4n j\u00E4rjestelm\u00E4\u00E4n.
passwordChanged.header = Salasana vaihdettu onnistuneesti
passwordReset.errorChanging = Odotamaton virhe. Ota yhteytt\u00E4 yll\u00E4pitoon.
passwordReset.hashNotFound = Salasanan vaihto on vanhentunut. Jos haluat vaihtaa salasanan l\u00E4het\u00E4 vaihtopyynt\u00F6 uudelleen.
permissiondenied.alreadyLoggedIn = Sinulla ei ole riitt\u00E4v\u00E4sti oikeuksia!
permissiondenied.header = P\u00E4\u00E4sy kielletty
permissiondenied.notLoggedIn = Sinulla ei ole riitt\u00E4v\u00E4sti oikeuksia t\u00E4lle sivulle.
resetMail.body = Voit vaihtaa unohtuneen salasanan sy\u00F6tt\u00E4m\u00E4ll\u00E4 k\u00E4ytt\u00E4j\u00E4tunnuksesi allaolevaan kentt\u00E4\u00E4n. Tunnukseen liitettyyn s\u00E4hk\u00F6postiosoitteeseen l\u00E4hetet\u00E4\u00E4n kertak\u00E4ytt\u00F6inen osoite jossa voit vaihtaa sy\u00F6tt\u00E4m\u00E4si k\u00E4ytt\u00E4j\u00E4tunnuksen salasanan.
resetMail.header = Salasana unohtunut?
resetMail.send = L\u00E4het\u00E4 s\u00E4hk\u00F6posti
resetmailSent.body = Antamasi k\u00E4ytt\u00E4j\u00E4tunnuksen s\u00E4hk\u00F6postiosoitteeseen on l\u00E4hetetty osoite jossa voit vaihtaa tunnuksen salasanan.
resetmailSent.header = S\u00E4hk\u00F6posti l\u00E4hetetty
......@@ -18,6 +18,8 @@ import java.io.StringWriter;
import java.util.Calendar;
import java.util.Map;
import java.util.zip.CRC32;
@Named
@RequestScoped
public class ErrorPageView implements Serializable {
......@@ -34,6 +36,7 @@ public class ErrorPageView implements Serializable {
@SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(ErrorPageView.class);
public String getStackTrace() {
......@@ -51,14 +54,29 @@ public class ErrorPageView implements Serializable {
}
public String getStackTraceHash() {
FacesContext context = FacesContext.getCurrentInstance();
Map requestMap = context.getExternalContext().getRequestMap();
Throwable ex =
(Throwable) requestMap.get("javax.servlet.error.exception");
CRC32 stackHash = new CRC32();
stackHash.update(ex.getStackTrace().toString().getBytes());
return "0x" + Long.toHexString(stackHash.getValue());
}
public String getTime(){
return "0x" + Long.toHexString(Calendar.getInstance().getTimeInMillis());
String stamp = "0x" + Long.toHexString(Calendar.getInstance().getTimeInMillis());
logger.error("Error occured at {} trail {}", stamp, getTrail());
return stamp;
}
public String getTrail() {
HttpServletRequest req = (HttpServletRequest) getContext().getExternalContext().getRequest();
Object trail = req.getSession().getAttribute("trail");
return trail != null ? trail.toString().replace(", ", "\n") : "u gots no trail!";
return trail != null ? trail.toString() : "";
}
public FacesContext getContext() {
......
package fi.insomnia.bortal.web.cdiview.user;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
......@@ -7,11 +10,15 @@ import javax.ejb.EJB;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.enterprise.inject.Produces;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import org.primefaces.event.CaptureEvent;
import org.primefaces.model.CroppedImage;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import org.primefaces.model.UploadedFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -28,6 +35,7 @@ import fi.insomnia.bortal.model.PrintedCard;
import fi.insomnia.bortal.model.Role;
import fi.insomnia.bortal.model.User;
import fi.insomnia.bortal.model.UserImage;
import fi.insomnia.bortal.util.MassPrintResult;
import fi.insomnia.bortal.web.annotations.LoggedIn;
import fi.insomnia.bortal.web.annotations.SelectedUser;
import fi.insomnia.bortal.web.cdiview.GenericCDIView;
......@@ -77,6 +85,12 @@ public class UserView extends GenericCDIView {
private transient EventBeanLocal eventbean;
@EJB
private transient CardPrintBeanLocal cardPrintBean;
private File file;
private StreamedContent streamedFile;
private MassPrintResult mpr = null;
private boolean waitForAcceptance = false;
@Produces
@LoggedIn
......@@ -143,6 +157,31 @@ public class UserView extends GenericCDIView {
}
return null;
}
public void prepareCardDownload() {
file = null;
try {
mpr = cardPrintBean.getUserCardAsPrintablePdf(this.user.getId());
file = File.createTempFile("cardprintout",null);
FileOutputStream fostream = new FileOutputStream(file);
fostream.write(mpr.getPdf());
fostream.close();
setStreamedFile(new DefaultStreamedContent(new FileInputStream(this.file)));
} catch(Exception e) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(e.getMessage()));
}
}
public String acceptPrintedCard() {
if(mpr != null && mpr.getAffectedUsers().size() > 0) {
cardPrintBean.acceptMassPrintResult(mpr);
return "accepted";
} else {
return "failure";
}
}
public String makeCard()
{
......@@ -311,4 +350,24 @@ public class UserView extends GenericCDIView {
public void setUsername(String username) {
this.username = username;
}
public void raiseWaitForAcceptance() {
waitForAcceptance = true;
}
public boolean isWaitForAcceptance() {
return waitForAcceptance;
}
public void setWaitForAcceptance(boolean waitForAcceptance) {
this.waitForAcceptance = waitForAcceptance;
}
public StreamedContent getStreamedFile() {
return streamedFile;
}
public void setStreamedFile(StreamedContent streamedFile) {
this.streamedFile = streamedFile;
}
}
File mode changed
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!