Divers changement:
Ajout d'image pour le download (à changer) Changement de choose preference
This commit is contained in:
@@ -108,14 +108,16 @@ function writePerson() {
|
|||||||
|
|
||||||
if (person.max <= person.min) {
|
if (person.max <= person.min) {
|
||||||
dwr.util.setValues({id:person.id, label:person.label, min:null, max:null });
|
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 {
|
else {
|
||||||
dwr.engine.beginBatch();
|
dwr.engine.beginBatch();
|
||||||
AddCriteriaJS.setCriterionClick(person);
|
AddCriteriaJS.setCriterionClick(person);
|
||||||
fillTable();
|
fillTable();
|
||||||
dwr.engine.endBatch();
|
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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h4 class="title"><fmt:message key="preference.title" /></h4>
|
<h4 class="title"><fmt:message key="preference.title" /></h4>
|
||||||
|
|
||||||
|
|
||||||
<form:form method="post" commandName="choosePreference">
|
<p class="formHelp">
|
||||||
<spring:message var="message"/>
|
Choose the preference you have for each article.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<form:form method="post" commandName="choosePreference">
|
||||||
<c:if test="${not empty articleList}">
|
<c:if test="${not empty articleList}">
|
||||||
<table>
|
<table>
|
||||||
<c:forEach items="${articleList}" var="article" varStatus="i">
|
<c:forEach items="${articleList}" var="article" varStatus="i">
|
||||||
@@ -30,8 +32,16 @@
|
|||||||
</table>
|
</table>
|
||||||
<input type="submit" name="submit" value="<fmt:message key="button.OK"/>"/>
|
<input type="submit" name="submit" value="<fmt:message key="button.OK"/>"/>
|
||||||
</c:if>
|
</c:if>
|
||||||
</form:form>
|
</form:form>
|
||||||
|
|
||||||
|
<c:if test="${param['message'] eq 'done'}">
|
||||||
|
<p class="formOk">
|
||||||
|
You have successfully updated the preference.<br/>
|
||||||
|
You can modify your choices immediately or later.<br/>
|
||||||
|
</p>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<br />
|
||||||
<a href="<c:url value="main.htm"/>">Home</a>
|
<a href="<c:url value="main.htm"/>">Home</a>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<%@ include file="/WEB-INF/decorators/include.jsp"%>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head></head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h4 class="title"><fmt:message key="preference.title" /></h4>
|
|
||||||
|
|
||||||
|
|
||||||
<fmt:message key="preference.ok"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -7,18 +7,11 @@
|
|||||||
<script type='text/javascript' src='./javascripts/effects.js'></script>
|
<script type='text/javascript' src='./javascripts/effects.js'></script>
|
||||||
<script type='text/javascript' src='./dwr/engine.js'></script>
|
<script type='text/javascript' src='./dwr/engine.js'></script>
|
||||||
<script type='text/javascript' src='./dwr/util.js'></script>
|
<script type='text/javascript' src='./dwr/util.js'></script>
|
||||||
<script type='text/javascript' src='./dwr/interface/ManagerArticleJS.js'></script>
|
|
||||||
<script type='text/javascript' src='./javascripts/yacos/manageArticle.js'></script>
|
<script type='text/javascript' src='./javascripts/yacos/manageArticle.js'></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h4 class="title"><fmt:message key="manageArticle.title" /></h4>
|
<h4 class="title"><fmt:message key="manageArticle.title" /></h4>
|
||||||
|
|
||||||
<!-- <div id="authorList" class="dynamicFredList">
|
|
||||||
<div class="dynamicListHeader" align="center"><fmt:message
|
|
||||||
key="listarticle.title" /></div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div id="articleList" class="dynamicFredList">
|
<div id="articleList" class="dynamicFredList">
|
||||||
@@ -41,9 +34,9 @@
|
|||||||
<li>Topic: <b>${article.topic}</b></li>
|
<li>Topic: <b>${article.topic}</b></li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td><a id="articleURL${i.index}" href="${article.URL_article}" />Download the article</a></td>
|
<td><a id="articleURL${i.index}" title="Download" href="<c:url value="/download.htm"><c:param name="articleId" value="${article.id}"/></c:url>"><img src="./images/cc-download_manager-128x128.png" alt="Download" /></a></td>
|
||||||
<td><a id="modifyArticle${i.index}" href="" />Modify the article</a></td>
|
<td><a id="modifyArticle${i.index}" title="Modify" href=""/><img src="./images/cc-button_ok-128x128.png" alt="Modify" /></a></td>
|
||||||
<td><a id="suppressArticle${i.index}" href="" />Suppress the article</a></td>
|
<td><a id="suppressArticle${i.index}" title="Delete" href="" /><img src="./images/cc-button_cancel-128x128.png" alt="Delete" /></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
<%@ include file="/WEB-INF/decorators/include.jsp"%>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head></head>
|
|
||||||
<body>
|
|
||||||
<h4 class="title">NO NAME</h4>
|
|
||||||
Soumission OK
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<a href="<c:url value="main.htm"/>">Home</a>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -22,63 +22,25 @@
|
|||||||
<property name="mappings">
|
<property name="mappings">
|
||||||
<props>
|
<props>
|
||||||
<prop key="/main.htm">MainController</prop>
|
<prop key="/main.htm">MainController</prop>
|
||||||
<prop key="/submissionArticleOK.htm">
|
<prop key="/listArticle.htm">ListArticleController</prop>
|
||||||
SArticleControllerOK
|
<prop key="/manageArticle.htm">ManageArticleController</prop>
|
||||||
</prop>
|
<prop key="/registerUser.htm">SUserRegistrationController</prop>
|
||||||
<prop key="/listArticle.htm">
|
<prop key="/submissionArticle.htm">SArticleController</prop>
|
||||||
ListArticleController
|
<prop key="/choosePreference.htm">ChoosePreferenceController</prop>
|
||||||
</prop>
|
<prop key="/dispatchArticleList.htm">DispatchArticleListController</prop>
|
||||||
<prop key="/manageArticle.htm">
|
<prop key="/dispatchArticle.htm">DispatchArticleController</prop>
|
||||||
ManageArticleController
|
<prop key="/addConference.htm">AddConferenceController</prop>
|
||||||
</prop>
|
|
||||||
<prop key="/registerUser.htm">
|
|
||||||
SUserRegistrationController
|
|
||||||
</prop>
|
|
||||||
<prop key="/submissionArticle.htm">
|
|
||||||
SArticleController
|
|
||||||
</prop>
|
|
||||||
<prop key="/choosePreference.htm">
|
|
||||||
ChoosePreferenceController
|
|
||||||
</prop>
|
|
||||||
<prop key="/dispatchArticleList.htm">
|
|
||||||
DispatchArticleListController
|
|
||||||
</prop>
|
|
||||||
<prop key="/dispatchArticle.htm">
|
|
||||||
DispatchArticleController
|
|
||||||
</prop>
|
|
||||||
<prop key="/addConference.htm">
|
|
||||||
AddConferenceController
|
|
||||||
</prop>
|
|
||||||
<prop key="/evaluation.htm">EvaluationController</prop>
|
<prop key="/evaluation.htm">EvaluationController</prop>
|
||||||
<prop key="/createReport.htm">
|
<prop key="/createReport.htm">CreateReportController</prop>
|
||||||
CreateReportController
|
<prop key="/listConference.htm">ListConferenceController</prop>
|
||||||
</prop>
|
<prop key="/chooseConference.htm">ChooseConferenceController</prop>
|
||||||
<prop key="/listConference.htm">
|
<prop key="/validateArticle.htm">ValidateArticleController</prop>
|
||||||
ListConferenceController
|
<prop key="/valideOrReject.htm">ValideOrRejectController</prop>
|
||||||
</prop>
|
|
||||||
<prop key="/chooseConference.htm">
|
|
||||||
ChooseConferenceController
|
|
||||||
</prop>
|
|
||||||
<prop key="/validateArticle.htm">
|
|
||||||
ValidateArticleController
|
|
||||||
</prop>
|
|
||||||
<prop key="/valideOrReject.htm">
|
|
||||||
ValideOrRejectController
|
|
||||||
</prop>
|
|
||||||
<prop key="/login.htm">LogonController</prop>
|
<prop key="/login.htm">LogonController</prop>
|
||||||
|
<prop key="/listEvaluation.htm">ListEvaluationController</prop>
|
||||||
<prop key="/listEvaluation.htm">
|
<prop key="/download.htm">ArticleDownloadController</prop>
|
||||||
ListEvaluationController
|
<prop key="/listReport.htm">ListReportController</prop>
|
||||||
</prop>
|
<prop key="/forgotPassword.htm">ForgotPasswordController</prop>
|
||||||
<prop key="/download.htm">
|
|
||||||
ArticleDownloadController
|
|
||||||
</prop>
|
|
||||||
<prop key="/listReport.htm">
|
|
||||||
ListReportController
|
|
||||||
</prop>
|
|
||||||
<prop key="/forgotPassword.htm">
|
|
||||||
ForgotPasswordController
|
|
||||||
</prop>
|
|
||||||
<prop key="/detailArticle.htm">
|
<prop key="/detailArticle.htm">
|
||||||
DetailArticleController
|
DetailArticleController
|
||||||
</prop>
|
</prop>
|
||||||
@@ -89,9 +51,6 @@
|
|||||||
<bean id="MainController"
|
<bean id="MainController"
|
||||||
class="org.yacos.web.author.controller.MainController" />
|
class="org.yacos.web.author.controller.MainController" />
|
||||||
|
|
||||||
<bean id="SArticleControllerOK"
|
|
||||||
class="org.yacos.web.author.controller.SArticleControllerOK" />
|
|
||||||
|
|
||||||
<bean id="ListArticleController"
|
<bean id="ListArticleController"
|
||||||
class="org.yacos.web.PCmember.controller.ListArticleController">
|
class="org.yacos.web.PCmember.controller.ListArticleController">
|
||||||
<property name="articleManager" ref="articleManager" />
|
<property name="articleManager" ref="articleManager" />
|
||||||
@@ -99,7 +58,6 @@
|
|||||||
|
|
||||||
<bean id="ManageArticleController"
|
<bean id="ManageArticleController"
|
||||||
class="org.yacos.web.author.controller.ManageArticleController">
|
class="org.yacos.web.author.controller.ManageArticleController">
|
||||||
<dwr:remote javascript="ManagerArticleJS" />
|
|
||||||
<property name="articleManager" ref="articleManager" />
|
<property name="articleManager" ref="articleManager" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
@@ -276,10 +234,6 @@
|
|||||||
<dwr:configuration>
|
<dwr:configuration>
|
||||||
<dwr:convert type="bean"
|
<dwr:convert type="bean"
|
||||||
class="org.yacos.web.chairman.form.FormConference">
|
class="org.yacos.web.chairman.form.FormConference">
|
||||||
</dwr:convert>
|
|
||||||
|
|
||||||
<dwr:convert type="bean"
|
|
||||||
class="org.yacos.web.author.form.ArticleBean">
|
|
||||||
</dwr:convert>
|
</dwr:convert>
|
||||||
|
|
||||||
<dwr:convert type="bean"
|
<dwr:convert type="bean"
|
||||||
|
|||||||
BIN
YACOSWeb/WebContent/images/cc-button_cancel-128x128.png
Normal file
BIN
YACOSWeb/WebContent/images/cc-button_cancel-128x128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
YACOSWeb/WebContent/images/cc-button_ok-128x128.png
Normal file
BIN
YACOSWeb/WebContent/images/cc-button_ok-128x128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
BIN
YACOSWeb/WebContent/images/cc-download_manager-128x128.png
Normal file
BIN
YACOSWeb/WebContent/images/cc-download_manager-128x128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -467,5 +467,4 @@ textarea {
|
|||||||
.yacos_button:hover {
|
.yacos_button:hover {
|
||||||
background-image: url(../images/button_background_hover.png);
|
background-image: url(../images/button_background_hover.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @end */
|
/* @end */
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.yacos.web.PCmember.controller;
|
package org.yacos.web.PCmember.controller;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -47,10 +45,10 @@ public class ChoosePreferenceController extends SimpleFormController {
|
|||||||
|
|
||||||
List<Article> articleList=articleManager.getArticles(currentConferenceId);
|
List<Article> articleList=articleManager.getArticles(currentConferenceId);
|
||||||
|
|
||||||
getServletContext().setAttribute("articleList", articleList);
|
request.getSession().setAttribute("articleList", articleList);
|
||||||
|
|
||||||
User currentUser = SessionService.getInstance().getCurrentUser();
|
User currentUser = SessionService.getInstance().getCurrentUser();
|
||||||
// TODO : mock object, replace with real user management
|
|
||||||
ArrayList<Preference> preferencesList = new ArrayList<Preference>();
|
ArrayList<Preference> preferencesList = new ArrayList<Preference>();
|
||||||
Preference pref;
|
Preference pref;
|
||||||
for(Article article : articleList){
|
for(Article article : articleList){
|
||||||
@@ -86,8 +84,9 @@ public class ChoosePreferenceController extends SimpleFormController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> model = new HashMap<String, String>();
|
Map<String, String> model = new HashMap<String, String>();
|
||||||
model.put("message", "preference.ok");
|
model.put("message", "done");
|
||||||
return new ModelAndView(new RedirectView(getSuccessView()), "model", model);
|
|
||||||
|
return new ModelAndView(new RedirectView(getSuccessView()), model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,6 @@ package org.yacos.web.PCmember.form;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.yacos.core.article.Preference;
|
import org.yacos.core.article.Preference;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.yacos.web.author.controller;
|
package org.yacos.web.author.controller;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
@@ -14,7 +13,6 @@ import org.springframework.web.servlet.ModelAndView;
|
|||||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||||
import org.yacos.core.article.Article;
|
import org.yacos.core.article.Article;
|
||||||
import org.yacos.core.article.IArticleManager;
|
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.controller.NoConferenceSelectedException;
|
||||||
import org.yacos.web.system.session.SessionService;
|
import org.yacos.web.system.session.SessionService;
|
||||||
|
|
||||||
@@ -23,40 +21,14 @@ public class ManageArticleController extends SimpleFormController {
|
|||||||
protected final Log logger = LogFactory.getLog(getClass());
|
protected final Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
private IArticleManager articleManager;
|
private IArticleManager articleManager;
|
||||||
|
|
||||||
/*private List<ArticleBean> listArticleBean;
|
|
||||||
|
|
||||||
public List<ArticleBean> getListArticle() {
|
|
||||||
return listArticleBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListArticle(List<ArticleBean> listArticleBean) {
|
|
||||||
this.listArticleBean = listArticleBean;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException, NoConferenceSelectedException {
|
throws ServletException, IOException, NoConferenceSelectedException {
|
||||||
|
|
||||||
logger.info("Returning manageArticle view");
|
logger.info("Returning manageArticle view");
|
||||||
|
|
||||||
//listArticleBean = new ArrayList<ArticleBean>();
|
|
||||||
|
|
||||||
List<Article> listArticle;
|
List<Article> listArticle;
|
||||||
listArticle = articleManager.getArticleOfAuthor(SessionService.getInstance().getCurrentConferenceId(), SessionService.getInstance().getCurrentUserLogin());
|
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);
|
return new ModelAndView("manageArticle", "listArticle", listArticle);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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<String> 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<String> getSecondaryAuthors() {
|
|
||||||
return secondaryAuthors;
|
|
||||||
}
|
|
||||||
public void setSecondaryAuthors(ArrayList<String> secondaryAuthors) {
|
|
||||||
this.secondaryAuthors = secondaryAuthors;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -25,27 +25,27 @@ import org.yacos.core.users.User;
|
|||||||
*/
|
*/
|
||||||
public class SessionService {
|
public class SessionService {
|
||||||
private static SessionService instance = new SessionService();
|
private static SessionService instance = new SessionService();
|
||||||
|
|
||||||
protected static ServletContext servletContext = null;
|
protected static ServletContext servletContext = null;
|
||||||
protected static HttpServletRequest request = null;
|
protected static HttpServletRequest request = null;
|
||||||
|
|
||||||
private IConferenceManager conferenceManager;
|
private IConferenceManager conferenceManager;
|
||||||
private IUserManager userManager;
|
private IUserManager userManager;
|
||||||
|
|
||||||
private User currentUser;
|
private User currentUser;
|
||||||
private Conference currentConference;
|
private Conference currentConference;
|
||||||
private int nbUserConferences;
|
private int nbUserConferences;
|
||||||
|
|
||||||
private SessionService(){
|
private SessionService(){
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SessionService getInstance(){
|
public static SessionService getInstance(){
|
||||||
if(instance == null){
|
if(instance == null){
|
||||||
instance = new SessionService();
|
instance = new SessionService();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init method to be called at filter time
|
* Init method to be called at filter time
|
||||||
* Makes the sessionAttributes available in the request context
|
* Makes the sessionAttributes available in the request context
|
||||||
@@ -66,33 +66,34 @@ public class SessionService {
|
|||||||
request.setAttribute("currentUser", getCurrentUser());
|
request.setAttribute("currentUser", getCurrentUser());
|
||||||
// Put the current roles for this user
|
// Put the current roles for this user
|
||||||
//request.setAttribute("nbUserConferences",getNbUserConferences());
|
//request.setAttribute("nbUserConferences",getNbUserConferences());
|
||||||
|
|
||||||
} catch (NamingException e) {
|
} catch (NamingException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNbUserConferences() {
|
public int getNbUserConferences() {
|
||||||
if(nbUserConferences == -1)
|
if(nbUserConferences == -1)
|
||||||
{
|
{
|
||||||
setNbUserConferences();
|
setNbUserConferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
return nbUserConferences;
|
return nbUserConferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNbUserConferences() {
|
public void setNbUserConferences() {
|
||||||
int nb = conferenceManager.getConferences(getCurrentUser()).size();
|
int nb = conferenceManager.getConferences(getCurrentUser()).size();
|
||||||
this.nbUserConferences = nb;
|
this.nbUserConferences = nb;
|
||||||
request.setAttribute("nbUserConferences", getNbUserConferences());
|
//request.setAttribute("nbUserConferences", getNbUserConferences());
|
||||||
|
request.setAttribute("nbUserConferences", this.nbUserConferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConferenceManager(IConferenceManager conferenceManager) {
|
public void setConferenceManager(IConferenceManager conferenceManager) {
|
||||||
this.conferenceManager = conferenceManager;
|
this.conferenceManager = conferenceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConferenceManager getConferenceManager() {
|
public IConferenceManager getConferenceManager() {
|
||||||
if(conferenceManager == null){
|
if(conferenceManager == null){
|
||||||
Context context;
|
Context context;
|
||||||
@@ -105,11 +106,11 @@ public class SessionService {
|
|||||||
}
|
}
|
||||||
return conferenceManager;
|
return conferenceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserManager(IUserManager userManager) {
|
public void setUserManager(IUserManager userManager) {
|
||||||
this.userManager = userManager;
|
this.userManager = userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IUserManager getUserManager() {
|
public IUserManager getUserManager() {
|
||||||
if(userManager == null){
|
if(userManager == null){
|
||||||
Context context;
|
Context context;
|
||||||
@@ -122,7 +123,7 @@ public class SessionService {
|
|||||||
}
|
}
|
||||||
return userManager;
|
return userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current conference Id
|
* Gets the current conference Id
|
||||||
* Additionally, put the current conference object in the request context
|
* Additionally, put the current conference object in the request context
|
||||||
@@ -135,7 +136,7 @@ public class SessionService {
|
|||||||
Integer confId = (Integer) WebUtils.getSessionAttribute(request, "currentConferenceId");
|
Integer confId = (Integer) WebUtils.getSessionAttribute(request, "currentConferenceId");
|
||||||
return confId;
|
return confId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current conference id
|
* Sets the current conference id
|
||||||
* @param request The current HTTP request object, necessary for session operations
|
* @param request The current HTTP request object, necessary for session operations
|
||||||
@@ -148,7 +149,7 @@ public class SessionService {
|
|||||||
// Refreshing user credentials
|
// Refreshing user credentials
|
||||||
refreshAuthentication();
|
refreshAuthentication();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current conference using a conference object
|
* Sets the current conference using a conference object
|
||||||
* @param request The current HTTP request object, necessary for session operations
|
* @param request The current HTTP request object, necessary for session operations
|
||||||
@@ -158,7 +159,7 @@ public class SessionService {
|
|||||||
setCurrentConferenceId( c.getId() );
|
setCurrentConferenceId( c.getId() );
|
||||||
currentConference = c;
|
currentConference = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets (if necessary) and returns the current conference of the session
|
* Gets (if necessary) and returns the current conference of the session
|
||||||
* @param request The current HTTP request object, necessary for session operations
|
* @param request The current HTTP request object, necessary for session operations
|
||||||
@@ -166,21 +167,23 @@ public class SessionService {
|
|||||||
*/
|
*/
|
||||||
public Conference getCurrentConference(){
|
public Conference getCurrentConference(){
|
||||||
Integer id = getCurrentConferenceId();
|
Integer id = getCurrentConferenceId();
|
||||||
|
|
||||||
// The currentConference can be out to date : force the update
|
// The currentConference can be out to date : force the update
|
||||||
if(currentConference != null && id != currentConference.getId()){
|
if(currentConference != null && id != currentConference.getId()){
|
||||||
currentConference = null;
|
currentConference = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( currentConference == null && id != null ){
|
if( currentConference == null && id != null ){
|
||||||
currentConference = conferenceManager.getConference(id);
|
currentConference = conferenceManager.getConference(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUserLogged()){setNbUserConferences();};
|
if (isUserLogged()) {
|
||||||
|
setNbUserConferences();
|
||||||
|
}
|
||||||
|
|
||||||
return currentConference;
|
return currentConference;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current user login from the session
|
* Gets the current user login from the session
|
||||||
* Additionally, puts the current User object in the request context
|
* 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
|
// Retrieve the login from the acegi security session
|
||||||
return SecurityContextHolder.getContext().getAuthentication().getName();
|
return SecurityContextHolder.getContext().getAuthentication().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get (if necessary) and returns the current user object
|
* Get (if necessary) and returns the current user object
|
||||||
* @return The current User
|
* @return The current User
|
||||||
@@ -200,12 +203,12 @@ public class SessionService {
|
|||||||
public User getCurrentUser() {
|
public User getCurrentUser() {
|
||||||
// Retrieve the login from the session
|
// Retrieve the login from the session
|
||||||
String login = this.getCurrentUserLogin();
|
String login = this.getCurrentUserLogin();
|
||||||
|
|
||||||
// The user can be out to date : force the update
|
// The user can be out to date : force the update
|
||||||
if(currentUser != null && (! currentUser.getLogin().equals(login)) ){
|
if(currentUser != null && (! currentUser.getLogin().equals(login)) ){
|
||||||
currentUser = null;
|
currentUser = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the user object is already in cache
|
// Check if the user object is already in cache
|
||||||
if(currentUser == null || (currentUser.getLogin().equals(login)) ){
|
if(currentUser == null || (currentUser.getLogin().equals(login)) ){
|
||||||
// Checks login for validity
|
// Checks login for validity
|
||||||
@@ -218,7 +221,7 @@ public class SessionService {
|
|||||||
}
|
}
|
||||||
return currentUser;
|
return currentUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the user is logged (is there a current User for this session)
|
* 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
|
* @return true if there's a current user in the session, false otherwise
|
||||||
@@ -226,7 +229,7 @@ public class SessionService {
|
|||||||
public boolean isUserLogged(){
|
public boolean isUserLogged(){
|
||||||
return getCurrentUser() != null;
|
return getCurrentUser() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puts an object in the session
|
* Puts an object in the session
|
||||||
* @param name The name of the attribute 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){
|
public void setSessionAttribute(String name, Object attribute){
|
||||||
WebUtils.setSessionAttribute(request, name, attribute);
|
WebUtils.setSessionAttribute(request, name, attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves an object from the Session
|
* Retrieves an object from the Session
|
||||||
* @param name The name of the attribute to retrieve
|
* @param name The name of the attribute to retrieve
|
||||||
@@ -248,27 +251,27 @@ public class SessionService {
|
|||||||
public void refreshAuthentication(){
|
public void refreshAuthentication(){
|
||||||
refreshAuthentication(null);
|
refreshAuthentication(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshAuthentication(String newPassword) {
|
public void refreshAuthentication(String newPassword) {
|
||||||
// First step : remove user from the cache
|
// First step : remove user from the cache
|
||||||
DaoAuthenticationProvider authProvider = (DaoAuthenticationProvider) RequestContextUtils.getWebApplicationContext(request).getBean("daoAuthenticationProvider");
|
DaoAuthenticationProvider authProvider = (DaoAuthenticationProvider) RequestContextUtils.getWebApplicationContext(request).getBean("daoAuthenticationProvider");
|
||||||
UserCache userCache = authProvider.getUserCache();
|
UserCache userCache = authProvider.getUserCache();
|
||||||
|
|
||||||
if(userCache != null){
|
if(userCache != null){
|
||||||
userCache.removeUserFromCache(getCurrentUserLogin());
|
userCache.removeUserFromCache(getCurrentUserLogin());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second step : Refreshing user credentials
|
// Second step : Refreshing user credentials
|
||||||
Authentication currentAuthentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication currentAuthentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
if(currentAuthentication instanceof UsernamePasswordAuthenticationToken){
|
if(currentAuthentication instanceof UsernamePasswordAuthenticationToken){
|
||||||
|
|
||||||
if(newPassword != null){
|
if(newPassword != null){
|
||||||
// Setting the new password in the authentication token
|
// Setting the new password in the authentication token
|
||||||
currentAuthentication = new UsernamePasswordAuthenticationToken(currentAuthentication.getPrincipal(),newPassword);
|
currentAuthentication = new UsernamePasswordAuthenticationToken(currentAuthentication.getPrincipal(),newPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityContextHolder.getContext().setAuthentication(authProvider.authenticate(currentAuthentication));
|
SecurityContextHolder.getContext().setAuthentication(authProvider.authenticate(currentAuthentication));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user