Commit 43f86a2b by Petri Järvisalo

codecämpin viimseimmät muutokset

1 parent bfdcabc2
......@@ -30,17 +30,19 @@ public class I18n {
public static String get(String key) {
String value = null;
try {
value = getResourceBundle().getString(key);
} catch (MissingResourceException e) {
value = null;
}
if (key == null) {
value = "########";
} else if (value == null) {
value = "???" + key + "???";
} else {
try {
value = getResourceBundle().getString(key);
} catch (MissingResourceException e) {
value = null;
}
if (value == null) {
value = "???" + key + "???";
}
}
return value;
}
......
......@@ -51,15 +51,6 @@
</div>
</div>
<ui:fragment rendered="#{menuView.getMenu(0).size() > 1}">
<div id="top-menu">
<ul>
<li jsfc="ui:repeat" var="menuitem" value="#{menuView.getMenu(0)}">
<h:link outcome="#{menuitem.outcome}" value="#{i18n[menuitem.navigation.key]}" styleClass="#{menuitem.selected?'active':''}" />
</li>
</ul>
</div>
</ui:fragment>
</div>
<div id="main">
......
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:p="http://primefaces.org/ui">
<composite:interface>
<composite:attribute name="creating" required="false" default="false" />
<composite:attribute name="commitvalue" required="true" />
<composite:attribute name="commitaction" required="true" method-signature="java.lang.String action()" />
</composite:interface>
<composite:implementation>
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<!-- <h2>
<h:outputText rendered="#{!cc.attrs.creating}" disabled="#{!cc.attrs.creating and !userView.canSave}" id="viewlogin" value="#{userView.selectedUser.login}" />
</h2>
-->
<h:form id="userform" enctype="multipart/form-data">
<h:panelGrid columns="2">
<h:panelGroup>
<ui:fragment rendered="#{not empty userView.user.id}">
<p:overlayPanel id="chartPanel" for="webcamButton" hideEffect="fade">
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:commandButton type="button" value="Capture" onclick="pc.capture()" />
</p:overlayPanel>
<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
<ui:fragment rendered="#{!empty userView.user.currentImage}">
<img style="width: 150px;" src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img" alt="image" />
</ui:fragment>
<br />
<p:commandButton id="webcamButton" value="#{i18n['userimage.webcam']}" type="button" />
<br />
<br />
<p:fileUpload id="uploadfile" required="TRUE" requiredMessage="Required!" invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024" value="#{userView.image}" mode="simple" />
<p:message for="uploadfile" />
<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" 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}" />
<p:message rendered="#{cc.attrs.creating}" for="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}" />
<p:message rendered="#{cc.attrs.creating}" for="passwordcheck" />
<br />
</h:panelGroup>
<h:panelGroup>
<table>
<tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.nick']}" for="nick" /> <br /> <p:inputText size="45" id="nick" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.nick}" /></td>
</tr>
<tr>
<td><h:outputLabel value="#{i18n['user.firstNames']}" for="firstnames" /><br /> <p:inputText size="22" id="firstnames" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.firstnames}" /></td>
<td><h:outputLabel value="#{i18n['user.lastName']}" for="lastname" /><br /> <p:inputText size="30" id="lastname" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.lastname}" /></td>
</tr>
<tr>
<td><h:outputLabel for="birthday" value="#{i18n['user.birthday']}" /><br /> <p:calendar id="birthday" navigator="true" yearRange="c-80:c-0" locale="fi"
value="#{userView.selectedUser.birthday}" pattern="#{sessionHandler.dateFormat}" timeZone="#{sessionHandler.timezone}" /> <h:message for="birthday" /></td>
<td><h:outputLabel value="#{i18n['user.sex']}" for="sex" /> <br /> <p:selectOneMenu disabled="#{!cc.attrs.creating and !userView.canSave}" id="sex" value="#{userView.selectedUser.gender}">
<f:selectItem id="undefined" itemLabel="#{i18n['user.sex.UNDEFINED']}" itemValue="UNDEFINED" />
<f:selectItem id="male" itemLabel="#{i18n['user.sex.MALE']}" itemValue="MALE" />
<f:selectItem id="female" itemLabel="#{i18n['user.sex.FEMALE']}" itemValue="FEMALE" />
</p:selectOneMenu></td>
</tr>
</table>
<table>
<tr>
<td colspan="2"><p:outputLabel value="#{i18n['user.address']}" for="address" /><br /> <p:inputText size="45" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.address}" /></td>
</tr>
<tr>
<td><p:outputLabel value="#{i18n['user.zipCode']}" for="zip" /><br /> <p:inputText styleClass="ui-input" size="7" id="zip" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.zip}" /> <p:message for="zip" /></td>
<td><p:outputLabel value="#{i18n['user.town']}" for="town" /><br /> <p:inputText styleClass="ui-input" size="25" id="town" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.town}" /> <p:message for="town" /></td>
</tr>
<tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.email']}" for="email" /> <br /> <p:inputText validator="#{userValidator.validateEmail}" size="45" id="email"
disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.email}" /></td>
</tr>
</table>
<p:commandButton rendered="#{cc.attrs.creating or userView.canSave}" id="commitbtn" action="#{cc.attrs.commitaction}" value="#{cc.attrs.commitvalue}" />
</h:panelGroup>
</h:panelGrid>
</h:form>
</composite:implementation>
</html>
......@@ -9,7 +9,7 @@
<composite:implementation>
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<p:dataTable id="user" value="#{userSearchView.results}" var="user" dynamic="true">
<p:dataTable id="user" value="#{userSearchView.results}" var="user">
<p:column>
<f:facet name="header">
<h:link value="#{i18n['user.nick']}" includeViewParams="true">
......@@ -18,27 +18,10 @@
</h:link>
</f:facet>
<h:outputText styleClass="hoverable" value="#{(empty user.nick)?'----':user.nick}" />
<div class="userdata_popup">
<h:panelGrid columns="2">
<img style="width:100px;" src="#{request.contextPath}/dydata/userimage/#{user.currentImage.id}.img" alt="image" />
<h:panelGroup>
<h:outputText value="#{user.nick}"/> <br />
<h:outputText value="#{user.firstnames} #{user.lastname}"/> <br />
<hr />
<h:outputText value="#{user.address}"/> <br />
<h:outputText value="#{user.zip} #{user.postalTown}"/> <br />
<br />
<h:outputText value="#{user.phone}"/> <br />
<h:outputText value="#{user.email}"/> <br />
</h:panelGroup>
</h:panelGrid>
</div>
</p:column>
<p:column>
<f:facet name="header">
<h:link value="#{i18n['user.firstNames']}" includeViewParams="true">
<h:link value="#{i18n['user.firstnames']}" includeViewParams="true">
<f:param name="sort" value="firstnames" />
<f:param name="page" value="0" />
<f:param name="direction" value="#{(userSearchView.sort eq 'firstnames')? !userSearchView.direction :userSearchView.direction }" />
......@@ -58,12 +41,32 @@
<p:column>
<p:commandButton onClick="location.replace('#{request.contextPath}/useradmin/edit.jsf?userid=#{user.id}')">#{i18n['user.edit']}</p:commandButton>
<p:commandButton id="userinfoBtn" value="Info" type="button" />
<p:overlayPanel for="userinfoBtn">
<h:panelGrid columns="2">
<img style="width:100px;" src="#{request.contextPath}/dydata/userimage/#{user.currentImage.id}.img" alt="image" />
<h:panelGroup>
<h:outputText value="#{user.nick}"/> <br />
<h:outputText value="#{user.firstnames} #{user.lastname}"/> <br />
<hr />
<h:outputText value="#{user.address}"/> <br />
<h:outputText value="#{user.zip} #{user.postalTown}"/> <br />
<br />
<h:outputText value="#{user.phone}"/> <br />
<h:outputText value="#{user.email}"/> <br />
</h:panelGroup>
</h:panelGrid>
</p:overlayPanel>
</p:column>
<!-- <h:column>
<h:commandButton action="#{userView.shop()}" value="#{i18n['user.shop']}" />
</h:column> -->
</p:dataTable>
<script>
jQuery(function() {
jQuery(".hoverable").hover(function () {
......
......@@ -3,7 +3,7 @@
"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:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
......@@ -20,8 +20,8 @@
<ui:define name="content">
<h1>#{i18n['userlist.header']}</h1>
<h:form>
<h:inputText value="#{userSearchView.search}" />
<h:commandButton value="#{i18n['userlist.search']}" action="#{userSearchView.newSearch()}" />
<p:inputText value="#{userSearchView.search}" />
<p:commandButton value="#{i18n['userlist.search']}" action="#{userSearchView.newSearch()}" />
</h:form>
<p>
<users:list />
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!