Commit c22b5c27 by Antti Jaakkola

fixed user edit page

1 parent f2a58344
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
<composite:implementation> <composite:implementation>
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" /> <h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<h:panelGrid columns="3" cellpadding="20" columnClasses="topalign,topalign,topalign"> <p:panelGrid columns="3" cellpadding="20" columnClasses="topalign,topalign,topalign" styleClass="noBorders">
<h:form id="userform" enctype="multipart/form-data"> <h:form id="userform" enctype="multipart/form-data">
<h:panelGroup> <p:fieldset legend="#{i18n['user.image']}">
<p:panelGrid columns="1">
<ui:fragment rendered="#{not empty userView.selectedUser.id}"> <ui:fragment rendered="#{not empty userView.selectedUser.id}">
<p:dialog id="chartPanel" for="webcamButton" modal="true" dynamic="true" widgetVar="webcamDialog"> <p:dialog id="chartPanel" for="webcamButton" modal="true" dynamic="true" widgetVar="webcamDialog">
...@@ -25,7 +26,6 @@ ...@@ -25,7 +26,6 @@
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" onerror="location.reload(true);" /> <p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" onerror="location.reload(true);" />
</p:dialog> </p:dialog>
<h:outputText rendered="#{empty userView.selectedUser.currentImage}" value="#{i18n['user.noCurrentImage']}" /> <h:outputText rendered="#{empty userView.selectedUser.currentImage}" value="#{i18n['user.noCurrentImage']}" />
<ui:fragment rendered="#{!empty userView.selectedUser.currentImage}"> <ui:fragment rendered="#{!empty userView.selectedUser.currentImage}">
<img style="width: 150px;" src="#{request.contextPath}/dydata/userimage/#{userView.selectedUser.currentImage.id}.img" alt="image" /> <img style="width: 150px;" src="#{request.contextPath}/dydata/userimage/#{userView.selectedUser.currentImage.id}.img" alt="image" />
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="#{cc.attrs.photocamupdate}" /> <p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="#{cc.attrs.photocamupdate}" />
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" onerror="location.reload(true);" update="#{cc.attrs.photocamupdate}" /> <p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" onerror="location.reload(true);" update="#{cc.attrs.photocamupdate}" />
</ui:fragment> </ui:fragment>
<!-- -->
&nbsp; &nbsp;
<p:fileUpload id="uploadfile" value="#{userView.image}" mode="simple" required="true" requiredMessage="Required!" invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024" /> <p:fileUpload id="uploadfile" value="#{userView.image}" mode="simple" required="true" requiredMessage="Required!" invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024" />
...@@ -74,83 +74,65 @@ ...@@ -74,83 +74,65 @@
<p:message rendered="#{cc.attrs.creating}" for="passwordcheck" /> <p:message rendered="#{cc.attrs.creating}" for="passwordcheck" />
<br /> <br />
</h:panelGroup> </p:panelGrid>
</p:fieldset>
</h:form> </h:form>
<h:form> <h:form>
<h:panelGrid columns="2" columnClasses="topalign,topalign"> <p:fieldset legend="#{i18n['user.edit']}">
<h:panelGroup> <p:panelGrid columns="3" styleClass="noBorders">
<table> <p:outputLabel value="#{i18n['user.login']}" />
<ui:fragment rendered="#{!cc.attrs.creating}"> <h:outputText size="30" value="#{userView.selectedUser.login}" id="login" />
<tr> <h:message for="login" />
<td colspan="2"><b><h:outputLabel for="login" value="#{i18n['user.login']}" /></b><br /> <h:outputText value="#{userView.selectedUser.login}" id="login" /></td>
<p:outputLabel value="#{i18n['user.nick']}" />
</tr> <p:inputText size="30" id="nick" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.nick}" />
</ui:fragment> <h:message for="nick" />
<tr>
<td colspan="2"><b><h:outputLabel value="#{i18n['user.nick']}" for="nick" /> </b><br /> <p:inplace emptyLabel="#{i18n['user.insert']}"> <p:outputLabel value="#{i18n['user.firstNames']}" />
<p:inputText size="45" id="nick" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.nick}" /> <p:inputText size="30" id="firstnames" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.firstnames}" />
</p:inplace></td> <h:message for="firstnames" />
</tr>
<tr> <p:outputLabel value="#{i18n['user.lastName']}" />
<td><b><h:outputLabel value="#{i18n['user.firstNames']}" for="firstnames" /></b><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText size="22" id="firstnames" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.firstnames}" />
</p:inplace></td>
<td><b><h:outputLabel value="#{i18n['user.lastName']}" for="lastname" /></b><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText size="30" id="lastname" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.lastname}" /> <p:inputText size="30" id="lastname" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.lastname}" />
</p:inplace></td> <h:message for="lastname" />
</tr>
<tr> <p:outputLabel value="#{i18n['user.sex']}" for="sex" />
<td colspan="2"><b><h:outputLabel value="#{i18n['user.sex']}" for="sex" /></b> <br /> <p:selectOneMenu disabled="#{!cc.attrs.creating and !userView.canSave}" id="sex" value="#{userView.selectedUser.gender}"> <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="undefined" itemLabel="#{i18n['user.sex.UNDEFINED']}" itemValue="UNDEFINED" />
<f:selectItem id="male" itemLabel="#{i18n['user.sex.MALE']}" itemValue="MALE" /> <f:selectItem id="male" itemLabel="#{i18n['user.sex.MALE']}" itemValue="MALE" />
<f:selectItem id="female" itemLabel="#{i18n['user.sex.FEMALE']}" itemValue="FEMALE" /> <f:selectItem id="female" itemLabel="#{i18n['user.sex.FEMALE']}" itemValue="FEMALE" />
</p:selectOneMenu></td> </p:selectOneMenu>
</tr> <h:message for="sex" />
<tr> <p:outputLabel value="#{i18n['user.birthday']}" />
<td><b><h:outputLabel for="birthday" value="#{i18n['user.birthday']}" /></b><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:calendar id="birthday" navigator="true" yearRange="c-80:c-0" value="#{userView.selectedUser.birthday}"> <p:calendar id="birthday" navigator="true" yearRange="c-80:c-0" value="#{userView.selectedUser.birthday}">
<f:convertDateTime pattern="#{sessionHandler.dateFormat}" timeZone="#{sessionHandler.timezone}" /> <f:convertDateTime pattern="#{sessionHandler.dateFormat}" timeZone="#{sessionHandler.timezone}" />
</p:calendar> </p:calendar>
</p:inplace> <h:message for="birthday" /></td> <h:message for="birthday" />
<td><b><h:outputLabel for="age" value="#{i18n['user.age']}" /></b><br /> <h:outputText value="#{userView.selectedUser.user.age}">
<f:convertNumber minFractionDigits="2" maxFractionDigits="2" /> <p:outputLabel value="#{i18n['user.address']}" />
</h:outputText></td> <p:inputText size="30" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.address}" />
</tr> <p:message for="address" />
</table>
<p:outputLabel value="#{i18n['user.zipCode']}" for="zip" />
<table>
<tr>
<td colspan="2"><b><p:outputLabel value="#{i18n['user.address']}" for="address" /></b><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText size="45" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.address}" />
</p:inplace></td>
</tr>
<tr>
<td><b><p:outputLabel value="#{i18n['user.zipCode']}" for="zip" /></b><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText styleClass="ui-input" size="7" id="zip" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.zip}" /> <p:inputText styleClass="ui-input" size="7" id="zip" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.zip}" />
</p:inplace> <p:message for="zip" /></td> <p:message for="zip" />
<td><b><p:outputLabel value="#{i18n['user.town']}" for="town" /></b><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText styleClass="ui-input" size="25" id="town" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.town}" /> <p:outputLabel value="#{i18n['user.town']}" for="town" />
</p:inplace> <p:message for="town" /></td> <p:inputText styleClass="ui-input" size="30" id="town" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.town}" />
</tr> <p:message for="town" />
<tr>
<td colspan="2"><b><h:outputLabel value="#{i18n['user.email']}" for="email" /></b> <br /> <p:inplace emptyLabel="#{i18n['user.insert']}"> <p:outputLabel value="#{i18n['user.email']}" for="email" />
<p:inputText validator="#{userValidator.validateEmail}" size="45" id="email" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.email}" /> <p:inputText validator="#{userValidator.validateEmail}" size="30" id="email" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.email}" />
</p:inplace></td> <p:message for="email" />
</tr>
<tr> <p:outputLabel value="#{i18n['user.phone']}" for="phone" />
<td><b><p:outputLabel value="#{i18n['user.phone']}" for="phone" /></b><br /> <p:inplace emptyLabel="#{i18n['user.insert']}"> <p:inputText styleClass="ui-input" size="30" id="phone" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.phone}" />
<p:inputText styleClass="ui-input" size="7" id="phone" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.phone}" /> <p:message for="phone" />
</p:inplace> <p:message for="phone" /></td>
</tr> <p:outputLabel value="#{i18n['user.shirtSize']}" for="shirtSize" rendered="#{userView.shirtEnabled}" />
<p:selectOneMenu style="width: 200px;" disabled="#{!cc.attrs.creating and !userView.canSave}" id="shirtSize" value="#{userView.selectedUser.user.shirtSize}" rendered="#{userView.shirtEnabled}">
<!-- this is terrible, pleace, someone, refactor this whole file -->
<ui:fragment rendered="#{userView.shirtEnabled}">
<tr>
<td>
<b><p:outputLabel value="#{i18n['user.shirtSize']}" for="shirtSize" /></b><br />
<p:selectOneMenu style="width: 200px;" disabled="#{!cc.attrs.creating and !userView.canSave}" id="shirtSize" value="#{userView.selectedUser.user.shirtSize}">
<f:selectItem itemLabel="#{i18n['user.shirt.select']}" itemValue="" /> <f:selectItem itemLabel="#{i18n['user.shirt.select']}" itemValue="" />
<f:selectItem itemLabel="#{i18n['user.shirt.S']}" itemValue="S" /> <f:selectItem itemLabel="#{i18n['user.shirt.S']}" itemValue="S" />
<f:selectItem itemLabel="#{i18n['user.shirt.M']}" itemValue="M" /> <f:selectItem itemLabel="#{i18n['user.shirt.M']}" itemValue="M" />
...@@ -166,37 +148,29 @@ ...@@ -166,37 +148,29 @@
<f:selectItem itemLabel="#{i18n['user.shirt.LadyXL']}" itemValue="Lady-XL" /> <f:selectItem itemLabel="#{i18n['user.shirt.LadyXL']}" itemValue="Lady-XL" />
<f:selectItem itemLabel="#{i18n['user.shirt.LadyXXL']}" itemValue="Lady-XXL" /> <f:selectItem itemLabel="#{i18n['user.shirt.LadyXXL']}" itemValue="Lady-XXL" />
</p:selectOneMenu> </p:selectOneMenu>
</td> <p:message for="shirtSize" rendered="#{userView.shirtEnabled}" />
</tr>
</ui:fragment>
</table>
</p:panelGrid>
<p:commandButton rendered="#{cc.attrs.creating or userView.canSave}" id="commitbtn" action="#{cc.attrs.commitaction}" ajax="false" value="#{cc.attrs.commitvalue}" onerror="location.reload(true);" /> <p:commandButton rendered="#{cc.attrs.creating or userView.canSave}" id="commitbtn" action="#{cc.attrs.commitaction}" ajax="false" value="#{cc.attrs.commitvalue}" onerror="location.reload(true);" />
</p:fieldset>
</h:panelGroup> </h:form>
<h:form>
<h:panelGroup rendered="#{userView.showUserSelectableRoles and cc.attrs.showRoles}"> <p:fieldset legend="#{i18n['user.userSelectableRoles']}" rendered="#{userView.showUserSelectableRoles and cc.attrs.showRoles}">
<p:panelGrid columns="2" styleClass="noBorders">
<h2>
<h:outputText value="#{i18n['user.userSelectableRoles']}:" />
</h2>
<p:selectManyCheckbox converter="#{roleConverter}" layout="pageDirection" value="#{userView.userSelectableRoles}"> <p:selectManyCheckbox converter="#{roleConverter}" layout="pageDirection" value="#{userView.userSelectableRoles}">
<f:selectItems value="#{roleDataView.userSelectableRoles}" var="roleitem" itemLabel="#{roleitem.name}" itemValue="#{roleitem}" /> <f:selectItems value="#{roleDataView.userSelectableRoles}" var="roleitem" itemLabel="#{roleitem.name}" itemValue="#{roleitem}" />
</p:selectManyCheckbox> </p:selectManyCheckbox>
<div> <div>
<h:message rendered="#{roleView.canReadRoles}" for="roles" /> <h:message rendered="#{roleView.canReadRoles}" for="roles" />
</div> </div>
<h:commandButton action="#{userView.saveUserSelectableRoles}" value="#{i18n['user.saveUserSelectableRoles']}" />
</h:panelGroup>
</h:panelGrid>
</p:panelGrid>
<p:commandButton action="#{userView.saveUserSelectableRoles}" value="#{i18n['user.saveUserSelectableRoles']}" />
</p:fieldset>
</h:form> </h:form>
</p:panelGrid>
</h:panelGrid>
</composite:implementation> </composite:implementation>
</html> </html>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!