Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 18 → Rev 19

/kickup/trunk/webapp/participant/unregistered.jsp
0,0 → 1,36
<%@ 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>Пьянка XP - <bean:write name="event" property="name" /> - Отказ</title>
<link rel="stylesheet" type="text/css" href="<strutsx:root />/style/general.css">
</head>
 
<body>
 
<h1>Пьянка XP - <bean:write name="event" property="name" /> - Отказ</h1>
 
<strutsx:errorsIterator id="errors" />
<strutsx:notEmpty name="errors">
<div class="error">Ошибки:
<ul>
<logic:iterate name="errors" id="error">
<li><strutsx:message name="error" property="key" valuesProperty="values" /></li>
</logic:iterate>
</ul>
</div>
</strutsx:notEmpty>
 
<p>Ваши данные удалены.</p>
 
<backpath:notEmpty><backpath:backlink>Назад</backpath:backlink></backpath:notEmpty>
 
</body>
 
</html>
/kickup/trunk/webapp/participant/ident.jsp
0,0 → 1,66
<%@ 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>Пьянка XP - <bean:write name="event" property="name" /> - Идентификация</title>
<link rel="stylesheet" type="text/css" href="<strutsx:root />/style/general.css">
</head>
 
<body>
 
<h1>Пьянка XP - <bean:write name="event" property="name" /> - Идентификация</h1>
 
<strutsx:errorsIterator id="errors" />
<strutsx:notEmpty name="errors">
<div class="error">Ошибки:
<ul>
<logic:iterate name="errors" id="error">
<li><strutsx:message name="error" property="key" valuesProperty="values" /></li>
</logic:iterate>
</ul>
</div>
</strutsx:notEmpty>
 
<h2>Изменение данных регистрации</h2>
 
<html:form action="/participant/login" method="GET">
<backpath:current />
<input type=hidden name="event" value="<bean:write name="event" property="id" />">
<table border=1>
<tr>
<th>Ваш номер</th>
<td><html:text property="ident" /></td>
</tr>
<tr>
<td colspan=2><html:submit>Перейти к изменению</html:submit></td>
</tr>
</table>
</html:form>
 
<h2>Отказ от регистрации</h2>
 
<html:form action="/participant/unregister">
<backpath:current />
<input type=hidden name="event" value="<bean:write name="event" property="id" />">
<table border=1>
<tr>
<th>Ваш номер</th>
<td><html:text property="ident" /></td>
</tr>
<tr>
<td colspan=2><html:submit>Я не еду</html:submit></td>
</tr>
</table>
</html:form>
 
<backpath:notEmpty><backpath:backlink>Назад</backpath:backlink></backpath:notEmpty>
 
</body>
 
</html>
/kickup/trunk/webapp/participant/register.jsp
0,0 → 1,107
<%@ 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>Пьянка XP - <bean:write name="event" property="name" /> - Регистрация</title>
<link rel="stylesheet" type="text/css" href="<strutsx:root />/style/general.css">
</head>
 
<body>
 
<h1>Пьянка XP - <bean:write name="event" property="name" /> - Регистрация</h1>
 
<strutsx:errorsIterator id="errors" />
<strutsx:notEmpty name="errors">
<div class="error">Ошибки:
<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="/participant/submit">
<backpath:current />
<html:hidden property="event" />
 
<table border=1>
<tr>
<th>Ник на форуме</th>
<td><html:text property="nick" /></td>
</tr>
<tr>
<th>Ваш e-mail</th>
<td><html:text property="email" /></td>
</tr>
<tr>
<th>Разрешить показ e-mail'а</th>
<td colspan=3><html:checkbox property="emailPublic" /></td>
</tr>
<tr>
<th>Сколько вас</th>
<td><html:text property="persons" /></td>
</tr>
 
<tr>
<th>Выезд из PLZ</th>
<td><html:text property="fromZip" /></td>
</tr>
<tr>
<th>Выезд из города</th>
<td><html:text property="fromCity" /></td>
</tr>
<tr>
<th>Время отправления</th>
<td><html:text property="departure" /></td>
</tr>
<tr>
<th>Свободных мест в машине</th>
<td><html:text property="freeTransport" /></td>
</tr>
<tr>
<th>Условия транспортировки</th>
<td><html:textarea property="transportComment" /></td>
</tr>
 
