Skip to content

Commit

Permalink
Merge 75b287f into c13e8d2
Browse files Browse the repository at this point in the history
  • Loading branch information
oskopek committed Sep 9, 2014
2 parents c13e8d2 + 75b287f commit 600dab0
Show file tree
Hide file tree
Showing 21 changed files with 1,069 additions and 415 deletions.
83 changes: 83 additions & 0 deletions NOTICE.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,86 @@ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABI
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----

=== CarCV WebApp
==== DataTables

----
MIT license
Copyright (C) 2008-2014, SpryMedia Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
----

==== JQuery

Copyright 2005, 2014 jQuery Foundation and other contributors,

https://jquery.org/[]

This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery

The following license applies to all parts of this software except as
documented below:

----
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
----

==== jsTimezoneDetect

----
MIT License
Copyright (c) 2012 Jon Nylander, project maintained at
https://bitbucket.org/pellepim/jstimezonedetect
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to
do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
----
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
String timeZoneStr = request.getParameter("timezone");
TimeZone tz = TimeZone.getTimeZone(timeZoneStr);

DateFormat dateFormat = new SimpleDateFormat("dd. MM. yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
dateFormat.setTimeZone(tz);
DateFormat timeFormat = new SimpleDateFormat("HH:mm");
timeFormat.setTimeZone(tz);
Expand Down Expand Up @@ -110,7 +110,7 @@ public int compare(FileEntry o1, FileEntry o2) {
request.setAttribute("wrtmList", wrtmList);

boolean isAdmin = request.isUserInRole(adminRole);
request.setAttribute("isAdmin", Boolean.valueOf(isAdmin));
request.setAttribute("isAdmin", isAdmin);

RequestDispatcher rd = getServletContext().getRequestDispatcher("/app/cartable.jsp");
rd.forward(request, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ public class RemoveEntryServlet extends HttpServlet {
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws
IOException {
long entryId = Long.parseLong(request.getParameter("entry_id"));
entryBean.remove(entryId);
String[] entryIdArray = request.getParameter("entry_id").split(",");
for (String entryId : entryIdArray) {
entryBean.remove(Long.parseLong(entryId));
}
response.sendRedirect("/app/index.jsp"); // TODO 3 redirect should be more intelligent
}

Expand Down
104 changes: 71 additions & 33 deletions carcv-webapp/src/main/webapp/app/cartable.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,94 @@
<link rel="SHORTCUT ICON" href="http://upload.wikimedia.org/wikipedia/commons/f/f0/Car_with_Driver-Silhouette.svg">
<link rel="icon" href="http://upload.wikimedia.org/wikipedia/commons/f/f0/Car_with_Driver-Silhouette.svg" type="image/ico">
<title>CarCV Car Table</title>
<link rel="stylesheet" type="text/css" href="/resources/mystyle.css">
<link rel="stylesheet" type="text/css" href="/resources/site.css">
<link rel="stylesheet" type="text/css" href="/resources/jquery.dataTables.css">
<style type="text/css">
#tabulator {
text-align: center;
height: 25px
}
</style>

<script type="text/javascript" language="javascript" src="/resources/jquery-1.11.1.min.js"></script>
<script type="text/javascript" language="javascript" src="/resources/jquery.dataTables.min.js"></script>
<script type="text/javascript" class="init">
$(document).ready(function () {
$('#carTable').dataTable({
"scrollCollapse": false,
"paging": false
});
var table = $('#carTable').DataTable();
$('#carTable tbody').on('click', 'tr', function () {
$(this).toggleClass('selected');
});
$('#deleteButton').click(function () {
if (!confirm("Are you sure you want to delete?")) {
return;
}
var rows = table.rows('.selected').data();
if (rows.length <= 0) {
alert("The selection is empty!");
return;
}
var idString = "";
for (var i = 0; i < rows.length; i++) {
idString += rows[i][0] + ",";
}
idString = idString.substring(0, idString.length - 1);
console.log("entryIDs: " + idString);
window.parent.location.replace("/admin/servlet/RemoveEntry?entry_id=" + idString);
//table.rows('.selected').remove().draw(false); //TODO 3 Make table editable w/o reload
});
});
</script>

</head>
<body>
<table style="border: 1px solid #C0C0C0;">
<c:if test="${isAdmin}"><button id="deleteButton">Delete selected entries</button></c:if><br>
<table id="carTable" class="display">
<thead>
<tr>
<th>ID</th>
<th>Picture</th>
<th>Date</th>
<th>License plate</th>
<th>Location</th>
<th>Video</th>
<th>Report</th>
</tr>
</thead>

<tfoot>
<tr>
<th style="width: 160px; height: 15px; background-color: #B0C4DE;">Car preview</th>
<th style="width: 10%; height: 15px; background-color: #B0C4DE;">Date</th>
<th style="width: 15%; height: 15px; background-color: #B0C4DE;">License plate</th>
<th style="width: 20%; height: 15px; background-color: #B0C4DE;">Location</th>
<th style="width: 15%; height: 15px; background-color: #B0C4DE;">Video</th>
<th style="width: 15%; height: 15px; background-color: #B0C4DE;">Pictures</th>
<th style="width: 15%; height: 15px; background-color: #B0C4DE;">Report</th>
<c:if test="${isAdmin}">
<th style="width: 10%; height: 15px; background-color: #B0C4DE;">Delete</th>
</c:if>
<th>ID</th>
<th>Picture</th>
<th>Date</th>
<th>License plate</th>
<th>Location</th>
<th>Video</th>
<th>Report</th>
</tr>
</tfoot>

<tbody>
<c:forEach var="member" items="${wrtmList}">
<tr>
<td><img src="/servlet/DisplayImage?path=${member.previewPath}&width=150" style="border: 2px" width="150"
alt="Car"></td>
<td>${member.date}<br> ${member.time}
</td>
<td>${member.entryId}</td>
<td><a href="/servlet/DisplayImage?path=${member.previewPath}" target="_top">
<img src="/servlet/DisplayImage?path=${member.previewPath}&width=200" style="border: 2px; width: 100%"
alt="Car"></a></td>
<td>${member.date}<br> ${member.time}</td>
<td>${member.licensePlate}</td>
<td>${member.location}</td>
<td><a href="/servlet/GenerateVideo?entry_id=${member.entryId}" target="_top">View video</a></td>
<td><a href="/servlet/DisplayImage?path=${member.previewPath}" target="_top">View preview</a></td>
<td><a href="/servlet/GenerateReport?entry_id=${member.entryId}&timezone=${member.timeZone}" target="_top">Generate
report</a></td>
<c:if test="${isAdmin}">
<td>
<button onclick="confirmRemove()">Delete</button>
<script>
function confirmRemove() {
var result = confirm("Are you sure you want to delete?");
if (result) { // TODO remove the correct entry! See issue #28
window.parent.location.replace("/admin/servlet/RemoveEntry?entry_id=${member.entryId}");
}
}
</script>
</td>
</c:if>
<td><a href="/servlet/GenerateVideo?entry_id=${member.entryId}" target="_top">View</a></td>
<td><a href="/servlet/GenerateReport?entry_id=${member.entryId}&timezone=${member.timeZone}" target="_top">Generate</a></td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>
59 changes: 19 additions & 40 deletions carcv-webapp/src/main/webapp/app/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,40 @@
<link rel="SHORTCUT ICON" href="http://upload.wikimedia.org/wikipedia/commons/f/f0/Car_with_Driver-Silhouette.svg">
<link rel="icon" href="http://upload.wikimedia.org/wikipedia/commons/f/f0/Car_with_Driver-Silhouette.svg" type="image/ico">
<title>CarCV</title>
<link rel="stylesheet" type="text/css" href="/resources/mystyle.css">
<style type="text/css">
#tabulator {
text-align: center;
height: 25px
}
</style>
<link rel="stylesheet" type="text/css" href="/resources/site.css">
</head>

<body>
<div id="header">
<a href="/app/index.jsp" target="_top"><img src="/resources/carcv-logo.png" width="150"
id="logo"
alt="OpenCV" /></a>
<p style="position: absolute; right: 8%; top: 2%; font-size: 11pt; word-spacing: .5em;">
<strong> <a href="/app/index.jsp" target="_top" style="text-decoration: none">Home</a> <a
href="/info/features.jsp" target="_top" style="text-decoration: none">Features</a> <a href="/info/contribute.jsp"
style="text-decoration: none">Contribute</a> <a href="/info/contact_us.jsp" target="_top"
style="text-decoration: none; word-spacing: 0em;">Contact us</a>
<div class="header">
<div class="logo"> <a href="/app/index.jsp" target="_top">
<img src="/resources/carcv-logo.png" alt="OpenCV" /></a>
</div>
<div class="topRow"> <strong>
<span class="link"><a href="/app/index.jsp" target="_top" >Home</a></span>
<span class="link"><a href="/info/features.jsp" target="_top" >Features</a></span>
<span class="link"><a href="/info/contribute.jsp">Contribute</a></span>
<span class="link"><a href="/info/contact_us.jsp" target="_top">Contact us</a></span>
</strong>
</p>
</div>
</div>

<div id="panel">
<p style="line-height: 200%; word-break: normal;">
<!--spravit tabulku-->
</p>
<table style="border: 0px;">
<tr style="text-align: center;">
<td><a href="/servlet/Recognize" target="_top"
style="position: absolute; left: 30%; text-align: center; text-decoration: none">Refresh DB</a><br></td>
</tr>
<tr style="text-align: center;">
<td><a href="/app/upload.jsp" target="_top" style="position: absolute; left: 37%; text-decoration: none">Upload</a><br>
</td>
</tr>
<tr>
<td><a href="/servlet/Logout" target="_top" style="position: absolute; left: 35%; text-decoration: none">Log
out</a><br></td>
</tr>
</table>
<div class="leftPanel">
<div class="panelItem"><button id="deleteButton">Delete selected entries</button></div>
<div class="panelItem"><a href="/servlet/Recognize" target="_top">Refresh DB</a></div>
<div class="panelItem"><a href="/app/upload.jsp" target="_top">Upload</a></div>
<div class="panelItem"><a href="/servlet/Logout" target="_top">Log out</a></div>
</div>

<div id="center-norm">
<div class="mainColumn">
<script type="text/javascript" src='/resources/jstz-1.0.4.min.js'></script>
<script type="text/javascript">
function getTimezone() {
var timezone = jstz.determine();
return timezone.name();
}
document.write("<iframe style=\"overflow-y: scroll; width: 99%; height: 98.5%; border: 5px solid #B0C4DE\""
+ "src=\"/servlet/CarTable?timezone="+getTimezone()+"\"></iframe>");
document.write("<iframe id=\"tableFrame\" src=\"/servlet/CarTable?timezone=" + getTimezone() + "\"></iframe>");
</script>
</div>

<div id="footer"></div>
<div class="footer"></div>
</body>
</html>
47 changes: 16 additions & 31 deletions carcv-webapp/src/main/webapp/app/refresh_in_progress.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="SHORTCUT ICON" href="http://upload.wikimedia.org/wikipedia/commons/f/f0/Car_with_Driver-Silhouette.svg">
<link rel="icon" href="http://upload.wikimedia.org/wikipedia/commons/f/f0/Car_with_Driver-Silhouette.svg" type="image/ico">
<title>CarCV</title>
<link rel="stylesheet" type="text/css" href="/resources/mystyle.css">
<link rel="stylesheet" type="text/css" href="/resources/site.css">
<style type="text/css">
#tabulator {
text-align: center;
Expand All @@ -15,40 +15,25 @@
</head>

<body>
<div id="header">
<a href="/app/index.jsp" target="_top"><img src="/resources/carcv-logo.png" width="150"
id="logo"
alt="OpenCV" /></a>
<p style="position: absolute; right: 8%; top: 2%; font-size: 11pt; word-spacing: .5em;">
<strong> <a href="/app/index.jsp" target="_top" style="text-decoration: none">Home</a> <a
href="/info/features.jsp" target="_top" style="text-decoration: none">Features</a> <a href="/info/contribute.jsp"
style="text-decoration: none">Contribute</a> <a href="/info/contact_us.jsp" target="_top"
style="text-decoration: none; word-spacing: 0em;">Contact us</a>
<div class="header">
<div class="logo"> <a href="/app/index.jsp" target="_top">
<img src="/resources/carcv-logo.png" alt="OpenCV" /></a>
</div>
<div class="topRow"> <strong>
<span class="link"><a href="/app/index.jsp" target="_top" >Home</a></span>
<span class="link"><a href="/info/features.jsp" target="_top" >Features</a></span>
<span class="link"><a href="/info/contribute.jsp">Contribute</a></span>
<span class="link"><a href="/info/contact_us.jsp" target="_top">Contact us</a></span>
</strong>
</p>
</div>
</div>

<div id="panel">
<p style="line-height: 200%; word-break: normal;">
<!--spravit tabulku-->
</p>
<table style="border: 0px;">
<tr style="text-align: center;">
<td><a href="/servlet/Recognize" target="_top"
style="position: absolute; left: 30%; text-align: center; text-decoration: none">Refresh DB</a><br></td>
</tr>
<tr style="text-align: center;">
<td><a href="/app/upload.jsp" target="_top" style="position: absolute; left: 37%; text-decoration: none">Upload</a><br>
</td>
</tr>
<tr>
<td><a href="/servlet/Logout" target="_top" style="position: absolute; left: 35%; text-decoration: none">Log
out</a><br></td>
</tr>
</table>
<div class="leftPanel">
<div class="panelItem"><a href="/servlet/Recognize" target="_top">Refresh DB</a></div>
<div class="panelItem"><a href="/app/upload.jsp" target="_top">Upload</a></div>
<div class="panelItem"><a href="/servlet/Logout" target="_top">Log out</a></div>
</div>

<div id="center-login">
<div class="mainColumn">
<h1>Refresh is in progress...</h1>
<br>
<h3>
Expand Down

0 comments on commit 600dab0

Please sign in to comment.