Mercurial > hg > LGServices
view src/main/webapp/pages/topicList.jsp @ 64:4c8fed0d71cc
minor fixed
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 25 Jul 2016 17:08:06 +0200 |
parents | 95bf4ac726e6 |
children | 7e161f2e6660 |
line wrap: on
line source
<%@page import="de.mpiwg.gazetteer.bo.LGTopic"%> <%@page import="org.apache.commons.lang.StringUtils"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" /> <html> <head> <jsp:include page="../componentes/headContent.jsp"/> <script> $(function() { var dialogCreateTopic = $("#dialogCreateTopic").dialog( { autoOpen: false, width: "400px", } ); $("#createTopic").button().on( "click", function() { dialogCreateTopic.dialog( "open" ); }); $("#nameEn").on( "keydown", function( event ) { var englishAlphabetAndWhiteSpace =/[A-Za-z 0-9]/g; var key = String.fromCharCode(event.which); // --- key code: --- // space: 32, delete: 8, enter: 13, tab: 9 // [a-z]: 65-91 // [0-9]: 48-57 // esc: 27 // shift, ctr, alt: 16, 17, 18, 20 // cmd: 91 if (event.keyCode == 8 || event.keyCode == 9 || (event.keyCode >= 16 && event.keyCode <= 20) || event.keyCode == 27 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 91 || englishAlphabetAndWhiteSpace.test(key)) { return true; } alert("Please type in English characters."); // TODO: maybe delete those chars that are not Latin char, instead of delete them all $("#nameEn").val(""); return false; }); }); </script> </head> <body> <jsp:include page="../componentes/template.jsp"/> <div id="page"> <% if(sessionBean.getUser() == null) { %> <label class="subTitel">You must login!</label> <% } else { if (sessionBean.getTopicListPage().getCompleteTopicList() == null){ sessionBean.getTopicListPage().loadParameters(request, response); sessionBean.getTopicListPage().reloadTopics(); } %> <button id="createTopic" type="button" class="lgButton">Create New Topic</button> <div id="dialogCreateTopic" title="Create a New Topic:"> <form name="createTopicForm" id="createTopicForm" action="<%= sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" method="post"> <input name="bean" type="hidden" value="topicListBean" /> <table> <tr> <td> <span>name(Eng)*</span> </td> <td> <input id="nameEn" name="nameEn" type="text" placeholder="e.g. Local Product"/> </td> </tr> <tr> <td> <span>name(中文)*</span> </td> <td> <input id="nameCh" name="nameCh" type="text" placeholder="e.g. 物產"/> </td> </tr> <tr> <td> <span>name(Pinyin)*</span> </td> <td> <input id="namePinyin" name="namePinyin" type="text" placeholder="e.g. wu chan"/> </td> </tr> <tr> <td> <span>description</span> </td> <td> <input id="description" name="description" type="text" placeholder=""/> </td> </tr> <tr> <td> <button onclick="setAction('createTopic', 'createTopicForm'); document.getElementById('createTopicForm').submit();">Submit</button> </td> </tr> </table> </form> </div> <form name="topicListForm" id="topicListForm" method="post" action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" > <input name="bean" type="hidden" value="topicListBean" /> <div class="subTitel"> <input type="image" onclick="setAction('forceLoadTopics', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getRefreshImage()%>" width="20" height="20"/> </div> <% if(sessionBean.getTopicListPage().getCompleteTopicList().isEmpty()) { %> <label class="subTitel">There's no topic in the system!</label> <% } else { %> <div class="subTitel">Topic List <p class="label">You have <%= sessionBean.getTopicListPage().getTopicNumber() %> topics.</p> <p class="label"><%= (StringUtils.isNotEmpty(sessionBean.getTopicListPage().getFilteringMessage())) ? sessionBean.getTopicListPage().getFilteringMessage() : ""%> </p> </div> <div class="tableDiv double-scroll"> <table class="pageTable" > <tr> <td> <table class="sortTable"> <tr> <td><label class="tableTitle">Topic ID</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByTopicIdUp', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByTopicIdDown', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> </table> </td> <td> <table class="sortTable"> <tr> <td><label class="tableTitle">Name(Eng)</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByNameEnUp', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByNameEnDown', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> </table> </td> <td> <table class="sortTable"> <tr> <td><label class="tableTitle">Name(Chi)</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByNameChUp', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByNameChDown', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> </table> </td> <td> <table class="sortTable"> <tr> <td><label class="tableTitle">Name(Pinyin)</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByNamePinyinUp', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByNamePinyinDown', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> </table> </td> <td> <table class="sortTable"> <tr> <td><label class="tableTitle">Description</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByDescriptionUp', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByNDescriptionDown', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> </table> </td> <td><label class="tableTitle">Contributors</label></td> <td> <table class="sortTable"> <tr> <td><label class="tableTitle">Last Modified</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByLastModifiedUp', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByLastModifiedDown', 'topicListForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> </table> </td> <td><label class="tableTitle">Manage</label></td> <td><label class="tableTitle">Delete</label></td> </tr> <% for (LGTopic topic : sessionBean.getTopicListPage().getCompleteTopicList() ) { %> <tr> <td><%=topic.getId() %></td> <td><%=topic.getNameEn() %></td> <td><%=topic.getNameCh() %></td> <td><%=topic.getNamePinyin() %></td> <td><%=topic.getDescription() %></td> <td> <table style="width:120px;"> <% for(String contributor : topic.getContributorsNameList()) { %> <tr><td><label><%= contributor %></label></td></tr> <% } %> </table> </td> <td><%=topic.getFomattedLastChange() %></td> <td> <%if(topic.hasContributor(sessionBean.getUser().getId())){ %> <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/pages/topicPage.jsp?topicId=<%=topic.getId() %>" > <img title="Manage Topic" src="<%=sessionBean.getApplicationBean().getEditBranchImage()%>"/> </a> <% } %> <label>(<%=topic.getNumOfSections().toString()%>/2000)</label> </td> <td> <%if(topic.hasContributor(sessionBean.getUser().getId())){ %> <input type="image" title="Delete it" onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> deleteTopic('deleteTopic', 'topicListForm', '<%=topic.getId() %>');" src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/> <% } %> </td> </tr> <% } %> </table> </div> </form> <% } %> <% } %> </div> </body>