<tr>
<th>Свободных спальных мест</th>
<td><html:text property="freeSleep" /></td>
</tr>
<tr>
<th>Условия ночевки</th>
<td><html:textarea property="sleepComment" /></td>
</tr>
 
<tr>
<th>Ваше имя</th>
<td><html:text property="name" /></td>
</tr>
<tr>
<th>Телефон</th>
<td><html:text property="phone" /></td>
</tr>
<tr>
<th>Дополнительная информация</th>
<td><html:textarea property="comment" /></td>
</tr>
 
<tr>
<td colspan=2>
<html:submit>Зарегистрироваться</html:submit>
<backpath:notEmpty><backpath:backlink>Отменить</backpath:backlink></backpath:notEmpty>
</td>
</tr>
</table>
 
</html:form>
 
</body>
 
</html>
/kickup/trunk/webapp/participant/edit.jsp
0,0 → 1,112
<%@ 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>Пьянка XP - <bean:write name="event" property="name" /> - Редактирование</title>
<link rel="stylesheet" type="text/css" href="<strutsx:root />/style/general.css">
</head>
 
<body>
 
<h1>Пьянка XP - <bean:write name="event" property="name" /> - Редактирование</h1>
 
<strutsx:errorsIterator id="errors" />
<strutsx:notEmpty name="errors">
<div class="error">Ошибки:
<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="/participant/update">
<backpath:current />
<html:hidden property="event" />
<html:hidden property="ident" />
 
<table border=1>
<tr>
<th>Ваш номер</th>
<td><bean:write name="participant" property="ident" /></td>
</tr>
<tr>
<th>Ник на форуме</th>
<td><bean:write name="participant" property="nick" /></td>
</tr>
<tr>
<th>Ваш e-mail</th>
<td><bean:write name="participant" property="email" /></td>
</tr>
<tr>
<th>Разрешить показ e-mail'а</th>
<td colspan=3><html:checkbox property="emailPublic" /></td>
</tr>
<tr>
<th>Сколько вас</th>
<td><html:text property="persons" /></td>
</tr>
 
<tr>
<th>Выезд из PLZ</th>
<td><html:text property="fromZip" /></td>
</tr>
<tr>
<th>Выезд из города</th>
<td><html:text property="fromCity" /></td>
</tr>
<tr>
<th>Время отправления</th>
<td><html:text property="departure" /></td>
</tr>
<tr>
<th>Свободных мест в машине</th>
<td><html:text property="freeTransport" /></td>
</tr>
<tr>
<th>Условия транспортировки</th>
<td><html:textarea property="transportComment" /></td>
</tr>
 
<tr>
<th>Свободных спальных мест</th>
<td><html:text property="freeSleep" /></td>
</tr>
<tr>
<th>Условия ночевки</th>
<td><html:textarea property="sleepComment" /></td>
</tr>
 
<tr>
<th>Ваше имя</th>
<td><html:text property="name" /></td>
</tr>
<tr>
<th>Телефон</th>
<td><html:text property="phone" /></td>
</tr>
<tr>
<th>Дополнительная информация</th>
<td><html:textarea property="comment" /></td>
</tr>
 
<tr>
<td colspan=2>
<html:submit>Сохранить</html:submit>
<backpath:notEmpty><backpath:backlink>Отменить</backpath:backlink></backpath:notEmpty>
</td>
</tr>
</table>
 
</html:form>
 
</body>
 
</html>
/kickup/trunk/webapp/event/show.jsp
37,6 → 37,10
<logic:notEmpty name="event" property="stop">- <bean:write name="event" property="stop" format="d MMM yyyy" /></logic:notEmpty>
</logic:notEmpty>
 
<p>Организаторы: <bean:write name="event" property="admins" /></p>
 
<p>Контактный e-mail: <a href="mailto:<bean:write name="event" property="email" />"><bean:write name="event" property="email" /></a></p>
 
<h2>Место проведения</h2>
 
<p><bean:write name="event" property="place" /></p>
59,10 → 63,17
</logic:notEmpty>
</p>
 
