Skip to content

Commit 126dbdf

Browse files
committed
Merge branch 'develop'
2 parents 45d814f + 2c328cc commit 126dbdf

File tree

3 files changed

+73
-12
lines changed

3 files changed

+73
-12
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## v0.6.0, 2019-08-07
2+
3+
### 🏭 Нові можливості
4+
5+
- Реалізовано можливість локального збереження файлів разбору `allterms.xml` та `parce.xml` через графічний інтерфейс користувача, зокрема, через взаємодію з елементом `#button-save` відповідно:
6+
- `#button-save-allterms-xml` для збереження `allterms.xml`;
7+
- `#button-save-parce-xml` для збереження `parce.xml`.
8+
9+
### 🔴 Виправлення помилок
10+
11+
- Дрібні виправлення `JavaScript` на клієнті.
12+
113
## v0.5.5, 2019-08-03
214

315
### 🔴 Виправлення помилок

static/javascripts/ken-recap.js

+45
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ var $newProjectAndClearAll = $('#newProjectAndClearAll'),
2525
$buttonSaveTerms = $('#button-save-terms'),
2626
$buttonSaveNer = $('#button-save-ner'),
2727
$buttonSaveProjectFileList = $('#button-save-project-file-list'),
28+
$buttonSaveAlltermsXml = $('#button-save-allterms-xml'),
29+
$buttonSaveParceXml = $('#button-save-parce-xml'),
2830
$upload_button = $('#upload-button'),
2931
$sents_from_text = $('#sents_from_text'),
3032
$sortSelect = $('#sort-select');
@@ -229,6 +231,35 @@ $recapOverviewButton.change(function () {
229231
$textContent.text('');
230232
});
231233

234+
$buttonSaveAlltermsXml.click(function () {
235+
if (localStorage.getItem("alltermsxml-for-last-file")) {
236+
downloadLink = document.createElement("a");
237+
// Make sure that the link is not displayed
238+
downloadLink.style.display = "none";
239+
// Add the link to your DOM
240+
document.body.appendChild(downloadLink);
241+
let blob = new Blob([localStorage.getItem("alltermsxml-for-last-file")], { type: "octet/stream" }),
242+
url = window.URL.createObjectURL(blob);
243+
downloadLink.href = url;
244+
downloadLink.download = 'allterms.xml';
245+
downloadLink.click();
246+
}
247+
})
248+
249+
$buttonSaveParceXml.click(function () {
250+
if (localStorage.getItem("parcexml-for-last-file")) {
251+
downloadLink = document.createElement("a");
252+
// Make sure that the link is not displayed
253+
downloadLink.style.display = "none";
254+
// Add the link to your DOM
255+
document.body.appendChild(downloadLink);
256+
let blob = new Blob([localStorage.getItem("parcexml-for-last-file")], { type: "octet/stream" }),
257+
url = window.URL.createObjectURL(blob);
258+
downloadLink.href = url;
259+
downloadLink.download = 'parce.xml';
260+
downloadLink.click();
261+
}
262+
})
232263

