Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 18 → Rev 19

/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");
}