Commit 6e8c4d72 authored by Michael Ritter's avatar Michael Ritter
Browse files

Add warning when removing items from the report summary

parent a05795ef
...@@ -31,14 +31,15 @@ ...@@ -31,14 +31,15 @@
package edu.umiacs.ace.monitor.core; package edu.umiacs.ace.monitor.core;
import edu.umiacs.ace.util.EntityManagerServlet;
import edu.umiacs.ace.util.PersistUtil;
import edu.umiacs.ace.monitor.log.LogEventManager;
import edu.umiacs.ace.monitor.access.browse.BrowseServlet; import edu.umiacs.ace.monitor.access.browse.BrowseServlet;
import edu.umiacs.ace.monitor.access.browse.DirectoryTree; import edu.umiacs.ace.monitor.access.browse.DirectoryTree;
import edu.umiacs.ace.monitor.log.LogEnum; import edu.umiacs.ace.monitor.log.LogEnum;
import edu.umiacs.ace.monitor.log.LogEventManager;
import edu.umiacs.ace.util.EntityManagerServlet;
import edu.umiacs.ace.util.PersistUtil;
import edu.umiacs.util.Strings; import edu.umiacs.util.Strings;
import java.io.IOException; import org.apache.log4j.Logger;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction; import javax.persistence.EntityTransaction;
import javax.servlet.RequestDispatcher; import javax.servlet.RequestDispatcher;
...@@ -46,7 +47,7 @@ import javax.servlet.ServletException; ...@@ -46,7 +47,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger; import java.io.IOException;
/** /**
* Remove an item from list of actively monitored items. This will not remove * Remove an item from list of actively monitored items. This will not remove
...@@ -74,27 +75,7 @@ public class RemoveItemServlet extends EntityManagerServlet { ...@@ -74,27 +75,7 @@ public class RemoveItemServlet extends EntityManagerServlet {
if ( itemId > 0 ) { if ( itemId > 0 ) {
item = em.getReference(MonitoredItem.class, itemId); item = em.getReference(MonitoredItem.class, itemId);
removeItem(item, em, dt); removeItem(item, em, dt);
/*if ( item != null ) { } else {
LogEventManager lem =
new LogEventManager(System.currentTimeMillis(), item.getParentCollection());
lem.persistItemEvent(LogEnum.REMOVE_ITEM, item.getPath(), null, em);
if ( !item.isDirectory() ) {
String parent = item.getParentPath();
Collection c = item.getParentCollection();
EntityTransaction trans = em.getTransaction();
trans.begin();
if ( item.getToken() != null ) {
em.remove(item.getToken());
}
em.remove(item);
trans.commit();
reloadTree(dt, parent, c, em);
} else {
new MyDeleteThread(item, dt).start();
}
}*/
}
else{
itemIds = getParameterList(request,REMOVAL, 0); itemIds = getParameterList(request,REMOVAL, 0);
if(itemIds != null){ if(itemIds != null){
for(long l:itemIds){ for(long l:itemIds){
......
...@@ -5,7 +5,7 @@ The taglib directive below imports the JSTL library. If you uncomment it, ...@@ -5,7 +5,7 @@ The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library. on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%> --%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib tagdir="/WEB-INF/tags" prefix="h" %> <%@taglib tagdir="/WEB-INF/tags" prefix="h" %>
...@@ -19,9 +19,16 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library. ...@@ -19,9 +19,16 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Collection Errors</title> <title>Collection Errors</title>
<link rel="stylesheet" type="text/css" href="style.css" /> <jsp:include page="imports.jsp"/>
<script src="jquery-1.7.1.min.js" type="text/javascript"></script> <!--<script src="jquery-1.7.1.min.js" type="text/javascript"></script> -->
<style type="text/css"> <style type="text/css">
body {
width: 752px !important;
margin-top: 8px !important;
padding-right: 0px !important;
}
#summaryTable { #summaryTable {
margin-left: 50px; margin-left: 50px;
margin-right: auto; margin-right: auto;
...@@ -42,7 +49,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library. ...@@ -42,7 +49,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
border-right: 1px solid #000000; border-right: 1px solid #000000;
border-top: 1px solid #000000; border-top: 1px solid #000000;
border-bottom: 1px solid #000000; border-bottom: 1px solid #000000;
border-collapse: separate;
} }
#reportTable thead { #reportTable thead {
border-bottom: 1px solid #000000; border-bottom: 1px solid #000000;
...@@ -90,7 +97,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library. ...@@ -90,7 +97,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
</tr> </tr>
</table> </table>
<span>Select All:&nbsp;</span> <input type="checkbox" id="selectall" /> <span>Select All:&nbsp;</span> <input type="checkbox" id="selectall"/>
<form method="GET" action="RemoveItem"> <form method="GET" action="RemoveItem">
<input type="hidden" name="redirect" value="Report"/> <input type="hidden" name="redirect" value="Report"/>
...@@ -108,7 +115,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library. ...@@ -108,7 +115,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
<c:forEach var="item" items="${items}"> <c:forEach var="item" items="${items}">
<tr> <tr>
<td> <td>
<input type="checkbox" name="removal" value="${item.id}" /> <input type="checkbox" name="removal" id="removal" value="${item.id}" />
</td> </td>
<td> <td>
<c:choose> <c:choose>
...@@ -160,18 +167,56 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library. ...@@ -160,18 +167,56 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
</table> </table>
</td></tr> </td></tr>
</table> </table>
<input type="submit" value="Remove Selected Items" onclick="document.location = 'report.jsp';"/> <!-- Button trigger modal -->
</form> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" style="width: 25%">
Remove Selected
</button>
<script type="text/javascript"> <!-- Modal -->
$("#selectall").click(function(){ <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
if($("#selectall").attr("checked")=="checked") <div class="modal-dialog" role="document">
$('input[name="removal"]').attr('checked', 'checked'); <div class="modal-content">
else <div class="modal-header">
$('input[name="removal"]').removeAttr('checked'); <h5 class="modal-title" id="exampleModalLabel">Confirmation</h5>
}); <button type="button" class="close" data-dismiss="modal" aria-label="Close">
</script> <span aria-hidden="true">&times;</span>
</button>
</div>
<h6 class="modal-body">
Submitting will remove all selected items and their tokens from tracking in ACE.
<br><br>
Continue?
</h6>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" onclick="docment.location = 'report.jsp">Submit</button>
</div>
</div>
</div>
</div>
</form>
<jsp:include page="footer.jsp" /> <jsp:include page="footer.jsp" />
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<script type="text/javascript">
$("#selectall").click(function() {
$("input[name=removal]").prop('checked', $(this).prop("checked"));
/*
if ($("#selectall").is(":checked")) {
$("#removal").toggle(this.checked);
} else {
$("#removal").checked;
}
if($("#selectall").attr("checked")=="checked")
$('input[name="removal"]').attr('checked', 'checked');
else
$('input[name="removal"]').removeAttr('checked');
*/
});
</script>
</body> </body>
</html> </html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment