diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/addConference4.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/addConference4.jsp index 314852f..95b501c 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/addConference4.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/addConference4.jsp @@ -108,14 +108,16 @@ function writePerson() { if (person.max <= person.min) { dwr.util.setValues({id:person.id, label:person.label, min:null, max:null }); - dwr.util.setValues({errorMax:"The max value should'nt be superior to the min value"}); + dwr.util.setValues({errorMax:"The max value should'nt be superior to the min value"}); + $('errorMax').style.display = ""; } else { dwr.engine.beginBatch(); AddCriteriaJS.setCriterionClick(person); fillTable(); dwr.engine.endBatch(); - dwr.util.setValues({ id:-1, label:null, min:1, max:5 }); + dwr.util.setValues({ id:-1, label:null, min:1, max:5 }); + $('errorMax').style.display = "none"; } } diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp index 4e663cd..d1f4f12 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp @@ -6,11 +6,13 @@ -

- +

- - +

+ Choose the preference you have for each article. +

+ + @@ -30,8 +32,16 @@
"/>
-
- +
+ + +

+ You have successfully updated the preference.
+ You can modify your choices immediately or later.
+

+
+ +
">Home diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/choosePreferenceOK.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/choosePreferenceOK.jsp deleted file mode 100644 index 79c17b4..0000000 --- a/YACOSWeb/WebContent/WEB-INF/jsp/choosePreferenceOK.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ include file="/WEB-INF/decorators/include.jsp"%> - - - - - -

- - - - - - - - \ No newline at end of file diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp index 9efb1a0..bf61f9f 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp @@ -7,18 +7,11 @@ -

