Commit 4e06f753 by Tuomas Riihimäki

Merge branch 'master' into devel

Conflicts:
	code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/AuthView.java
2 parents c7ebc634 0daf2748
<!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
......@@ -8,15 +8,19 @@
<f:metadata>
<f:event type="preRenderView" listener="#{userView.initCreateView}" />
</f:metadata>
<ui:define name="content">
<div style="text-align: center;">
<h1>#{i18n["adduser.newuser"]}</h1>
<users:create creating="true" commitaction="#{userView.createUser()}" commitvalue="#{i18n['user.create']}" />
<div style="width: 400px; text-align: left; margin: 0 auto;">
<users:create creating="true" commitaction="#{userView.createUserAdduserView()}" commitvalue="#{i18n['user.create']}" />
</div>
</div>
<h:form>
<h:commandLink styleClass="userbackbutton" action="/admin/adduser/start">
<div>#{i18n['adduser.back']}</div>
</h:commandLink>
</h:form>
</ui:define>
</ui:composition>
......
<!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:shop="http://java.sun.com/jsf/composite/cditools/shop"
xmlns:tools="http://java.sun.com/jsf/composite/cditools">
<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">
<h:body>
<ui:composition
template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
<ui:composition template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
<ui:define name="content">
<div style="text-align: center;">
<h:form>
<h1>#{i18n["adduser.welcome"]}</h1>
<br/><br/><p>#{i18n["adduser.welcometext"]}
</p>
<br/><br/>
<p:commandButton styleClass="start" ajax="false" action="/admin/adduser/newuser" value="#{i18n['adduser.newuser']}" /><br/>
<p:commandButton styleClass="start" ajax="false" action="/admin/adduser/update" value="#{i18n['adduser.update']}" />
</h:form>
</div>
<div style="text-align: center;">
<h1>#{i18n["adduser.welcome"]}</h1>
<br /> <br /> <br /> <br />
<div style="width: 300px; margin: 0 auto;">
<h:link styleClass="touchItem" outcome="/admin/adduser/newuser" >
<div>
#{i18n['adduser.newuser']}
</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: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"
xmlns:shop="http://java.sun.com/jsf/composite/cditools/shop"
xmlns:tools="http://java.sun.com/jsf/composite/cditools">
<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">
<h:body>
<ui:composition
template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
<ui:composition 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">
<div style="text-align: center;">
<h:form>
<h1>#{i18n["adduser.update"]}</h1>
</h:form>
</div>
<div style="text-align: center;">
<h:panelGrid columns="2">
<h:panelGroup>
<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>
</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:composition>
</h:body>
</html>
\ No newline at end of file
......@@ -19,9 +19,9 @@
<meta http-equiv="Content-Language" content="fi" />
<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"
href="#{request.contextPath}/resources/style/blipview/css/general.css" />
href="#{request.contextPath}/resources/style/adduser/css/general.css" />
<ui:insert name="headerdata" />
</h:head>
......
......@@ -48,31 +48,6 @@
<p:commandButton action="#{userView.sendImage}" value="#{i18n['user.imagesubmit']}" />
</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>
......@@ -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>
</tr>
</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}" />
......
/* General css, use for non-layout purposes for general elements */
/* userlistview popup */
.userdata_popup {
position: absolute;
border: 1px solid black;
......@@ -37,7 +36,18 @@
float: left;
width: 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;
margin: 2px;
}
......@@ -46,6 +56,35 @@ a.shopItem {
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 {
position: absolute;
height: 72px;
......@@ -69,50 +108,14 @@ a.shopItem div {
clip: rect(0, 72px, 72px, 0);
}
}
a.shopItem:hover {
background: darkgoldenrod;
a.shopItem:hover,a.touchItem:hover {
background: rgba(255, 255, 255, 0.2);
}
a.shopItem:active {
a.shopItem:active,a.touchItem:active {
background: red;
}
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%;
.top {
vertical-align: top;
}
.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
......@@ -31,4 +31,9 @@ body {
#content {
width: 800px;
margin: 0 auto;
}
table td {
vertical-align: top;
}
\ No newline at end of file
/* General css, use for non-layout purposes for general elements */
/* userlistview popup */
.userdata_popup {
position: absolute;
border: 1px solid black;
......@@ -33,20 +32,20 @@
text-overflow: clip;
}
.shopItem {
.shopItem, .touchItem {
float: left;
width: 72px;
height: 72px;
background: burlywood;
background: #40BDE8;
border: 1px solid black;
margin: 2px;
}
a.shopItem {
a.shopItem, a.touchItem {
color: black !important;
}
a.shopItem div {
a.shopItem div, a.touchItem div {
position: absolute;
height: 72px;
width: 72px;
......@@ -70,49 +69,10 @@ a.shopItem div {
}
}
a.shopItem:hover {
background: darkgoldenrod;
a.shopItem:hover, a.touchItem:hover {
background: rgba(255,255,255,0.4);
}
a.shopItem:active {
a.shopItem:active, a.touchItem:active {
background: red;
}
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,20 +32,20 @@
text-overflow: clip;
}
.shopItem {
.shopItem, .touchItem {
float: left;
width: 72px;
height: 72px;
background: burlywood;
background: #40BDE8;
border: 1px solid black;
margin: 2px;
}
a.shopItem {
a.shopItem, a.touchItem {
color: black !important;
}
a.shopItem div {
a.shopItem div, a.touchItem div {
position: absolute;
height: 72px;
width: 72px;
......@@ -69,10 +69,10 @@ a.shopItem div {
}
}
a.shopItem:hover {
background: darkgoldenrod;
a.shopItem:hover, a.touchItem:hover {
background: rgba(255,255,255,0.4);
}
a.shopItem:active {
a.shopItem:active, a.touchItem:active {
background: red;
}
\ No newline at end of file
......@@ -47,7 +47,7 @@
<h2>#{i18n['user.thisIsCurrentImage']}</h2>
<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" />
<div>
<h:form>
......@@ -56,7 +56,7 @@
</h:form>
</div>
</ui:fragment>
-->
<!--
<h2>asdasd</h2>
<h:dataTable value="#{userView.user.userImageList}" var="img">
......
......@@ -22,6 +22,17 @@ public class NavigationHandler implements Serializable {
@Inject
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) {
if (conversation.isTransient()) {
conversation.begin();
......
......@@ -34,6 +34,7 @@ actionlog.tasklist.header = Tasklist
actionlog.time = Time
actionlog.user = User
adduser.back = Back
adduser.newuser = Create new user
adduser.update = Update profile picture
adduser.welcome = Welcome
......
......@@ -34,6 +34,7 @@ actionlog.tasklist.header = Teht\u00E4v\u00E4lista
actionlog.time = Aika
actionlog.user = Tekij\u00E4
adduser.back = Takaisin
adduser.newuser = Luo uusi k\u00E4ytt\u00E4j\u00E4tunnus
adduser.update = P\u00E4ivit\u00E4 profiilin kuva
adduser.welcome = Tervetuloa
......
......@@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.BootstrapBeanLocal;
import fi.insomnia.bortal.handler.NavigationHandler;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.User;
import fi.insomnia.bortal.web.cdiview.GenericCDIView;
......@@ -32,7 +33,7 @@ public class AuthView extends GenericCDIView {
@Inject
private NavigationHandler navihandler;
@EJB
private transient BootstrapBeanLocal bootStrapBean;
......@@ -56,11 +57,15 @@ public class AuthView extends GenericCDIView {
navihandler.forward("logoutDone");
}
public void executeLogin() {
doLogin("/auth/loginError");
}
private void doLogin(String onError) {
bootStrapBean.saneDefaults();
if (login == null || password == null || login.isEmpty() || password.isEmpty()) {
return;
}
......@@ -88,7 +93,7 @@ public class AuthView extends GenericCDIView {
if (principal != null) {
navihandler.redirectToSaved();
} else {
navihandler.forward("/auth/loginError");
navihandler.forward(onError);
try {
request.login(User.ANONYMOUS_LOGINNAME, null);
} catch (ServletException e) {
......@@ -97,10 +102,15 @@ public class AuthView extends GenericCDIView {
}
}
return;
}
public void executeAdduserViewLogin() {
navihandler.saveNavigation("/admin/adduser/update");
doLogin("/admin/adduser/loginerror");
}
public String executeLoginAction() {
executeLogin();
return null;
......@@ -122,4 +132,12 @@ public class AuthView extends GenericCDIView {
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;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.http.HttpRequest;
import org.primefaces.event.CaptureEvent;
import org.primefaces.model.CroppedImage;
import org.primefaces.model.DefaultStreamedContent;
......@@ -47,6 +48,9 @@ public class UserView extends GenericCDIView {
*/
private static final Logger logger = LoggerFactory.getLogger(UserView.class);
private static final long serialVersionUID = 7724348195373468017L;
@Inject
private AuthView authView;
@EJB
private transient UserBeanLocal userbean;
private Integer userid;
......@@ -291,7 +295,12 @@ public class UserView extends GenericCDIView {
userbean.createNewUser(user, getPassword());
return "/user/created";
}
public String createUserAdduserView() {
userbean.createNewUser(user, getPassword());
authView.executeAdduserAutoLogin(user, getPassword());
return "/admin/adduser/update";
}
public String createAdminUser() {
userbean.createNewUser(user, getPassword());
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!