Filter sur Admin (manage user)
Notification d'ajout de token dans admin Correction message addConference Dates Correction bug MailSenderService quand echec de l'envoi
This commit is contained in:
@@ -20,9 +20,9 @@
|
||||
User list
|
||||
</div>
|
||||
<div class="dynamicListPlaceholder">
|
||||
Please enter a value in the filter field.
|
||||
Sorry, there's no users matching this filter.
|
||||
</div>
|
||||
<div class="dynamicListItem" id="person_item_pattern" style="display:none;height:0px;width:0px;">
|
||||
<div class="dynamicListItemPattern" id="person_item_pattern" style="display:none;height:0px;width:0px;">
|
||||
<div id="person_name" style="display:table-cell;">Name</div>
|
||||
<div style="display:table-cell">
|
||||
<a href="#" id="person_add_token">+</a>
|
||||
@@ -31,6 +31,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="button" id="sendNotificationsButton" value="Send email notifications" style="display:none;"/>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
var AdminManager = Class.create({
|
||||
initialize: function(){
|
||||
this.input = $('userFilterInput');
|
||||
this.input.observe('keyPress',this.userInputKeyHandler.bind(this));
|
||||
this.fillUserList();
|
||||
this.input.observe('keypress',this.userInputKeyHandler.bindAsEventListener(this));
|
||||
$('sendNotificationsButton').observe('click',this.sendNotifications.bind(this));
|
||||
this.filterTimeout = window.setTimeout(this.fillUserList.bind(this),0);
|
||||
},
|
||||
addConferenceCreationToken: function(event,user_object){
|
||||
AdminController.addConferenceCreationToken(user_object.login,
|
||||
@@ -11,6 +12,7 @@ var AdminManager = Class.create({
|
||||
updated_number);
|
||||
}
|
||||
);
|
||||
$('sendNotificationsButton').appear({duration:0.5});
|
||||
event.stop();
|
||||
},
|
||||
removeConferenceCreationToken: function(event,user_object){
|
||||
@@ -22,7 +24,16 @@ var AdminManager = Class.create({
|
||||
);
|
||||
event.stop();
|
||||
},
|
||||
userInputKeyHandler: function(){
|
||||
sendNotifications: function(){
|
||||
AdminController.sendNotifications(function(){
|
||||
alert("The users have been notified of their new rights.");
|
||||
});
|
||||
},
|
||||
userInputKeyHandler: function(event){
|
||||
window.clearTimeout(this.filterTimeout);
|
||||
this.filterTimeout = window.setTimeout(
|
||||
this.fillUserList.bind(this),1000);
|
||||
this.input.pulsate({duration:1.0,from:0.7,pulses:3});
|
||||
switch(event.keyCode){
|
||||
case Event.KEY_RETURN:
|
||||
this.addRemote();
|
||||
@@ -31,12 +42,19 @@ var AdminManager = Class.create({
|
||||
}
|
||||
},
|
||||
fillUserList: function(){
|
||||
AdminController.getUsersList(function(people){
|
||||
var filter = this.input.value;
|
||||
AdminController.getUsersList(filter,function(people){
|
||||
$$('#userDynamicList .dynamicListItem').invoke("remove");
|
||||
var content;
|
||||
var elemName;
|
||||
var contentValue;
|
||||
var id;
|
||||
var person;
|
||||
if(people.length > 0){
|
||||
$$(".dynamicListPlaceholder").invoke("fade");
|
||||
} else {
|
||||
$$(".dynamicListPlaceholder").invoke("appear");
|
||||
}
|
||||
for (var i = 0; i < people.length; i++) {
|
||||
person = people[i];
|
||||
id = "_"+person.id;
|
||||
@@ -46,6 +64,9 @@ var AdminManager = Class.create({
|
||||
dwr.util.setValue("person_name" + id, person.firstName + " " + person.lastName);
|
||||
dwr.util.setValue("person_num_tokens"+id,person.numTokens);
|
||||
|
||||
$(elemName).removeClassName("dynamicListItemPattern");
|
||||
$(elemName).addClassName("dynamicListItem");
|
||||
|
||||
$("person_add_token"+id).observe('click',
|
||||
this.addConferenceCreationToken.bindAsEventListener(this,person));
|
||||
$("person_remove_token"+id).observe('click',
|
||||
|
||||
@@ -799,6 +799,12 @@ div.user_new {
|
||||
.button .down {
|
||||
background-image: url(../images/button-box-down.png);
|
||||
}
|
||||
.button .hover div {
|
||||
background-image: url(../images/button-box-hover.png);
|
||||
}
|
||||
.button .down div {
|
||||
background-image: url(../images/button-box-down.png);
|
||||
}
|
||||
|
||||
.to-right {
|
||||
float: right;
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.yacos.web.admin;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
@@ -14,7 +13,6 @@ import org.yacos.core.exceptions.NoConferenceCreationTokenLeftException;
|
||||
import org.yacos.core.users.IUserManager;
|
||||
import org.yacos.core.users.User;
|
||||
import org.yacos.web.system.controller.MailSenderService;
|
||||
import org.yacos.web.system.session.SessionService;
|
||||
import org.yacos.web.system.session.YACOSUtils;
|
||||
|
||||
public class AdminController extends MultiActionController {
|
||||
@@ -79,25 +77,33 @@ public class AdminController extends MultiActionController {
|
||||
User user;
|
||||
for(String login : addedConferenceCreationTokens){
|
||||
user = userManager.getUser(login);
|
||||
MailSenderService.getInstance().sendEMail(user.getEmail(),
|
||||
// We can't be sure of what happened on the client side, so we avoid sending mails for nothing
|
||||
if(user.getConferenceCreationTokens() > 0 ){
|
||||
MailSenderService.getInstance().sendEMail(user.getEmail(),
|
||||
"YACOS : "+user.getFirstName()+" "+user.getLastName()+" you have been granted a conference creation token",
|
||||
"You receive this email because the YACOS admin allowed you to create a new conference in the system.\n"
|
||||
+ "Your current conference creation token count is "+user.getConferenceCreationTokens()+"\n"
|
||||
+ YACOSUtils.fullURL("addConference.htm"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<DWRPersonBean> getUsersList(){
|
||||
public List<DWRPersonBean> getUsersList(String filter){
|
||||
List<DWRPersonBean> beans = new ArrayList<DWRPersonBean>();
|
||||
DWRPersonBean bean;
|
||||
for(User user : userManager.getUsers()){
|
||||
bean = new DWRPersonBean();
|
||||
bean.setLogin(user.getLogin());
|
||||
bean.setFirstName(user.getFirstName());
|
||||
bean.setLastName(user.getLastName());
|
||||
bean.setId(beans.size());
|
||||
bean.setNumTokens(conferenceManager.conferenceCreationTokens(user.getLogin()));
|
||||
beans.add(bean);
|
||||
if (filter.equals("") ||
|
||||
user.getFirstName().toLowerCase().startsWith(filter.toLowerCase()) ||
|
||||
user.getLastName().toLowerCase().startsWith(filter.toLowerCase())){
|
||||
|
||||
bean = new DWRPersonBean();
|
||||
bean.setLogin(user.getLogin());
|
||||
bean.setFirstName(user.getFirstName());
|
||||
bean.setLastName(user.getLastName());
|
||||
bean.setId(beans.size());
|
||||
bean.setNumTokens(conferenceManager.conferenceCreationTokens(user.getLogin()));
|
||||
beans.add(bean);
|
||||
}
|
||||
}
|
||||
return beans;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class MailSenderService {
|
||||
try {
|
||||
mailSender.send(message);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Could not send email to "+toEmail,e);
|
||||
logger.warn("Could not send email to "+toEmail+" :\n"+e.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user