<p>
<backpath:link action="/participant/list" paramId="event" paramName="event" paramProperty="id">Участники</backpath:link>
<backpath:link action="/apartment/list" paramId="event" paramName="event" paramProperty="id">Где разместиться</backpath:link>
<backpath:link action="/transport/list" paramId="event" paramName="event" paramProperty="id">Как добраться</backpath:link>
</p>
 
<p>
<backpath:link action="/participant/register" paramId="event" paramName="event" paramProperty="id">Зарегистрироваться</backpath:link>
<backpath:link action="/participant/ident" paramId="event" paramName="event" paramProperty="id">Изменить свои данные</backpath:link>
</p>
 
<p><backpath:notEmpty><backpath:backlink>Назад</backpath:backlink></backpath:notEmpty></p>
 
<p><html:link page="/admin">Администрирование</html:link></<>
/kickup/trunk/webapp/WEB-INF/struts-config.xml
18,6 → 18,8
<form-property name="id" type="java.lang.String" />
<form-property name="name" type="java.lang.String" />
<form-property name="place" type="java.lang.String" />
<form-property name="email" type="java.lang.String" />
<form-property name="admins" type="java.lang.String" />
<form-property name="address" type="java.lang.String" />
<form-property name="transport" type="java.lang.String" />
<form-property name="start" type="java.lang.String" />
77,6 → 79,13
</form-bean>
 
<form-bean
name="ParticipantLoginForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="event" type="java.lang.String" />
<form-property name="ident" type="java.lang.String" />
</form-bean>
 
<form-bean
name="ParticipantEditForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="id" type="java.lang.String" />
98,6 → 107,45
<form-property name="comment" type="java.lang.String" />
<form-property name="privateComment" type="java.lang.String" />
</form-bean>
 
<form-bean
name="ParticipantRegisterForm"
type="org.apache.struts.validator.DynaValidatorForm">
<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="comment" type="java.lang.String" />
</form-bean>
 
<form-bean
name="ParticipantRegisterEditForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="ident" type="java.lang.String" />
<form-property name="event" 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="comment" type="java.lang.String" />
</form-bean>
</form-beans>
 
<global-exceptions>
153,6 → 201,74
<forward name="default" path="/participant/list.jsp" />
</action>
 
<action
path="/participant/register"
type="ak.kickup.core.action.ParticipantAction"
parameter="register"
name="ParticipantListForm"
validate="true"
scope="request"
>
<forward name="default" path="/participant/register.jsp" />
</action>
 
<action
path="/participant/submit"
type="ak.kickup.core.action.ParticipantAction"
parameter="submit"
name="ParticipantRegisterForm"
validate="true"
scope="request"
input="/participant/register.jsp"
>
</action>
 
<action
path="/participant/ident"
type="ak.kickup.core.action.ParticipantAction"
parameter="ident"
name="ParticipantListForm"
validate="true"
scope="request"
>
<forward name="default" path="/participant/ident.jsp" />
</action>
 
<action
path="/participant/login"
type="ak.kickup.core.action.ParticipantAction"
parameter="login"
name="ParticipantLoginForm"
validate="true"
scope="request"
input="/participant/ident.jsp"
>
<forward name="default" path="/participant/edit.jsp" />
</action>
 
<action
path="/participant/update"
type="ak.kickup.core.action.ParticipantAction"
parameter="update"
name="ParticipantRegisterEditForm"
validate="true"
scope="request"
input="/participant/edit.jsp"
>
</action>
 
<action
path="/participant/unregister"
type="ak.kickup.core.action.ParticipantAction"
parameter="unregister"
name="ParticipantLoginForm"
validate="true"
scope="request"
input="/participant/login.jsp"
>
<forward name="default" path="/participant/unregistered.jsp" />
</action>
 
<!-- == transport =========================================================================== -->
 
<action
/kickup/trunk/webapp/WEB-INF/validation.xml
22,6 → 22,13
<field property="name" depends="required">
<msg name="required" key="ak.kickup.core.event.edit.name.required" />
</field>
<field property="admins" depends="required">
<msg name="required" key="ak.kickup.core.event.edit.admins.required" />
</field>
<field property="email" depends="required,email">
<msg name="required" key="ak.kickup.core.event.edit.email.required" />
<msg name="email" key="ak.kickup.core.event.edit.email.wrong" />
</field>
<field property="start" depends="date">
<msg name="date" key="ak.kickup.core.event.edit.start.wrong" />
</field>
87,6 → 94,15
</field>
</form>
 
