create.xhtml 5.74 KB
<?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:form id="userform">
		<h:panelGrid columns="3">

			<h:outputLabel rendered="#{!cc.attrs.creating}" value="#{i18n['user.login']}:" for="viewlogin" />
			<h:outputText rendered="#{!cc.attrs.creating}" disabled="#{!cc.attrs.creating and !userView.canSave()}"
				id="viewlogin" value="#{userView.selectedUser.login}"
			/>
			<h:message rendered="#{!cc.attrs.creating}" for="viewlogin" />

			<h:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.login']}:" for="login" />
			<h:inputText size="45"  rendered="#{cc.attrs.creating}" validator="#{userValidator.login}"
				disabled="#{!cc.attrs.creating and !userView.canSave()}" id="login" value="#{userView.selectedUser.login}"
			/>
			<h:message rendered="#{cc.attrs.creating}" for="login" />

			<h:outputLabel value="#{i18n['user.nick']}:" for="nick" />
			<h:inputText size="45"  id="nick" disabled="#{!cc.attrs.creating and !userView.canSave()}" value="#{userView.selectedUser.nick}" />
			<h:message for="nick" />


			<h:outputLabel value="#{i18n['user.email']}:" for="email" />
			<h:inputText validator="#{userValidator.validateEmail}" size="45"  id="email" disabled="#{!cc.attrs.creating and !userView.canSave()}"
				value="#{userView.selectedUser.email}"
			/>
			<h:message for="email" />

			<h:outputLabel value="#{i18n['user.firstNames']}:" for="firstnames" />
			<h:inputText size="45"  id="firstnames" disabled="#{!cc.attrs.creating and !userView.canSave()}"
				value="#{userView.selectedUser.firstnames}"
			/>
			<h:message for="firstnames" />

			<h:outputLabel value="#{i18n['user.lastName']}:" for="lastname" />
			<h:inputText size="45"  id="lastname" disabled="#{!cc.attrs.creating and !userView.canSave()}"
				value="#{userView.selectedUser.lastname}"
			/>
			<h:message for="lastname" />

			<h:outputLabel value="#{i18n['user.address']}:" for="address" />
			<h:inputText size="45"  id="address" disabled="#{!cc.attrs.creating and !userView.canSave()}"
				value="#{userView.selectedUser.address}"
			/>
			<h:message for="address" />

			<h:outputLabel value="#{i18n['user.zipCode']}:" for="zip" />
			<h:inputText size="45"  id="zip" disabled="#{!cc.attrs.creating and !userView.canSave()}" value="#{userView.selectedUser.zip}" />
			<h:message for="zip" />

			<h:outputLabel value="#{i18n['user.town']}:" for="town" />
			<h:inputText size="45" id="town" disabled="#{!cc.attrs.creating and !userView.canSave()}" value="#{userView.selectedUser.town}" />
			<h:message for="town" />


			
			<!--
                <h:outputLabel  value="#{i18n['user.defaultImage']}:" for="currentImage" />
                	<h:selectOneMenu rendered="#{sessionHandler.hasPermission('USER', 'READ')}" id="currentImage" value="#{userView.selectedUser.currentImage}" converter="#{userimageConverter}" >
					<f:selectItems var="image" itemLabel="#{image.description}" value="#{userView.selectedUser.userImageList}" />
               	</h:selectOneMenu>
				 -->
			<h:outputLabel value="#{i18n['user.sex']}:" for="sex" />
			<h:selectOneRadio 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" />
			</h:selectOneRadio>
			<h:message for="sex" />
			
			<h:outputLabel for="birthday" value="#{i18n['user.birthday']}:"/>
			<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" />



			<h:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.password']}:" for="password" />
			<h:inputSecret validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="password"
				value="#{userView.password}"
			/>
			<h:message rendered="#{cc.attrs.creating}" for="password" />

			<h:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.passwordcheck']}:" for="passwordcheck" />
			<h:inputSecret validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="passwordcheck"
				value="#{userView.passwordcheck}"
			/>
			<h:message rendered="#{cc.attrs.creating}" for="passwordcheck" />
			
			<h:outputLabel rendered="#{sessionHandler.superadmin}" value="#{i18n['user.superadmin']}:" for="superadmin" />
			<h:selectBooleanCheckbox disabled="#{!cc.attrs.creating and !userView.canSave()}"
				rendered="#{sessionHandler.superadmin}" id="superadmin" value="#{userView.selectedUser.superadmin}"
			/>
			<h:message rendered="#{sessionHandler.superadmin}" for="superadmin" />
			
			
			
			<h:commandButton rendered="#{cc.attrs.creating or userView.canSave()}" id="commitbtn"
				action="#{cc.attrs.commitaction}" value="#{cc.attrs.commitvalue}"
			/>
		</h:panelGrid>
	</h:form>

</composite:implementation>
</html>