Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
berndmoos committed Dec 11, 2024
1 parent 0136753 commit 8db201c
Show file tree
Hide file tree
Showing 5 changed files with 655 additions and 7 deletions.
130 changes: 130 additions & 0 deletions src/main/java/org/zumult/io/exb2Partitur.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math"
version="3.0">

<xsl:variable name="TIMELINE_COPY">
<timeline>
<xsl:for-each select="//tli">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="position" select="count(preceding-sibling::tli) + 1"/>
</xsl:copy>
</xsl:for-each>
</timeline>
</xsl:variable>

<xsl:template match="/">
<div>


<div style="width:100%; overflow:auto;" >
<table class="w-100 d-block d-md-table">
<tr>
<td class="empty"> </td>
<xsl:apply-templates select="//tli"/>
</tr>
<xsl:apply-templates select="//tier"/>
</table>
</div>

<!-- <div style="width:100%; text-align:center; margin-top:10px;">
<svg id="measurement" width="2400" height="200" xmlns="http://www.w3.org/2000/svg" style="background:rgb(220,220,220); border: dotted 3px gray">
<text x="5" y="15" fill="black">Some measurement</text>
<line x1="0" y1="100" x2="2400" y2="100" style="stroke:gray;stroke-width:2" stroke-dasharray="4" />
<circle id="circle1" cx="0" cy="100" r="10" style="fill:red;" />
<rect id="rect1" x ="0" y="80" height="12" width ="12" stroke-width ="1px" stroke ="black" fill="white" />
<line id="line1" x1="0" y1="100" x2="0" y2="80" style="stroke:black;stroke-width:1"/>
</svg>
</div> -->
</div>

</xsl:template>

<xsl:template match="tli">
<td class="tli">
<xsl:attribute name="data-start">
<xsl:value-of select="@time"/>
</xsl:attribute>
<xsl:attribute name="data-end">
<xsl:value-of select="following-sibling::tli[1]/@time"/>
</xsl:attribute>
<xsl:value-of select="position()"/>
</td>
</xsl:template>

<xsl:template match="tier">
<xsl:variable name="TIER_COPY">
<xsl:copy-of select="."/>
</xsl:variable>
<tr>
<td>
<xsl:attribute name="class">
<!-- <xsl:value-of select="@category"/>--><xsl:text> label</xsl:text>
</xsl:attribute>
<xsl:value-of select="@display-name"/>
</td>
<xsl:apply-templates select="event"/>
</tr>
</xsl:template>

<xsl:template match="event">
<xsl:variable name="START" select="@start"/>
<xsl:choose>
<xsl:when test="preceding-sibling::event[1]">
<xsl:variable name="PRECEDING_END" select="preceding-sibling::event[1]/@end"/>
<xsl:if test="not(@start=$PRECEDING_END)">
<td class="empty">
<xsl:attribute name="colspan">
<xsl:value-of select="$TIMELINE_COPY/descendant::tli[@id=$START]/@position - $TIMELINE_COPY/descendant::tli[@id=$PRECEDING_END]/@position"/>
</xsl:attribute>
</td>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$TIMELINE_COPY/descendant::tli[@id=$START]/@position &gt;1">
<td class="empty">
<xsl:attribute name="colspan">
<xsl:value-of select="$TIMELINE_COPY/descendant::tli[@id=$START]/@position - 1"/>
</xsl:attribute>
</td>
</xsl:if>
</xsl:otherwise>
</xsl:choose>

<xsl:variable name="END" select="@end"/>
<xsl:variable name="COLSPAN" select="$TIMELINE_COPY/descendant::tli[@id=$END]/@position - $TIMELINE_COPY/descendant::tli[@id=$START]/@position"/>
<td>
<xsl:attribute name="colspan">
<xsl:value-of select="$COLSPAN"/>
</xsl:attribute>
<xsl:attribute name="class">
<xsl:value-of select="../@category"/>
</xsl:attribute>
<xsl:attribute name="data-start">
<xsl:value-of select="$TIMELINE_COPY/descendant::tli[@id=$START]/@time"/>
</xsl:attribute>
<xsl:attribute name="data-end">
<xsl:value-of select="$TIMELINE_COPY/descendant::tli[@id=$END]/@time"/>
</xsl:attribute>
<xsl:value-of select="text()"/>
</td>