<form name="ParticipantLoginForm">
<field property="event" depends="long">
<msg name="long" key="ak.kickup.core.participant.edit.event.wrong" />
</field>
<field property="ident" depends="required">
<msg name="required" key="ak.kickup.core.participant.edit.ident.required" />
</field>
</form>
 
<form name="ParticipantEditForm">
<field property="event" depends="long">
<msg name="long" key="ak.kickup.core.participant.edit.event.wrong" />
107,9 → 123,58
<field property="freeTransport" depends="integer">
<msg name="integer" key="ak.kickup.core.participant.edit.freetransport.wrong" />
</field>
<field property="departure" depends="datetime">
<msg name="datetime" key="ak.kickup.core.participant.edit.departure.wrong" />
</field>
<field property="freeSleep" depends="integer">
<msg name="integer" key="ak.kickup.core.participant.edit.freesleep.wrong" />
</field>
</form>
 
<form name="ParticipantRegisterForm">
<field property="event" depends="long">
<msg name="long" key="ak.kickup.core.participant.edit.event.wrong" />
</field>
<field property="nick" depends="required">
<msg name="required" key="ak.kickup.core.participant.edit.nick.required" />
</field>
<field property="email" depends="required,email">
<msg name="required" key="ak.kickup.core.participant.edit.email.required" />
<msg name="email" key="ak.kickup.core.participant.edit.email.wrong" />
</field>
<field property="persons" depends="integer">
<msg name="integer" key="ak.kickup.core.participant.edit.persons.wrong" />
</field>
<field property="freeTransport" depends="integer">
<msg name="integer" key="ak.kickup.core.participant.edit.freetransport.wrong" />
</field>
<field property="departure" depends="datetime">
<msg name="datetime" key="ak.kickup.core.participant.edit.departure.wrong" />
</field>
<field property="freeSleep" depends="integer">
<msg name="integer" key="ak.kickup.core.participant.edit.freesleep.wrong" />
</field>
</form>
 
<form name="ParticipantRegisterEditForm">
<field property="ident" depends="required">
<msg name="required" key="ak.kickup.core.participant.edit.ident.required" />
</field>
<field property="event" depends="long">
<msg name="long" key="ak.kickup.core.participant.edit.event.wrong" />
</field>
<field property="persons" depends="integer">
<msg name="integer" key="ak.kickup.core.participant.edit.persons.wrong" />
</field>
<field property="freeTransport" depends="integer">
<msg name="integer" key="ak.kickup.core.participant.edit.freetransport.wrong" />
</field>
<field property="departure" depends="datetime">
<msg name="datetime" key="ak.kickup.core.participant.edit.departure.wrong" />
</field>
<field property="freeSleep" depends="integer">
<msg name="integer" key="ak.kickup.core.participant.edit.freesleep.wrong" />
</field>
</form>
</formset>
</form-validation>
/kickup/trunk/webapp/WEB-INF/validator-rules.xml
1007,6 → 1007,18
msg="errors.currency"
/>
 
<validator name="datetime"
classname="ak.kickup.util.Validator"
method="validateDateTime"
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.datetime"
/>
 
</global>
 
