/it-ru/trunk/build.xml |
---|
1,6 → 1,6 |
<project name="it-ru" default="deploy" basedir="."> |
<property name="build.compiler" value="jikes" /> |
<!--property name="build.compiler" value="jikes" /--> |
<property name="src" location="src" /> |
<property name="classes" location="classes" /> |
/it-ru/trunk/webapp/generalError.jsp |
---|
4,25 → 4,20 |
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> |
<%@ taglib uri="/WEB-INF/ak-backpath.tld" prefix="backpath" %> |
<%@ taglib uri="/WEB-INF/ak-strutsx.tld" prefix="strutsx" %> |
<%@ taglib uri="/WEB-INF/hostadmiral-core.tld" prefix="core" %> |
<html> |
<head> |
<meta http-equiv="expires" content="0"> |
<title><bean:message key="ak.hostadmiral.page.generalError.title" /></title> |
<title>Error</title> |
<link rel="stylesheet" type="text/css" href="<strutsx:root />/style/general.css"> |
</head> |
<body> |
<h1><bean:message key="ak.hostadmiral.page.generalError.title" /></h1> |
<h1>Error</h1> |
<p><bean:message key="ak.hostadmiral.page.generalError.message" /></p> |
<p>There is a general error occured. Please go <backpath:backlink>back</backpath:backlink> and try again.</p> |
<!-- FIXME: backpath:link><bean:message key="ak.hostadmiral.page.generalError.index" /></ backpath : link--> |
<br> |
<backpath:backlink><bean:message key="ak.hostadmiral.page.generalError.back" /></backpath:backlink> |
</body> |
</html> |
/it-ru/trunk/webapp/error.jsp |
---|
9,17 → 9,17 |
<head> |
<meta http-equiv="expires" content="0"> |
<title><bean:message key="ak.hostadmiral.page.error.title" /></title> |
<title>Error</title> |
<link rel="stylesheet" type="text/css" href="<strutsx:root />/style/general.css"> |
</head> |
<body> |
<h1><bean:message key="ak.hostadmiral.page.error.title" /></h1> |
<h1>Error</h1> |
<strutsx:errorsIterator id="errors" /> |
<strutsx:notEmpty name="errors"> |
<div class="error"><bean:message key="ak.hostadmiral.page.general.errors" />: |
<div class="error">There are some errors occured |
<ul> |
<logic:iterate name="errors" id="error"> |
<li><strutsx:message name="error" property="key" valuesProperty="values" /></li> |
29,7 → 29,7 |
</strutsx:notEmpty> |
<br> |
<backpath:backlink><bean:message key="ak.hostadmiral.page.error.back" /></backpath:backlink> |
<backpath:backlink>back</backpath:backlink> |
</body> |
/it-ru/trunk/webapp/WEB-INF/validator-rules.xml |
---|
983,6 → 983,18 |
</validator> |
<validator name="number" |
classname="ak.itru.util.Validator" |
method="validateNumber" |
methodParams="java.lang.Object, |
org.apache.commons.validator.ValidatorAction, |
org.apache.commons.validator.Field, |
org.apache.struts.action.ActionErrors, |
javax.servlet.http.HttpServletRequest" |
depends="" |
msg="errors.number" |
/> |
<validator name="currency" |
classname="ak.itru.util.Validator" |
method="validateCurrency" |
/it-ru/trunk/webapp/WEB-INF/web.xml |
---|
23,6 → 23,7 |
ak.itru.core.model.EventManager; |
ak.itru.core.model.ActManager; |
ak.itru.core.model.ApartmentManager; |
ak.itru.core.model.ParticipantManager; |
</param-value> |
</init-param> |
</filter> |
114,4 → 115,26 |
<taglib-location>/WEB-INF/ak-backpath.tld</taglib-location> |
</taglib> |
<security-constraint> |
<web-resource-collection> |
<web-resource-name>Admin</web-resource-name> |
<url-pattern>/admin/*</url-pattern> |
</web-resource-collection> |
<auth-constraint> |
<role-name>itru-admin</role-name> |
</auth-constraint> |
</security-constraint> |
<login-config> |
<auth-method>BASIC</auth-method> |
<realm-name>it-ru Admin</realm-name> |
</login-config> |
<security-role> |
<description> |
Administrator of it-ru |
</description> |
<role-name>itru-admin</role-name> |
</security-role> |
</web-app> |
/it-ru/trunk/webapp/WEB-INF/ak-itru.tld |
---|
0,0 → 1,273 |
<?xml version="1.0" encoding="UTF-8"?> |
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> |
<taglib> |
<tlibversion>1.0</tlibversion> |
<jspversion>1.1</jspversion> |
<shortname>itru</shortname> |
<uri>http://26th.net/itru</uri> |
<tag> |
<name>link</name> |
<tagclass>ak.itru.core.taglib.ExtendedLinkTag</tagclass> |
<attribute> |
<name>accesskey</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>action</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>anchor</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>forward</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>href</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>indexed</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>indexId</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>linkName</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>name</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onblur</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onclick</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>ondblclick</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onfocus</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onkeydown</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onkeypress</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onkeyup</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onmousedown</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onmousemove</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onmouseout</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onmouseover</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>onmouseup</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>page</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramId</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramName</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramProperty</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramScope</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramId2</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramName2</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramProperty2</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramScope2</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramId3</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramName3</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramProperty3</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramScope3</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramId4</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramName4</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramProperty4</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>paramScope4</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>property</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>scope</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>style</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>styleClass</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>styleId</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>tabindex</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>target</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>title</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>titleKey</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>transaction</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>backPathKey</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>backPathParam</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>backPathIgnore</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
<attribute> |
<name>zip</name> |
<required>false</required> |
<rtexprvalue>true</rtexprvalue> |
</attribute> |
</tag> |
</taglib> |
/it-ru/trunk/webapp/WEB-INF/struts-config.xml |
---|
29,6 → 29,7 |
<form-property name="enabled" type="java.lang.Boolean" /> |
<form-property name="comment" type="java.lang.String" /> |
<form-property name="acts" type="ak.itru.core.form.EventActBean[]" size="1" /> |
<form-property name="apartments" type="ak.itru.core.form.EventApartmentBean[]" size="1" /> |
</form-bean> |
<form-bean |
61,6 → 62,42 |
<form-property name="url" type="java.lang.String" /> |
<form-property name="comment" type="java.lang.String" /> |
</form-bean> |
<form-bean |
name="ParticipantListForm" |
type="org.apache.struts.validator.DynaValidatorForm"> |
<form-property name="event" type="java.lang.String" /> |
</form-bean> |
<form-bean |
name="ParticipantForm" |
type="org.apache.struts.validator.DynaValidatorForm"> |
<form-property name="id" type="java.lang.String" /> |
<form-property name="event" type="java.lang.String" /> |
</form-bean> |
<form-bean |
name="ParticipantEditForm" |
type="org.apache.struts.validator.DynaValidatorForm"> |
<form-property name="id" type="java.lang.String" /> |
<form-property name="event" type="java.lang.String" /> |
<form-property name="nick" type="java.lang.String" /> |
<form-property name="email" type="java.lang.String" /> |
<form-property name="emailPublic" type="java.lang.Boolean" /> |
<form-property name="name" type="java.lang.String" /> |
<form-property name="phone" type="java.lang.String" /> |
<form-property name="persons" type="java.lang.String" /> |
<form-property name="fromZip" type="java.lang.String" /> |
<form-property name="fromCity" type="java.lang.String" /> |
<form-property name="departure" type="java.lang.String" /> |
<form-property name="freeTransport" type="java.lang.String" /> |
<form-property name="transportComment" type="java.lang.String" /> |
<form-property name="freeSleep" type="java.lang.String" /> |
<form-property name="sleepComment" type="java.lang.String" /> |
<form-property name="payed" type="java.lang.Boolean" /> |
<form-property name="comment" type="java.lang.String" /> |
<form-property name="privateComment" type="java.lang.String" /> |
</form-bean> |
</form-beans> |
<global-exceptions> |
210,6 → 247,51 |
> |
</action> |
<!-- == participant ========================================================================= --> |
<action |
path="/admin/participant/list" |
type="ak.itru.core.action.AdminParticipantAction" |
parameter="list" |
name="ParticipantListForm" |
validate="true" |
scope="request" |
> |
<forward name="default" path="/admin/participant/list.jsp" /> |
</action> |
<action |
path="/admin/participant/delete" |
type="ak.itru.core.action.AdminParticipantAction" |
parameter="delete" |
name="ParticipantForm" |
validate="true" |
scope="request" |
> |
</action> |
<action |
path="/admin/participant/edit" |
type="ak.itru.core.action.AdminParticipantAction" |
parameter="edit" |
name="ParticipantForm" |
validate="true" |
scope="request" |
> |
<forward name="default" path="/admin/participant/edit.jsp" /> |
</action> |
<action |
path="/admin/participant/submit" |
type="ak.itru.core.action.AdminParticipantAction" |
parameter="submit" |
name="ParticipantEditForm" |
validate="true" |
scope="request" |
input="/admin/participant/edit.jsp" |
> |
</action> |
</action-mappings> |
<controller processorClass="ak.strutsx.RequestProcessorX" /> |
/it-ru/trunk/webapp/WEB-INF/validation.xml |
---|
71,5 → 71,45 |
<msg name="currency" key="ak.itru.core.apartment.edit.price.wrong" /> |
</field> |
</form> |
<form name="ParticipantListForm"> |
<field property="event" depends="long"> |
<msg name="long" key="ak.itru.core.participant.edit.event.wrong" /> |
</field> |
</form> |
<form name="ParticipantForm"> |
<field property="event" depends="long"> |
<msg name="long" key="ak.itru.core.participant.edit.event.wrong" /> |
</field> |
<field property="id" depends="long"> |
<msg name="long" key="ak.itru.core.participant.edit.id.wrong" /> |
</field> |
</form> |
<form name="ParticipantEditForm"> |
<field property="event" depends="long"> |
<msg name="long" key="ak.itru.core.participant.edit.event.wrong" /> |
</field> |
<field property="id" depends="long"> |
<msg name="long" key="ak.itru.core.participant.edit.id.wrong" /> |
</field> |
<field property="nick" depends="required"> |
<msg name="required" key="ak.itru.core.participant.edit.nick.required" /> |
</field> |
<field property="email" depends="required,email"> |
<msg name="required" key="ak.itru.core.participant.edit.email.required" /> |
<msg name="email" key="ak.itru.core.participant.edit.email.wrong" /> |
</field> |
<field property="persons" depends="integer"> |
<msg name="integer" key="ak.itru.core.participant.edit.persons.wrong" /> |
</field> |
<field property="freeTransport" depends="integer"> |
<msg name="integer" key="ak.itru.core.participant.edit.freetransport.wrong" /> |
</field> |
<field property="freeSleep" depends="integer"> |
<msg name="integer" key="ak.itru.core.participant.edit.freesleep.wrong" /> |
</field> |
</form> |
</formset> |
</form-validation> |
/it-ru/trunk/webapp/admin/participant/edit.jsp |
---|
0,0 → 1,116 |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> |
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> |
<%@ taglib uri="/WEB-INF/ak-backpath.tld" prefix="backpath" %> |
<%@ taglib uri="/WEB-INF/ak-strutsx.tld" prefix="strutsx" %> |
<html> |
<head> |
<meta http-equiv="expires" content="0"> |
<title>Edit participant</title> |
<link rel="stylesheet" type="text/css" href="<strutsx:root />/style/general.css"> |
</head> |
<body> |
<h1>Edit participant</h1> |
<strutsx:errorsIterator id="errors" /> |
<strutsx:notEmpty name="errors"> |
<div class="error">Errors in input: |
<ul> |
<logic:iterate name="errors" id="error"> |
<li><strutsx:message name="error" property="key" valuesProperty="values" /></li> |
</logic:iterate> |
</ul> |
</div> |
</strutsx:notEmpty> |
<html:form action="/admin/participant/submit"> |
<backpath:current /> |
<html:hidden property="id" /> |
<html:hidden property="event" /> |
<table border=1> |
<tr> |
<th>Ident</th> |
<td><bean:write name="participant" property="ident" /></td> |
</tr> |
<tr> |
<th>Nick</th> |
<td><html:text property="nick" /></td> |
</tr> |
<tr> |
<th>Email</th> |
<td><html:text property="email" /></td> |
</tr> |
<tr> |
<th>Email is public</th> |
<td colspan=3><html:checkbox property="emailPublic" /></td> |
</tr> |
<tr> |
<th>Name</th> |
<td><html:text property="name" /></td> |
</tr> |
<tr> |
<th>Phone</th> |
<td><html:text property="phone" /></td> |
</tr> |
<tr> |
<th>Persons</th> |
<td><html:text property="persons" /></td> |
</tr> |
<tr> |
<th>From ZIP</th> |
<td><html:text property="fromZip" /></td> |
</tr> |
<tr> |
<th>From city</th> |
<td><html:text property="fromCity" /></td> |
</tr> |
<tr> |
<th>Departure</th> |
<td><html:text property="departure" /></td> |
</tr> |
<tr> |
<th>Free places in transport</th> |
<td><html:text property="freeTransport" /></td> |
</tr> |
<tr> |
<th>Comment to free places in transport</th> |
<td><html:textarea property="transportComment" /></td> |
</tr> |
<tr> |
<th>Free places to sleep</th> |
<td><html:text property="freeSleep" /></td> |
</tr> |
<tr> |
<th>Comment to free places to sleep</th> |
<td><html:textarea property="sleepComment" /></td> |
</tr> |
<tr> |
<th>Comment</th> |
<td><html:textarea property="comment" /></td> |
</tr> |
<tr> |
<th>Payed</th> |
<td colspan=3><html:checkbox property="payed" /></td> |
</tr> |
<tr> |
<th>Private comment</th> |
<td><html:textarea property="privateComment" /></td> |
</tr> |
<tr> |
<td colspan=2> |
<html:submit>Submit</html:submit> |
<backpath:backlink>Back</backpath:backlink> |
</td> |
</tr> |
</table> |
</html:form> |
</body> |
</html> |
/it-ru/trunk/webapp/admin/participant/list.jsp |
---|
0,0 → 1,70 |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> |
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> |
<%@ taglib uri="/WEB-INF/ak-backpath.tld" prefix="backpath" %> |
<%@ taglib uri="/WEB-INF/ak-strutsx.tld" prefix="strutsx" %> |
<%@ taglib uri="/WEB-INF/ak-itru.tld" prefix="itru" %> |
<html> |
<head> |
<meta http-equiv="expires" content="0"> |
<title>Participants</title> |
<link rel="stylesheet" type="text/css" href="<strutsx:root />/style/general.css"> |
</head> |
<body> |
<h1>Participants of <bean:write name="event" property="name" /></h1> |
<strutsx:errorsIterator id="errors" /> |
<strutsx:notEmpty name="errors"> |
<div class="error">Errors in input: |
<ul> |
<logic:iterate name="errors" id="error"> |
<li><strutsx:message name="error" property="key" valuesProperty="values" /></li> |
</logic:iterate> |
</ul> |
</div> |
</strutsx:notEmpty> |
<table border=1> |
<tr> |
<th>Ident</th> |
<th>Nick</th> |
<th>Email</th> |
<th>Name</th> |
<th>Persons</th> |
<th>Payed</th> |
<th> </th> |
<th> </th> |
</tr> |
<logic:iterate name="participants" id="p"> |
<tr> |
<td><bean:write name="p" property="ident" /></td> |
<td><bean:write name="p" property="nick" /> </td> |
<td><bean:write name="p" property="email" /> </td> |
<td><bean:write name="p" property="name" /> </td> |
<td><bean:write name="p" property="persons" /> </td> |
<td> |
<logic:equal name="p" property="payed" value="true">x</logic:equal> |
<logic:notEqual name="p" property="payed" value="true"> </logic:notEqual> |
</td> |
<td> |
<itru:link action="/admin/participant/edit" paramId="id" paramName="p" paramProperty="id" paramId2="event" paramName2="event" paramProperty2="id">edit</itru:link> |
</td> |
<td> |
<backpath:link action="/admin/participant/delete" paramId="id" paramName="p" paramProperty="id">delete</backpath:link> |
</td> |
</tr> |
</logic:iterate> |
</table> |
<backpath:link action="/admin/participant/edit" paramId="event" paramName="event" paramProperty="id">Add new participant</backpath:link> |
<br> |
<backpath:backlink>Back</backpath:backlink> |
</body> |
</html> |
/it-ru/trunk/webapp/admin/event/list.jsp |
---|
36,6 → 36,7 |
<th>Enabled</th> |
<th> </th> |
<th> </th> |
<th> </th> |
</tr> |
<logic:iterate name="events" id="e"> |
42,8 → 43,8 |
<tr> |
<td><bean:write name="e" property="name" /></td> |
<td><bean:write name="e" property="place" /> </td> |
<td><bean:write name="e" property="start" /> </td> |
<td><bean:write name="e" property="stop" /> </td> |
<td><bean:write name="e" property="start" format="dd.MM.yyyy" /> </td> |
<td><bean:write name="e" property="stop" format="dd.MM.yyyy" /> </td> |
<td> |
<logic:equal name="e" property="enabled" value="true">x</logic:equal> |
<logic:notEqual name="e" property="enabled" value="true"> </logic:notEqual> |
54,6 → 55,9 |
<td> |
<backpath:link action="/admin/event/delete" paramId="id" paramName="e" paramProperty="id">delete</backpath:link> |
</td> |
<td> |
<backpath:link action="/admin/participant/list" paramId="event" paramName="e" paramProperty="id">participants</backpath:link> |
</td> |
</tr> |
</logic:iterate> |
</table> |
/it-ru/trunk/webapp/admin/event/edit.jsp |
---|
34,65 → 34,97 |
<table border=1> |
<tr> |
<th>Name</th> |
<td><html:text property="name" /></td> |
<td colspan=3><html:text property="name" /></td> |
</tr> |
<tr> |
<th>Place</th> |
<td><html:text property="place" /></td> |
<td colspan=3><html:text property="place" /></td> |
</tr> |
<tr> |
<th>Address</th> |
<td><html:textarea property="address" /></td> |
<td colspan=3><html:textarea property="address" /></td> |
</tr> |
<tr> |
<th>Transport Description</th> |
<td><html:textarea property="transport" /></td> |
<td colspan=3><html:textarea property="transport" /></td> |
</tr> |
<tr> |
<th>Start</th> |
<td><html:text property="start" /></td> |
<td colspan=3><html:text property="start" /></td> |
</tr> |
<tr> |
<th>Stop</th> |
<td><html:text property="stop" /></td> |
<td colspan=3><html:text property="stop" /></td> |
</tr> |
<tr> |
<th>Last registration</th> |
<td><html:text property="lastreg" /></td> |
<td colspan=3><html:text property="lastreg" /></td> |
</tr> |
<tr> |
<th>Last unregistration</th> |
<td><html:text property="lastunreg" /></td> |
<td colspan=3><html:text property="lastunreg" /></td> |
</tr> |
<tr> |
<th>Price per person</th> |
<td><html:text property="price" /></td> |
<td colspan=3><html:text property="price" /></td> |
</tr> |
<tr> |
<th>Account to transfer money</th> |
<td><html:textarea property="account" /></td> |
<td colspan=3><html:textarea property="account" /></td> |
</tr> |
<tr> |
<th>Enabled</th> |
<td><html:checkbox property="enabled" /></td> |
<td colspan=3><html:checkbox property="enabled" /></td> |
</tr> |
<tr> |
<th>Comment</th> |
<td><html:textarea property="comment" /></td> |
<td colspan=3><html:textarea property="comment" /></td> |
</tr> |
<tr> |
<th colspan=4>Acts for the event</th> |
</tr> |
<tr> |
<td>Name</td> |
<td>Include</td> |
<td>Comment</td> |
<td> </td> |
</tr> |
<logic:iterate name="EventEditForm" property="acts" id="acts" indexId="iid"> |
<tr> |
<td> |
<th> |
<bean:write name="actList" property='<%= "objects[" + iid + "].name" %>' /> |
<html:hidden name="acts" property="actId" indexed="true" /> |
<html:checkbox name="acts" property="selected" indexed="true" /> |
</td> |
</th> |
<td><html:checkbox name="acts" property="selected" indexed="true" /></td> |
<td><html:text name="acts" property="comment" indexed="true" /></td> |
<td> </td> |
</tr> |
</logic:iterate> |
<tr> |
<td colspan=2> |
<th colspan=4>Apartment for the event</th> |
</tr> |
<tr> |
<td>Name</td> |
<td>Include</td> |
<td>Comment</td> |
<td>Distance</td> |
</tr> |
<logic:iterate name="EventEditForm" property="apartments" id="apartments" indexId="iid2"> |
<tr> |
<th> |
<bean:write name="apartmentList" property='<%= "objects[" + iid2 + "].name" %>' /> |
<html:hidden name="apartments" property="apartmentId" indexed="true" /> |
</th> |
<td><html:checkbox name="apartments" property="selected" indexed="true" /></td> |
<td><html:text name="apartments" property="comment" indexed="true" /></td> |
<td><html:text name="apartments" property="distance" indexed="true" /></td> |
</tr> |
</logic:iterate> |
<tr> |
<td colspan=4> |
<html:submit>Submit</html:submit> |
<backpath:backlink>Back</backpath:backlink> |
</td> |
/it-ru/trunk/sql/00.tables.sql |
---|
4,6 → 4,7 |
create sequence hibernate_sequence; |
/* removed in this version |
create table participants |
( |
id integer not null, |
17,6 → 18,7 |
constraint participants_prim primary key (id), |
constraint participants_email unique(email) |
); |
*/ |
create table events |
( |
69,12 → 71,12 |
( |
id integer not null, |
event integer not null, |
apartments integer not null, |
apartment integer not null, |
distance decimal, |
comment text, |
mod_stamp timestamp, |
constraint event_apartments_prim primary key (event, apartments) |
constraint event_apartments_prim primary key (event, apartment) |
); |
create table acts |
99,6 → 101,7 |
constraint event_acts_prim primary key (event, act) |
); |
/* removed in this version |
create table participant_events |
( |
participant integer not null, |
111,12 → 114,41 |
transport_comment integer, |
free_sleep integer, |
sleep_comment text, |
payed char(1) default ' ', |
comment text, |
mod_stamp timestamp, |
constraint participant_events_prim primary key (participant, event) |
); |
*/ |
create table participants |
( |
id integer not null, |
ident varchar(255) not null, |
nick varchar(255) not null, |
email varchar(255) not null, |
email_public char(1) default ' ', |
name varchar(255), |
phone varchar(255), |
event integer not null, |
persons integer, |
from_zip varchar(10), |
from_city varchar(10), |
departure timestamp, |
free_transport integer, |
transport_comment text, |
free_sleep integer, |
sleep_comment text, |
payed char(1) default ' ', |
comment text, |
private_comment text, |
mod_stamp timestamp, |
constraint participants_prim primary key (id), |
constraint participants_email unique(email) |
); |
create table participant_acts |
( |
participant integer not null, |
/it-ru/trunk/src/ak/itru/core/action/AdminParticipantAction.java |
---|
0,0 → 1,156 |
package ak.itru.core.action; |
import java.util.List; |
import java.util.Collections; |
import java.util.ArrayList; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import org.apache.struts.action.Action; |
import org.apache.struts.action.ActionMapping; |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.DynaActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.struts.action.ActionMessages; |
import org.apache.struts.action.ActionErrors; |
import org.apache.struts.action.ActionError; |
import ak.strutsx.RequestUtilsX; |
import ak.strutsx.ErrorHandlerX; |
import ak.backpath.BackPath; |
import ak.itru.util.StringConverter; |
import ak.itru.util.UserException; |
import ak.itru.core.model.Participant; |
import ak.itru.core.model.ParticipantManager; |
import ak.itru.core.model.Event; |
import ak.itru.core.model.EventManager; |
public final class AdminParticipantAction |
extends Action |
implements ErrorHandlerX |
{ |
public void handleErrors(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("submit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long eventId = StringConverter.parseLong(theForm.get("event")); |
Event event = EventManager.getInstance().get(eventId); |
Long participantId = StringConverter.parseLong(theForm.get("id")); |
Participant participant; |
if(participantId == null) { |
participant = ParticipantManager.getInstance().create(); |
} |
else { |
participant = ParticipantManager.getInstance().get(participantId); |
} |
request.setAttribute("event", event); |
request.setAttribute("participant", participant); |
} |
} |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("list".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long eventId = StringConverter.parseLong(theForm.get("event")); |
Event event = EventManager.getInstance().get(eventId); |
List list = new ArrayList(ParticipantManager.getInstance().listParticipants(event)); |
Collections.sort(list, ParticipantManager.NICK_COMPARATOR); |
request.setAttribute("participants", list); |
request.setAttribute("event", event); |
return mapping.findForward("default"); |
} |
else if("edit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long eventId = StringConverter.parseLong(theForm.get("event")); |
Event event = EventManager.getInstance().get(eventId); |
Long participantId = StringConverter.parseLong(theForm.get("id")); |
Participant participant; |
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm( |
this, request, "ParticipantEditForm"); |
if(participantId == null) { |
participant = ParticipantManager.getInstance().create(); |
} |
else { |
participant = ParticipantManager.getInstance().get(participantId); |
showForm.set("nick", participant.getNick()); |
showForm.set("email", participant.getEmail()); |
showForm.set("emailPublic", participant.getEmailPublic()); |
showForm.set("name", participant.getName()); |
showForm.set("phone", participant.getPhone()); |
showForm.set("persons", StringConverter.toString(participant.getPersons())); |
showForm.set("fromZip", participant.getFromZip()); |
showForm.set("fromCity", participant.getFromCity()); |
showForm.set("departure", StringConverter.toDateTime(participant.getDeparture())); |
showForm.set("freeTransport", StringConverter.toString(participant.getFreeTransport())); |
showForm.set("transportComment", participant.getTransportComment()); |
showForm.set("freeSleep", StringConverter.toString(participant.getFreeSleep())); |
showForm.set("sleepComment", participant.getSleepComment()); |
showForm.set("payed", participant.getPayed()); |
showForm.set("comment", participant.getComment()); |
showForm.set("privateComment", participant.getPrivateComment()); |
} |
request.setAttribute("event", event); |
request.setAttribute("participant", participant); |
return mapping.findForward("default"); |
} |
else if("delete".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long participantId = StringConverter.parseLong(theForm.get("id")); |
Participant participant = ParticipantManager.getInstance().get(participantId); |
ParticipantManager.getInstance().delete(participant); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else if("submit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long participantId = StringConverter.parseLong(theForm.get("id")); |
Participant participant; |
if(participantId == null) { |
Long eventId = StringConverter.parseLong(theForm.get("event")); |
Event event = EventManager.getInstance().get(eventId); |
participant = ParticipantManager.getInstance().create(); |
participant.setIdent(ParticipantManager.getInstance().generateIdent()); |
participant.setEvent(event); |
} |
else { |
participant = ParticipantManager.getInstance().get(participantId); |
} |
participant.setNick((String)theForm.get("nick")); |
participant.setEmail((String)theForm.get("email")); |
participant.setEmailPublic((Boolean)theForm.get("emailPublic")); |
participant.setName((String)theForm.get("name")); |
participant.setPhone((String)theForm.get("phone")); |
participant.setPersons(StringConverter.parseInteger(theForm.get("persons"))); |
participant.setFromZip((String)theForm.get("fromZip")); |
participant.setFromCity((String)theForm.get("fromCity")); |
participant.setDeparture(StringConverter.parseDateTime(theForm.get("departure"))); |
participant.setFreeTransport(StringConverter.parseInteger(theForm.get("freeTransport"))); |
participant.setTransportComment((String)theForm.get("transportComment")); |
participant.setFreeSleep(StringConverter.parseInteger(theForm.get("freeSleep"))); |
participant.setSleepComment((String)theForm.get("sleepComment")); |
participant.setPayed((Boolean)theForm.get("payed")); |
participant.setComment((String)theForm.get("comment")); |
participant.setPrivateComment((String)theForm.get("privateComment")); |
ParticipantManager.getInstance().save(participant); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else { |
throw new Exception("unknown mapping parameter"); |
} |
} |
} |
/it-ru/trunk/src/ak/itru/core/action/AdminEventAction.java |
---|
24,13 → 24,28 |
import ak.itru.util.UserException; |
import ak.itru.core.model.Event; |
import ak.itru.core.model.EventManager; |
import ak.itru.core.model.EventAct; |
import ak.itru.core.model.EventApartment; |
import ak.itru.core.model.Act; |
import ak.itru.core.model.ActManager; |
import ak.itru.core.model.Apartment; |
import ak.itru.core.model.ApartmentManager; |
import ak.itru.core.form.EventActBean; |
import ak.itru.core.form.EventApartmentBean; |
public final class AdminEventAction |
extends Action |
implements ErrorHandlerX |
{ |
public void handleErrors(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("submit".equals(mapping.getParameter())) { |
initLists(request); // FIXME: if a list is changed between "edit" and "submit" then indicies are wrong |
} |
} |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
46,6 → 61,7 |
Long eventId = StringConverter.parseLong(theForm.get("id")); |
Event event; |
List acts = new ArrayList(ActManager.getInstance().listActs()); |
List apartments = new ArrayList(ApartmentManager.getInstance().listApartments()); |
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm( |
this, request, "EventEditForm"); |
69,6 → 85,7 |
showForm.set("comment", event.getComment()); |
} |
// acts |
EventActBean[] a = new EventActBean[acts.size()]; |
Collections.sort(acts, ActManager.NAME_COMPARATOR); |
for(int i = 0; i < acts.size(); i++) { |
77,6 → 94,17 |
} |
showForm.set("acts", a); |
// apartments |
EventApartmentBean[] ap = new EventApartmentBean[apartments.size()]; |
Collections.sort(apartments, ApartmentManager.NAME_COMPARATOR); |
for(int i = 0; i < apartments.size(); i++) { |
Apartment apartment = (Apartment)apartments.get(i); |
ap[i] = new EventApartmentBean(apartment, (event == null) |
? null : event.getApartment(apartment.getId())); |
} |
showForm.set("apartments", ap); |
initLists(request); |
return mapping.findForward("default"); |
} |
else if("delete".equals(mapping.getParameter())) { |
100,6 → 128,56 |
event = EventManager.getInstance().get(eventId); |
} |
// acts |
EventActBean[] acts = (EventActBean[])theForm.get("acts"); |
for(int i = 0; i < acts.length; i++) { |
// FIXME: validate act id |
// get bean |
Long actId = StringConverter.parseLong(acts[i].getActId()); |
Act act = ActManager.getInstance().get(actId); |
EventAct eventAct = event.getAct(actId); |
if(acts[i].getSelected() == null || !acts[i].getSelected().booleanValue()) { |
if(eventAct != null) event.removeAct(eventAct); |
} |
else { |
if(eventAct == null) { |
eventAct = EventManager.getInstance().createAct(); |
eventAct.setEvent(event); |
eventAct.setAct(act); |
event.addAct(eventAct); |
} |
eventAct.setComment(acts[i].getComment()); |
} |
} |
// apartments |
EventApartmentBean[] apartments = (EventApartmentBean[])theForm.get("apartments"); |
for(int i = 0; i < apartments.length; i++) { |
// FIXME: validate apartment id, distance |
// get bean |
Long apartmentId = StringConverter.parseLong(apartments[i].getApartmentId()); |
Apartment apartment = ApartmentManager.getInstance().get(apartmentId); |
EventApartment eventApartment = event.getApartment(apartmentId); |
if(apartments[i].getSelected() == null || !apartments[i].getSelected().booleanValue()) { |
if(eventApartment != null) event.removeApartment(eventApartment); |
} |
else { |
if(eventApartment == null) { |
eventApartment = EventManager.getInstance().createApartment(); |
eventApartment.setEvent(event); |
eventApartment.setApartment(apartment); |
event.addApartment(eventApartment); |
} |
eventApartment.setDistance(StringConverter.parseNumber(apartments[i].getDistance())); |
eventApartment.setComment(apartments[i].getComment()); |
} |
} |
// name |
String name = (String)theForm.get("name"); |
if(EventManager.getInstance().nameExists(event, name)) { |
throw new UserException("ak.itru.core.event.name.nonunique"); |
106,6 → 184,7 |
} |
event.setName(name); |
// others |
event.setPlace((String)theForm.get("place")); |
event.setAddress((String)theForm.get("address")); |
event.setTransportDesc((String)theForm.get("transport")); |
118,6 → 197,7 |
event.setEnabled((Boolean)theForm.get("enabled")); |
event.setComment((String)theForm.get("comment")); |
// save |
EventManager.getInstance().save(event); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
126,4 → 206,16 |
throw new Exception("unknown mapping parameter"); |
} |
} |
private void initLists(HttpServletRequest request) |
throws Exception |
{ |
List acts = new ArrayList(ActManager.getInstance().listActs()); |
List apartments = new ArrayList(ApartmentManager.getInstance().listApartments()); |
Collections.sort(acts, ActManager.NAME_COMPARATOR); |
request.setAttribute("actList", new ObjectList(acts)); |
Collections.sort(apartments, ApartmentManager.NAME_COMPARATOR); |
request.setAttribute("apartmentList", new ObjectList(apartments)); |
} |
} |
/it-ru/trunk/src/ak/itru/core/action/ObjectList.java |
---|
0,0 → 1,23 |
package ak.itru.core.action; |
import java.util.List; |
public class ObjectList |
{ |
private List objects; |
public ObjectList(List objects) |
{ |
this.objects = objects; |
} |
public List getObjects() |
{ |
return objects; |
} |
public void setObjects(List objects) |
{ |
this.objects = objects; |
} |
} |
/it-ru/trunk/src/ak/itru/core/model/EventAct.java |
---|
9,10 → 9,10 |
* @hibernate.class table="event_acts" |
*/ |
public class EventAct |
extends GeneralModelObject |
{ |
private Long id; |
private Long eventId; |
private Long actId; |
private Event event; |
private Act act; |
private String comment; |
private Date modStamp; |
22,30 → 22,30 |
/** |
* |
* @hibernate.id generator-class="native" |
* @hibernate.many-to-one |
*/ |
public Long getId() |
public Event getEvent() |
{ |
return id; |
return event; |
} |
protected void setId(Long id) |
public void setEvent(Event event) |
{ |
this.id = id; |
this.event = event; |
} |
/** |
* |
* @hibernate.property |
* @hibernate.many-to-one |
*/ |
public Long getEventId() |
public Act getAct() |
{ |
return eventId; |
return act; |
} |
public void setEventId(Long eventId) |
public void setAct(Act act) |
{ |
this.eventId = eventId; |
this.act = act; |
} |
/** |
52,20 → 52,6 |
* |
* @hibernate.property |
*/ |
public Long getActId() |
{ |
return actId; |
} |
public void setActId(Long actId) |
{ |
this.actId = actId; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getComment() |
{ |
return comment; |
75,18 → 61,4 |
{ |
this.comment = comment; |
} |
/** |
* |
* @hibernate.timestamp column="mod_stamp" |
*/ |
public Date getModStamp() |
{ |
return modStamp; |
} |
public void setModStamp(Date modStamp) |
{ |
this.modStamp = modStamp; |
} |
} |
/it-ru/trunk/src/ak/itru/core/model/ParticipantManager.java |
---|
0,0 → 1,170 |
package ak.itru.core.model; |
import java.util.*; |
import java.io.UnsupportedEncodingException; |
import net.sf.hibernate.*; |
import net.sf.hibernate.type.Type; |
import ak.itru.util.HibernateUtil; |
import ak.itru.util.ModelException; |
import ak.itru.util.ModelSecurityException; |
public class ParticipantManager |
{ |
private static ParticipantManager participantManager = null; |
private static boolean registered = false; |
public static ParticipantManager getInstance() |
{ |
return participantManager; |
} |
protected static void register() |
{ |
synchronized(ParticipantManager.class) { |
if(registered) return; |
registered = true; |
try { |
HibernateUtil.getConfiguration().addResource( |
"ak/itru/core/model/Participant.hbm.xml"); |
participantManager = new ParticipantManager(); |
} |
catch(Exception ex) { |
ex.printStackTrace(); |
throw new RuntimeException(ex.getMessage()); |
} |
} |
} |
static { |
register(); |
} |
private ParticipantManager() |
{ |
} |
public Participant create() |
throws ModelException |
{ |
return new Participant(); |
} |
public Participant get(Long id) |
throws ModelException |
{ |
try { |
return (Participant)HibernateUtil.currentSession().load(Participant.class, id); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public String generateIdent() |
throws ModelException |
{ |
String ident; |
do { |
byte[] buf = new byte[6]; |
for(int i = 0; i < buf.length; i++) { |
buf[i] = (byte)(Math.random() * 10 + 48); |
} |
try { |
ident = new String(buf, "ascii"); |
} |
catch(UnsupportedEncodingException ex) { |
throw new ModelException(ex); |
} |
} while(identExists(ident)); |
return ident; |
} |
public boolean identExists(String ident) |
throws ModelException |
{ |
try { |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from Participant where ident = ?", |
ident, Hibernate.STRING) |
.next()).intValue() > 0; |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void save(Participant participant) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().saveOrUpdate(participant); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void delete(Participant participant) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().delete(participant); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public Collection listParticipants(Event event) |
throws ModelException |
{ |
try { |
return HibernateUtil.currentSession().find( |
"from Participant where event = ?", |
event, Hibernate.entity(Event.class)); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public static final Comparator NICK_COMPARATOR = new NickComparator(); |
private static class NickComparator |
implements Comparator |
{ |
public int compare(Object o1, Object o2) |
{ |
if(!(o1 instanceof Participant) || !(o2 instanceof Participant)) |
throw new ClassCastException("not a Participant"); |
Participant a1 = (Participant)o1; |
Participant a2 = (Participant)o2; |
if(a1 == null && a2 == null) |
return 0; |
else if(a1 == null && a2 != null) |
return -1; |
else if(a1 != null && a2 == null) |
return 1; |
else |
return a1.getNick().compareToIgnoreCase(a2.getNick()); |
} |
public boolean equals(Object obj) |
{ |
return (obj instanceof NickComparator); |
} |
} |
} |
/it-ru/trunk/src/ak/itru/core/model/EventManager.java |
---|
28,6 → 28,8 |
"ak/itru/core/model/Event.hbm.xml"); |
HibernateUtil.getConfiguration().addResource( |
"ak/itru/core/model/EventAct.hbm.xml"); |
HibernateUtil.getConfiguration().addResource( |
"ak/itru/core/model/EventApartment.hbm.xml"); |
eventManager = new EventManager(); |
} |
131,6 → 133,18 |
} |
} |
public EventAct createAct() |
throws ModelException |
{ |
return new EventAct(); |
} |
public EventApartment createApartment() |
throws ModelException |
{ |
return new EventApartment(); |
} |
public static final Comparator NAME_COMPARATOR = new NameComparator(); |
public static final Comparator START_COMPARATOR = new StartComparator(); |
/it-ru/trunk/src/ak/itru/core/model/EventApartment.java |
---|
0,0 → 1,80 |
package ak.itru.core.model; |
import java.math.BigDecimal; |
import java.util.Date; |
import ak.itru.util.ModelException; |
import ak.itru.util.ModelSecurityException; |
/** |
* |
* @hibernate.class table="event_apartments" |
*/ |
public class EventApartment |
extends GeneralModelObject |
{ |
private Event event; |
private Apartment apartment; |
private BigDecimal distance; |
private String comment; |
private Date modStamp; |
protected EventApartment() |
{ |
} |
/** |
* |
* @hibernate.many-to-one |
*/ |
public Event getEvent() |
{ |
return event; |
} |
public void setEvent(Event event) |
{ |
this.event = event; |
} |
/** |
* |
* @hibernate.many-to-one |
*/ |
public Apartment getApartment() |
{ |
return apartment; |
} |
public void setApartment(Apartment apartment) |
{ |
this.apartment = apartment; |
} |
/** |
* |
* @hibernate.property |
*/ |
public BigDecimal getDistance() |
{ |
return distance; |
} |
public void setDistance(BigDecimal distance) |
{ |
this.distance = distance; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
} |
/it-ru/trunk/src/ak/itru/core/model/Participant.java |
---|
1,5 → 1,6 |
package ak.itru.core.model; |
import java.util.Date; |
import ak.itru.util.ModelException; |
import ak.itru.util.ModelSecurityException; |
10,11 → 11,24 |
public class Participant |
extends GeneralModelObject |
{ |
private String ident; |
private String nick; |
private String email; |
private Boolean emailPublic; |
private String name; |
private String phone; |
private Event event; |
private Integer persons; |
private String fromZip; |
private String fromCity; |
private Date departure; |
private Integer freeTransport; |
private String transportComment; |
private Integer freeSleep; |
private String sleepComment; |
private Boolean payed; |
private String comment; |
private String privateComment; |
protected Participant() |
{ |
24,6 → 38,20 |
* |
* @hibernate.property |
*/ |
public String getIdent() |
{ |
return ident; |
} |
public void setIdent(String ident) |
{ |
this.ident = ident; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getNick() |
{ |
return nick; |
50,6 → 78,20 |
/** |
* |
* @hibernate.property column="email_public" |
*/ |
public Boolean getEmailPublic() |
{ |
return emailPublic; |
} |
public void setEmailPublic(Boolean emailPublic) |
{ |
this.emailPublic = emailPublic; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getName() |
78,8 → 120,148 |
/** |
* |
* @hibernate.many-to-one |
*/ |
public Event getEvent() |
{ |
return event; |
} |
public void setEvent(Event event) |
{ |
this.event = event; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Integer getPersons() |
{ |
return persons; |
} |
public void setPersons(Integer persons) |
{ |
this.persons = persons; |
} |
/** |
* |
* @hibernate.property column="from_zip" |
*/ |
public String getFromZip() |
{ |
return fromZip; |
} |
public void setFromZip(String fromZip) |
{ |
this.fromZip = fromZip; |
} |
/** |
* |
* @hibernate.property column="from_city" |
*/ |
public String getFromCity() |
{ |
return fromCity; |
} |
public void setFromCity(String fromCity) |
{ |
this.fromCity = fromCity; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Date getDeparture() |
{ |
return departure; |
} |
public void setDeparture(Date departure) |
{ |
this.departure = departure; |
} |
/** |
* |
* @hibernate.property column="free_transport" |
*/ |
public Integer getFreeTransport() |
{ |
return freeTransport; |
} |
public void setFreeTransport(Integer freeTransport) |
{ |
this.freeTransport = freeTransport; |
} |
/** |
* |
* @hibernate.property column="transport_comment" |
*/ |
public String getTransportComment() |
{ |
return transportComment; |
} |
public void setTransportComment(String transportComment) |
{ |
this.transportComment = transportComment; |
} |
/** |
* |
* @hibernate.property column="free_sleep" |
*/ |
public Integer getFreeSleep() |
{ |
return freeSleep; |
} |
public void setFreeSleep(Integer freeSleep) |
{ |
this.freeSleep = freeSleep; |
} |
/** |
* |
* @hibernate.property column="sleep_comment" |
*/ |
public String getSleepComment() |
{ |
return sleepComment; |
} |
public void setSleepComment(String sleepComment) |
{ |
this.sleepComment = sleepComment; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Boolean getPayed() |
{ |
return payed; |
} |
public void setPayed(Boolean payed) |
{ |
this.payed = payed; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getComment() |
{ |
return comment; |
90,6 → 272,20 |
this.comment = comment; |
} |
/** |
* |
* @hibernate.property column="private_comment" |
*/ |
public String getPrivateComment() |
{ |
return privateComment; |
} |
public void setPrivateComment(String privateComment) |
{ |
this.privateComment = privateComment; |
} |
public boolean equals(Object o) |
{ |
if(o == null || !(o instanceof Participant)) return false; |
/it-ru/trunk/src/ak/itru/core/model/Event.java |
---|
2,6 → 2,7 |
import java.math.BigDecimal; |
import java.util.Collection; |
import java.util.Collections; |
import java.util.ArrayList; |
import java.util.Iterator; |
import java.util.Date; |
30,7 → 31,9 |
private Boolean enabled; |
private String comment; |
private Collection acts; // Collection(EventAct) |
private Map actsMap = new HashMap(); |
private Map actsMap = new HashMap(); // Map(Long id -> EventAct) |
private Collection apartments; // Collection(EventApartment) |
private Map apartmentsMap = new HashMap(); // Map(Long id -> EventApartment) |
protected Event() |
{ |
213,30 → 216,99 |
* @return Collection(EventAct) |
* |
* @hibernate.bag inverse="true" cascade="all-delete-orphan" lazy="true" |
* @hibernate.collection-key column="eventid" |
* @hibernate.collection-key column="event" |
* @hibernate.collection-one-to-many class="ak.itru.core.model.EventAct" |
*/ |
public Collection getActs() |
protected Collection getActs() |
{ |
return acts; |
} |
public Collection getActCollection() |
{ |
return Collections.unmodifiableCollection(acts); |
} |
/** |
* @param destinations Collection(EventAct) |
*/ |
public void setActs(Collection acts) |
protected void setActs(Collection acts) |
{ |
this.acts = acts; |
actsMap.clear(); |
if(acts != null) { |
for(Iterator i = acts.iterator(); i.hasNext(); ) { |
EventAct a = (EventAct)i.next(); |
actsMap.put(a.getActId(), a); |
actsMap.put(a.getAct().getId(), a); |
} |
} |
} |
public EventAct getAct(Long actId) |
{ |
return (EventAct)actsMap.get(actId); |
} |
public void addAct(EventAct act) |
{ |
acts.add(act); |
actsMap.put(act.getAct().getId(), act); |
} |
public void removeAct(EventAct act) |
{ |
acts.remove(act); |
actsMap.remove(act.getAct().getId()); |
} |
/** |
* @return Collection(EventApartment) |
* |
* @hibernate.bag inverse="true" cascade="all-delete-orphan" lazy="true" |
* @hibernate.collection-key column="event" |
* @hibernate.collection-one-to-many class="ak.itru.core.model.EventApartment" |
*/ |
protected Collection getApartments() |
{ |
return apartments; |
} |
public Collection getApartmentCollection() |
{ |
return Collections.unmodifiableCollection(apartments); |
} |
/** |
* @param destinations Collection(EventApartment) |
*/ |
protected void setApartments(Collection apartments) |
{ |
this.apartments = apartments; |
apartmentsMap.clear(); |
if(apartments != null) { |
for(Iterator i = apartments.iterator(); i.hasNext(); ) { |
EventApartment a = (EventApartment)i.next(); |
apartmentsMap.put(a.getApartment().getId(), a); |
} |
} |
} |
public EventApartment getApartment(Long apartmentId) |
{ |
return (EventApartment)apartmentsMap.get(apartmentId); |
} |
public void addApartment(EventApartment apartment) |
{ |
apartments.add(apartment); |
apartmentsMap.put(apartment.getApartment().getId(), apartment); |
} |
public void removeApartment(EventApartment apartment) |
{ |
apartments.remove(apartment); |
apartmentsMap.remove(apartment.getApartment().getId()); |
} |
} |
/it-ru/trunk/src/ak/itru/core/taglib/ExtendedLinkTag.java |
---|
0,0 → 1,230 |
// based on Jakarta Struts |
package ak.itru.core.taglib; |
import java.net.MalformedURLException; |
import java.util.Map; |
import java.util.HashMap; |
import javax.servlet.jsp.JspException; |
import org.apache.struts.util.RequestUtils; |
import org.apache.struts.taglib.logic.IterateTag; |
import ak.backpath.taglib.ForwardLinkTag; |
public class ExtendedLinkTag |
extends ForwardLinkTag |
{ |
protected String paramId2 = null; |
public String getParamId2() |
{ |
return this.paramId2; |
} |
public void setParamId2(String paramId2) |
{ |
this.paramId2 = paramId2; |
} |
protected String paramName2 = null; |
public String getParamName2() |
{ |
return this.paramName2; |
} |
public void setParamName2(String paramName2) |
{ |
this.paramName2 = paramName2; |
} |
protected String paramProperty2 = null; |
public String getParamProperty2() |
{ |
return this.paramProperty2; |
} |
public void setParamProperty2(String paramProperty2) |
{ |
this.paramProperty2 = paramProperty2; |
} |
protected String paramScope2 = null; |
public String getParamScope2() |
{ |
return this.paramScope2; |
} |
public void setParamScope2(String paramScope2) |
{ |
this.paramScope2 = paramScope2; |
} |
protected String paramId3 = null; |
public String getParamId3() |
{ |
return this.paramId3; |
} |
public void setParamId3(String paramId3) |
{ |
this.paramId3 = paramId3; |
} |
protected String paramName3 = null; |
public String getParamName3() |
{ |
return this.paramName3; |
} |
public void setParamName3(String paramName3) |
{ |
this.paramName3 = paramName3; |
} |
protected String paramProperty3 = null; |
public String getParamProperty3() |
{ |
return this.paramProperty3; |
} |
public void setParamProperty3(String paramProperty3) |
{ |
this.paramProperty3 = paramProperty3; |
} |
protected String paramScope3 = null; |
public String getParamScope3() |
{ |
return this.paramScope3; |
} |
public void setParamScope3(String paramScope3) |
{ |
this.paramScope3 = paramScope3; |
} |
protected String paramId4 = null; |
public String getParamId4() |
{ |
return this.paramId4; |
} |
public void setParamId4(String paramId4) |
{ |
this.paramId4 = paramId4; |
} |
protected String paramName4 = null; |
public String getParamName4() |
{ |
return this.paramName4; |
} |
public void setParamName4(String paramName4) |
{ |
this.paramName4 = paramName4; |
} |
protected String paramProperty4 = null; |
public String getParamProperty4() |
{ |
return this.paramProperty4; |
} |
public void setParamProperty4(String paramProperty4) |
{ |
this.paramProperty4 = paramProperty4; |
} |
protected String paramScope4 = null; |
public String getParamScope4() |
{ |
return this.paramScope4; |
} |
public void setParamScope4(String paramScope4) |
{ |
this.paramScope4 = paramScope4; |
} |
public void release() |
{ |
super.release(); |
paramId2 = null; |
paramName2 = null; |
paramProperty2 = null; |
paramScope2 = null; |
paramId3 = null; |
paramName3 = null; |
paramProperty3 = null; |
paramScope3 = null; |
paramId4 = null; |
paramName4 = null; |
paramProperty4 = null; |
paramScope4 = null; |
} |
protected String calculateURL() |
throws JspException |
{ |
Map params = RequestUtils.computeParameters(pageContext, paramId, paramName, paramProperty, paramScope, |
name, property, scope, transaction); |
Map params2 = RequestUtils.computeParameters(pageContext, paramId2, paramName2, paramProperty2, paramScope2, |
null, null, null, false); |
if(params2 != null) params.putAll(params2); |
Map params3 = RequestUtils.computeParameters(pageContext, paramId3, paramName3, paramProperty3, paramScope3, |
null, null, null, false); |
if(params3 != null) params.putAll(params3); |
Map params4 = RequestUtils.computeParameters(pageContext, paramId4, paramName4, paramProperty4, paramScope4, |
null, null, null, false); |
if(params4 != null) params.putAll(params4); |
if(indexed) { |
IterateTag iterateTag = (IterateTag) findAncestorWithClass(this, IterateTag.class); |
if(iterateTag == null) { |
JspException e = new JspException(messages.getMessage("indexed.noEnclosingIterate")); |
RequestUtils.saveException(pageContext, e); |
throw e; |
} |
if(params == null) params = new HashMap(); |
if(indexId != null) |
params.put(indexId, Integer.toString(iterateTag.getIndex())); |
else |
params.put("index", Integer.toString(iterateTag.getIndex())); |
} |
String url = null; |
try { |
url = RequestUtils.computeURL(pageContext, forward, href, page, action, params, anchor, false); |
} |
catch(MalformedURLException ex) { |
RequestUtils.saveException(pageContext, ex); |
throw new JspException(messages.getMessage("rewrite.url", ex.toString())); |
} |
if(url == null) return null; |
// add backpath |
String forwardParams = findBackPath().getForwardParams(); |
if(forwardParams == null) return url; |
if(url.indexOf("?") > 0) |
return url + "&" + backPathParam + "=" + forwardParams; |
else |
return url + "?" + backPathParam + "=" + forwardParams; |
} |
} |
/it-ru/trunk/src/ak/itru/core/form/EventApartmentBean.java |
---|
0,0 → 1,65 |
package ak.itru.core.form; |
import ak.itru.util.StringConverter; |
import ak.itru.core.model.EventApartment; |
import ak.itru.core.model.Apartment; |
public final class EventApartmentBean |
{ |
private String apartmentId; |
private String distance; |
private String comment; |
private Boolean selected; |
public EventApartmentBean() |
{ |
} |
public EventApartmentBean(Apartment apartment, EventApartment info) |
{ |
this.apartmentId = StringConverter.toString(apartment.getId()); |
this.distance = (info == null) ? null : StringConverter.toNumber(info.getDistance()); |
this.comment = (info == null) ? null : info.getComment(); |
this.selected = Boolean.valueOf(info != null); |
} |
public String getApartmentId() |
{ |
return apartmentId; |
} |
public void setApartmentId(String apartmentId) |
{ |
this.apartmentId = apartmentId; |
} |
public String getDistance() |
{ |
return distance; |
} |
public void setDistance(String distance) |
{ |
this.distance = distance; |
} |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
public Boolean getSelected() |
{ |
return selected; |
} |
public void setSelected(Boolean selected) |
{ |
this.selected = selected; |
} |
} |
/it-ru/trunk/src/ak/itru/util/Validator.java |
---|
16,6 → 16,26 |
public class Validator |
{ |
public static BigDecimal validateNumber(Object bean, ValidatorAction va, Field field, |
ActionErrors errors, HttpServletRequest request) |
{ |
String value = null; |
if((bean == null) || (bean instanceof String)) |
value = (String)bean; |
else |
value = ValidatorUtil.getValueAsString(bean, field.getProperty()); |
if(value == null || "".equals(value)) return null; |
try { |
return new BigDecimal(NumberFormat.getInstance().parse(value).doubleValue()); |
} |
catch(ParseException ex) { |
errors.add(field.getKey(), Resources.getActionError(request, va, field)); |
return null; |
} |
} |
public static BigDecimal validateCurrency(Object bean, ValidatorAction va, Field field, |
ActionErrors errors, HttpServletRequest request) |
{ |
/it-ru/trunk/src/ak/itru/util/StringConverter.java |
---|
47,6 → 47,22 |
return (s == null) ? null : new Integer(s); |
} |
public static BigDecimal parseNumber(Object o) |
throws NumberFormatException, ParseException |
{ |
String s = preparse(o); |
return (s == null) |
? null : new BigDecimal(NumberFormat.getInstance().parse(s).doubleValue()); |
} |
public static String toNumber(Number n) |
{ |
if(n == null) |
return null; |
else |
return (new DecimalFormat("0")).format(n); |
} |
public static BigDecimal parseCurrency(Object o) |
throws NumberFormatException, ParseException |
{ |
78,6 → 94,21 |
return DateFormat.getDateInstance().format(d); |
} |
public static Date parseDateTime(Object o) |
throws NumberFormatException, ParseException |
{ |
String s = preparse(o); |
return (s == null) ? null : DateFormat.getDateTimeInstance().parse(s); |
} |
public static String toDateTime(Date d) |
{ |
if(d == null) |
return null; |
else |
return DateFormat.getDateTimeInstance().format(d); |
} |
public static String toString(Object o) |
{ |
if(o == null) |