233264
$buttonSaveTerms.click(function () {
234265
let arrayOfValuesOfYploadResultList = $("#uploadResultList option").map(function () { return this.value; }).get().join('\n'),
@@ -369,6 +400,11 @@ function fetchFileToRecapService() {
369400
// add to local storage recap of this file for #projectFileList
370401
localStorage[uniqueUploadFilename] = JSON.stringify(resJSON);
371402

403+
// add to local storage allterms.xml of the last uploaded file
404+
localStorage["alltermsxml-for-last-file"] = result;
405+
// add to local storage allterms.xml of this file for #projectFileList selection
406+
localStorage[uniqueUploadFilename + "-alltermsxml"] = result;
407+
372408
for (let elementKnownTxtJson of resJSON.termsintext.exporterms.term) {
373409
termsWithIndexDict[elementKnownTxtJson.tname] = resJSON.termsintext.exporterms.term.indexOf(elementKnownTxtJson); // for dictionary structure
374410
if (Array.isArray(elementKnownTxtJson.sentpos)) {
@@ -407,6 +443,11 @@ function fetchFileToRecapService() {
407443
dom = new DOMParser().parseFromString(result, "text/xml");
408444
resParceJSON = xmlToJson(dom);
409445

446+
// add to local storage parce.xml of the last uploaded file
447+
localStorage["parcexml-for-last-file"] = result;
448+
// add to local storage parce.xml of this file for #projectFileList selection
449+
localStorage[uniqueUploadFilename + "-parcexml"] = result;
450+
410451
for (let sentElement of resParceJSON.text.sentence) {
411452

412453
if (sentElement.hasOwnProperty('ner')) {
@@ -632,6 +673,10 @@ function forProjectFileListClickAndEnterPressEvents() {
632673

633674
if (localStorage.getItem($projectFileList.prop('value'))) {
634675

676+
if (localStorage.getItem($projectFileList.prop('value') + "-alltermsxml")) {
677+
localStorage["alltermsxml-for-last-file"] = localStorage.getItem($projectFileList.prop('value') + "-alltermsxml")
678+
}
679+
635680
resJSON = JSON.parse(localStorage.getItem($projectFileList.prop('value')));
636681
// add to local storage recap of the last uploaded file
637682
localStorage["recapForLastFile"] = JSON.stringify(resJSON);

templates/index.html

+16-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33

44
<head>
5-
<title>Конспект 2019 - v0.5.5</title>
5+
<title>Конспект 2019 - v0.6.0</title>
66
<meta charset="UTF-8">
77
<link rel="shortcut icon" type="image/png" href="./static/images/favicon.png" />
88
<link rel="stylesheet" type="text/css" href="./static/bootstrap/css/flatly.bootstrap.css" media="screen" />
@@ -20,10 +20,10 @@
2020
</div>
2121
<!-- <textarea id="text-content" readonly="true"></textarea> -->
2222
<div class="panel panel-default" id="text-content-panel">
23-
<div class="panel-body context" id="text-content-panel-body">
24-
<p id="text-content"></p>
25-
</div>
23+
<div class="panel-body context" id="text-content-panel-body">
24+
<p id="text-content"></p>
2625
</div>
26+
</div>
2727
<div class="recap_label">
2828
<label>Дерево термінів</label>
2929
</div>
@@ -52,13 +52,13 @@
5252
<div class="tab-content" id="select-block">
5353
<div class="tab-pane active fade in" id="term_tab">
5454
<div id="term-tab-container">
55-
<select id="sort-select" title="Сортування виокремлених термінів з тексту">
56-
<option value="0">-- Оберіть тип сортування --</option>
57-
<option value="1">за алфавітом</option>
58-
<option value="2">за збільшенням частоти</option>
59-
<option value="3">за зменшенням частоти</option>
60-
<option value="4">за появою тексті</option>
61-
</select>
55+
<select id="sort-select" title="Сортування виокремлених термінів з тексту">
56+
<option value="0">-- Оберіть тип сортування --</option>
57+
<option value="1">за алфавітом</option>
58+
<option value="2">за збільшенням частоти</option>
59+
<option value="3">за зменшенням частоти</option>
60+
<option value="4">за появою тексті</option>
61+
</select>
6262
<select id="uploadResultList" name="uploadResultList"></select>
6363
</div>
6464
</div>
@@ -93,6 +93,10 @@
9393
<li role="presentation" id="button-save-project-file-list"
9494
title="Зберегти список документів проекту в файл (txt, utf-8)"><a role="menuitem" tabindex="-1"
9595
href="#">Список Файли</a></li>
96+
<li role="presentation" id="button-save-allterms-xml" title="Зберегти allterms.xml"><a role="menuitem"
97+
tabindex="-1" href="#">allterms.xml</a></li>
98+
<li role="presentation" id="button-save-parce-xml" title="Зберегти parce.xml"><a role="menuitem"
99+
tabindex="-1" href="#">parce.xml</a></li>
96100
</ul>
97101
</div>
98102
<!-- Basic dropdown -->
@@ -123,7 +127,7 @@
123127
<div class="panel panel-default" id="sents-from-text-panel">
124128
<div class="panel-body context">
125129
<p id="sents_from_text">
126-
</p>
130+
</p>
127131
</div>
128132
</div>
129133
</div>

0 commit comments

Comments
 (0)