</form-validation>
/kickup/trunk/webapp/admin/event/list.jsp
33,7 → 33,9
<th>Место/город</th>
<th>Начало</th>
<th>Окончание</th>
<th>Регистрация разрешена</th>
<th>В открытом доступе</th>
<th>Заявок</th>
<th>Участников</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
49,6 → 51,8
<logic:equal name="e" property="enabled" value="true">да</logic:equal>
<logic:notEqual name="e" property="enabled" value="true">нет</logic:notEqual>
</td>
<td><bean:write name="e" property="participantCount" /></td>
<td><bean:write name="e" property="personCount" /></td>
<td>
<backpath:link action="/admin/event/edit" paramId="id" paramName="e" paramProperty="id">редактировать</backpath:link>
</td>
/kickup/trunk/webapp/admin/event/edit.jsp
37,6 → 37,14
<td colspan=3><html:text property="name" /></td>
</tr>
<tr>
<th>Контактный e-mail</th>
<td colspan=3><html:text property="email" /></td>
</tr>
<tr>
<th>Организаторы</th>
<td colspan=3><html:text property="admins" /></td>
</tr>
<tr>
<th>Место/город</th>
<td colspan=3><html:text property="place" /></td>
</tr>
73,7 → 81,7
<td colspan=3><html:textarea property="account" /></td>
</tr>
<tr>
<th>Разрешить регистрацию</th>
<th>Открыть доступ</th>
<td colspan=3><html:checkbox property="enabled" /></td>
</tr>
<tr>
109,7 → 117,7
<td>Название</td>
<td>Включить</td>
<td>Описание</td>
<td>Расстояние до место (км)</td>
<td>Расстояние до местa (км)</td>
</tr>
<logic:iterate name="EventEditForm" property="apartments" id="apartments" indexId="iid2">
<tr>
/kickup/trunk/webapp/admin/participant/list.jsp
44,7 → 44,7
<tr>
<td><bean:write name="p" property="ident" /></td>
<td><bean:write name="p" property="nick" />&nbsp;</td>
<td><bean:write name="p" property="email" />&nbsp;</td>
<td><a href="mailto:<bean:write name="p" property="email" />"><bean:write name="p" property="email" /></a></td>
<td><bean:write name="p" property="name" />&nbsp;</td>
<td><bean:write name="p" property="persons" />&nbsp;</td>
<td>
61,6 → 61,9
</logic:iterate>
</table>
 
<p>Всего заявок: <bean:write name="event" property="participantCount" /></p>
<p>Всего участников: <bean:write name="event" property="personCount" /></p>
 
<backpath:link action="/admin/participant/edit" paramId="event" paramName="event" paramProperty="id">Добавить участника</backpath:link>
<br>
<backpath:notEmpty><backpath:backlink>Назад</backpath:backlink></backpath:notEmpty>
/kickup/trunk/sql/00.tables.sql
48,6 → 48,8
(
id integer not null,
name varchar(255) not null,
email varchar(255) not null,
admins varchar(255) not null,
place varchar(255),
address text,
transport_desc text,
/kickup/trunk/src/ak/kickup/core/model/ParticipantManager.java
63,6 → 63,25
}
}
 
public Participant findForIdent(String ident)
throws ModelException
{
try {
List list = HibernateUtil.currentSession().find(
"from Participant where ident = ?",
ident, Hibernate.STRING );
 
if(list.size() == 0)
return null;
else
return (Participant)list.get(0);
}
catch(HibernateException ex)
{
throw new ModelException(ex);
}
}
 
