Commit 7e270964 authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

Add CoNLL button

parent 1a68652b
......@@ -280,3 +280,15 @@ h3 {
float: right;
margin-right: 8px;
}
.modal-content {
height: 200%;
}
#conllResult {
width: 100%;
height: 100%;
resize: none;
font-family: monospace;
font-size: x-small;
}
......@@ -377,7 +377,7 @@ function next_results() {
}
},
error: function(x) {
alert("Ajax error:" + JSON.stringify(x));
alert("[NEXT] Ajax error:" + JSON.stringify(x));
}
});
}
......@@ -474,7 +474,7 @@ function search_pattern() {
}
},
error: function(x) {
alert("Ajax error:" + JSON.stringify(x));
alert("[NEW] Ajax error:" + JSON.stringify(x));
}
});
}
......@@ -670,7 +670,7 @@ function export_tsv() {
}
},
error: function(x) {
alert("Ajax error:" + JSON.stringify(x));
alert("[EXPORT] Ajax error:" + JSON.stringify(x));
}
});
}
......@@ -680,6 +680,43 @@ function download() {
window.location = './data/' + current_request_id + '/export.tsv';
}
// ==================================================================================
function one_conll() {
var data = {
request: "CONLL",
id: current_request_id,
current_view: current_view,
cluster: current_cluster
};
$.ajax({
url: 'main.php',
dataType: 'text',
data: data,
type: 'post',
success: function(reply) {
var fields = reply.split("@@");
var id = fields[0];
var conll = fields[1];
if (conll == 'ERROR') {
sweetAlert("Disconnected");
} else {
$("#conllResult").html(conll);
$('#conllModal').modal('show');
}
},
error: function(x) {
alert("[CONLL] Ajax error:" + JSON.stringify(x));
}
})
}
// ==================================================================================
function copy_conll () {
$("#conllResult").select()
document.execCommand('copy');
}
// ==================================================================================
function save_pattern() {
let clustering = "";
......@@ -715,7 +752,7 @@ function save_pattern() {
SelectText("custom-url");
},
error: function(x) {
alert("Ajax error:" + JSON.stringify(x));
alert("[SHORTEN] Ajax error:" + JSON.stringify(x));
}
});
} else {
......@@ -977,11 +1014,11 @@ function update_group() {
html += '<div class="panel-heading">\n';
html += '<h4 class="panel-title">\n';
html += '<a onclick="toggle_folder_icon(\'' + href + '\');" data-toggle="collapse" href="#' + href + '" id="folder_' + href + '" class="collapsed corpus-folder">\n';
html += '<span id = "icon_'+href+'" class="glyphicon glyphicon-folder-close"></span>\n';
html += '<span id = "icon_' + href + '" class="glyphicon glyphicon-folder-close"></span>\n';
html += value["folder"] + '\n';
html += '<span class="badge badge-danger">'+value["corpora"].length+'</span>';
html += '<span class="badge badge-danger">' + value["corpora"].length + '</span>';
html += '</a>\n';
......@@ -1018,8 +1055,8 @@ function update_group() {
// ==================================================================================
function toggle_folder_icon(arg) {
let folder = $("#folder_"+arg);
let icon = $("#icon_"+arg);
let folder = $("#folder_" + arg);
let icon = $("#icon_" + arg);
if (folder.hasClass("collapsed")) {
console.log("OPEN");
icon.removeClass("glyphicon-folder-close");
......
......@@ -13,6 +13,8 @@ if ($request == "NEW") {
export();
} elseif ($request == "SHORTEN") {
shorten();
} elseif ($request == "CONLL") {
conll();
}
// ============================================================
......@@ -65,6 +67,13 @@ function shorten() {
echo $_POST['id'];
}
// ============================================================
function conll() {
$id = $_POST['id'];
$msg = "#CONLL#" . $_POST['current_view'] . "#" . $_POST['cluster'];;
send($id, $msg);
}
// ============================================================
// send the request to the daemon
......@@ -84,7 +93,7 @@ function send($id, $msg) { // send request to the daemon
demonDown($_POST['corpus'],$id);
}else{
fwrite($client, $dir . $id . $msg);
$result = stream_get_contents($client,10);
$result = stream_get_contents($client);
fclose($client);
}
error_reporting(E_ALL & ~E_NOTICE);
......
......@@ -216,6 +216,10 @@
<span class="btn-results" style="font-size: 150%" id="progress-num"></span>
<button class="btn btn-primary btn-results" onclick="javascript:next_svg()"></button>
<button class="btn btn-primary btn-results" onclick="javascript:last_svg()"></button>
<button type="button" id="tables" class="btn btn-primary" onclick="javascript:one_conll()" style="float: right;">
CoNLL
<span href="" class="glyphicon glyphicon-export"></span>
</button>
<ul id="results-list"></ul>
</div>
</div>
......@@ -305,7 +309,7 @@
</div>
</div>
<!-- modal for data export -->
<!-- modal for tsvs export -->
<div id="export-modal" class="modal fade">
<div class="modal-dialog modal-lg modal-dialog-scrollable">
<div class="modal-content">
......@@ -320,6 +324,20 @@
</div>
</div>
<!-- modal for conll export -->
<div id="conllModal" class="modal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<button type="button" class="btn btn-primary" style="width:100%" onclick="javascript:copy_conll()">Copy in clipboard</button>
</div>
<div class="modal-body">
<textarea id="conllResult" rows="25" readonly="" />
</div>
</div>
</div>
</div>
</body>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment