Export Demo
Change-Id: If68df97b29ee279087be5f0952ec9b5c88ec4121
diff --git a/dev/demo/export.html b/dev/demo/export.html
new file mode 100644
index 0000000..4de4ad5
--- /dev/null
+++ b/dev/demo/export.html
@@ -0,0 +1,161 @@
+ <!DOCTYPE html>
+<html>
+ <head>
+ <title>Export Demo</title>
+ <meta charset="utf-8" />
+ <link type="text/css" rel="stylesheet" href="../css/kalamar.css" />
+ <link type="text/css" rel="stylesheet" href="../css/kwic.css" />
+
+ <script>//<![CDATA[
+
+ window.KorAP = window.KorAP || {};
+ KorAP.URL = '';
+
+ //]]></script>
+ <script data-main="export.js" src="../js/lib/require.js" async="async"></script>
+ </head>
+ <body>
+ <p>To run this demo start the <a href= https://korap.ids-mannheim.de/gerrit/admin/repos/KorAP/KalamarExportPlugin> Plugin Server</a> as Java Application or with the jar file in the /target folder.</p>
+
+ <div id="resultinfo" class="found"></div>
+
+ <script>
+
+KorAP.koralQuery = {
+ "matches":["..."],
+ "corpus":{
+ "@type": "koral:docGroup",
+ "operation": "operation:or", "operands": [{
+ "@type": "koral:docGroup",
+ "operation": "operation:and",
+ "operands": [
+ {
+ "@type": "koral:doc",
+ "key": "title",
+ "match": "match:eq",
+ "value": "Der Birnbaum",
+ "type": "type:string"
+ },
+ {
+ "@type": "koral:doc",
+ "key": "pubPlace",
+ "match": "match:eq",
+ "value": "Mannheim",
+ "type": "type:string"
+ },
+ {
+ "@type": "koral:docGroup",
+ "operation": "operation:or",
+ "operands": [
+ {
+ "@type": "koral:doc",
+ "key": "subTitle",
+ "match": "match:eq",
+ "value": "Aufzucht und Pflege",
+ "type": "type:string"
+ },
+ {
+ "@type": "koral:doc",
+ "key": "subTitle",
+ "match": "match:eq",
+ "value": "Gedichte",
+ "type": "type:string"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "@type": "koral:doc",
+ "key": "pubDate",
+ "match": "match:geq",
+ "value": "2015-03-05",
+ "type": "type:date",
+ "rewrites" : [{
+ "@type" : "koral:rewrite",
+ "operation" : "operation:modification",
+ "src" : "querySerializer",
+ "scope" : "tree"
+ }]
+ }
+ ]
+}, "query":{"wrap":{"layer":"orth","match":"match:eq","foundry":"opennlp","key":"Goethe","@type":"koral:term"},"@type":"koral:token"},"meta":{"serialQuery":"tokens:s:Goethe","startIndex":0,"version":"unknown","itemsPerPage":25,"context":"p","benchmark":"0.103553092 s","totalResults":-1}};
+ </script>
+
+ <div id="search">
+ <ol class="align-left" tabindex="-8">
+ <li data-corpus-id="WPD"
+ data-doc-id="WWW"
+ data-text-id="03313"
+ data-match-id="p102-103"
+ data-available-info="base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans malt/d=rels"
+ id="WPD-WWW.03313-p102-103"
+ tabindex="6">
+ <div class="meta">WPD/WWW/03313</div>
+ <div class="match-main">
+ <div class="match-wrap">
+ <div class="snippet startMore endMore">
+ <div class="flag"></div>
+ <span class="context-left">In diesem Beispiel ist zu sehen, dass die beiden Variablen a und b lediglich ihre Werte an die Funktion </span><mark><mark class="class-2 level-1">Dies </mark><mark class="class-1 level-0"><mark class="class-2 level-1"><mark class="class-3 level-2">ist</mark> ein</mark> Test</mark></mark><span class="context-right"> übergeben, aber im Gegensatz zu einem Referenzparamter dabei unverändert bleiben.</span></div>
+ </div>
+ <!-- only inject via javascript! -->
+ </div>
+ <p class="ref"><strong>Wertparameter</strong> by Hubi,Zwobot,4; published on 2005-03-28 as WWW.03313 (WPD)</p>
+ <!-- only inject via javascript! -->
+ </li>
+ <li data-corpus-id="WPD"
+ data-doc-id="FFF"
+ data-text-id="01460"
+ data-match-id="p119-120"
+ data-available-info="base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans malt/d=rels"
+ id="WPD-FFF.01460-p119-120"
+ tabindex="6">
+ <div class="meta">WPD/III/78432</div>
+ <div class="match-main">
+ <div class="match-wrap">
+ <div class="snippet startMore endMore"><span class="context-left">Der Fehler unterläuft häufig bei der direkten Übersetzung aus dem Englischen, wenn im originalen Ausdruck die beiden Wortteile verschiedene Wörter sind und sich das Adjektiv wahlweise auf das erste oder zweite Wort bezieht. Ein Beispiel ist multiples Testproblem für multiple </span><span class="match">test</span><span class="context-right"> problem.</span></div>
+ <div class="tokenInfo"></div>
+ </div>
+ </div>
+ <p class="ref"><strong>Fehlbezogenes Adjektiv</strong> by Joni2,Peterlustig,BWBot; published on 2005-03-28 as FFF.01460 (WPD)</p>
+ </li>
+
+ <li data-corpus-id="WPD"
+ data-doc-id="HHH"
+ data-text-id="06056"
+ data-match-id="p2564-2565"
+ data-available-info="base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans malt/d=rels"
+ id="WPD-HHH.06056-p2564-2565"
+ tabindex="6">
+ <div class="meta">WPD/HHH/06056</div>
+ <div class="match-main">
+ <div class="match-wrap">
+ <div class="snippet startMore endMore">
+ <div class="flag"></div>
+ <span class="context-left">HDTV Samples from European (and other) broadcasters and </span><span class="match">test</span><span class="context-right"> transmissions in Europe</span></div>
+ <div class="tokenInfo"></div>
+ </div>
+ </div>
+ <p class="ref"><strong>High Definition Television</strong> by ArtMechanic,TheK,Andreas -horn- Hornig; published on 2005-03-28 as HHH.06056 (WPD)</p>
+ </li>
+
+ <li data-match-id="p367-368"
+ data-text-sigle="Corola-journal/Journalistic/16438_a_17763"
+
+ data-available-info="dereko/s=spans drukola/l=tokens drukola/m=tokens drukola/p=tokens"
+ data-info="{"UID":0,"author":"Irina Coroiu","availability":"QAO-NC","corpusID":null,"corpusSigle":"Corola-journal","docID":null,"docSigle":"Corola-journal\/Journalistic","layerInfos":"dereko\/s=spans drukola\/l=tokens drukola\/m=tokens drukola\/p=tokens","license":"QAO-NC","matchID":"p367-368","pubDate":"2001","textClass":"Film","textID":null,"textSigle":"Corola-journal\/Journalistic\/16438_a_17763","title":"DRACULA revine!"}"
+ id="Corola-journal/Journalistic/16438_a_17763#p367-368">
+ <div class="meta flop">Corola-journal/Journalistic/16438_a_17763</div>
+ <div class="match-main">
+ <div class="match-wrap">
+ <div class="snippet startMore endMore"><span class="context-left"><span class="more"></span>ntrînd în joc, Richard Corliss spunea:"Acest film savuros redă personajului noblețea pentru a-l lăsa să se odihnească în pace". La sfîrșit de veac, în octombrie 2000, la final de psihoză milenaristă, Compania Kushner-Locke oferă această nouă versiune.Scenariul lui Tom </span><span class="match"><mark>Baum</mark></span><span class="context-right"> pretinde a fi cît mai aproape de realitate;regizorul Joe Chappelle a ambiționat o ultramodernă înfățișare a "Patimilor lui Țepeș" o suită de flash-back-uri iscate tot de un interogatoriu la care este supus eroul de către un sinod de preoți ortodocși<span class="more"></span></span></div>
+ </div>
+ </div>
+ <p class="ref"><strong>DRACULA revine!</strong> von Irina Coroiu (<time datetime="2001">2001</time>) <span class="sigle">[Corola-journal/Journalistic/16438_a_17763]</span> </p>
+ </li>
+ </ol>
+
+ </div>
+
+ </body>
+</html>
diff --git a/dev/demo/export.js b/dev/demo/export.js
new file mode 100644
index 0000000..0457436
--- /dev/null
+++ b/dev/demo/export.js
@@ -0,0 +1,81 @@
+/**
+ * Export Demo
+ *
+ * @author Helge
+ *
+ */
+
+requirejs.config({
+ baseUrl: '../js/src',
+ paths : {
+ 'lib': '../lib'
+ }
+});
+
+
+require(['plugin/server', 'panel/result'], function (pluginClass, resultPanelClass){
+
+ KorAP.Plugin = pluginClass.create();
+
+ // Add services container to head
+ document.head.appendChild(KorAP.Plugin.element());
+
+ //Register result plugin
+ KorAP.Plugin.register({
+ 'name' : 'Export',
+ 'desc' : 'Exports Kalamar results',
+ // 'about' : 'https://localhost:5678/',
+ 'embed' : [{
+ 'panel' : 'result',
+ 'title' : 'Export',
+ 'classes' : ['export'],
+ 'onClick' : {
+ 'action' : 'addWidget',
+ 'template' : 'http://localhost:7777/res/export.html'
+ }
+ }]
+ });
+
+ //Add result panel
+ var show = {};
+ var resultPanel = resultPanelClass.create(show);
+
+ var resultInfo = document.getElementById('resultinfo');
+ if (resultInfo != null) {
+ // Move buttons to resultinfo
+ resultInfo.appendChild(resultPanel.actions.element());
+ // The views are at the top of the search results
+ var sb = document.getElementById('search');
+ sb.insertBefore(resultPanel.element(), sb.firstChild);
+ };
+
+ resultPanel.addAlignAction();
+
+ // There is a koralQuery
+ if (KorAP.koralQuery !== undefined) {
+
+ // Add KoralQuery view to result panel
+ if (resultInfo !== null) {
+ resultPanel.addKqAction()
+ };
+
+ if (KorAP.koralQuery["errors"]) {
+ var errors = KorAP.koralQuery["errors"];
+ for (var i in errors) {
+
+ // Malformed query
+ if (errors[i][0] === 302 && errors[i][2]) {
+ obj.hint = hintClass.create();
+ obj.hint.alert(errors[i][2], errors[i][1]);
+ break;
+ }
+
+ // no query
+ else if (errors[i][0] === 301) {
+ obj.hint = hintClass.create();
+ obj.hint.alert(0, errors[i][1]);
+ }
+ }
+ };
+ };
+});