This repository has been archived by the owner on Feb 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
179 lines (135 loc) · 6.23 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html>
<head>
<title>Parsing xml</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script>
<script src="lib/blockly_compressed.js"></script>
<script src="lib/blockly_msg_js_en.js"></script>
<script src="src/blockly_extensions.js"></script>
<script src="src/js_extensions.js"></script>
<script src="src/HueGenerator.js"></script>
<script src="src/UnicodeIndenter.js"></script>
<script src="src/parser.js"></script>
<script src="src/frontend.js"></script>
<script src="src/Validator.js"></script>
<script src="src/XMLGenerator.js"></script>
<script src="lib/vkbeautify.0.99.00.beta.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
body{
margin: 25px;
}
textarea{
width: 100%;
resize: none;
}
.tab-content{
padding: 10px;
}
.leftMargin{
margin-left: 2.5%;
}
#blocklyDiv{
float: left;
width: 100%;
height: 1000px;
border: 1px solid #ddd;
}
</style>
</head>
<body>
<div>
<h1>Graphical RNG Editor Using Blockly (<a href=https://github.com/Ensembl/XML-To-Blockly>code in gitHub</a>)</h1>
<div>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#examples">Load a demo example or a custom RNG file</a></li>
<li><a data-toggle="tab" href="#editor">RNG Editor</a></li>
<li id="blocklycode_tab_header" class="disabled"><a data-toggle="tab" href="#blockly_code">Blockly JS-code generated from RNG</a></li>
<li id="xmlgen_tab_header" class="disabled"><a data-toggle="tab" href="#xml_generator">Diagram validation and export into XML</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" id="examples" class="tab-pane fade in active">
<p>The following buttons load some ready-made RNG files into the next tab (RNG Editor) for you to play:</p>
<p>
<button type="button" class="btn btn-primary" onclick='xmlToBlocklyWorkspace.loadOurExample("contact.rng");'>Small example 1</button>
A contact (for an address-book)
</p>
<p>
<button type="button" class="btn btn-primary" onclick='xmlToBlocklyWorkspace.loadOurExample("addressBook.rng");'>Small example 2</button>
An address-book as a collection of contacts
</p>
<p>
<button type="button" class="btn btn-primary" onclick='xmlToBlocklyWorkspace.loadOurExample("addressBook_with_collapsible_contacts.rng");'>Small example 3</button>
An address-book with contacts that have a collapsible section
</p>
<p>
<button type="button" class="btn btn-primary" onclick='xmlToBlocklyWorkspace.loadOurExample("attrib.rng");'>Small example 4</button>
Example with attributes
</p>
<p>
<button type="button" class="btn btn-primary" onclick='xmlToBlocklyWorkspace.loadOurExample("basic_value.rng");'>Small example 5</button>
An attribute with a choice and a dropdown menu
</p>
<p>
<button type="button" class="btn btn-primary" onclick='xmlToBlocklyWorkspace.loadOurExample("optiField_03_multiple_multi-level.rng");'>Small example 6</button>
Optional element controlled by a checkbox
</p>
<p>
<button type="button" class="btn btn-primary" onclick='xmlToBlocklyWorkspace.loadOurExample("ref_structure_ehive.rng");'>Small example 7</button>
Nested structure of blocks (used to represent eHive parameters)
</p>
<p>
<button type="button" class="btn btn-primary" onclick='xmlToBlocklyWorkspace.loadOurExample("LRG.rng");'>Real-life example 1</button>
Locus Reference Genomic (LRG)
</p>
<p>
<button type="button" class="btn btn-primary" onclick='xmlToBlocklyWorkspace.loadOurExample("ehive_pipeline_schema3.rng");'>Real-life example 2</button>
eHive
</p>
<label class="btn btn-primary" for="file">
<input id="file" type="file" style="display:none;" onclick="javascript:document.getElementById('file').value=''; xmlToBlocklyWorkspace.bringUpEditor();" onchange="javascript:readFile(event)">
Open a local RNG file ...
</label> Any file you like
</div>
<div role="tabpanel" id="editor" class="tab-pane fade">
<p>The RNG below is editable.
<button class="btn btn-primary leftMargin" id="interpretBtn" onclick="xmlToBlocklyWorkspace.handleRNG( document.getElementById('rng_area').value )">
Create Blockly blocks from RNG below
</button>
<span class="text-danger" id="parsing_error_area"></span>
</p>
<!-- Textareas for RNG file editing and XML generation -->
<div id="textareaLeft">
<p>RNG Input: <label class='label label-info' id="file-name"></label></p>
<textarea id="rng_area" onchange="javascript:document.getElementById('file').value=''" rows="19"></textarea>
</div>
</div>
<div role="tabpanel" id="blockly_code" class="tab-pane fade">
<p>In this area we generate JS-code to produce a system of Blockly blocks from the RNG grammar in the previous tab:</p>
<div id="blockly_code_area"></div>
</div>
<div role="tabpanel" id="xml_generator" class="tab-pane fade">
<p> XML generation content </p>
<span class="text-danger" id="validation_error_area"></span>
<textarea id="xml_output_area" rows="25" readonly></textarea>
</div>
</div>
</div>
<!-- Div for blockly workspace and toolbox -->
<div>
<div id="blocklyDiv"></div>
<xml id="toolbox" style="display: none">
</xml>
</div>
</div>
<script>
var xmlToBlocklyWorkspace = new XMLToBlocklyWorkspace();
$('.nav a[href="#xml_generator"]').click(function (e) {
xmlToBlocklyWorkspace.validateBlocklyGraph();
});
</script>
</body>
</html>