public String generateIdent()
throws ModelException
{
/kickup/trunk/src/ak/kickup/core/model/Event.java
20,6 → 20,8
extends GeneralModelObject
{
private String name;
private String email;
private String admins;
private String place;
private String address;
private String transportDesc;
64,6 → 66,34
*
* @hibernate.property
*/
public String getEmail()
{
return email;
}
 
public void setEmail(String email)
{
this.email = email;
}
 
/**
*
* @hibernate.property
*/
public String getAdmins()
{
return admins;
}
 
public void setAdmins(String admins)
{
this.admins = admins;
}
 
/**
*
* @hibernate.property
*/
public String getPlace()
{
return place;
/kickup/trunk/src/ak/kickup/core/action/AdminEventAction.java
72,6 → 72,8
else {
event = EventManager.getInstance().get(eventId, false);
showForm.set("name", event.getName());
showForm.set("email", event.getEmail());
showForm.set("admins", event.getAdmins());
showForm.set("place", event.getPlace());
showForm.set("address", event.getAddress());
showForm.set("transport", event.getTransportDesc());
190,6 → 192,8
event.setName(name);
 
// others
event.setEmail((String)theForm.get("email"));
event.setAdmins((String)theForm.get("admins"));
event.setPlace((String)theForm.get("place"));
event.setAddress((String)theForm.get("address"));
event.setTransportDesc((String)theForm.get("transport"));
/kickup/trunk/src/ak/kickup/core/action/ParticipantAction.java
22,6 → 22,7
 
import ak.kickup.util.StringConverter;
import ak.kickup.util.UserException;
import ak.kickup.util.ModelSecurityException;
import ak.kickup.core.model.Participant;
import ak.kickup.core.model.ParticipantManager;
import ak.kickup.core.model.Event;
35,23 → 36,22
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, true);
Long participantId = StringConverter.parseLong(theForm.get("id"));
Participant participant;
if(participantId == null) {
participant = ParticipantManager.getInstance().create();
}
else {
participant = ParticipantManager.getInstance().get(participantId);
}
if("submit".equals(mapping.getParameter()) || "update".equals(mapping.getParameter())
|| "unregister".equals(mapping.getParameter()))
{
DynaActionForm theForm = (DynaActionForm)form;
Long eventId = StringConverter.parseLong(theForm.get("event"));
Event event = (eventId == null)
? null : EventManager.getInstance().get(eventId, true);
request.setAttribute("event", event);
request.setAttribute("participant", participant);
*/
}
 
if("update".equals(mapping.getParameter())) {
DynaActionForm theForm = (DynaActionForm)form;
String ident = (String)theForm.get("ident");
request.setAttribute("participant",
(ident == null) ? null : ParticipantManager.getInstance().findForIdent(ident));
}
}
 
public ActionForward execute(ActionMapping mapping, ActionForm form,
68,69 → 68,82
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, true);
Long participantId = StringConverter.parseLong(theForm.get("id"));
Participant participant;
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm(
this, request, "ParticipantEditForm");
else if("ident".equals(mapping.getParameter())) {
DynaActionForm theForm = (DynaActionForm)form;
Long eventId = StringConverter.parseLong(theForm.get("event"));
Event event = EventManager.getInstance().get(eventId, true);
request.setAttribute("event", event);
return mapping.findForward("default");
}
else if("register".equals(mapping.getParameter())) {
DynaActionForm theForm = (DynaActionForm)form;
Long eventId = StringConverter.parseLong(theForm.get("event"));
Event event = EventManager.getInstance().get(eventId, true);
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm(
this, request, "ParticipantRegisterForm");
 
if(participantId == null) {
participant = ParticipantManager.getInstance().create();
showForm.set("emailPublic", Boolean.TRUE);
 
request.setAttribute("event", event);
return mapping.findForward("default");
}
else if("login".equals(mapping.getParameter())) {
DynaActionForm theForm = (DynaActionForm)form;
Long eventId = StringConverter.parseLong(theForm.get("event"));
Event event = EventManager.getInstance().get(eventId, true);
String ident = (String)theForm.get("ident");
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm(
this, request, "ParticipantRegisterEditForm");
 
Participant participant = ParticipantManager.getInstance().findForIdent(ident);
if(participant == null) {
Thread.sleep(1000);
request.setAttribute("event", event);
throw new UserException("ak.kickup.core.participant.edit.ident.wrong");
}
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);
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("comment", participant.getComment());
 
request.setAttribute("participant", participant);
request.setAttribute("event", event);
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);
else if("unregister".equals(mapping.getParameter())) {
DynaActionForm theForm = (DynaActionForm)form;
Long eventId = StringConverter.parseLong(theForm.get("event"));
Event event = EventManager.getInstance().get(eventId, true);
String ident = (String)theForm.get("ident");
Participant participant = ParticipantManager.getInstance().findForIdent(ident);
 
if(participant == null) {
Thread.sleep(1000);
throw new UserException("ak.kickup.core.participant.edit.ident.wrong");
}
 
ParticipantManager.getInstance().delete(participant);
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl());
return null;
request.setAttribute("event", event);
return mapping.findForward("default");
}
else if("submit".equals(mapping.getParameter())) {
DynaActionForm theForm = (DynaActionForm)form;
Long participantId = StringConverter.parseLong(theForm.get("id"));
Participant participant;
DynaActionForm theForm = (DynaActionForm)form;
Long eventId = StringConverter.parseLong(theForm.get("event"));
Event event = EventManager.getInstance().get(eventId, true);
Participant participant = ParticipantManager.getInstance().create();
 
if(participantId == null) {
Long eventId = StringConverter.parseLong(theForm.get("event"));
Event event = EventManager.getInstance().get(eventId, true);
participant.setIdent(ParticipantManager.getInstance().generateIdent());
participant.setEvent(event);
 
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"));
144,15 → 157,45
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);
 
// FIXME: send email here
 
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl());
return null;
}
*/
else if("update".equals(mapping.getParameter())) {
DynaActionForm theForm = (DynaActionForm)form;
Long eventId = StringConverter.parseLong(theForm.get("event"));
Event event = EventManager.getInstance().get(eventId, true);
String ident = (String)theForm.get("ident");
Participant participant = ParticipantManager.getInstance().findForIdent(ident);
 
if(participant == null) {
Thread.sleep(1000);
throw new ModelSecurityException();
}
 
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.setComment((String)theForm.get("comment"));
 
ParticipantManager.getInstance().save(participant);
 
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl());
return null;
}
else {
throw new Exception("unknown mapping parameter");
}
/kickup/trunk/src/ak/kickup/core/CoreResources.properties
5,6 → 5,9
ak.kickup.core.access.denied=Сюда нельзя!
ak.kickup.core.event.edit.id.wrong=Неизвестная пьянка, выбирайти из списка
ak.kickup.core.event.edit.name.required=Название обязательно
ak.kickup.core.event.edit.admins.required=Имена организаторов обязательны
ak.kickup.core.event.edit.email.required=e-mail обязателен
ak.kickup.core.event.edit.email.wrong=Некорректный e-mail
ak.kickup.core.event.edit.start.wrong=Дата начала должна быть в виде ДД.ММ.ГГГГ
ak.kickup.core.event.edit.stop.wrong=Дата окончания должна быть в виде ДД.ММ.ГГГГ
ak.kickup.core.event.edit.lastreg.wrong=Дата окончания регистрации должна быть в виде ДД.ММ.ГГГГ
23,6 → 26,8
ak.kickup.core.participant.edit.email.wrong=Некорректный e-mail
ak.kickup.core.participant.edit.persons.wrong=Количество должно быть целым числом
ak.kickup.core.participant.edit.freetransport.wrong=Количество мест в машине должно быть целым числом
ak.kickup.core.participant.edit.departure.wrong=Время отправления дожно быть, например, 20.10.2004 13:55
ak.kickup.core.participant.edit.freesleep.wrong=Количество спальных мест должно быть целым числом
ak.kickup.core.participant.edit.ident.wrong=Неизвестный номер
 
