Skip to content
Snippets Groups Projects
Commit f598d0c4 authored by Sven Kästle's avatar Sven Kästle
Browse files

feat: Add unstructured annotation page and show submission text based on id

parent 81e3a6d7
No related branches found
No related tags found
No related merge requests found
body, html {
height: 100vh;
width: 100vw;
}
ol {
padding: 0px;
margin: 0px;
list-style-type: none;
}
.content-mainpage {
display: flex;
box-sizing: border-box;
font-family: Arial;
height: 100%;
overflow-y: hidden;
}
.rightcolumn {
float: right;
width: 25%;
display: inline-block;
overflow: scroll;
/* background-color: blue; */
}
.leftcolumn {
padding: 10px;
float: left;
width: 75%;
display: inline-block;
/* background-color: yellow; */
}
.rightcontent {
margin: 10px;
}
.leftcontent {
max-height: 100%;
display: flex;
flex-flow: column;
/* background-color: white; */
}
.spacing {
height: 10px;
/* background-color: orange; */
}
.container-fluid-content {
display: flex;
flex-flow: column;
height: 100%;
}
.flex {
display: flex;
}
.flex .container-fluid{
flex: 1;
}
.full-height {
height: 100%;
}
.leftcontent-buttons-save {
float: right;
margin: 20px;
}
.leftcontent-text {
overflow: scroll;
white-space: pre-line;
}
/**
* This function will fire when the DOM is ready
*/
$(document).ready(function() {
// fetch the document text of the given id
getFullSubmission(getSubmissionIdFromUrl(), function (response) {
// set text in div
$('#documentText').html(response.text);
}, function () {
// jump to previous page on error
location.href="unstructured-upload.jsp?token="+getUserTokenFromUrl();
});
/**
* Context menu handler
*/
$.contextMenu({
selector: '.context-menu-one',
callback: function(key, options) {
// TODO - show and handle more options
// action for 'annotation' click
if (key == 'annotation') {
}
},
items: {
"annotation": {name: "Annotation", icon: "edit"}
}
});
});
/**
* Get the id of a full submission from url
*
* @returns The id of the full submission
*/
function getSubmissionIdFromUrl() {
var parts = window.location.search.substr(1).split("&");
var $_GET = {};
for (var i = 0; i < parts.length; i++) {
var temp = parts[i].split("=");
$_GET[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
}
return $_GET['submission'];
}
...@@ -22,7 +22,7 @@ $(document).ready(function() { ...@@ -22,7 +22,7 @@ $(document).ready(function() {
$('#upload-textarea').val(""); $('#upload-textarea').val("");
// jump to next page // jump to next page
location.href="project-student.jsp?token=" + getUserTokenFromUrl() + "&submission=" + response.id; location.href="unstructured-annotation.jsp?token=" + getUserTokenFromUrl() + "&submission=" + response.id;
}); });
} }
}); });
......
...@@ -24,8 +24,9 @@ function createFullSubmission(fullSubmissionPostRequest, responseHandler) { ...@@ -24,8 +24,9 @@ function createFullSubmission(fullSubmissionPostRequest, responseHandler) {
* *
* @param id The id of the full submission * @param id The id of the full submission
* @param responseHandler The response handler * @param responseHandler The response handler
* @param errorHandler The error handler
*/ */
function getAnnotation(id, responseHandler) { function getFullSubmission(id, responseHandler, errorHandler) {
var url = "../rest/submissions/full/" + id; var url = "../rest/submissions/full/" + id;
$.ajax({ $.ajax({
url: url, url: url,
...@@ -34,6 +35,10 @@ function getAnnotation(id, responseHandler) { ...@@ -34,6 +35,10 @@ function getAnnotation(id, responseHandler) {
success: function (response) { success: function (response) {
// handle the response // handle the response
responseHandler(response); responseHandler(response);
},
error: function () {
// handle the error
errorHandler();
} }
}) })
} }
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="menu" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="headLine" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="omniDependencies" %>
<!DOCTYPE html>
<html>
<head>
<omniDependencies:omniDependencies/>
<!-- css - unstructured-annotation -->
<link rel="stylesheet" type="text/css" href="../assets/css/unstructured-annotation.css">
<!-- css - contextMenu -->
<link href="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<!-- js - jQuery ui position -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" type="text/javascript"></script>
<!-- js - contextMenu script -->
<script src="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.js" type="text/javascript"></script>
<!-- js - unstructuredUpload -->
<script src="../assets/js/unstructuredAnnotation.js"></script>
<!-- js - unstructuredUploadRest -->
<script src="../assets/js/unstructuredUploadRest.js"></script>
</head>
<body>
<div id="wrapper" class="full-height">
<menu:menu></menu:menu>
<div class="page-content-wrapper full-height">
<div class="container-fluid full-height">
<div class="container-fluid-content">
<div class="flex">
<headLine:headLine/>
</div>
<div class="content-mainpage">
<div class="leftcolumn">
<div class="leftcontent">
<div class="leftcontent-text context-menu-one" id="documentText"></div>
<div class="leftcontent-buttons">
<div class="leftcontent-buttons-save">
<button id="btnSave" type="button" class="btn btn-secondary">Speichern</button>
</div>
</div>
</div>
</div>
<div class="rightcolumn">
<div class="rightcontent">
<ol id="annotations">
</ol>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment