//kickup/trunk/webapp/WEB-INF/struts-config.xml |
---|
154,6 → 154,13 |
<form-property name="acts" type="ak.kickup.core.form.ParticipantActBean[]" |
size="1" /> |
</form-bean> |
<form-bean |
name="ParticipantActListForm" |
type="org.apache.struts.validator.DynaValidatorForm"> |
<form-property name="act" type="java.lang.String" /> |
<form-property name="event" type="java.lang.String" /> |
</form-bean> |
</form-beans> |
<global-exceptions> |
277,6 → 284,19 |
<forward name="default" path="/participant/unregistered.jsp" /> |
</action> |
<!-- == act ================================================================================= --> |
<action |
path="/act/list" |
type="ak.kickup.core.action.ActAction" |
parameter="list" |
name="ParticipantActListForm" |
validate="true" |
scope="request" |
> |
<forward name="default" path="/act/list.jsp" /> |
</action> |
<!-- == transport =========================================================================== --> |
<action |
//kickup/trunk/webapp/WEB-INF/validation.xml |
---|
117,9 → 117,13 |
<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="persons" depends="required,integer,intRange"> |
<msg name="required" key="ak.kickup.core.participant.edit.persons.required" /> |
<msg name="integer" key="ak.kickup.core.participant.edit.persons.wrong" /> |
<msg name="intRange" key="ak.kickup.core.participant.edit.persons.wrong" /> |
<var><var-name>min</var-name><var-value>1</var-value></var> |
<var><var-name>max</var-name><var-value>1000</var-value></var> |
</field> |
<field property="freeTransport" depends="integer"> |
<msg name="integer" key="ak.kickup.core.participant.edit.freetransport.wrong" /> |
</field> |
142,8 → 146,12 |
<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 property="persons" depends="required,integer,intRange"> |
<msg name="required" key="ak.kickup.core.participant.edit.persons.required" /> |
<msg name="integer" key="ak.kickup.core.participant.edit.persons.wrong" /> |
<msg name="intRange" key="ak.kickup.core.participant.edit.persons.wrong" /> |
<var><var-name>min</var-name><var-value>1</var-value></var> |
<var><var-name>max</var-name><var-value>1000</var-value></var> |
</field> |
<field property="freeTransport" depends="integer"> |
<msg name="integer" key="ak.kickup.core.participant.edit.freetransport.wrong" /> |
163,8 → 171,12 |
<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 property="persons" depends="required,integer,intRange"> |
<msg name="required" key="ak.kickup.core.participant.edit.persons.required" /> |
<msg name="integer" key="ak.kickup.core.participant.edit.persons.wrong" /> |
<msg name="intRange" key="ak.kickup.core.participant.edit.persons.wrong" /> |
<var><var-name>min</var-name><var-value>1</var-value></var> |
<var><var-name>max</var-name><var-value>1000</var-value></var> |
</field> |
<field property="freeTransport" depends="integer"> |
<msg name="integer" key="ak.kickup.core.participant.edit.freetransport.wrong" /> |
176,5 → 188,16 |
<msg name="integer" key="ak.kickup.core.participant.edit.freesleep.wrong" /> |
</field> |
</form> |
<form name="ParticipantActListForm"> |
<field property="event" depends="long,required"> |
<msg name="long" key="ak.kickup.core.participant.edit.event.wrong" /> |
<msg name="required" key="ak.kickup.core.participant.edit.event.wrong" /> |
</field> |
<field property="act" depends="long,required"> |
<msg name="long" key="ak.kickup.core.act.edit.id.wrong" /> |
<msg name="required" key="ak.kickup.core.act.edit.id.wrong" /> |
</field> |
</form> |
</formset> |
</form-validation> |
//kickup/trunk/webapp/act/list.jsp |
---|
0,0 → 1,61 |
<%@ 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-kickup.tld" prefix="kickup" %> |
<html> |
<head> |
<meta http-equiv="expires" content="0"> |
<title>Пьянка XP - Участники "<bean:write name="act" property="act.name" />" на пьянке "<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="act" property="act.name" />" на пьянке "<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> |
<table border=1> |
<tr> |
<th>Ник</th> |
<th>Имя</th> |
<th>e-mail</th> |
<th>Телефон</th> |
<th>Дополнительно</th> |
</tr> |
<logic:iterate name="list" id="p"> |
<tr> |
<td><bean:write name="p" property="participant.nick" /> </td> |
<td><bean:write name="p" property="participant.name" /> </td> |
<td> |
<logic:equal name="p" property="participant.emailPublic" value="true"> |
<bean:write name="p" property="participant.email" /> |
</logic:equal> |
|
</td> |
<td><bean:write name="p" property="participant.phone" /> </td> |
<td><bean:write name="p" property="comment" /> </td> |
</tr> |
</logic:iterate> |
</table> |
<br> |
<backpath:notEmpty><backpath:backlink>Назад</backpath:backlink></backpath:notEmpty> |
</body> |
</html> |
//kickup/trunk/webapp/admin/participant/list.jsp |
---|
41,7 → 41,7 |
</tr> |
<logic:iterate name="participants" id="p"> |
<tr> |
<tr class="<logic:equal name="p" property="payed" value="true">payed</logic:equal><logic:notEqual name="p" property="payed" value="true">notpayed</logic:notEqual>"> |
<td><bean:write name="p" property="ident" /></td> |
<td><bean:write name="p" property="nick" /> </td> |
<td><a href="mailto:<bean:write name="p" property="email" />"><bean:write name="p" property="email" /></a></td> |
//kickup/trunk/webapp/participant/register.jsp |
---|
31,7 → 31,7 |
<backpath:current /> |
<html:hidden property="event" /> |
<table border=1> |
<table border=1 width=600> |
<tr> |
<th>Ник на форуме</th> |
<td colspan=2><html:text property="nick" /></td> |
38,7 → 38,11 |
</tr> |
<tr> |
<th>Ваш e-mail</th> |
<td colspan=2><html:text property="email" /></td> |
<td colspan=2> |
<html:text property="email" /><br> |
После регистрации на этот адрес будет выслан ваш регистрационный номер и счет для перевода денег. |
Поэтому указывайте, пожалуйста, ваш реальный e-mail. |
</td> |
</tr> |
<tr> |
<th>Разрешить показ e-mail'а</th> |
//kickup/trunk/webapp/participant/edit.jsp |
---|
93,6 → 93,13 |
<td colspan=2><html:text property="phone" /></td> |
</tr> |
<tr> |
<th>Деньги переведены и получены</th> |
<td colspan=2> |
<logic:equal name="participant" property="payed" value="true">да</logic:equal> |
<logic:notEqual name="participant" property="payed" value="true">нет</logic:notEqual> |
</td> |
</tr> |
<tr> |
<th>Дополнительная информация</th> |
<td colspan=2><html:textarea property="comment" /></td> |
</tr> |
//kickup/trunk/webapp/style/general.css |
---|
0,0 → 1,3 |
.error { color:red; } |
.payed { background-color:white; } |
.notpayed { background-color:#FFC0C0; } |
//kickup/trunk/webapp/event/show.jsp |
---|
50,7 → 50,8 |
<ul> |
<logic:iterate name="acts" id="a"> |
<li><bean:write name="a" property="act.name" /></li> |
<li><bean:write name="a" property="act.name" /> |
<kickup:link action="/act/list" paramId="event" paramName="event" paramProperty="id" paramId2="act" paramName2="a" paramProperty2="act.id">(участники)</kickup:link></li> |
</logic:iterate> |
</ul> |
//kickup/trunk/sql/00.tables.sql |
---|
141,7 → 141,7 |
name varchar(255), |
phone varchar(255), |
event integer not null, |
persons integer, |
persons integer not null, |
from_zip varchar(10), |
from_city varchar(10), |
departure timestamp, |
//kickup/trunk/src/ak/kickup/core/action/AdminParticipantAction.java |
---|
205,8 → 205,16 |
participant.setPrivateComment((String)theForm.get("privateComment")); |
ParticipantManager.getInstance().save(participant); |
if(newParticipant) |
Messages.sendRegistrationMessage(participant, null); |
if(newParticipant) { |
try { |
Messages.sendRegistrationMessage(participant, null); |
} |
catch(Exception ex) { |
request.setAttribute("event", event); |
initLists(request, event); |
throw ex; |
} |
} |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
//kickup/trunk/src/ak/kickup/core/action/ActAction.java |
---|
0,0 → 1,63 |
package ak.kickup.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.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; |
import ak.kickup.core.model.EventManager; |
import ak.kickup.core.model.ParticipantAct; |
import ak.kickup.core.model.EventAct; |
import ak.kickup.core.mail.Messages; |
public final class ActAction |
extends Action |
{ |
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, true); |
Long actId = StringConverter.parseLong(theForm.get("act")); |
EventAct act = event.getAct(actId); |
List list; |
if(act == null) throw new UserException("ak.kickup.core.act.edit.id.wrong"); |
list = new ArrayList(ParticipantManager.getInstance().listForAct(act)); |
Collections.sort(list, ParticipantManager.ACT_NICK_COMPARATOR); |
request.setAttribute("list", list); |
request.setAttribute("event", event); |
request.setAttribute("act", act); |
return mapping.findForward("default"); |
} |
else { |
throw new Exception("unknown mapping parameter"); |
} |
} |
} |
//kickup/trunk/src/ak/kickup/core/action/TransportAction.java |
---|
33,7 → 33,7 |
Long eventId = StringConverter.parseLong(theForm.get("event")); |
Event event = EventManager.getInstance().get(eventId, true); |
List list = new ArrayList(ParticipantManager.getInstance().listFreeTransport(event)); |
Collections.sort(list, ParticipantManager.NICK_COMPARATOR); |
Collections.sort(list, ParticipantManager.FROM_ZIP_COMPARATOR); |
request.setAttribute("participants", list); |
request.setAttribute("event", event); |
return mapping.findForward("default"); |
//kickup/trunk/src/ak/kickup/core/action/ParticipantAction.java |
---|
236,7 → 236,14 |
ParticipantManager.getInstance().save(participant); |
Messages.sendRegistrationMessage(participant, request.getRemoteAddr()); |
try { |
Messages.sendRegistrationMessage(participant, request.getRemoteAddr()); |
} |
catch(Exception ex) { |
request.setAttribute("event", event); |
initLists(request, event); |
throw ex; |
} |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
//kickup/trunk/src/ak/kickup/core/CoreResources.properties |
---|
29,7 → 29,8 |
ak.kickup.core.participant.edit.nick.required=Ник обязателен |
ak.kickup.core.participant.edit.email.required=e-mail обязателен |
ak.kickup.core.participant.edit.email.wrong=Некорректный e-mail |
ak.kickup.core.participant.edit.persons.wrong=Количество должно быть целым числом |
ak.kickup.core.participant.edit.persons.required=Количество не указано |
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=Количество спальных мест должно быть целым числом |
//kickup/trunk/src/ak/kickup/core/model/ParticipantManager.java |
---|
200,6 → 200,22 |
} |
} |
public Collection listForAct(EventAct act) |
throws ModelException |
{ |
try { |
return HibernateUtil.currentSession().find( |
"select pa from Participant as p, ParticipantAct as pa" |
+ " where p.event = ? and pa.participant = p and pa.act = ?", |
new Object[] { act.getEvent(), act.getAct() }, |
new Type[] { Hibernate.entity(Event.class), Hibernate.entity(Act.class) } ); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public ParticipantAct createAct() |
throws ModelException |
{ |
222,6 → 238,8 |
} |
public static final Comparator NICK_COMPARATOR = new NickComparator(); |
public static final Comparator ACT_NICK_COMPARATOR = new ActNickComparator(); |
public static final Comparator FROM_ZIP_COMPARATOR = new FromZipComparator(); |
private static class NickComparator |
implements Comparator |
249,4 → 267,58 |
return (obj instanceof NickComparator); |
} |
} |
private static class ActNickComparator |
implements Comparator |
{ |
public int compare(Object o1, Object o2) |
{ |
if(!(o1 instanceof ParticipantAct) || !(o2 instanceof ParticipantAct)) |
throw new ClassCastException("not a ParticipantAct"); |
ParticipantAct a1 = (ParticipantAct)o1; |
ParticipantAct a2 = (ParticipantAct)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.getParticipant().getNick().compareToIgnoreCase(a2.getParticipant().getNick()); |
} |
public boolean equals(Object obj) |
{ |
return (obj instanceof ActNickComparator); |
} |
} |
private static class FromZipComparator |
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 || a1.getFromZip() == null) && (a2 == null || a2.getFromZip() == null)) |
return 0; |
else if((a1 == null || a1.getFromZip() == null) && (a2 != null && a2.getFromZip() != null)) |
return -1; |
else if((a1 != null && a1.getFromZip() == null) && (a2 == null || a2.getFromZip() == null)) |
return 1; |
else |
return a1.getFromZip().compareToIgnoreCase(a2.getFromZip()); |
} |
public boolean equals(Object obj) |
{ |
return (obj instanceof FromZipComparator); |
} |
} |
} |