- - -
@@ -41,9 +34,9 @@
  • Topic: ${article.topic}
  • - Download the article - Modify the article - Suppress the article + ">Download + Modify + Delete diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticleOK.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticleOK.jsp deleted file mode 100644 index 36c002a..0000000 --- a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticleOK.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ include file="/WEB-INF/decorators/include.jsp"%> - - - - -

    NO NAME

    -Soumission OK -
    - -">Home - - - - \ No newline at end of file diff --git a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml index fb21436..eccc078 100644 --- a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml +++ b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml @@ -22,63 +22,25 @@ MainController - - SArticleControllerOK - - - ListArticleController - - - ManageArticleController - - - SUserRegistrationController - - - SArticleController - - - ChoosePreferenceController - - - DispatchArticleListController - - - DispatchArticleController - - - AddConferenceController - + ListArticleController + ManageArticleController + SUserRegistrationController + SArticleController + ChoosePreferenceController + DispatchArticleListController + DispatchArticleController + AddConferenceController EvaluationController - - CreateReportController - - - ListConferenceController - - - ChooseConferenceController - - - ValidateArticleController - - - ValideOrRejectController - + CreateReportController + ListConferenceController + ChooseConferenceController + ValidateArticleController + ValideOrRejectController LogonController - - - ListEvaluationController - - - ArticleDownloadController - - - ListReportController - - - ForgotPasswordController - + ListEvaluationController + ArticleDownloadController + ListReportController + ForgotPasswordController DetailArticleController @@ -89,9 +51,6 @@ - - @@ -99,7 +58,6 @@ - @@ -276,10 +234,6 @@ - - - articleList=articleManager.getArticles(currentConferenceId); - getServletContext().setAttribute("articleList", articleList); + request.getSession().setAttribute("articleList", articleList); User currentUser = SessionService.getInstance().getCurrentUser(); - // TODO : mock object, replace with real user management + ArrayList preferencesList = new ArrayList(); Preference pref; for(Article article : articleList){ @@ -86,8 +84,9 @@ public class ChoosePreferenceController extends SimpleFormController { } Map model = new HashMap(); - model.put("message", "preference.ok"); - return new ModelAndView(new RedirectView(getSuccessView()), "model", model); + model.put("message", "done"); + + return new ModelAndView(new RedirectView(getSuccessView()), model); } diff --git a/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceControllerOK.java b/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceControllerOK.java deleted file mode 100644 index a45b4a6..0000000 --- a/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceControllerOK.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.yacos.web.PCmember.controller; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.SimpleFormController; - -public class ChoosePreferenceControllerOK extends SimpleFormController { - - protected final Log logger = LogFactory.getLog(getClass()); - - public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - logger.info("Returning choosePreference OK view"); - - return new ModelAndView("choosePreferenceOK"); - } - -} \ No newline at end of file diff --git a/YACOSWeb/src/org/yacos/web/PCmember/form/FormPreference.java b/YACOSWeb/src/org/yacos/web/PCmember/form/FormPreference.java index c81b5d6..a0863fe 100644 --- a/YACOSWeb/src/org/yacos/web/PCmember/form/FormPreference.java +++ b/YACOSWeb/src/org/yacos/web/PCmember/form/FormPreference.java @@ -2,7 +2,6 @@ package org.yacos.web.PCmember.form; import java.util.ArrayList; import java.util.List; - import org.yacos.core.article.Preference; diff --git a/YACOSWeb/src/org/yacos/web/author/controller/ManageArticleController.java b/YACOSWeb/src/org/yacos/web/author/controller/ManageArticleController.java index 37acef6..420700c 100644 --- a/YACOSWeb/src/org/yacos/web/author/controller/ManageArticleController.java +++ b/YACOSWeb/src/org/yacos/web/author/controller/ManageArticleController.java @@ -1,7 +1,6 @@ package org.yacos.web.author.controller; import java.io.IOException; -import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; @@ -14,7 +13,6 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.SimpleFormController; import org.yacos.core.article.Article; import org.yacos.core.article.IArticleManager; -import org.yacos.web.author.form.ArticleBean; import org.yacos.web.system.controller.NoConferenceSelectedException; import org.yacos.web.system.session.SessionService; @@ -23,40 +21,14 @@ public class ManageArticleController extends SimpleFormController { protected final Log logger = LogFactory.getLog(getClass()); private IArticleManager articleManager; - - /*private List listArticleBean; - - public List getListArticle() { - return listArticleBean; - } - - public void setListArticle(List listArticleBean) { - this.listArticleBean = listArticleBean; - }*/ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, NoConferenceSelectedException { logger.info("Returning manageArticle view"); - - //listArticleBean = new ArrayList(); List
    listArticle; listArticle = articleManager.getArticleOfAuthor(SessionService.getInstance().getCurrentConferenceId(), SessionService.getInstance().getCurrentUserLogin()); - - /*for (Article a : listArticle) { - ArticleBean ab = new ArticleBean(); - ab.setId(a.getId()); - ab.setMainAuthor(a.getMainAuthor().getFirstName() + " " + a.getMainAuthor().getLastName()); - ab.setSecondaryAuthors(a.getSecondaryAuthors()); - ab.setTitle(a.getTitle()); - ab.setTopic(a.getTopic()); - String fullUrl = request.getContextPath()+"/download.htm?articleId="+a.getId(); - ab.setURL_article(fullUrl); - ab.setState(a.getState().toString()); - - listArticleBean.add(ab); - }*/ return new ModelAndView("manageArticle", "listArticle", listArticle); } diff --git a/YACOSWeb/src/org/yacos/web/author/controller/SArticleControllerOK.java b/YACOSWeb/src/org/yacos/web/author/controller/SArticleControllerOK.java deleted file mode 100644 index 4e06376..0000000 --- a/YACOSWeb/src/org/yacos/web/author/controller/SArticleControllerOK.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.yacos.web.author.controller; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.SimpleFormController; - -public class SArticleControllerOK extends SimpleFormController { - - protected final Log logger = LogFactory.getLog(getClass()); - - public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - logger.info("Returning submission OK view"); - - return new ModelAndView("submissionArticleOK"); - } - -} \ No newline at end of file diff --git a/YACOSWeb/src/org/yacos/web/author/form/ArticleBean.java b/YACOSWeb/src/org/yacos/web/author/form/ArticleBean.java deleted file mode 100644 index b97bf8c..0000000 --- a/YACOSWeb/src/org/yacos/web/author/form/ArticleBean.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.yacos.web.author.form; - -import java.util.ArrayList; - -public class ArticleBean { - - private int id; - private String title; - private String topic; - private String URL_article; - private String mainAuthor; - private ArrayList secondaryAuthors; - private String state; - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public ArticleBean() {} - - public int getId() { - return id; - } - public void setId(int id) { - this.id = id; - } - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - public String getTopic() { - return topic; - } - public void setTopic(String topic) { - this.topic = topic; - } - public String getURL_article() { - return URL_article; - } - public void setURL_article(String url_article) { - URL_article = url_article; - } - public String getMainAuthor() { - return mainAuthor; - } - public void setMainAuthor(String mainAuthor) { - this.mainAuthor = mainAuthor; - } - public ArrayList getSecondaryAuthors() { - return secondaryAuthors; - } - public void setSecondaryAuthors(ArrayList secondaryAuthors) { - this.secondaryAuthors = secondaryAuthors; - } - -} diff --git a/YACOSWeb/src/org/yacos/web/system/session/SessionService.java b/YACOSWeb/src/org/yacos/web/system/session/SessionService.java index 2554917..f20b474 100644 --- a/YACOSWeb/src/org/yacos/web/system/session/SessionService.java +++ b/YACOSWeb/src/org/yacos/web/system/session/SessionService.java @@ -25,27 +25,27 @@ import org.yacos.core.users.User; */ public class SessionService { private static SessionService instance = new SessionService(); - + protected static ServletContext servletContext = null; protected static HttpServletRequest request = null; - + private IConferenceManager conferenceManager; private IUserManager userManager; - + private User currentUser; private Conference currentConference; private int nbUserConferences; - + private SessionService(){ } - + public static SessionService getInstance(){ if(instance == null){ instance = new SessionService(); } return instance; } - + /** * Init method to be called at filter time * Makes the sessionAttributes available in the request context @@ -66,33 +66,34 @@ public class SessionService { request.setAttribute("currentUser", getCurrentUser()); // Put the current roles for this user //request.setAttribute("nbUserConferences",getNbUserConferences()); - + } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } - + public int getNbUserConferences() { if(nbUserConferences == -1) { setNbUserConferences(); } - + return nbUserConferences; } public void setNbUserConferences() { int nb = conferenceManager.getConferences(getCurrentUser()).size(); this.nbUserConferences = nb; - request.setAttribute("nbUserConferences", getNbUserConferences()); + //request.setAttribute("nbUserConferences", getNbUserConferences()); + request.setAttribute("nbUserConferences", this.nbUserConferences); } public void setConferenceManager(IConferenceManager conferenceManager) { this.conferenceManager = conferenceManager; } - + public IConferenceManager getConferenceManager() { if(conferenceManager == null){ Context context; @@ -105,11 +106,11 @@ public class SessionService { } return conferenceManager; } - + public void setUserManager(IUserManager userManager) { this.userManager = userManager; } - + public IUserManager getUserManager() { if(userManager == null){ Context context; @@ -122,7 +123,7 @@ public class SessionService { } return userManager; } - + /** * Gets the current conference Id * Additionally, put the current conference object in the request context @@ -135,7 +136,7 @@ public class SessionService { Integer confId = (Integer) WebUtils.getSessionAttribute(request, "currentConferenceId"); return confId; } - + /** * Sets the current conference id * @param request The current HTTP request object, necessary for session operations @@ -148,7 +149,7 @@ public class SessionService { // Refreshing user credentials refreshAuthentication(); } - + /** * Sets the current conference using a conference object * @param request The current HTTP request object, necessary for session operations @@ -158,7 +159,7 @@ public class SessionService { setCurrentConferenceId( c.getId() ); currentConference = c; } - + /** * Gets (if necessary) and returns the current conference of the session * @param request The current HTTP request object, necessary for session operations @@ -166,21 +167,23 @@ public class SessionService { */ public Conference getCurrentConference(){ Integer id = getCurrentConferenceId(); - + // The currentConference can be out to date : force the update if(currentConference != null && id != currentConference.getId()){ currentConference = null; } - + if( currentConference == null && id != null ){ currentConference = conferenceManager.getConference(id); } - - if (isUserLogged()){setNbUserConferences();}; - + + if (isUserLogged()) { + setNbUserConferences(); + } + return currentConference; } - + /** * Gets the current user login from the session * Additionally, puts the current User object in the request context @@ -192,7 +195,7 @@ public class SessionService { // Retrieve the login from the acegi security session return SecurityContextHolder.getContext().getAuthentication().getName(); } - + /** * Get (if necessary) and returns the current user object * @return The current User @@ -200,12 +203,12 @@ public class SessionService { public User getCurrentUser() { // Retrieve the login from the session String login = this.getCurrentUserLogin(); - + // The user can be out to date : force the update if(currentUser != null && (! currentUser.getLogin().equals(login)) ){ currentUser = null; } - + // Check if the user object is already in cache if(currentUser == null || (currentUser.getLogin().equals(login)) ){ // Checks login for validity @@ -218,7 +221,7 @@ public class SessionService { } return currentUser; } - + /** * Returns whether the user is logged (is there a current User for this session) * @return true if there's a current user in the session, false otherwise @@ -226,7 +229,7 @@ public class SessionService { public boolean isUserLogged(){ return getCurrentUser() != null; } - + /** * Puts an object in the session * @param name The name of the attribute in the session @@ -235,7 +238,7 @@ public class SessionService { public void setSessionAttribute(String name, Object attribute){ WebUtils.setSessionAttribute(request, name, attribute); } - + /** * Retrieves an object from the Session * @param name The name of the attribute to retrieve @@ -248,27 +251,27 @@ public class SessionService { public void refreshAuthentication(){ refreshAuthentication(null); } - + public void refreshAuthentication(String newPassword) { // First step : remove user from the cache DaoAuthenticationProvider authProvider = (DaoAuthenticationProvider) RequestContextUtils.getWebApplicationContext(request).getBean("daoAuthenticationProvider"); UserCache userCache = authProvider.getUserCache(); - + if(userCache != null){ userCache.removeUserFromCache(getCurrentUserLogin()); } - + // Second step : Refreshing user credentials Authentication currentAuthentication = SecurityContextHolder.getContext().getAuthentication(); if(currentAuthentication instanceof UsernamePasswordAuthenticationToken){ - + if(newPassword != null){ // Setting the new password in the authentication token currentAuthentication = new UsernamePasswordAuthenticationToken(currentAuthentication.getPrincipal(),newPassword); } - + SecurityContextHolder.getContext().setAuthentication(authProvider.authenticate(currentAuthentication)); } - + } }