Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tanakrit127 committed Oct 2, 2016
2 parents 5d08769 + ae615d4 commit d620cab
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions WebContent/inc.body.header.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
<div class="btn-group">
<a href="#" class="margin-left-8 white-color dropdown-toggle white-color" data-toggle="dropdown" id="login">${sessionScope.user.getNickname()} <span class="caret"></span></a>
<ul class="dropdown-menu">
<jstl:if test="${sessionScope.user.isAdmin()}">
<li><a href="${contextPath}/admin/login">Admin Login</a></li>
</jstl:if>
<li><a href="${contextPath}/user/profile">Edit Profile</a></li>
<li><a href="${contextPath}/user/pub/manage">Manage Publications</a></li>
<li><a href="${contextPath}/logout">Logout</a></li>
Expand Down
7 changes: 6 additions & 1 deletion src/com/sixppl/cmd/EmbedUserCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.sixppl.dao.AdminLoginDAO;
import com.sixppl.dao.AdminUserBanDAO;
import com.sixppl.dao.SessionDAO;
import com.sixppl.dao.UserDAO;
Expand All @@ -18,11 +19,13 @@ public class EmbedUserCommand implements Command {
private SessionDAO sessionDao;
private UserDAO userDao;
private AdminUserBanDAO adminUserBanDao;
private AdminLoginDAO adminLoginDao;

public EmbedUserCommand() {
sessionDao = Application.getSharedInstance().getDAOFactory().getSessionDAO();
userDao = Application.getSharedInstance().getDAOFactory().getUserDAO();
adminUserBanDao = Application.getSharedInstance().getDAOFactory().getAdminUserBanDAO();
adminLoginDao = Application.getSharedInstance().getDAOFactory().getAdminLoginDAO();
}

@Override
Expand All @@ -32,8 +35,10 @@ public void execute(HttpServletRequest request, HttpServletResponse response) th
sessionDto.setSessionID(request.getSession().getId());
int userid = sessionDao.finduserIDbySession(sessionDto);
UserDTO userDto = userDao.findUserByUserID(userid);
if(userDto != null)
if(userDto != null){
userDto.setIsBanned(adminUserBanDao.isBanned(userDto.getUserID()));
userDto.setIsAdmin(adminLoginDao.isAdmin(userDto.getUserID()));
}
session.setAttribute("user", userDto);

}
Expand Down
16 changes: 15 additions & 1 deletion src/com/sixppl/importData/ExtractXMLGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,21 @@ public static void main(String[] args) throws SQLException {
if (pubSell.editors.isEmpty()) {
pubSell.editors.add("");
}
pubSell.type = p.getType();
if (p.getType().equals("article")) {
pubSell.type = "Article";
}
else if (p.getType().equals("book")){
pubSell.type = "Book";
}
else if (p.getType().equals("mastersthesis")){
pubSell.type = "Master Thesis";
}
else if (p.getType().equals("phdthesis")){
pubSell.type = "Ph.D.Thesis";
}
else {
pubSell.type = "Conference";
}
if (p.getYear() == null) {
pubSell.year = 2016;
}
Expand Down

0 comments on commit d620cab

Please sign in to comment.