-
Notifications
You must be signed in to change notification settings - Fork 1
/
MetadataEditorJS.html
executable file
·126 lines (110 loc) · 3.92 KB
/
MetadataEditorJS.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
<script src="https://cdnjs.cloudflare.com/ajax/libs/sigma.js/1.2.1/sigma.min.js" integrity="sha512-4+XX9O3GEcpTWGNW7m3w/ORF91L4zUX01/U3wAoWIXp1P+LRBEqutZdQIFUeHSa0cJRZ9LPM+GOWus8h8TlYhg==" crossorigin="anonymous"></script>
<script>
$(function(){
/* sigma.utils.pkg('sigma.canvas.nodes');
sigma.canvas.nodes.image = (function() {
var _cache = {},
_loading = {},
_callbacks = {};
// Return the renderer itself:
var renderer = function(node, context, settings) {
var args = arguments,
prefix = settings('prefix') || '',
size = node[prefix + 'size'],
color = node.color || settings('defaultNodeColor'),
data = node.data;
context.save();
var img = new Image();
img.src = data;
// Draw the clipping disc:
context.beginPath();
context.arc(
node[prefix + 'x'],
node[prefix + 'y'],
node[prefix + 'size'],
0,
Math.PI * 2,
true
);
context.closePath();
context.clip();
// Draw the image
context.drawImage(
img,
node[prefix + 'x'] - size,
node[prefix + 'y'] - size,
2 * size,
2 * size
);
// Quit the "clipping mode":
context.restore();
// Draw the border:
context.beginPath();
context.arc(
node[prefix + 'x'],
node[prefix + 'y'],
node[prefix + 'size'],
0,
Math.PI * 2,
true
);
context.lineWidth = size / 5;
context.strokeStyle = node.color || settings('defaultNodeColor');
context.stroke();
}
return renderer;
})();
*/
function coreSheetSelected(response) {
if (response && response.error) {
$('#coreSheetIndex').val('');
// $('.loading').hide();
showOKAlert('Error', response.message);
}
// else {
// google.script.run.withSuccessHandler(updateDwcArchive).getDwCArchiveSchema();
// }
}
function dwcArchiveGenerated(response) {
$(this).prop('disabled', false);
$(this).text('Generate DwC-Archive');
if (response && response.error) {
showOKAlert('Alert', response.message);
}
}
// function updateDwcArchive(dwcArchiveSchema) {
// $('.loading').hide();
// dwcaSchema.graph.clear();
// dwcaSchema.graph.read(dwcArchiveSchema);
// dwcaSchema.refresh();
// }
//Initialize DwC-Archive Graph
// var dwcaSchema = new sigma('dwca-schema');
// if ($('#coreSheetIndex').val() > 0) {
// google.script.run.withSuccessHandler(updateDwcArchive).getDwCArchiveSchema();
// }
$('#coreSheetIndex').change(function(e){
var sheetIndex = $(this).val();
if (sheetIndex > 0) {
// $('.loading').show();
google.script.run.withSuccessHandler(coreSheetSelected).setCoreSheet(sheetIndex);
}
});
$('.rowtype').change(function(e){
var rowType = $(this).val();
var sheetIndex = $(this).prop('id');
if (rowType != '' && sheetIndex > 0) {
google.script.run.setRowType(rowType, sheetIndex);
}
});
$('#generate-dwca').click(function(e) {
var rowTypes = $('.rowtype option:selected').filter(function(){ return $(this).val() != ''});
if ($('#coreSheetIndex').val() > 0 && rowTypes.length == $('.rowtype').length) {
// Generate DwC-Archive
$(this).prop('disabled', true);
$(this).text('Creating DwC-Archive...');
google.script.run.withSuccessHandler(dwcArchiveGenerated).generateDwCA();
}
});
});
</script>