Choose conference BLINDE

bug choose conf regle
This commit is contained in:
Nicolas Michard
2008-02-06 17:01:57 +00:00
parent 85876487e7
commit e97ec906e8
6 changed files with 80 additions and 11 deletions

View File

@@ -79,6 +79,13 @@ form.register.error.passwordEmpty=The password can't be empty
form.register.error.alreadyExists=A user with this login already exists. Please check you haven't already registered or change your login.
###################
# MESSAGE ERROR
message.error.noconferenceforthisid=This conference doesn't exist. Pease try again
message.error.noconferenceid=No conference selectionned
message.error.conferenceerror=Error. Try again.
submission.title=Article's submission
form.submission.article.title=Article's title

View File

@@ -13,7 +13,7 @@
<div id="bar">
<div id="rightchoice">
<c:choose>
<c:choose>
<c:when test="${currentConferenceId != null}">
La conf<6E>rence courante est :<br />
<span class="currentConferenceTitle">${currentConference.title}</span>

View File

@@ -6,12 +6,23 @@
<h2 align="center">Choose a conference</h2>
<c:if test="${errorMessage != null}">
<span class="formError">
<c:choose>
<c:when test="${errorMessage == 1}"><fmt:message key="message.error.noconferenceforthisid" /></c:when>
<c:when test="${errorMessage == 2}"><fmt:message key="message.error.noconferenceid" /></c:when>
<c:otherwise><fmt:message key="message.error.conferenceerror" /></c:otherwise>
</c:choose>
</span><br />
</c:if>
Choix de la conference <br /><br />
<c:if test="${idCurrentConference!=null}">
La conf<6E>rence courante est : ${idCurrentConference}.<br /><br />
<c:if test="${currentConferenceId!=null}">
La conf<6E>rence courante est : ${currentConference.title}.<br /><br />
</c:if>
<c:if test="${idCurrentConference==null}">
<c:if test="${currentConferenceId==null}">
Il n'y a pas de conf<6E>rence s<>lectionn<6E>.<br /><br />
</c:if>

View File

@@ -209,7 +209,8 @@
<!-- Get chosen conference in session context -->
<bean id="ChooseConferenceController"
class="org.yacos.web.system.controller.ChooseConferenceController">
class="org.yacos.web.system.controller.ChooseConferenceController">
<property name="conferenceManager" ref="conferenceManager" />
</bean>

View File

@@ -1,22 +1,64 @@
package org.yacos.web.system.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.view.RedirectView;
import org.yacos.core.conferences.IConferenceManager;
import org.yacos.web.system.session.SessionService;
public class ChooseConferenceController implements Controller {
private IConferenceManager conferenceManager;
public IConferenceManager getConferenceManager() {
return conferenceManager;
}
public void setConferenceManager(IConferenceManager conferenceManager) {
this.conferenceManager = conferenceManager;
}
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
// get IDConf
int idConf = Integer.parseInt(request.getParameter("idConf"));
Map<String, Object> model = new HashMap<String, Object>();
// Set idConf in session context
SessionService.getInstance().setCurrentConferenceId(idConf);
// get IDConf if exist
if (request.getParameter("idConf") != null)
{
try
{
int idConf = Integer.parseInt(request.getParameter("idConf"));
if(conferenceManager.exists(idConf))
{
// Set idConf in session context
SessionService.getInstance().setCurrentConferenceId(idConf);
return new ModelAndView("main");
}
else
{
model.put("error", "1");
return new ModelAndView(new RedirectView("listConference.htm"), model);
}
}
catch(NumberFormatException e)
{
model.put("error", "3");
return new ModelAndView(new RedirectView("listConference.htm"), model);
}
}
else
{
model.put("error", "2");
return new ModelAndView(new RedirectView("listConference.htm"), model);
}
return new ModelAndView("main");
}
}

View File

@@ -39,7 +39,15 @@ public class ListConferenceController implements Controller{
// List all conference
Map<String, Object> model = new HashMap<String, Object>();
model.put("listConference", conferenceManager.getConferences());
// Error choose conference
String msgCode = request.getParameter("error");
if (msgCode != null)
{
model.put("errorMessage", msgCode);
}
return new ModelAndView("listConference", model);
}