-
Notifications
You must be signed in to change notification settings - Fork 9
/
functions.html
317 lines (315 loc) · 14.9 KB
/
functions.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<!--
# *************************************************************************************
# Copyright (C) 2021 Ritwik Murali, Harshit Agarwal, Rajkumar S, Gali Mary Sanjana
# This file is part of Flowgramming <https://github.com/flowgrammers-org/flowgramming>.
#
# Flowgramming is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Flowgramming is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Flowgramming. If not, see <http://www.gnu.org/licenses/>.
# *************************************************************************************
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Function Manager - Flowgramming</title>
<link
rel="apple-touch-icon"
sizes="180x180"
href="assets/favicons/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="assets/favicons/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="assets/favicons/favicon-16x16.png"
/>
<link rel="manifest" href="site.webmanifest" />
<link rel="stylesheet" type="text/css" href="css/build/functions.css" />
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<p class="navbar-nav navbar-brand text-center align-items-center">
<span>
<svg
class="mx-2 bi bi-list-task my-auto"
fill="white"
height="1.5em"
viewBox="0 0 16 16"
width="1.5em"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M2 2.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5H2zM3 3H2v1h1V3z"
/>
<path
d="M5 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zM5.5 7a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1h-9zm0 4a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1h-9z"
/>
<path
fill-rule="evenodd"
d="M1.5 7a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5V7zM2 7h1v1H2V7zm0 3.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5H2zm1 .5H2v1h1v-1z"
/>
</svg>
</span>
Function Manager
</p>
<input accept=".fgfn" hidden id="open-file" type="file" />
<a
class="nav-item d-flex"
href="#"
id="open-btn"
title="Import a flowgramming function"
>
<svg
class="mx-2 bi bi-folder2-open my-auto"
fill="white"
height="1.5em"
viewBox="0 0 16 16"
width="1.5em"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1 3.5A1.5 1.5 0 0 1 2.5 2h2.764c.958 0 1.76.56 2.311 1.184C7.985 3.648 8.48 4 9 4h4.5A1.5 1.5 0 0 1 15 5.5v.64c.57.265.94.876.856 1.546l-.64 5.124A2.5 2.5 0 0 1 12.733 15H3.266a2.5 2.5 0 0 1-2.481-2.19l-.64-5.124A1.5 1.5 0 0 1 1 6.14V3.5zM2 6h12v-.5a.5.5 0 0 0-.5-.5H9c-.964 0-1.71-.629-2.174-1.154C6.374 3.334 5.82 3 5.264 3H2.5a.5.5 0 0 0-.5.5V6zm-.367 1a.5.5 0 0 0-.496.562l.64 5.124A1.5 1.5 0 0 0 3.266 14h9.468a1.5 1.5 0 0 0 1.489-1.314l.64-5.124A.5.5 0 0 0 14.367 7H1.633z"
fill-rule="evenodd"
/>
</svg>
</a>
<a class="ml-auto navbar-brand float-right" href="#">
Flowgramming
<span>
<svg
class="bi bi-diagram-3-fill"
fill="currentColor"
height="1em"
viewBox="0 0 16 16"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M6 3.5A1.5 1.5 0 0 1 7.5 2h1A1.5 1.5 0 0 1 10 3.5v1A1.5 1.5 0 0 1 8.5 6v1H14a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-1 0V8h-5v.5a.5.5 0 0 1-1 0V8h-5v.5a.5.5 0 0 1-1 0v-1A.5.5 0 0 1 2 7h5.5V6A1.5 1.5 0 0 1 6 4.5v-1zm-6 8A1.5 1.5 0 0 1 1.5 10h1A1.5 1.5 0 0 1 4 11.5v1A1.5 1.5 0 0 1 2.5 14h-1A1.5 1.5 0 0 1 0 12.5v-1zm6 0A1.5 1.5 0 0 1 7.5 10h1a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 8.5 14h-1A1.5 1.5 0 0 1 6 12.5v-1zm6 0a1.5 1.5 0 0 1 1.5-1.5h1a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1-1.5 1.5h-1a1.5 1.5 0 0 1-1.5-1.5v-1z"
fill-rule="evenodd"
/>
</svg>
</span>
</a>
</nav>
<div>
<div class="functions-table">
<table class="table text-center">
<thead class="thead-dark">
<tr>
<th>Function Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="functionsTable"></tbody>
</table>
</div>
<div class="add-edit-function">
<div class="container mt-2">
<div class="card mb-3">
<div class="card-header">
<h4>Create / Edit a function</h4>
</div>
<div class="card-body">
<form
id="addFn"
onsubmit="return saveFunction(this)"
>
<div class="form-group">
<label for="functionName"
>Function Name</label
>
<input
type="text"
class="form-control"
id="functionName"
placeholder="Enter a name adhering to standard naming conventions"
/>
</div>
<hr />
<div class="form-row mx-1">
<div class="form-group col-11">
<p>Parameters</p>
</div>
<div class="form-group col-1">
<button
type="button"
class="btn btn-sm btn-info d-flex align-items-center"
onclick="manageFunctionParams()"
>
<svg
class="mr-2 bi bi-list-task my-auto"
fill="white"
height="1em"
viewBox="0 0 16 16"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"
/>
<path
fill-rule="evenodd"
d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"
/>
</svg>
Add
</button>
</div>
</div>
<table class="table table-sm text-center">
<thead class="thead-light">
<tr>
<th>Variable Name</th>
<th>Variable Type</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="parametersTable"></tbody>
</table>
<hr />
<div class="form-group">
<label for="returnVariable"
>Return Variable</label
>
<input
class="form-control"
id="returnVariable"
placeholder="Leave this field empty if the function doesn't return anything"
/>
</div>
<div class="form-group">
<label for="returnType">Return Type</label>
<select
class="custom-select"
id="returnType"
>
<option
value="Default"
disabled
selected
>
Select
</option>
<option value="int">Integer</option>
<option value="float">Float</option>
<option value="char">Character</option>
<option value="int(array)">
Integer Array
</option>
<option value="float(array)">
Float Array
</option>
<option value="char(array)">
Character Array
</option>
</select>
</div>
<button
type="submit"
class="btn btn-info btn-block mb-5"
>
Save the function and continue
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal" role="dialog">
<div class="modal-dialog modal-sm vertical-align-center">
<div class="modal-content">
<div class="modal-body"></div>
<div class="modal-footer">
<button
id="closeButton"
type="button"
class="btn btn-outline-danger mr-auto"
data-dismiss="modal"
>
Close
</button>
<button
class="btn btn-outline-success"
id="okButton"
type="button"
>
OK
</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="saveFunctionsModal" role="dialog">
<div class="modal-dialog modal-sm vertical-align-center">
<div class="modal-content">
<div class="modal-body">
<p>
Are you sure you want to close without saving the
function?
</p>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-outline-secondary mr-auto"
data-dismiss="modal"
>
Cancel
</button>
<button
class="btn btn-outline-danger"
type="button"
onclick="saveFunctions()"
>
Yes
</button>
</div>
</div>
</div>
</div>
<nav class="navbar fixed-bottom navbar-light bg-light">
<button
onclick="showSaveFunctionsModal()"
type="button"
class="ml-auto btn btn-info btn-block"
>
Save Functions and Close
</button>
</nav>
</body>
<script src="js/build/functionVendor.js"></script>
<script src="js/build/functionMain.js"></script>
<script>
preventIndependentOpen()
$('#open-btn').on('click', function () {
$('#open-file').click()
})
$('#open-file').on('change', function () {
const fileReader = new FileReader()
fileReader.onload = function () {
const data = fileReader.result
openFromFile(data, true)
}
fileReader.readAsText($('#open-file').prop('files')[0])
})
</script>
</html>