Skip to content

Commit

Permalink
#218 and some other changes in passing
Browse files Browse the repository at this point in the history
  • Loading branch information
berndmoos committed Dec 19, 2024
1 parent a361fe7 commit 29f0649
Show file tree
Hide file tree
Showing 12 changed files with 176 additions and 69 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/zumult/io/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public class Constants {
public static String WORDLIST2HTML_STYLESHEET = "/org/zumult/io/tokenlist2html_table.xsl";

// new for #175
public static String EVENT2HTML_STYLESHEET = "/org/zumult/io/folkEvent2html_table.xsl";
public static String SPEECHEVENT2HTML_STYLESHEET = "/org/zumult/io/speechEvent2Table.xsl";
public static String SPEAKER2HTML_STYLESHEET = "";
public static String EVENT2HTML_STYLESHEET = "/org/zumult/io/communication2HTML.xsl";
public static String SPEECHEVENT2HTML_STYLESHEET = "/org/zumult/io/communication2HTML.xsl";
public static String SPEAKER2HTML_STYLESHEET = "/org/zumult/io/speaker2HTML.xsl";
public static String EVENT_TITLE_METADATAKEY = "v_e_se_art";

// issue #55
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/org/zumult/io/communication2HTML.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Document : communication2HTML.xsl
Created on : 19 December 2024, 14:17
Author : bernd
Description:
Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="html"/>

<xsl:template match="/">
<table class="table table-striped">
<xsl:apply-templates select="//Communication/Description/Key">
<xsl:sort select="@Name"/>
</xsl:apply-templates>
</table>
</xsl:template>

<xsl:template match="Key">
<tr>
<td class="metadatakey"><xsl:value-of select="@Name"/></td>
<td class="metadatavalue"><xsl:value-of select="text()"/></td>
</tr>
</xsl:template>

</xsl:stylesheet>
29 changes: 29 additions & 0 deletions src/main/java/org/zumult/io/speaker2HTML.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Document : communication2HTML.xsl
Created on : 19 December 2024, 14:17
Author : bernd
Description:
Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="html"/>

<xsl:template match="/">
<table class="table table-striped">
<xsl:apply-templates select="//Speaker/Description/Key">
<xsl:sort select="@Name"/>
</xsl:apply-templates>
</table>
</xsl:template>

<xsl:template match="Key">
<tr>
<td class="metadatakey"><xsl:value-of select="@Name"/></td>
<td class="metadatavalue"><xsl:value-of select="text()"/></td>
</tr>
</xsl:template>

</xsl:stylesheet>
12 changes: 11 additions & 1 deletion src/main/java/org/zumult/webservices/ZumultDataServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.zumult.objects.SpeechEvent;
import org.zumult.objects.TokenList;
import org.zumult.objects.Transcript;
import org.zumult.objects.implementations.COMAMedia;
import org.zumult.objects.implementations.ISOTEITranscript;

/**
Expand Down Expand Up @@ -173,6 +172,11 @@ private void getSpeakerMetadataHTML(HttpServletRequest request, HttpServletRespo
try {
BackendInterface backend = BackendInterfaceFactory.newBackendInterface();
String speakerID = request.getParameter("speakerID");
String transcriptID = request.getParameter("transcriptID");
if (transcriptID!=null){
// i.e. speakerID is a transcript sigle, not the corpus ID
speakerID = backend.getTranscript(transcriptID).getSpeakerIDBySpeakerInitials(speakerID);
}
if (speakerID!=null){
Speaker speaker = backend.getSpeaker(speakerID);
String speakerXML = speaker.toXML();
Expand Down Expand Up @@ -206,6 +210,12 @@ private void getEventMetadataHTML(HttpServletRequest request, HttpServletRespons
BackendInterface backend = BackendInterfaceFactory.newBackendInterface();
// this does not really make sense : we want event metadata, so why are we passing speechEventID as parameter?
String speechEventID = request.getParameter("speechEventID");
if (speechEventID==null){
String transcriptID = request.getParameter("transcriptID");
if (transcriptID!=null){
speechEventID = backend.getSpeechEvent4Transcript(transcriptID);
}
}
if (speechEventID!=null){
// changed for issue #175
//Event event = backend.getEvent(eventID.substring(0,12));
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/resources/MessageBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ SearchOptions=Search Options
SearchVocabularyLists=Search by lemma and query lists
SelectOne=select one
ShortDescription=short description
ShowEventMetadataInDGD=Show event metadata in DGD
ShowEventMetadataIn=Show event metadata
ShowExcerptInDGD=Show excerpt in DGD
ShowExcerptInZuMult=Show excerpt in ZuViel
ShowMore=show more
ShowLess=show less
ShowSpeakerMetadataInDGD=Show speaker metadata in DGD
ShowSpeakerMetadata=Show speaker metadata
SortBy=Sort by
SortedBy=Sorted by
Tokens=tokens
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/resources/MessageBundle_de_DE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ ForRelevantTopicsInGFLDidactics=f\u00fcr relevante Themen in der DaF-Didaktik
SearchInputFieldPlaceholder=Ihr CQP-Suchausdruck ...
HitsPerPage=Treffer pro Seite
HoldCTRLToSelectAndDeselectMoreThanOne=Halten Sie die Strg-Taste gedr\u00fcckt um mehr als eine Option zu markieren
ShowSpeakerMetadataInDGD=Klicken, um Sprecherdokumentation in der DGD anzuzeigen
ShowEventMetadataInDGD=Klicken, um Ereignisdokumentation in der DGD anzuzeigen
ShowSpeakerMetadata=Sprecherdokumentation anzeigen
ShowEventMetadata=Ereignisdokumentation anzeigen
ShowMore=mehr zeigen
ShowLess=weniger zeigen
SearchByIndividualSpeakers=Sprecher-basierte Suche
Expand Down
2 changes: 0 additions & 2 deletions web/WEB-INF/jspf/metadataModal.jspf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
<div class="modal-body" id="metadata-body">
</div>
<div class="modal-footer">
<a href="#" id="metadata-transcript-link" target="_blank">Transkript anzeigen</a>
<a href="#" id="metadata-transcript-dgd-link" target="_blank">Transkript in DGD</a>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions web/WEB-INF/jspf/zuRechtContextOptions.jspf
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<div class="col">
<label><%=myResources.getString("Left").toLowerCase()%> <small><i>(max. 25 <%=myResources.getString("WordTokens")%>)</i></small></label>
<div class="form-group">
<input type="text" class="form-control form-control-sm customLeftContextLength" maxlength="2" value="3">
<input type="text" class="form-control form-control-sm customLeftContextLength" maxlength="2" value="5">
</div>
</div>
<div class="col">
<label><%=myResources.getString("Right").toLowerCase()%> <small><i>(max. 25 <%=myResources.getString("WordTokens")%>)</i></small></label>
<div class="form-group mr-2">
<input type="text" class="form-control form-control-sm customRightContextLength" maxlength="2" value="3">
<input type="text" class="form-control form-control-sm customRightContextLength" maxlength="2" value="5">
</div>
</div>
</div>
Expand Down
7 changes: 7 additions & 0 deletions web/css/query.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ td.numberOfAbsAndRelHits {text-align: center; width: 100px;}
th {text-align: center; background-color: #d9edf7; color: #337AB7;white-space:nowrap;}
th.numbering {text-align: left;}

td.left-context{text-align: right; min-width: 250px; margin-left: 30px;}
td.hit{text-align: center;}
td.right-context{text-align: left; min-width: 250px; margin-right: 30px;}

td.metadatakey {text-align: right; font-weight:bold;}
td.metadatavalue {text-align: left; font-weight:normal;}

/************** collapsible elements ******/
.content {display: none;}
.collapsible {cursor: pointer; border: none; text-align: right; text-decoration: underline; color: blue; margin: 10px; color: #337AB7;}
Expand Down
9 changes: 7 additions & 2 deletions web/jsp/zuAnn.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
}
String vttURL = Configuration.getWebAppBaseURL() + "/ZumultDataServlet?command=getVTT&transcriptID=" + transcriptID;
int height = 400;
if (videoIDs.isEmpty()){
height+=320;
}
%>

Expand All @@ -69,7 +74,7 @@
<html>
<html>
<head>
<script src="../js/media_zupass.js"></script>
<script src="../js/media_zuann.js"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://kit.fontawesome.com/e215b03c17.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="../css/annotation.css">
Expand Down Expand Up @@ -165,7 +170,7 @@

<div id="partitur-form" class="row mt-2">
<div class="col-1"></div>
<div class="col-10 overflow-auto" style="height: 400px; width: 100%;">
<div class="col-10 overflow-auto" style="height: <%= Integer.toString(height)%>px; width: 100%;">
<%= html %>
</div>
<div class="col-1"></div>
Expand Down
53 changes: 48 additions & 5 deletions web/jsp/zuRecht.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ String annotationTagSetXML = annotationTagSetString.replace("\"", "\\\"").replac
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script src="https://kit.fontawesome.com/ed5adda70b.js" crossorigin="anonymous"></script>


<script src="https://unpkg.com/wavesurfer.js"></script>
<script src="https://unpkg.com/wavesurfer.js/dist/plugin/wavesurfer.regions.min.js"></script>
Expand Down Expand Up @@ -144,10 +146,12 @@ String annotationTagSetXML = annotationTagSetString.replace("\"", "\\\"").replac
</div>
</div>
</div>
<%@include file="../WEB-INF/jspf/metadataModal.jspf" %>
</div>

<%@include file="../WEB-INF/jspf/zuRechtConstants.jspf" %>
<script type="text/javascript">
var BASE_URL = '<%= Configuration.getWebAppBaseURL() %>';
var languageTag = '<%=currentLocale.toLanguageTag()%>';
var ajaxSearchRequest = null;
var ajaxDownLoadRequest = null;
Expand Down Expand Up @@ -406,8 +410,8 @@ String annotationTagSetXML = annotationTagSetString.replace("\"", "\\\"").replac
$(selector).find('.rowData-KWICSearch').text(xml);
var data = new FormData();
data.append('speakerInitialsToolTip', '<%=myResources.getString("ShowSpeakerMetadataInDGD")%>');
data.append('transcriptIdToolTip', '<%=myResources.getString("ShowEventMetadataInDGD")%>');
data.append('speakerInitialsToolTip', '<%=myResources.getString("ShowSpeakerMetadata")%>');
data.append('transcriptIdToolTip', '<%=myResources.getString("ShowEventMetadata")%>');
data.append('zuMultToolTip', '<%=myResources.getString("ShowExcerptInZuMult")%>');
data.append('dgdToolTip', '<%=myResources.getString("ShowExcerptInDGD")%>');
Expand Down Expand Up @@ -477,14 +481,53 @@ String annotationTagSetXML = annotationTagSetString.replace("\"", "\\\"").replac
}
function openMetadata(obj){
$(obj).closest('form').append("<input type='hidden' name='lang' value='"+ '<%=currentLocale.getLanguage()%>' +"' />");
$(obj).closest('form').submit();
let transcriptID = $(obj).data('transcriptid');
$.post(
BASE_URL + "/ZumultDataServlet",
{
command: 'getEventMetadataHTML',
transcriptID: transcriptID
},
function( data ) {
$("#metadata-body").html(data);
$("#metadata-title").html(transcriptID);
$('#metadataModal').modal("toggle");
}
);
}
function openSpeakerMetadata(obj){
let speakerID = $(obj).data('speakerid');
let transcriptID = $(obj).data('transcriptid');
$.post(
BASE_URL + "/ZumultDataServlet",
{
command: 'getSpeakerMetadataHTML',
speakerID: speakerID,
transcriptID: transcriptID
},
function( data ) {
$("#metadata-body").html(data);
$("#metadata-title").html(speakerID);
$('#metadataModal').modal("toggle");
}
);
}
function openTranscript(obj){
$(obj).closest('form').submit();
}
function playbackMedia(obj){
let transcriptID = $(obj).data('transcriptid');
let tokenID = $(obj).data('tokenid');
alert(transcriptID + " / " + tokenID);
}
/**************************************************/
/* other help methods */
Expand Down Expand Up @@ -532,7 +575,7 @@ String annotationTagSetXML = annotationTagSetString.replace("\"", "\\\"").replac
function configureContext(selectorModal, selectorForm){
var defaultContextLength = 3;
var defaultContextLength = 5; // changed that from 3
var regex = /^(0?\d|1\d|2[0-5])$/;
var left = $(selectorModal).find(":text.customLeftContextLength").val();
if (!left.match(regex)) {
Expand Down
Loading

0 comments on commit 29f0649

Please sign in to comment.