cewebs-transformationengine 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/cewebs-transformationengine.gemspec +1 -1
- data/index.html +7 -1
- data/server/data/Default/strings.default.xml +1 -0
- data/server/data/Default/strings.rng +10 -0
- data/server/data/Default/strings.xml +105 -0
- data/static/js/administration.js +165 -58
- data/static/js/engine.js +32 -7
- data/static/js/temml/LICENSE +21 -0
- data/static/js/temml/temml.min.js +1 -0
- data/static/styles/content.css +8 -0
- data/static/styles/plain.css +68 -0
- data/static/styles/temml/Temml-Local.css +372 -0
- data/static/styles/temml/Temml.woff2 +0 -0
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 109ee8ce7979f751dfc0c3ec01e8bdb715c7ae2c8b0b99d00518e52c2b3e621d
|
|
4
|
+
data.tar.gz: 6dc92413d7c5f9a3eee0b59ac9ef9ffacc348accb824fd7e84d71141323f12c9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ee2ed572cec407a0ec78644076d45d585a3dffb7c7acd5fe8ddccfe83aba36dd1c96c8bf0d3ee74fd2ea164153fbeddb78dac88f31669d6312cf8c07fe41078
|
|
7
|
+
data.tar.gz: 7b2fa831985a45bb7c33d369ef0d1a3a24e6fdb87131f7e0f13cca3abcefb9f00abe4f74865b297459ea944e6e34bcc2e02ea6f0df7d0ca6235c0b12e3a58b5c
|
data/index.html
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8"/>
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
5
6
|
<title>CEWebS</title>
|
|
6
7
|
<script>
|
|
7
8
|
// requested before engine.js is loaded, which uses the answer. Has to be before the stylesheets
|
|
@@ -26,7 +27,12 @@
|
|
|
26
27
|
<div class="search"></div>
|
|
27
28
|
</div>
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
<!-- on small screens the menu is opened by the burger, without JavaScript: the checkbox has to come right before the menu -->
|
|
31
|
+
<input type="checkbox" id="menutoggle" autocomplete="off"/>
|
|
32
|
+
<label for="menutoggle" id="burger" title="Menu" aria-label="Menu"></label>
|
|
33
|
+
<!-- covers everything around the open menu, tapping it closes the menu -->
|
|
34
|
+
<label for="menutoggle" id="menuclose"></label>
|
|
35
|
+
<div id="menu"><ul id="navmenu"></ul><ul id="points"></ul></div>
|
|
30
36
|
|
|
31
37
|
<div id="contentcontainer">
|
|
32
38
|
<div id="content"></div>
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
<menupoints_desc>Diese sind unabhängig von den Services. Sie können diese löschen, ohne Konsequenzen für die Services. Mehrere Menüpunkte können auf ein Service verweisen (z.B. können mehrere Menüpunkte auf mehrere Seiten in einem Wiki zeigen).</menupoints_desc>
|
|
69
69
|
<menupoints_new>Menüpunkt erstellen</menupoints_new>
|
|
70
70
|
<menupoints_del_it>Menüpunkt löschen?</menupoints_del_it>
|
|
71
|
+
<menupoints_edit>Menüpunkt bearbeiten</menupoints_edit>
|
|
71
72
|
<menupoints_order>Reihenfolge durch ziehen verändern</menupoints_order>
|
|
72
73
|
<menupoints_indent>Einrückung verändern</menupoints_indent>
|
|
73
74
|
<menupoints_save_order>Reihenfolge speichern</menupoints_save_order>
|
|
@@ -461,6 +461,16 @@
|
|
|
461
461
|
</cewebs:ui>
|
|
462
462
|
<data type="string"/>
|
|
463
463
|
</element>
|
|
464
|
+
<optional>
|
|
465
|
+
<element name="menupoints_edit">
|
|
466
|
+
<cewebs:ui xml:lang="de">
|
|
467
|
+
<cewebs:label>Icon und Titel Menüpunkt bearbeiten</cewebs:label>
|
|
468
|
+
</cewebs:ui>
|
|
469
|
+
<data type="string">
|
|
470
|
+
<param name="maxLength">100</param>
|
|
471
|
+
</data>
|
|
472
|
+
</element>
|
|
473
|
+
</optional>
|
|
464
474
|
<element name="menupoints_order">
|
|
465
475
|
<cewebs:ui xml:lang="de">
|
|
466
476
|
<cewebs:label>Icon Reihenfolge</cewebs:label>
|
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<strings>
|
|
3
|
+
<strings xml:lang="en">
|
|
4
|
+
<description>DC</description>
|
|
5
|
+
<title1>Development Client</title1>
|
|
6
|
+
<title2>One that reckoneth accounts all the day passeth not a single happy moment.</title2>
|
|
7
|
+
<logout>logout</logout>
|
|
8
|
+
<name>DC</name>
|
|
9
|
+
<contact>© %Y Juergen Mangler</contact>
|
|
10
|
+
<info>To use this page, you have to identify yourself! &lt;i&gt;Important: cookies have to be enabled.&lt;/i&gt;
|
|
11
|
+
&lt;ul&gt;
|
|
12
|
+
&lt;li&gt;If you have problems logging in, please contact the administrator.&lt;/li&gt;
|
|
13
|
+
&lt;/ul&gt;</info>
|
|
14
|
+
<username>Username</username>
|
|
15
|
+
<password>Password</password>
|
|
16
|
+
<login>login</login>
|
|
17
|
+
<administration>admin</administration>
|
|
18
|
+
<administration_config>configure</administration_config>
|
|
19
|
+
<change>password</change>
|
|
20
|
+
<identify>Identify</identify>
|
|
21
|
+
<public>Stay logged in until the browser window is closed (e.g., in a lecture hall).</public>
|
|
22
|
+
<home>Stay logged in permanently (e.g., at home or at your own workplace).</home>
|
|
23
|
+
<failed>Login failed! Please check your username and password.</failed>
|
|
24
|
+
<blocked>Too many attempts! Please try again in 15 minutes.</blocked>
|
|
25
|
+
<sender>cewebs@localhost</sender>
|
|
26
|
+
<send>Send me a link!</send>
|
|
27
|
+
<sendinfo>Please enter your login name.</sendinfo>
|
|
28
|
+
<sendnotfound>This user was not found. Please check whether the username was spelled correctly.</sendnotfound>
|
|
29
|
+
<sendthanks>The email with the link for a new password should arrive shortly.</sendthanks>
|
|
30
|
+
<sendnothanks>The password can <strong>NOT</strong> be sent to you.</sendnothanks>
|
|
31
|
+
<sendsubject>Password</sendsubject>
|
|
32
|
+
<sendmessage>%s,
|
|
33
|
+
|
|
34
|
+
with this link you can set a new password within one hour:
|
|
35
|
+
|
|
36
|
+
%s</sendmessage>
|
|
37
|
+
<sendinvalid>This link is no longer valid.</sendinvalid>
|
|
38
|
+
<passchangeinfo>Please fill in the fields below to change your password.</passchangeinfo>
|
|
39
|
+
<oldpassword>Old password</oldpassword>
|
|
40
|
+
<newpassword>New password</newpassword>
|
|
41
|
+
<repeatpassword>Repeat password</repeatpassword>
|
|
42
|
+
<fieldsemptyerror>Did you leave a field empty?</fieldsemptyerror>
|
|
43
|
+
<notthesamepasserror>You mistyped the new password!</notthesamepasserror>
|
|
44
|
+
<passchangethanks>Your new password has been set!</passchangethanks>
|
|
45
|
+
<passchangeerror>You mistyped the old password!</passchangeerror>
|
|
46
|
+
<youarehere>You are here:</youarehere>
|
|
47
|
+
<report>reports</report>
|
|
48
|
+
<reports>Reports</reports>
|
|
49
|
+
<reports_desc>Select one of the subscribed services to get to the reports available for this service.</reports_desc>
|
|
50
|
+
<reportsfor>Reports for</reportsfor>
|
|
51
|
+
<search>Search term</search>
|
|
52
|
+
<searchresults>Search results for %s</searchresults>
|
|
53
|
+
<nosearchresults>No results were found for this search term.</nosearchresults>
|
|
54
|
+
<searchscore>(Score %6.4f)</searchscore>
|
|
55
|
+
<config>General</config>
|
|
56
|
+
<config_desc>Here you find the settings that all services share, among them those that concern the interface (engine).</config_desc>
|
|
57
|
+
<services>Services</services>
|
|
58
|
+
<services_desc>Services are general units of functionality, such as the possibility to use a wiki or a forum.
|
|
59
|
+
|
|
60
|
+
<strong>Note</strong> that two different menu items can also point to the same service. Different menu items can, e.g., point to two different pages in a wiki, or to two different threads in a forum.</services_desc>
|
|
61
|
+
<services_new>Subscribe to a service</services_new>
|
|
62
|
+
<services_available>The following services are available in the repositories you have included:</services_available>
|
|
63
|
+
<services_del>Remove service (all of its data will be deleted)</services_del>
|
|
64
|
+
<services_rename>Rename service</services_rename>
|
|
65
|
+
<services_lock>Lock/unlock the service for use</services_lock>
|
|
66
|
+
<services_del_it>If you really want to delete this service and all of its data, please enter "Yes, I do!".</services_del_it>
|
|
67
|
+
<services_del_yes>Yes, I do!</services_del_yes>
|
|
68
|
+
<menupoints>Menu items</menupoints>
|
|
69
|
+
<menupoints_desc>These are independent of the services. You can delete them without consequences for the services. Several menu items can point to one service (e.g., several menu items can point to several pages in a wiki).</menupoints_desc>
|
|
70
|
+
<menupoints_new>Create menu item</menupoints_new>
|
|
71
|
+
<menupoints_del_it>Delete menu item?</menupoints_del_it>
|
|
72
|
+
<menupoints_edit>Edit menu item</menupoints_edit>
|
|
73
|
+
<menupoints_order>Change the order by dragging</menupoints_order>
|
|
74
|
+
<menupoints_indent>Change the indentation</menupoints_indent>
|
|
75
|
+
<menupoints_save_order>Save order</menupoints_save_order>
|
|
76
|
+
<menupoints_add>Menu item</menupoints_add>
|
|
77
|
+
<menupoints_add_desc>The <strong>label</strong> of a menu item can be given in several languages. In addition you need a <strong>unique short name</strong>, which you can use in <em>CEWebS://shortname/document/command</em> links, and an <strong>entry point</strong>.</menupoints_add_desc>
|
|
78
|
+
<menupoints_add_name>Short name</menupoints_add_name>
|
|
79
|
+
<menupoints_add_name_desc>A short name may only consist of lowercase letters and digits, and must not contain special characters, diacritics or spaces.</menupoints_add_name_desc>
|
|
80
|
+
<menupoints_add_ltexts>Labels (pairs of: language - label)</menupoints_add_ltexts>
|
|
81
|
+
<menupoints_add_ltexts_desc>Valid languages are, e.g., <em>en</em>, <em>en-US</em>, <em>de</em>, <em>de-AT</em> or <em>fr</em>
|
|
82
|
+
(more information under <a href='http://www.w3.org/International/articles/bcp47/'>Understanding the New Language Tags</a>).
|
|
83
|
+
If the browser is set to another language, the first entry is always used.</menupoints_add_ltexts_desc>
|
|
84
|
+
<menupoints_add_ltexts_add>Add label</menupoints_add_ltexts_add>
|
|
85
|
+
<menupoints_add_ltexts_remove>Remove label</menupoints_add_ltexts_remove>
|
|
86
|
+
<menupoints_add_service>Service</menupoints_add_service>
|
|
87
|
+
<menupoints_add_service_desc>Select a service and an entry point. An entry point is a particular page within a service: in a wiki, a menu item can point to a particular page instead of the default main page. In a forum, a menu item can point to a particular topic instead of the list of topics.</menupoints_add_service_desc>
|
|
88
|
+
<menupoints_save>Save menu item</menupoints_save>
|
|
89
|
+
<menupoints_add_entry_point_wait>Please wait until the menu items have been loaded.</menupoints_add_entry_point_wait>
|
|
90
|
+
<menupoints_add_error_name>Short name only lowercase letters and digits (a-z,0-9)!</menupoints_add_error_name>
|
|
91
|
+
<menupoints_add_error_text>Do not forget the label!</menupoints_add_error_text>
|
|
92
|
+
<menupoints_add_error_language>Language not correct! Please check (e.g., en-US).</menupoints_add_error_language>
|
|
93
|
+
<cewebs_link_reveal>show</cewebs_link_reveal>
|
|
94
|
+
<cewebs_link_info>Query CEWebS link</cewebs_link_info>
|
|
95
|
+
<cewebs_link_info_desc>CEWebS links for individual services can be queried here. CEWebS links are not only the basis for possible menu items, but can also be used in the wiki to link to particular functionality in other services.</cewebs_link_info_desc>
|
|
96
|
+
<engine>Website (strings & languages)</engine>
|
|
97
|
+
<engine_desc>Configure header, contact, login text, ...</engine_desc>
|
|
98
|
+
<registration_success>The engine was connected to the repository "%s".</registration_success>
|
|
99
|
+
<registration_error>The engine could not be connected to the repository "%s".</registration_error>
|
|
100
|
+
<repository_down>The repository is currently not running, or the key of the repository is no longer valid.</repository_down>
|
|
101
|
+
<comment>Please give a short description of what you use this service for, e.g., "Discussion forum" or "Wiki for lecturers".</comment>
|
|
102
|
+
<comment_error>The description of the service is mandatory.</comment_error>
|
|
103
|
+
<error>This service is currently not available.</error>
|
|
104
|
+
<hyperlink>Link to external page</hyperlink>
|
|
105
|
+
<spacer>Separator</spacer>
|
|
106
|
+
</strings>
|
|
3
107
|
<strings xml:lang="de">
|
|
4
108
|
<description>DC</description>
|
|
5
109
|
<title1>Development Client</title1>
|
|
@@ -69,6 +173,7 @@
|
|
|
69
173
|
<menupoints_desc>Diese sind unabhängig von den Services. Sie können diese löschen, ohne Konsequenzen für die Services. Mehrere Menüpunkte können auf ein Service verweisen (z.B. können mehrere Menüpunkte auf mehrere Seiten in einem Wiki zeigen).</menupoints_desc>
|
|
70
174
|
<menupoints_new>Menüpunkt erstellen</menupoints_new>
|
|
71
175
|
<menupoints_del_it>Menüpunkt löschen?</menupoints_del_it>
|
|
176
|
+
<menupoints_edit>Menüpunkt bearbeiten</menupoints_edit>
|
|
72
177
|
<menupoints_order>Reihenfolge durch ziehen verändern</menupoints_order>
|
|
73
178
|
<menupoints_indent>Einrückung verändern</menupoints_indent>
|
|
74
179
|
<menupoints_save_order>Reihenfolge speichern</menupoints_save_order>
|
data/static/js/administration.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// index.html?m=ADMIN services, menu points, and links to the configuration
|
|
4
4
|
// index.html?m=ADMIN_SERVICES subscribe to a service
|
|
5
5
|
// index.html?m=ADMIN_MENUPOINTS add a menu point
|
|
6
|
+
// index.html?m=ADMIN_MENUPOINTS_EDIT&point={name} change the labels and the target of a menu point
|
|
6
7
|
// index.html?m=ADMIN_CEWEBS_LINK_INFO&service={service} links to a service
|
|
7
8
|
var CEWebS_Administration = (function() {
|
|
8
9
|
var XMLNS = 'http://www.w3.org/XML/1998/namespace';
|
|
@@ -81,7 +82,7 @@ var CEWebS_Administration = (function() {
|
|
|
81
82
|
var body = el('tbody', { id: 'menupoint_list' }, [
|
|
82
83
|
el('tr', {}, [
|
|
83
84
|
el('td', {}, '•'),
|
|
84
|
-
el('td', { colspan:
|
|
85
|
+
el('td', { colspan: 8 }, el('a', { href: '?m=ADMIN_MENUPOINTS' }, [icon(c, 'document-new', ''), ' ' + c.text('menupoints_new')]))
|
|
85
86
|
])
|
|
86
87
|
].concat(points.map(function(p, i) {
|
|
87
88
|
return el('tr', { id: 'point_' + i, class: 'sort' }, [
|
|
@@ -91,9 +92,11 @@ var CEWebS_Administration = (function() {
|
|
|
91
92
|
class: 'small click' + (p.parentNode == menu ? ' disabled' : ''),
|
|
92
93
|
onclick: function(event) { event.target.classList.toggle('disabled'); changed(); }
|
|
93
94
|
})),
|
|
94
|
-
el('td', { class: 'margin-right-
|
|
95
|
+
el('td', { class: 'margin-right-small' }, action(c, icon(c, 'edit-delete', c.text('menupoints_del_it')), function() {
|
|
95
96
|
if (confirm(c.text('menupoints_del_it'))) { p.remove(); save(c, menu); }
|
|
96
97
|
})),
|
|
98
|
+
el('td', { class: 'margin-right-big' }, el('a', { href: '?m=ADMIN_MENUPOINTS_EDIT&point=' + encodeURIComponent(p.getAttribute('name')) },
|
|
99
|
+
icon(c, 'accessories-text-editor', c.text('menupoints_edit')))),
|
|
97
100
|
el('td', {}, '['),
|
|
98
101
|
el('td', { class: 'size-m' }, el('em', {}, p.getAttribute('name'))),
|
|
99
102
|
el('td', { class: 'margin-right-big' }, ']'),
|
|
@@ -199,40 +202,77 @@ var CEWebS_Administration = (function() {
|
|
|
199
202
|
collect();
|
|
200
203
|
}
|
|
201
204
|
|
|
202
|
-
/* ----
|
|
205
|
+
/* ---- labels of a menu point ---- */
|
|
203
206
|
|
|
204
|
-
|
|
207
|
+
// language - text pairs, prefilled from existing [[language, text], ...]. The first one can not be removed.
|
|
208
|
+
function labels(c, existing) {
|
|
205
209
|
var el = c.el;
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
function label(removable) {
|
|
211
|
-
var row = el('div', {}, [
|
|
212
|
-
el('button', { type: 'button', class: removable ? null : 'hidden', title: c.text('menupoints_add_ltexts_remove'), onclick: function() { row.remove(); } },
|
|
210
|
+
var rows = el('div');
|
|
211
|
+
function row(language, text, removable) {
|
|
212
|
+
var r = el('div', {}, [
|
|
213
|
+
el('button', { type: 'button', class: removable ? null : 'hidden', title: c.text('menupoints_add_ltexts_remove'), onclick: function() { r.remove(); } },
|
|
213
214
|
icon(c, 'list-remove', c.text('menupoints_add_ltexts_remove'))), ' ',
|
|
214
|
-
el('input', { type: 'text', name: 'language', value:
|
|
215
|
-
el('input', { type: 'text', name: 'text' })
|
|
215
|
+
el('input', { type: 'text', name: 'language', value: language, maxlength: 5, size: 5 }), ' - ',
|
|
216
|
+
el('input', { type: 'text', name: 'text', value: text })
|
|
216
217
|
]);
|
|
217
|
-
|
|
218
|
-
return
|
|
218
|
+
rows.append(r);
|
|
219
|
+
return r;
|
|
219
220
|
}
|
|
221
|
+
var first = (existing.length > 0 ? existing : [['de', '']]).map(function(e, i) { return row(e[0], e[1], i > 0); })[0];
|
|
222
|
+
return {
|
|
223
|
+
first: first.querySelector('[name=text]'),
|
|
224
|
+
nodes: [
|
|
225
|
+
el('h2', { html: c.string('menupoints_add_ltexts') }),
|
|
226
|
+
el('p', { html: c.string('menupoints_add_ltexts_desc') }),
|
|
227
|
+
rows,
|
|
228
|
+
el('div', { class: 'margin-bottom-big margin-top-small' }, el('button', { type: 'button', title: c.text('menupoints_add_ltexts_add'), onclick: function() { row('de', '', true); } },
|
|
229
|
+
icon(c, 'list-add', c.text('menupoints_add_ltexts_add'))))
|
|
230
|
+
],
|
|
231
|
+
// the pairs of a submitted form, null (after telling why) if they are not valid
|
|
232
|
+
read: function(data) {
|
|
233
|
+
var languages = data.getAll('language'), texts = data.getAll('text');
|
|
234
|
+
if (!languages.every(function(l) { return /^[a-z][a-z](-[A-Z][A-Z])?$/.test(l); })) { alert(c.text('menupoints_add_error_language')); return null; }
|
|
235
|
+
if (!texts.every(function(t) { return t.trim(); })) { alert(c.text('menupoints_add_error_text')); return null; }
|
|
236
|
+
return texts.map(function(t, i) { return [languages[i], t]; });
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
220
240
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
var
|
|
224
|
-
|
|
225
|
-
|
|
241
|
+
// replaces the text elements of a point, they have to come before command
|
|
242
|
+
function relabel(point, pairs) {
|
|
243
|
+
var doc = point.ownerDocument;
|
|
244
|
+
Array.from(point.children).filter(function(n) { return n.localName == 'text'; }).forEach(function(n) { n.remove(); });
|
|
245
|
+
var before = Array.from(point.children).find(function(n) { return n.localName == 'command'; }) || null;
|
|
246
|
+
pairs.forEach(function(p) {
|
|
247
|
+
var node = doc.createElement('text');
|
|
248
|
+
node.setAttributeNS(XMLNS, 'xml:lang', p[0]);
|
|
249
|
+
node.textContent = p[1];
|
|
250
|
+
point.insertBefore(node, before);
|
|
226
251
|
});
|
|
252
|
+
}
|
|
227
253
|
|
|
254
|
+
/* ---- target of a menu point ---- */
|
|
255
|
+
|
|
256
|
+
// service and entry point, preselected from an existing point (null for a new one)
|
|
257
|
+
function target(c, services, point) {
|
|
258
|
+
var el = c.el;
|
|
259
|
+
var current = point ? { type: point.getAttribute('service'), command: c.value(point, 'command'), parameters: c.value(point, 'parameters') } : null;
|
|
228
260
|
var entry = el('span');
|
|
229
261
|
async function update() {
|
|
230
|
-
|
|
262
|
+
var same = current && select.value == current.type;
|
|
263
|
+
if (select.value == 'hyperlink') return entry.replaceChildren(el('input', { type: 'text', name: 'entry_point', value: same ? current.command : 'https://', size: 30 }));
|
|
231
264
|
if (!select.value.startsWith('service')) return entry.replaceChildren();
|
|
232
265
|
var selected = select.value;
|
|
233
266
|
entry.replaceChildren(c.text('menupoints_add_entry_point_wait'));
|
|
234
267
|
try {
|
|
235
268
|
var points = await entrypoints(c, selected);
|
|
269
|
+
if (same) {
|
|
270
|
+
// the current entry point stays selectable, also when the service does not offer it anymore
|
|
271
|
+
var value = current.command + '?' + current.parameters;
|
|
272
|
+
var option = Array.from(points.options).find(function(o) { return o.value == value; });
|
|
273
|
+
if (!option) points.append(option = el('option', { value: value }, value));
|
|
274
|
+
option.selected = true;
|
|
275
|
+
}
|
|
236
276
|
if (select.value == selected) entry.replaceChildren(points);
|
|
237
277
|
} catch (e) {
|
|
238
278
|
if (select.value == selected) entry.replaceChildren(c.text('error'));
|
|
@@ -245,62 +285,129 @@ var CEWebS_Administration = (function() {
|
|
|
245
285
|
el('option', { value: 'spacer' }, c.text('spacer')),
|
|
246
286
|
el('option', { value: 'plain' }, 'Text')
|
|
247
287
|
]));
|
|
288
|
+
if (current) {
|
|
289
|
+
// a service that is not subscribed anymore stays selectable
|
|
290
|
+
if (!Array.from(select.options).some(function(o) { return o.value == current.type; })) select.append(el('option', { value: current.type }, current.type));
|
|
291
|
+
select.value = current.type;
|
|
292
|
+
}
|
|
293
|
+
return {
|
|
294
|
+
nodes: [
|
|
295
|
+
el('h2', { html: c.string('menupoints_add_service') }),
|
|
296
|
+
el('p', { html: c.string('menupoints_add_service_desc') }),
|
|
297
|
+
select, ' ', entry
|
|
298
|
+
],
|
|
299
|
+
update: update,
|
|
300
|
+
// type, command and parameters of a submitted form, null (after telling why) if they are not valid
|
|
301
|
+
read: function(data) {
|
|
302
|
+
var type = data.get('service'), entered = data.get('entry_point');
|
|
303
|
+
if (type == 'hyperlink' && !/^(https?:\/\/.|mailto:.)/.test(entered)) { alert(c.text('hyperlink') + ': https://'); return null; }
|
|
304
|
+
if (type.startsWith('service') && !entered) { alert(c.text('menupoints_add_entry_point_wait')); return null; }
|
|
305
|
+
return {
|
|
306
|
+
type: type,
|
|
307
|
+
command: type == 'hyperlink' ? entered : type.startsWith('service') ? entered.split('?')[0] : '',
|
|
308
|
+
parameters: type.startsWith('service') ? entered.split('?').slice(1).join('?') : ''
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// sets service, command and parameters of a point, they come after the text elements and before sub points
|
|
315
|
+
function retarget(point, goal) {
|
|
316
|
+
var doc = point.ownerDocument;
|
|
317
|
+
var children = Array.from(point.children);
|
|
318
|
+
var command = children.find(function(n) { return n.localName == 'command'; });
|
|
319
|
+
var parameters = children.find(function(n) { return n.localName == 'parameters'; });
|
|
320
|
+
var before = children.find(function(n) { return n.localName == 'point'; }) || null;
|
|
321
|
+
if (!command) point.insertBefore(command = doc.createElement('command'), before);
|
|
322
|
+
if (!parameters) point.insertBefore(parameters = doc.createElement('parameters'), before);
|
|
323
|
+
point.setAttribute('service', goal.type);
|
|
324
|
+
command.textContent = goal.command;
|
|
325
|
+
parameters.textContent = goal.parameters;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* ---- add a menu point ---- */
|
|
329
|
+
|
|
330
|
+
async function add(c) {
|
|
331
|
+
var el = c.el;
|
|
332
|
+
var services = subscribed(c, await c.request('GET', 'services'));
|
|
333
|
+
var menu = await c.request('GET', 'menu');
|
|
334
|
+
var texts = labels(c, []);
|
|
335
|
+
|
|
336
|
+
// the name is derived from the first label until it is changed
|
|
337
|
+
var named = false;
|
|
338
|
+
var name = el('input', { type: 'text', name: 'name', maxlength: 15, size: 20, onchange: function() { named = true; } });
|
|
339
|
+
texts.first.addEventListener('input', function(event) {
|
|
340
|
+
if (!named) name.value = event.target.value.replace(/[^a-zA-Z0-9]/g, '').toLowerCase().substring(0, 15);
|
|
341
|
+
});
|
|
342
|
+
var where = target(c, services, null);
|
|
248
343
|
|
|
249
344
|
function submit(event) {
|
|
250
345
|
event.preventDefault();
|
|
251
346
|
var data = new FormData(event.target);
|
|
252
|
-
var type = data.get('service'), entered = data.get('entry_point');
|
|
253
|
-
var languages = data.getAll('language'), texts = data.getAll('text');
|
|
254
347
|
if (!/^[a-z0-9]+$/.test(data.get('name'))) return alert(c.text('menupoints_add_error_name'));
|
|
255
|
-
|
|
256
|
-
if (!
|
|
257
|
-
|
|
258
|
-
if (
|
|
348
|
+
var pairs = texts.read(data);
|
|
349
|
+
if (!pairs) return;
|
|
350
|
+
var goal = where.read(data);
|
|
351
|
+
if (!goal) return;
|
|
259
352
|
|
|
260
353
|
var unique = data.get('name');
|
|
261
354
|
for (var i = 1; menu.querySelector('point[name="' + unique + '"]'); i++) unique = data.get('name') + i;
|
|
262
|
-
var
|
|
263
|
-
var point = doc.createElement('point');
|
|
355
|
+
var point = menu.ownerDocument.createElement('point');
|
|
264
356
|
point.setAttribute('name', unique);
|
|
265
|
-
point
|
|
266
|
-
|
|
267
|
-
var node = doc.createElement('text');
|
|
268
|
-
node.setAttributeNS(XMLNS, 'xml:lang', languages[i]);
|
|
269
|
-
node.textContent = t;
|
|
270
|
-
point.append(node);
|
|
271
|
-
});
|
|
272
|
-
var command = doc.createElement('command');
|
|
273
|
-
var parameters = doc.createElement('parameters');
|
|
274
|
-
if (type == 'hyperlink') {
|
|
275
|
-
command.textContent = entered;
|
|
276
|
-
} else if (type.startsWith('service')) {
|
|
277
|
-
command.textContent = entered.split('?')[0];
|
|
278
|
-
parameters.textContent = entered.split('?').slice(1).join('?');
|
|
279
|
-
}
|
|
280
|
-
point.append(command, parameters);
|
|
357
|
+
relabel(point, pairs);
|
|
358
|
+
retarget(point, goal);
|
|
281
359
|
menu.append(point);
|
|
282
360
|
save(c, menu);
|
|
283
361
|
}
|
|
284
362
|
|
|
285
363
|
c.show([
|
|
286
364
|
el('p', { html: c.string('menupoints_add_desc') }),
|
|
287
|
-
el('form', { onsubmit: submit }, [
|
|
288
|
-
el('h2', { html: c.string('menupoints_add_ltexts') }),
|
|
289
|
-
el('p', { html: c.string('menupoints_add_ltexts_desc') }),
|
|
290
|
-
labels,
|
|
291
|
-
el('div', { class: 'margin-bottom-big margin-top-small' }, el('button', { type: 'button', title: c.text('menupoints_add_ltexts_add'), onclick: function() { label(true); } },
|
|
292
|
-
icon(c, 'list-add', c.text('menupoints_add_ltexts_add')))),
|
|
365
|
+
el('form', { onsubmit: submit }, texts.nodes.concat([
|
|
293
366
|
el('h2', { html: c.string('menupoints_add_name') }),
|
|
294
367
|
el('p', { html: c.string('menupoints_add_name_desc') }),
|
|
295
|
-
name
|
|
296
|
-
|
|
297
|
-
el('p', { html: c.string('menupoints_add_service_desc') }),
|
|
298
|
-
select, ' ', entry,
|
|
368
|
+
name
|
|
369
|
+
], where.nodes, [
|
|
299
370
|
el('p', {}, el('input', { type: 'submit', value: c.text('menupoints_save') }))
|
|
300
|
-
])
|
|
371
|
+
]))
|
|
301
372
|
], c.string('menupoints_add'));
|
|
302
|
-
update();
|
|
373
|
+
where.update();
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/* ---- edit a menu point ---- */
|
|
377
|
+
|
|
378
|
+
// labels, service and entry point can change. The short name stays, as CEWebS://name/... links and ?t=name addresses use it
|
|
379
|
+
async function edit(c) {
|
|
380
|
+
var el = c.el;
|
|
381
|
+
var services = subscribed(c, await c.request('GET', 'services'));
|
|
382
|
+
var menu = await c.request('GET', 'menu');
|
|
383
|
+
var name = new URLSearchParams(location.search).get('point');
|
|
384
|
+
var point = Array.from(menu.querySelectorAll('point')).find(function(p) { return p.getAttribute('name') == name; });
|
|
385
|
+
if (!point) return c.show([el('p', { class: 'urgent' }, c.text('error'))], c.string('menupoints_edit'));
|
|
386
|
+
var texts = labels(c, c.all(point, 'text').map(function(t) { return [t.getAttribute('xml:lang'), t.textContent]; }));
|
|
387
|
+
var where = target(c, services, point);
|
|
388
|
+
|
|
389
|
+
function submit(event) {
|
|
390
|
+
event.preventDefault();
|
|
391
|
+
var data = new FormData(event.target);
|
|
392
|
+
var pairs = texts.read(data);
|
|
393
|
+
if (!pairs) return;
|
|
394
|
+
var goal = where.read(data);
|
|
395
|
+
if (!goal) return;
|
|
396
|
+
relabel(point, pairs);
|
|
397
|
+
retarget(point, goal);
|
|
398
|
+
save(c, menu);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
c.show([
|
|
402
|
+
el('form', { onsubmit: submit }, texts.nodes.concat([
|
|
403
|
+
el('h2', { html: c.string('menupoints_add_name') }),
|
|
404
|
+
el('p', {}, el('em', {}, name))
|
|
405
|
+
], where.nodes, [
|
|
406
|
+
el('p', {}, el('input', { type: 'submit', value: c.text('menupoints_save') }))
|
|
407
|
+
]))
|
|
408
|
+
], c.string('menupoints_edit'));
|
|
409
|
+
where.update();
|
|
303
410
|
}
|
|
304
411
|
|
|
305
|
-
return { ADMIN: overview, ADMIN_SERVICES: subscribe, ADMIN_MENUPOINTS: add, ADMIN_CEWEBS_LINK_INFO: links };
|
|
412
|
+
return { ADMIN: overview, ADMIN_SERVICES: subscribe, ADMIN_MENUPOINTS: add, ADMIN_MENUPOINTS_EDIT: edit, ADMIN_CEWEBS_LINK_INFO: links };
|
|
306
413
|
})();
|
data/static/js/engine.js
CHANGED
|
@@ -12,7 +12,8 @@ var CEWebS = (function() {
|
|
|
12
12
|
var times, began = 0;
|
|
13
13
|
var loaded = {};
|
|
14
14
|
var bundles = {
|
|
15
|
-
jquery: ['jquery.min', 'jquery-ui.min', 'base64', 'printf'].map(function(f) { return 'jquery/' + f + '.js'; })
|
|
15
|
+
jquery: ['jquery.min', 'jquery-ui.min', 'base64', 'printf'].map(function(f) { return 'jquery/' + f + '.js'; }),
|
|
16
|
+
temml: ['temml/temml.min.js']
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
// element, attributes starting with on are event handlers, html is markup
|
|
@@ -78,14 +79,16 @@ var CEWebS = (function() {
|
|
|
78
79
|
var nav = [];
|
|
79
80
|
if (user) {
|
|
80
81
|
var role = value(user, 'role');
|
|
81
|
-
if (role == 'true' || role == 'limited') nav.push(
|
|
82
|
-
if (role == 'true') nav.push(
|
|
83
|
-
nav.push(
|
|
84
|
-
nav.push(['
|
|
82
|
+
if (role == 'true' || role == 'limited') nav.push(['report', { href: '?m=REPORT', html: string('report') }]);
|
|
83
|
+
if (role == 'true') nav.push(['admin', { href: '?m=ADMIN', html: string('administration') }]);
|
|
84
|
+
nav.push(['change', { href: '?m=CHANGE', html: string('change') }]);
|
|
85
|
+
nav.push(['logout', { href: '#', title: value(user, 'name'), html: string('logout'), onclick: logout }]);
|
|
85
86
|
} else {
|
|
86
|
-
nav.push(
|
|
87
|
+
nav.push(['login', { href: '?m=LOGIN', html: string('login') }]);
|
|
87
88
|
}
|
|
88
|
-
id('hnav').append.apply(id('hnav'), nav.
|
|
89
|
+
id('hnav').append.apply(id('hnav'), nav.flatMap(function(n, i) { return ['[', el('a', n[1]), i < nav.length - 1 ? '] ' : ']']; }));
|
|
90
|
+
// the same links on top of the menu, which styles show instead of hnav on small screens
|
|
91
|
+
id('navmenu').append.apply(id('navmenu'), nav.map(function(n) { return el('li', { class: 'menu nav-' + n[0] }, el('a', n[1])); }));
|
|
89
92
|
document.querySelector('#header .search').replaceChildren(el('form', { action: 'index.html' }, [
|
|
90
93
|
el('input', { type: 'hidden', name: 'm', value: 'SEARCH' }),
|
|
91
94
|
el('input', { type: 'text', name: 'search', placeholder: text('search'), value: new URLSearchParams(location.search).get('search') })
|
|
@@ -155,11 +158,31 @@ var CEWebS = (function() {
|
|
|
155
158
|
document.head.append(el('link', { rel: 'stylesheet', href: 'static/styles/jquery-ui/jquery-ui.css' }));
|
|
156
159
|
document.head.append(el('link', { rel: 'stylesheet', href: 'static/styles/jquery-ui/custom.css' }));
|
|
157
160
|
}
|
|
161
|
+
if (name == 'temml') document.head.append(el('link', { rel: 'stylesheet', href: 'static/styles/temml/Temml-Local.css' }));
|
|
158
162
|
loaded[name] = Promise.all(bundles[name].map(function(f) { return load('static/js/' + f); }));
|
|
159
163
|
}
|
|
160
164
|
return loaded[name];
|
|
161
165
|
}
|
|
162
166
|
|
|
167
|
+
// formulas are TeX with delimiters, $...$ inline and \[...\] as block. They become MathML,
|
|
168
|
+
// Temml is only loaded for pages that contain one. Errors in a formula are shown in its place.
|
|
169
|
+
// Browsers without MathML, and formulas Temml can not handle, keep the TeX.
|
|
170
|
+
async function formulas(node) {
|
|
171
|
+
var spans = node.querySelectorAll('span.formula');
|
|
172
|
+
if (spans.length == 0 || typeof MathMLElement == 'undefined') return;
|
|
173
|
+
await bundle('temml');
|
|
174
|
+
spans.forEach(function(s) {
|
|
175
|
+
var tex = s.textContent;
|
|
176
|
+
var block = tex.startsWith('\\[');
|
|
177
|
+
try {
|
|
178
|
+
temml.render(block ? tex.slice(2, -2) : tex.slice(1, -1), s, { displayMode: block });
|
|
179
|
+
s.classList.remove('monospace');
|
|
180
|
+
} catch (e) {
|
|
181
|
+
s.textContent = tex;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
163
186
|
// the time the engine needed, details are in the tooltip
|
|
164
187
|
function speed(times) {
|
|
165
188
|
var ms = {};
|
|
@@ -195,6 +218,8 @@ var CEWebS = (function() {
|
|
|
195
218
|
script.textContent = old.textContent;
|
|
196
219
|
old.replaceWith(script);
|
|
197
220
|
});
|
|
221
|
+
// before scrolling to an anchor, as formulas change the height of the page
|
|
222
|
+
await formulas(id('content'));
|
|
198
223
|
id('contentcontainer').scrollTop = 0;
|
|
199
224
|
if (location.hash) {
|
|
200
225
|
var anchor = id(decodeURIComponent(location.hash.substring(1)));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Ron Kok
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|