-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
156 lines (153 loc) · 6.92 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.w3.org/1999/xhtml" data-template="templates:surround" data-template-with="templates/page.html" data-template-at="content">
<div class="row">
<div data-template="eXgroups:addAnno2Group"/>
<div class="col-md-12">
<div data-template="eXv:table"/>
<script type="text/javascript" src="resources/js/DataTables/datatables.min.js"/>
<script>
$( document ).ready(function(){
$( "#store2TextGrid" ).on("click", function() {
var sid = $('#sessionId').val(),
pid = $('#projectId').val(),
aid = [];
$('.selected').each(function(){
var id = $(this).attr("id");
aid.push( id );
});
$.ajax({
method: "POST",
url: "send2TextGrid.xq",
data: { sessionId: sid, projectId: pid, annos: aid.join(",") }
})
.done(function( msg ) {
alert( "OK" );
});
});
$(".table").on("change", function(){
if ( $(".selected").length === 0 ) {
$(".textgrid").addClass("disabled");
}
else {
$(".textgrid").removeClass("disabled");
}
});
});
function getAnnotations() {
$(".grpId").change(function() {
var grpIds = [];
$(":checked").each(function() {
grpIds.push( $(this).val() );
});
var groups = grpIds.join(",");
$("#groupsInput").val( groups );
});
var annIds = [];
$('.selected').each(function(){
var id = $(this).attr("id");
annIds.push( id );
});
var annotations = annIds.join(",");
$("#annotationsInput").val(annotations);
}
function testSelect() {
if ( $(".selected").length === 0 ) {
$(".textgrid").addClass("disabled");
$(".groups").addClass("disabled");
}
else {
$(".textgrid").removeClass("disabled");
$(".groups").removeClass("disabled");
}
}
$.fn.dataTable.ext.buttons.textgrid = {
className: "textgrid",
text: 'Send to TextGrid',
enabled: false,
action: function () {
$('#tgModal').modal('show');
}
};
$.fn.dataTable.ext.buttons.groups = {
className: "groups",
text: 'Add to Groups',
enabled: false,
action: function () {
$('#groupsModal').modal('show');
getAnnotations();
}
};
var table = $('#annoTable').DataTable({
dom: 'Bfrtip',
buttons: [
'selectAll',
'selectNone',
'csvHtml5',
'colvis',
'groups',
'textgrid'
]});
table.on( 'select', function () {
testSelect();
} );
table.on( 'deselect', function () {
testSelect();
} );
</script>
</div>
</div>
<!-- Modal TextGrid -->
<div class="modal fade" id="tgModal" tabindex="-1" role="dialog" aria-labelledby="tgModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
<h4 class="modal-title" id="tgModalLabel">Store Annotations in TextGrid</h4>
</div>
<div class="modal-body">
<p>In order to store any selected annotation in TextGrid, you have to provide a SessionId and a ProjectId. You will find both informations within the Lab.</p>
<div class="form-group">
<label for="sessionId">Session ID</label>
<input type="text" class="form-control" id="sessionId" placeholder="sessionId"/>
</div>
<div class="form-group">
<label for="projectId">Project ID</label>
<input type="text" class="form-control" id="projectId" placeholder="projectId"/>
</div>
</div>
<div class="modal-footer">
<button type="submit" id="store2TextGrid" class="btn btn-primary">Store in TextGrid</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal Groups -->
<div class="modal fade" id="groupsModal" tabindex="-1" role="dialog" aria-labelledby="groupsModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
<h4 class="modal-title" id="groupsModalLabel">Share Annotations within a Group</h4>
</div>
<form action="index.html" method="POST">
<div class="modal-body">
<p>You can share your annotations with multiple groups.
Admins of the groups will be able to remove (but not delete) annotations.</p>
<ul data-template="eXgroups:listUserGroups"/>
<input id="groupsInput" type="hidden" name="groups" value=""/>
<input id="annotationsInput" type="hidden" name="annotations" value=""/>
</div>
<div class="modal-footer">
<button type="submit" id="groupsAddAnnos" class="btn btn-primary">Share!</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
</div>