org.apache.struts.taglib.bean.format.sql.timestamp=dd.MM.yyyy HH:mm:ss.SSS
/kickup/trunk/src/ak/kickup/util/Validator.java
1,6 → 1,7
package ak.kickup.util;
 
import java.math.BigDecimal;
import java.util.Date;
import java.text.NumberFormat;
import java.text.ParseException;
 
54,5 → 55,25
errors.add(field.getKey(), Resources.getActionError(request, va, field));
return null;
}
}
 
public static Date validateDateTime(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 StringConverter.DATE_TIME_FORMAT.parse(value);
}
catch(ParseException ex) {
errors.add(field.getKey(), Resources.getActionError(request, va, field));
return null;
}
}
}
/kickup/trunk/src/ak/kickup/util/StringConverter.java
3,6 → 3,7
import java.math.BigDecimal;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.text.NumberFormat;
import java.text.DecimalFormat;
import java.text.ParseException;
9,6 → 10,8
 
public abstract class StringConverter
{
public static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm");
 
public static boolean isEmpty(Object o)
{
if(o == null)
98,7 → 101,7
throws NumberFormatException, ParseException
{
String s = preparse(o);
return (s == null) ? null : DateFormat.getDateTimeInstance().parse(s);
return (s == null) ? null : DATE_TIME_FORMAT.parse(s);
}
 
public static String toDateTime(Date d)
106,7 → 109,7
if(d == null)
return null;
else
return DateFormat.getDateTimeInstance().format(d);
return DATE_TIME_FORMAT.format(d);
}
 
public static String toString(Object o)