<xsl:if test="not(following-sibling::event[1])">
<td class="empty">
<xsl:variable name="COLSPAN" select="$TIMELINE_COPY/descendant::tli[last()]/@position - $TIMELINE_COPY/descendant::tli[@id=$END]/@position"/>
<xsl:attribute name="colspan">
<xsl:value-of select="$COLSPAN"/>
</xsl:attribute>
</td>

</xsl:if>

</xsl:template>



</xsl:stylesheet>
4 changes: 2 additions & 2 deletions web/WEB-INF/jspf/zumultNav.jspf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<%@page import="org.zumult.objects.IDList"%>
<%@ page pageEncoding="UTF-8" %>
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<a class="navbar-brand" href="http://agd.ids-mannheim.de/folk.shtml">
<a class="navbar-brand" href="http://zumult.org">
<% String imgSrc = "../images/agd.png"; %>
<img src="<%= imgSrc %>" height="30" class="d-inline-block align-top" alt=""/>
<!-- <img src="<%= imgSrc %>" height="30" class="d-inline-block align-top" alt=""/> -->
</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand" href="http://www.zumult.org"><b><%= pageName %></b></a>
Expand Down
18 changes: 13 additions & 5 deletions web/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@page import="java.util.Locale"%>
<%@page import="java.util.Random"%>
<%@page import="java.util.ResourceBundle"%>
<%@page import="org.zumult.objects.IDList"%>
<%@page import="org.zumult.backend.BackendInterfaceFactory"%>
Expand Down Expand Up @@ -60,8 +61,11 @@
<%
String pageTitle = myResources.getString("testApp");
BackendInterface bi = BackendInterfaceFactory.newBackendInterface();
IDList allTranscriptIDs = bi.getTranscripts4Corpus(bi.getCorpora().get(0));
String randomTranscriptID = allTranscriptIDs.get((int)(Math.random() * (allTranscriptIDs.size())));
Random random = new Random();
IDList allCorpusIDs = bi.getCorpora();
String randomCorpusID = allCorpusIDs.get(random.nextInt(allCorpusIDs.size()));
IDList allTranscriptIDs = bi.getTranscripts4Corpus(randomCorpusID);
String randomTranscriptID = allTranscriptIDs.get(random.nextInt(allTranscriptIDs.size()));
%>

<body style="background-image: url('./images/talking.png');">
Expand All @@ -73,12 +77,13 @@
</div>
<div class="col-sm-8" style="background:white;padding-top: 20px; border-radius: 15px;">
<div class="m-3 text-center">
<a href="./jsp/corpusoverview.jsp?lang=<%=currentLocale.getLanguage()%>" class="btn btn-outline-info" target="_blank">Corpora</a>
This ZuMult instance has <%= allCorpusIDs.size() %> corpora: <%= String.join(" / ", allCorpusIDs) %>
<a href="./jsp/corpusoverview.jsp?lang=<%=currentLocale.getLanguage()%>" class="btn btn-outline-info ml-3" target="_blank">Corpus Overview</a>
</div>

<div class="card-deck">
<div class="card mb-3">
<img class="card-img-top" src="./images/query.jpg" alt="Card image cap">
<img class="card-img-top" src="./images/query.png" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">ZuRecht</h5>
<p class="card-text"><%=myResources.getString("ZuRechtShort")%></p>
Expand All @@ -88,9 +93,12 @@
<div class="card mb-3">
<img class="card-img-top" src="./images/transcript2.png" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">ZuViel</h5>
<h5 class="card-title">ZuViel / ZuPass / ZuAnn</h5>
<p class="card-text"><%=myResources.getString("ZuVielShort")%></p>
<a href="./jsp/zuViel.jsp?transcriptID=<%= randomTranscriptID %>" class="btn btn-primary" target="_blank">ZuViel</a>
<a href="./jsp/zuPass.jsp?transcriptID=<%= randomTranscriptID %>" class="btn btn-primary" target="_blank">ZuPass</a>
<a href="./jsp/zuAnn.jsp?transcriptID=<%= randomTranscriptID %>" class="btn btn-primary" target="_blank">ZuAnn</a>
<small class="text-muted ml-2"><%= randomCorpusID %> / <%= randomTranscriptID %> </small>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 8db201c

Please sign in to comment.