Commit cfb14754 by Juho Salli

Merge branch 'devel' of codecrew.fi:bortal into devel

2 parents 78806407 4e06f753
Showing with 386 additions and 194 deletions
package fi.insomnia.bortal.facade;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import fi.insomnia.bortal.model.CardBarcode;
@Stateless
@LocalBean
public class CardBarcodeFacade extends IntegerPkGenericFacade<CardBarcode> {
public CardBarcodeFacade() {
super(CardBarcode.class);
}
}
...@@ -2,4 +2,7 @@ Manifest-Version: 1.0 ...@@ -2,4 +2,7 @@ Manifest-Version: 1.0
Class-Path: bcprov-jdk16-146.jar Class-Path: bcprov-jdk16-146.jar
bcmail-jdk16-146.jar bcmail-jdk16-146.jar
LanBortalUtilities.jar LanBortalUtilities.jar
org.ancoron.postgresql.jpa-9.1.901.jdbc4.1-rc6.jar
org.postgresql-9.1.901.jdbc4.1-rc6.jar
org.postgresql.net-9.1.901.jdbc4.1-rc6.jar
...@@ -11,8 +11,12 @@ ...@@ -11,8 +11,12 @@
value="database" /> value="database" />
<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"
value="fi.insomnia.bortal.database.LanBortalPostgresqlPlatform" /> --> value="fi.insomnia.bortal.database.BortalPostgreSQLPlatform" />
<property name="eclipselink.session-event-listener"
value="org.ancoron.postgresql.jpa.eclipselink.ConverterInitializer" />
<property name="eclipselink.descriptor.customizer"
value="fi.insomnia.bortal.database.BortalDescriptorCustomizer" />
</properties> </properties>
</persistence-unit> </persistence-unit>
......
package fi.insomnia.bortal.database;
import java.util.List;
import org.eclipse.persistence.config.DescriptorCustomizer;
import org.eclipse.persistence.descriptors.ChangedFieldsLockingPolicy;
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.descriptors.ReturningPolicy;
import org.eclipse.persistence.internal.helper.DatabaseField;
public class BortalDescriptorCustomizer implements DescriptorCustomizer {
@Override
public void customize(ClassDescriptor descriptor) throws Exception {
// Optimistic locking policy
ChangedFieldsLockingPolicy changedFieldsLockingPolicy = new ChangedFieldsLockingPolicy();
descriptor.setOptimisticLockingPolicy(changedFieldsLockingPolicy);
// Returningpolicy
ReturningPolicy returningPolicy = new ReturningPolicy();
List<DatabaseField> pkFields = descriptor.getPrimaryKeyFields();
for (final DatabaseField field : pkFields) {
returningPolicy.addFieldForInsertReturnOnly(field);
field.setUpdatable(false);
field.setInsertable(false);
}
for (final DatabaseField field : descriptor.getFields()) {
if (pkFields.contains(field))
continue;
returningPolicy.addFieldForInsert(field);
returningPolicy.addFieldForUpdate(field);
}
descriptor.setReturningPolicy(returningPolicy);
}
}
package fi.insomnia.bortal.database;
import java.util.Hashtable;
import org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition;
import org.eclipse.persistence.platform.database.PostgreSQLPlatform;
public class BortalPostgreSQLPlatform extends PostgreSQLPlatform {
private static final long serialVersionUID = 6351395815598077327L;
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected Hashtable buildFieldTypes() {
Hashtable map = super.buildFieldTypes();
map.put(String.class, new FieldTypeDefinition("TEXT", false));
map.put(java.sql.Timestamp.class, new FieldTypeDefinition(
"TIMESTAMPTZ", false));
return map;
}
}
package fi.insomnia.bortal.model;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@Entity
@Table(name = "card_barcode")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CardBarcode extends GenericEntity {
private static final long serialVersionUID = 4771609802672223277L;
@ManyToOne
@JoinColumn(name = "printed_cards_id")
private PrintedCard printedCard;
public PrintedCard getPrintedCard() {
return printedCard;
}
public void setPrintedCard(PrintedCard printedCard) {
this.printedCard = printedCard;
}
}
<!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:login="http://java.sun.com/jsf/composite/cditools/login"
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:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:tools="http://java.sun.com/jsf/composite/cditools">
<h:body>
<ui:composition template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
<f:metadata>
<f:event type="preRenderView" listener="#{authView.executeAdduserViewLogin}" />
</f:metadata>
<ui:define name="content">
<h1>#{i18n['login.login']}</h1>
<login:login />
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
...@@ -12,11 +12,15 @@ ...@@ -12,11 +12,15 @@
<ui:define name="content"> <ui:define name="content">
<div style="text-align: center;"> <div style="text-align: center;">
<h1>#{i18n["adduser.newuser"]}</h1> <h1>#{i18n["adduser.newuser"]}</h1>
<div style="width: 400px; text-align: left; margin: 0 auto;">
<users:create creating="true" commitaction="#{userView.createUser()}" commitvalue="#{i18n['user.create']}" /> <users:create creating="true" commitaction="#{userView.createUserAdduserView()}" commitvalue="#{i18n['user.create']}" />
</div> </div>
</div>
<h:form>
<h:commandLink styleClass="userbackbutton" action="/admin/adduser/start">
<div>#{i18n['adduser.back']}</div>
</h:commandLink>
</h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <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:shop="http://java.sun.com/jsf/composite/cditools/shop" xmlns:tools="http://java.sun.com/jsf/composite/cditools">
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:shop="http://java.sun.com/jsf/composite/cditools/shop"
xmlns:tools="http://java.sun.com/jsf/composite/cditools">
<h:body> <h:body>
<ui:composition <ui:composition template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
<ui:define name="content"> <ui:define name="content">
<div style="text-align: center;">
<h:form> <h:form>
<h1>#{i18n["adduser.welcome"]}</h1> <div style="text-align: center;">
<br/><br/><p>#{i18n["adduser.welcometext"]}
</p> <h1>#{i18n["adduser.welcome"]}</h1>
<br/><br/> <br /> <br /> <br /> <br />
<p:commandButton styleClass="start" ajax="false" action="/admin/adduser/newuser" value="#{i18n['adduser.newuser']}" /><br/> <div style="width: 300px; margin: 0 auto;">
<p:commandButton styleClass="start" ajax="false" action="/admin/adduser/update" value="#{i18n['adduser.update']}" /> <h:link styleClass="touchItem" outcome="/admin/adduser/newuser" >
</h:form> <div>
#{i18n['adduser.newuser']}
</div> </div>
</h:link>
<span style="width: 6em;">&nbsb;</span>
<h:link styleClass="touchItem" outcome="/admin/adduser/login" >
<div>
#{i18n['adduser.update']}
</div>
</h:link>
</div>
</div>
</h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <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:shop="http://java.sun.com/jsf/composite/cditools/shop" xmlns:tools="http://java.sun.com/jsf/composite/cditools">
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:shop="http://java.sun.com/jsf/composite/cditools/shop"
xmlns:tools="http://java.sun.com/jsf/composite/cditools">
<h:body> <h:body>
<ui:composition <ui:composition template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml"> <ui:param name="thispage" value="page.user.create" />
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
</f:metadata>
<ui:define name="content"> <ui:define name="content">
<div style="text-align: center;"> <div style="text-align: center;">
<h:form> <h:panelGrid columns="2">
<h:panelGroup>
<h1>#{i18n["adduser.update"]}</h1> <h1>#{i18n["adduser.update"]}</h1>
<div id="webcamcontainer">
<h:form styleClass="captureForm">
<div id="count" />
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:commandButton type="button" value="Capture" onclick="dophoto(pc)" />
</h:form> </h:form>
</div> </div>
</h:panelGroup>
<h:panelGroup styleClass="top">
<h2>#{i18n['user.thisIsCurrentImage']}</h2>
<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
<ui:fragment rendered="#{!empty userView.user.currentImage}">
<img width="300" src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img" alt="image" />
</ui:fragment>
</h:panelGroup>
</h:panelGrid>
</div>
<script>
function dophoto(pc) {
docount(5,pc);
}
function docount(count,pc) {
$('#count').html(count);
$('#count').css("opacity", 1);
$('#count').css("font-size", "28pt");
$('#count').animate({
opacity : 0,
fontSize : 0
}, 1500, function() {
if (count > 1)
docount(count - 1, pc);
if (count == 1) {
pc.capture();
}
});
}
</script>
<style>
#count {
font-size: 25pt;
text-align: center;
width: 30px;
}
</style>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
<meta http-equiv="Content-Language" content="fi" /> <meta http-equiv="Content-Language" content="fi" />
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="#{request.contextPath}/resources/style/blipview/css/style.css" /> href="#{request.contextPath}/resources/style/adduser/css/style.css" />
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="#{request.contextPath}/resources/style/blipview/css/general.css" /> href="#{request.contextPath}/resources/style/adduser/css/general.css" />
<ui:insert name="headerdata" /> <ui:insert name="headerdata" />
</h:head> </h:head>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:c="http://java.sun.com/jsp/jstl/core"
> >
<f:view locale="#{sessionHandler.locale}"> <f:view locale="#{sessionHandler.locale}" >
<ui:insert name="metadata" /> <ui:insert name="metadata" />
<h:head> <h:head>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/style/insomnia1/style.css" /> <link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/style/insomnia1/style.css" />
<ui:insert name="headerdata" /> <ui:insert name="headerdata" />
</h:head> </h:head>
<h:body> <h:body >
<div id="wrapper"> <div id="wrapper">
......
...@@ -5,16 +5,19 @@ ...@@ -5,16 +5,19 @@
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:f="http://java.sun.com/jsf/core"
xmlns:orgrole="http://java.sun.com/jsf/composite/cditools/orgrole" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"> xmlns:p="http://primefaces.org/ui"
>
<h:body> <h:body>
<ui:composition <ui:composition
template="/layout/#{sessionHandler.layout}/template.xhtml"> template="/layout/#{sessionHandler.layout}/template.xhtml">
<ui:param name="thispage" value="page.orgrole.list" /> <ui:param name="thispage" value="page.orgrole.list" />
<f:metadata> <f:metadata>
<f:event type="preRenderView" <f:event type="preRenderView" listener="#{orgRoleView.permissionList()}" />
listener="#{orgRoleView.permissionList()}" />
</f:metadata> </f:metadata>
<ui:define name="title">
<h1>#{i18n['foodwave.template.edit.title']}</h1>
</ui:define>
<ui:define name="content"> <ui:define name="content">
<orgrole:list /> <orgrole:list />
</ui:define> </ui:define>
......
...@@ -48,31 +48,6 @@ ...@@ -48,31 +48,6 @@
<p:commandButton action="#{userView.sendImage}" value="#{i18n['user.imagesubmit']}" /> <p:commandButton action="#{userView.sendImage}" value="#{i18n['user.imagesubmit']}" />
</ui:fragment> </ui:fragment>
<ui:fragment rendered="#{cc.attrs.creating}">
<h:outputLabel value="#{i18n['user.login']}" for="login" />
<br />
<p:inputText size="25" id="login" validator="#{userValidator.login}" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.login}" />
<p:message for="login" />
<br />
</ui:fragment>
<br />
<h:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.password']}" for="password" />
<br />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="password" value="#{userView.password}" />
<br />
<p:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.passwordcheck']}" for="passwordcheck" />
<br />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="passwordcheck" value="#{userView.passwordcheck}" />
<br />
</h:panelGroup> </h:panelGroup>
...@@ -111,6 +86,31 @@ ...@@ -111,6 +86,31 @@
<td><p:outputLabel value="#{i18n['user.phone']}" for="phone" /><br /> <p:inputText size="9" id="phone" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.phone}" /> <p:message for="phone" /></td> <td><p:outputLabel value="#{i18n['user.phone']}" for="phone" /><br /> <p:inputText size="9" id="phone" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.phone}" /> <p:message for="phone" /></td>
</tr> </tr>
</table> </table>
<br />
<ui:fragment rendered="#{cc.attrs.creating}">
<h:outputLabel value="#{i18n['user.login']}" for="login" />
<br />
<p:inputText size="25" id="login" validator="#{userValidator.login}" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.login}" />
<p:message for="login" />
<br />
</ui:fragment>
<br />
<h:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.password']}" for="password" />
<br />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="password" value="#{userView.password}" />
<br />
<p:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.passwordcheck']}" for="passwordcheck" />
<br />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="passwordcheck" value="#{userView.passwordcheck}" />
<br />
<p:commandButton ajax="false" rendered="#{cc.attrs.creating or userView.canSave}" id="commitbtn" action="#{cc.attrs.commitaction}" value="#{cc.attrs.commitvalue}" /> <p:commandButton ajax="false" rendered="#{cc.attrs.creating or userView.canSave}" id="commitbtn" action="#{cc.attrs.commitaction}" value="#{cc.attrs.commitvalue}" />
......
/* General css, use for non-layout purposes for general elements */ /* General css, use for non-layout purposes for general elements */
/* userlistview popup */ /* userlistview popup */
.userdata_popup { .userdata_popup {
position: absolute; position: absolute;
border: 1px solid black; border: 1px solid black;
...@@ -37,7 +36,18 @@ ...@@ -37,7 +36,18 @@
float: left; float: left;
width: 72px; width: 72px;
height: 72px; height: 72px;
background: burlywood; background: #40BDE8;
border: 1px solid black;
margin: 2px;
}
.touchItem {
float: none;
display: inline-block;
position: relative;
background: #40BDE8;
width: 128px;
height: 128px;
border: 1px solid black; border: 1px solid black;
margin: 2px; margin: 2px;
} }
...@@ -46,6 +56,35 @@ a.shopItem { ...@@ -46,6 +56,35 @@ a.shopItem {
color: black !important; color: black !important;
} }
a.touchItem {
color: white !important;
font-weight: bold;
}
a.touchItem div {
position: absolute;
height: 128px;
width: 128px;
text-align: center;
/* Firefox */
display: -moz-box;
-moz-box-orient: horizontal;
-moz-box-pack: center;
-moz-box-align: center;
/* Safari and Chrome */
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-pack: center;
-webkit-box-align: center;
/* W3C */
display: box;
box-orient: horizontal;
box-pack: center;
box-align: center;
clip: rect(0, 128px, 128px, 0);
}
a.shopItem div { a.shopItem div {
position: absolute; position: absolute;
height: 72px; height: 72px;
...@@ -69,50 +108,14 @@ a.shopItem div { ...@@ -69,50 +108,14 @@ a.shopItem div {
clip: rect(0, 72px, 72px, 0); clip: rect(0, 72px, 72px, 0);
} }
} a.shopItem:hover,a.touchItem:hover {
a.shopItem:hover { background: rgba(255, 255, 255, 0.2);
background: darkgoldenrod;
} }
a.shopItem:active { a.shopItem:active,a.touchItem:active {
background: red; background: red;
} }
.top {
vertical-align: top;
a.userimagetile, a.usertile {
float: left;
}
a.userimagetile div {
width: 128px;
height: 224px;
border: 1px solid black;
margin: 2px;
}
a.userimagetile div img {
width: 100%;
}
.usertilenick {
font-size: 14pt;
}
a.userbackbutton:link, a.userbackbutton:visited {
color: black;
text-decoration: none;
}
a.userbackbutton div{
background: #CEE4ED;
width:8em;
height: 2em;
padding: 1em;
border: 1px solid black;
}
a.usertile div {
background: #CEE4ED;
width: 10em;
height: 10em;
padding: 1em;
margin: 1em;
border: 1px solid black;
} }
\ No newline at end of file
...@@ -32,3 +32,8 @@ body { ...@@ -32,3 +32,8 @@ body {
width: 800px; width: 800px;
margin: 0 auto; margin: 0 auto;
} }
table td {
vertical-align: top;
}
\ No newline at end of file
/* General css, use for non-layout purposes for general elements */ /* General css, use for non-layout purposes for general elements */
/* userlistview popup */ /* userlistview popup */
.userdata_popup { .userdata_popup {
position: absolute; position: absolute;
border: 1px solid black; border: 1px solid black;
...@@ -33,20 +32,20 @@ ...@@ -33,20 +32,20 @@
text-overflow: clip; text-overflow: clip;
} }
.shopItem { .shopItem, .touchItem {
float: left; float: left;
width: 72px; width: 72px;
height: 72px; height: 72px;
background: burlywood; background: #40BDE8;
border: 1px solid black; border: 1px solid black;
margin: 2px; margin: 2px;
} }
a.shopItem { a.shopItem, a.touchItem {
color: black !important; color: black !important;
} }
a.shopItem div { a.shopItem div, a.touchItem div {
position: absolute; position: absolute;
height: 72px; height: 72px;
width: 72px; width: 72px;
...@@ -70,49 +69,10 @@ a.shopItem div { ...@@ -70,49 +69,10 @@ a.shopItem div {
} }
} }
a.shopItem:hover { a.shopItem:hover, a.touchItem:hover {
background: darkgoldenrod; background: rgba(255,255,255,0.4);
} }
a.shopItem:active { a.shopItem:active, a.touchItem:active {
background: red; background: red;
} }
\ No newline at end of file
a.userimagetile, a.usertile {
float: left;
}
a.userimagetile div {
width: 128px;
height: 224px;
border: 1px solid black;
margin: 2px;
}
a.userimagetile div img {
width: 100%;
}
.usertilenick {
font-size: 14pt;
}
a.userbackbutton:link, a.userbackbutton:visited {
color: black;
text-decoration: none;
}
a.userbackbutton div{
background: #CEE4ED;
width:8em;
height: 2em;
padding: 1em;
border: 1px solid black;
}
a.usertile div {
background: #CEE4ED;
width: 10em;
height: 10em;
padding: 1em;
margin: 1em;
border: 1px solid black;
}
...@@ -32,20 +32,20 @@ ...@@ -32,20 +32,20 @@
text-overflow: clip; text-overflow: clip;
} }
.shopItem { .shopItem, .touchItem {
float: left; float: left;
width: 72px; width: 72px;
height: 72px; height: 72px;
background: burlywood; background: #40BDE8;
border: 1px solid black; border: 1px solid black;
margin: 2px; margin: 2px;
} }
a.shopItem { a.shopItem, a.touchItem {
color: black !important; color: black !important;
} }
a.shopItem div { a.shopItem div, a.touchItem div {
position: absolute; position: absolute;
height: 72px; height: 72px;
width: 72px; width: 72px;
...@@ -69,10 +69,10 @@ a.shopItem div { ...@@ -69,10 +69,10 @@ a.shopItem div {
} }
} }
a.shopItem:hover { a.shopItem:hover, a.touchItem:hover {
background: darkgoldenrod; background: rgba(255,255,255,0.4);
} }
a.shopItem:active { a.shopItem:active, a.touchItem:active {
background: red; background: red;
} }
\ No newline at end of file
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<h2>#{i18n['user.thisIsCurrentImage']}</h2> <h2>#{i18n['user.thisIsCurrentImage']}</h2>
<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" /> <h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
<ui:fragment rendered="#{!empty userView.user.currentImage}"> <!-- <ui:fragment rendered="#{!empty userView.user.currentImage}">
<img width="300" src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img" alt="image" /> <img width="300" src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img" alt="image" />
<div> <div>
<h:form> <h:form>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</h:form> </h:form>
</div> </div>
</ui:fragment> </ui:fragment>
-->
<!-- <!--
<h2>asdasd</h2> <h2>asdasd</h2>
<h:dataTable value="#{userView.user.userImageList}" var="img"> <h:dataTable value="#{userView.user.userImageList}" var="img">
......
<!DOCTYPE html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "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" <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:users="http://java.sun.com/jsf/composite/tools/user" xmlns:c="http://java.sun.com/jsp/jstl/core"> xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/resources/#{sessionHandler.layout}/template.xhtml">
<ui:param name="thispage" value="page.eventorg.edit" /> <ui:define name="page">
<ui:define name="content">
#{sessionHandler.flushCache()} #{sessionHandler.flushCache()}
<h:form>
<h:commandButton action="#{testView.resetMenu()}" value="Reset to newui menu" onclick="return confirm('THIS WILL RESET ALL MODIFICATIONS TO DEFAULT MENU!!\n Are you really sure?!');" />
<h:commandButton action="#{testView.resetOldMenu()}" value="Reset to old menu" onclick="return confirm('THIS WILL RESET ALL MODIFICATIONS TO DEFAULT MENU!!\n Are you really sure?!');" />
</h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
...@@ -22,6 +22,17 @@ public class NavigationHandler implements Serializable { ...@@ -22,6 +22,17 @@ public class NavigationHandler implements Serializable {
@Inject @Inject
private transient Conversation conversation; private transient Conversation conversation;
public void saveNavigation(String navigation)
{
FacesContext fcont = FacesContext.getCurrentInstance();
HttpServletRequest req = (HttpServletRequest) fcont.getExternalContext().getRequest();
// TODO: Parse navigation correctly
StringBuilder viewidbuilder = new StringBuilder().append(req.getContextPath()).append(navigation);
viewidbuilder.append(".jsf");
saveDestination(viewidbuilder.toString());
}
public void saveDestination(String pageid) { public void saveDestination(String pageid) {
if (conversation.isTransient()) { if (conversation.isTransient()) {
conversation.begin(); conversation.begin();
......
...@@ -10,7 +10,6 @@ import java.util.TimeZone; ...@@ -10,7 +10,6 @@ import java.util.TimeZone;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -34,10 +33,10 @@ import fi.insomnia.bortal.model.LanEventPropertyKey; ...@@ -34,10 +33,10 @@ import fi.insomnia.bortal.model.LanEventPropertyKey;
public class SessionHandler { public class SessionHandler {
private static final Logger logger = LoggerFactory.getLogger(SessionHandler.class); private static final Logger logger = LoggerFactory.getLogger(SessionHandler.class);
//
@Inject // @Inject
private HttpServletRequest httprequest; // private HttpServletRequest httprequest;
//
@EJB @EJB
private RoleBeanLocal rolebean; private RoleBeanLocal rolebean;
@EJB @EJB
......
...@@ -34,6 +34,7 @@ actionlog.tasklist.header = Tasklist ...@@ -34,6 +34,7 @@ actionlog.tasklist.header = Tasklist
actionlog.time = Time actionlog.time = Time
actionlog.user = User actionlog.user = User
adduser.back = Back
adduser.newuser = Create new user adduser.newuser = Create new user
adduser.update = Update profile picture adduser.update = Update profile picture
adduser.welcome = Welcome adduser.welcome = Welcome
......
...@@ -34,6 +34,7 @@ actionlog.tasklist.header = Teht\u00E4v\u00E4lista ...@@ -34,6 +34,7 @@ actionlog.tasklist.header = Teht\u00E4v\u00E4lista
actionlog.time = Aika actionlog.time = Aika
actionlog.user = Tekij\u00E4 actionlog.user = Tekij\u00E4
adduser.back = Takaisin
adduser.newuser = Luo uusi k\u00E4ytt\u00E4j\u00E4tunnus adduser.newuser = Luo uusi k\u00E4ytt\u00E4j\u00E4tunnus
adduser.update = P\u00E4ivit\u00E4 profiilin kuva adduser.update = P\u00E4ivit\u00E4 profiilin kuva
adduser.welcome = Tervetuloa adduser.welcome = Tervetuloa
......
...@@ -54,7 +54,7 @@ public abstract class GenericCDIView implements Serializable { ...@@ -54,7 +54,7 @@ public abstract class GenericCDIView implements Serializable {
ret = requirePermissions(externalChecks); ret = requirePermissions(externalChecks);
} }
if (!ret) { if (!ret) {
logger.info("Permission required failed for {}", perm.getFullName()); logger.info("Permission required failed for {} Permission: {} (or extrachecks)", perm.getFullName(), perm);
} }
......
...@@ -77,15 +77,15 @@ public class PollView extends GenericCDIView { ...@@ -77,15 +77,15 @@ public class PollView extends GenericCDIView {
if (super.requirePermissions(PollPermission.ANSWER) && poll == null) { if (super.requirePermissions(PollPermission.ANSWER) && poll == null) {
thisPage = 1; thisPage = 1;
poll = pollBean.find(pollId); poll = pollBean.find(pollId);
if (super.requirePermissions(poll != null && poll.getQuestions() != null && !poll.getQuestions().isEmpty())) logger.debug("Initializing poll with id {} , poll {}", pollId, poll);
if (!super.requirePermissions(poll != null && poll.getQuestions() != null && !poll.getQuestions().isEmpty()))
{ {
return; return;
} }
logger.debug("initializing poll questions {}", poll.getQuestions());
pages = new HashMap<Integer, List<QuestionWrapper>>(); pages = new HashMap<Integer, List<QuestionWrapper>>();
logger.info("initializing poll {}", poll); for (PollQuestion q : poll.getQuestions()) {
for (PollQuestion q : getPoll().getQuestions()) {
if (!getPages().containsKey(q.getPage())) { if (!getPages().containsKey(q.getPage())) {
......
...@@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory; ...@@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.BootstrapBeanLocal; import fi.insomnia.bortal.beans.BootstrapBeanLocal;
import fi.insomnia.bortal.handler.NavigationHandler; import fi.insomnia.bortal.handler.NavigationHandler;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.User; import fi.insomnia.bortal.model.User;
import fi.insomnia.bortal.web.cdiview.GenericCDIView; import fi.insomnia.bortal.web.cdiview.GenericCDIView;
...@@ -38,11 +39,9 @@ public class AuthView extends GenericCDIView { ...@@ -38,11 +39,9 @@ public class AuthView extends GenericCDIView {
private HttpServletRequest getRequest() { private HttpServletRequest getRequest() {
FacesContext facesContext = FacesContext.getCurrentInstance(); FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext. ExternalContext externalContext = facesContext.getExternalContext();
getExternalContext();
Object request = externalContext.getRequest(); Object request = externalContext.getRequest();
return request instanceof HttpServletRequest ? return request instanceof HttpServletRequest ? (HttpServletRequest) request : null;
(HttpServletRequest) request : null;
} }
public void executeLogout() { public void executeLogout() {
...@@ -60,6 +59,10 @@ public class AuthView extends GenericCDIView { ...@@ -60,6 +59,10 @@ public class AuthView extends GenericCDIView {
} }
public void executeLogin() { public void executeLogin() {
doLogin("/auth/loginError");
}
private void doLogin(String onError) {
bootStrapBean.saneDefaults(); bootStrapBean.saneDefaults();
...@@ -90,7 +93,7 @@ public class AuthView extends GenericCDIView { ...@@ -90,7 +93,7 @@ public class AuthView extends GenericCDIView {
if (principal != null) { if (principal != null) {
navihandler.redirectToSaved(); navihandler.redirectToSaved();
} else { } else {
navihandler.forward("/auth/loginError"); navihandler.forward(onError);
try { try {
request.login(User.ANONYMOUS_LOGINNAME, null); request.login(User.ANONYMOUS_LOGINNAME, null);
} catch (ServletException e) { } catch (ServletException e) {
...@@ -103,6 +106,11 @@ public class AuthView extends GenericCDIView { ...@@ -103,6 +106,11 @@ public class AuthView extends GenericCDIView {
return; return;
} }
public void executeAdduserViewLogin() {
navihandler.saveNavigation("/admin/adduser/update");
doLogin("/admin/adduser/loginerror");
}
public String executeLoginAction() { public String executeLoginAction() {
executeLogin(); executeLogin();
return null; return null;
...@@ -124,4 +132,12 @@ public class AuthView extends GenericCDIView { ...@@ -124,4 +132,12 @@ public class AuthView extends GenericCDIView {
this.password = password; this.password = password;
} }
public void executeAdduserAutoLogin(EventUser user, String password2) {
// TODO Auto-generated method stub
this.login = user.getLogin();
this.password = password2;
navihandler.saveNavigation("/admin/adduser/update");
doLogin("/admin/adduser/loginerror");
}
} }
...@@ -13,6 +13,7 @@ import javax.faces.context.FacesContext; ...@@ -13,6 +13,7 @@ import javax.faces.context.FacesContext;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import org.apache.http.HttpRequest;
import org.primefaces.event.CaptureEvent; import org.primefaces.event.CaptureEvent;
import org.primefaces.model.CroppedImage; import org.primefaces.model.CroppedImage;
import org.primefaces.model.DefaultStreamedContent; import org.primefaces.model.DefaultStreamedContent;
...@@ -47,6 +48,9 @@ public class UserView extends GenericCDIView { ...@@ -47,6 +48,9 @@ public class UserView extends GenericCDIView {
*/ */
private static final Logger logger = LoggerFactory.getLogger(UserView.class); private static final Logger logger = LoggerFactory.getLogger(UserView.class);
private static final long serialVersionUID = 7724348195373468017L; private static final long serialVersionUID = 7724348195373468017L;
@Inject
private AuthView authView;
@EJB @EJB
private transient UserBeanLocal userbean; private transient UserBeanLocal userbean;
private Integer userid; private Integer userid;
...@@ -292,6 +296,11 @@ public class UserView extends GenericCDIView { ...@@ -292,6 +296,11 @@ public class UserView extends GenericCDIView {
return "/user/created"; return "/user/created";
} }
public String createUserAdduserView() {
userbean.createNewUser(user, getPassword());
authView.executeAdduserAutoLogin(user, getPassword());
return "/admin/adduser/update";
}
public String createAdminUser() { public String createAdminUser() {
userbean.createNewUser(user, getPassword()); userbean.createNewUser(user, getPassword());
canSave = permbean.hasPermission(UserPermission.MODIFY); canSave = permbean.hasPermission(UserPermission.MODIFY);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!