@saltcorn/server 0.5.5-beta.1 → 0.5.5
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.
- package/package.json +8 -8
- package/public/saltcorn.js +42 -0
- package/wrapper.js +6 -0
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/server",
|
|
3
|
-
"version": "0.5.5
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Server app for Saltcorn, open-source no-code platform",
|
|
5
5
|
"homepage": "https://saltcorn.com",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@saltcorn/base-plugin": "0.5.5
|
|
10
|
-
"@saltcorn/builder": "0.5.5
|
|
11
|
-
"@saltcorn/data": "0.5.5
|
|
9
|
+
"@saltcorn/base-plugin": "0.5.5",
|
|
10
|
+
"@saltcorn/builder": "0.5.5",
|
|
11
|
+
"@saltcorn/data": "0.5.5",
|
|
12
12
|
"greenlock-express": "^4.0.3",
|
|
13
|
-
"@saltcorn/markup": "0.5.5
|
|
14
|
-
"@saltcorn/sbadmin2": "0.5.5
|
|
13
|
+
"@saltcorn/markup": "0.5.5",
|
|
14
|
+
"@saltcorn/sbadmin2": "0.5.5",
|
|
15
15
|
"@socket.io/cluster-adapter": "^0.1.0",
|
|
16
16
|
"@socket.io/sticky": "^1.0.1",
|
|
17
17
|
"connect-flash": "^0.1.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"greenlock": "^4.0.4",
|
|
31
31
|
"helmet": "^3.23.3",
|
|
32
32
|
"i18n": "^0.13.2",
|
|
33
|
-
"live-plugin-manager": "^0.
|
|
33
|
+
"live-plugin-manager": "^0.16.0",
|
|
34
34
|
"moment": "^2.27.0",
|
|
35
35
|
"node-fetch": "^2.6.1",
|
|
36
36
|
"passport": "^0.4.1",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"passport-http-bearer": "^1.0.1",
|
|
39
39
|
"pg": "^8.2.1",
|
|
40
40
|
"pluralize": "^8.0.0",
|
|
41
|
-
"socket.io": "4.
|
|
41
|
+
"socket.io": "4.2.0",
|
|
42
42
|
"tmp-promise": "^3.0.2"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
package/public/saltcorn.js
CHANGED
|
@@ -106,28 +106,70 @@ function reindex(element, oldix, newix) {
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
function get_form_subset_record(e) {
|
|
110
|
+
const rec = {};
|
|
111
|
+
e.find("input[name],select[name]").each(function () {
|
|
112
|
+
rec[$(this).attr("name")] = $(this).val();
|
|
113
|
+
});
|
|
114
|
+
return rec;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function apply_form_subset_record(e, vals) {
|
|
118
|
+
e.find("input[name],select[name]").each(function () {
|
|
119
|
+
var name = $(this).attr("name");
|
|
120
|
+
if (vals[name]) $(this).val(vals[name]);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function reindex_form_record(vals, oldix, newix) {
|
|
125
|
+
const rec = {};
|
|
126
|
+
Object.keys(vals).forEach((k) => {
|
|
127
|
+
const newkey = k.split("_" + oldix).join("_" + newix);
|
|
128
|
+
rec[newkey] = vals[k];
|
|
129
|
+
});
|
|
130
|
+
return rec;
|
|
131
|
+
}
|
|
132
|
+
|
|
109
133
|
function rep_up(e) {
|
|
110
134
|
var myrep = $(e).closest(".form-repeat");
|
|
135
|
+
var theform = $(e).closest("form");
|
|
111
136
|
var ix = myrep.index();
|
|
112
137
|
var parent = myrep.parent();
|
|
113
138
|
if (ix > 0) {
|
|
114
139
|
var swap_with = parent.children(".form-repeat").eq(ix - 1);
|
|
140
|
+
var vals1 = reindex_form_record(get_form_subset_record(myrep), ix, ix - 1);
|
|
141
|
+
var vals2 = reindex_form_record(
|
|
142
|
+
get_form_subset_record(swap_with),
|
|
143
|
+
ix - 1,
|
|
144
|
+
ix
|
|
145
|
+
);
|
|
115
146
|
reindex(myrep, ix, ix - 1);
|
|
116
147
|
reindex(swap_with, ix - 1, ix);
|
|
117
148
|
$(myrep).swapWith(swap_with);
|
|
149
|
+
apply_form_subset_record(theform, vals2);
|
|
150
|
+
apply_form_subset_record(theform, vals1);
|
|
118
151
|
}
|
|
119
152
|
}
|
|
120
153
|
|
|
121
154
|
function rep_down(e) {
|
|
122
155
|
var myrep = $(e).closest(".form-repeat");
|
|
156
|
+
var theform = $(e).closest("form");
|
|
123
157
|
var ix = myrep.index();
|
|
124
158
|
var parent = myrep.parent();
|
|
125
159
|
var nchildren = parent.children(".form-repeat").length;
|
|
126
160
|
if (ix < nchildren - 1) {
|
|
127
161
|
var swap_with = parent.children(".form-repeat").eq(ix + 1);
|
|
162
|
+
var vals1 = reindex_form_record(get_form_subset_record(myrep), ix, ix + 1);
|
|
163
|
+
var vals2 = reindex_form_record(
|
|
164
|
+
get_form_subset_record(swap_with),
|
|
165
|
+
ix + 1,
|
|
166
|
+
ix
|
|
167
|
+
);
|
|
128
168
|
reindex(myrep, ix, ix + 1);
|
|
129
169
|
reindex(swap_with, ix + 1, ix);
|
|
130
170
|
$(myrep).swapWith(swap_with);
|
|
171
|
+
apply_form_subset_record(theform, vals2);
|
|
172
|
+
apply_form_subset_record(theform, vals1);
|
|
131
173
|
}
|
|
132
174
|
}
|
|
133
175
|
function initialize_page() {
|
package/wrapper.js
CHANGED
|
@@ -245,6 +245,11 @@ module.exports = (version_tag) =>
|
|
|
245
245
|
const renderToHtml = layout.renderBody
|
|
246
246
|
? (h, role) => layout.renderBody({ title, body: h, role, alerts })
|
|
247
247
|
: defaultRenderToHtml;
|
|
248
|
+
res.header(
|
|
249
|
+
"Cache-Control",
|
|
250
|
+
"private, no-cache, no-store, must-revalidate"
|
|
251
|
+
);
|
|
252
|
+
|
|
248
253
|
res.set("Page-Title", encodeURIComponent(title));
|
|
249
254
|
res.send(
|
|
250
255
|
html.length === 1
|
|
@@ -256,6 +261,7 @@ module.exports = (version_tag) =>
|
|
|
256
261
|
const currentUrl = req.originalUrl.split("?")[0];
|
|
257
262
|
|
|
258
263
|
const pageHeaders = typeof opts === "string" ? [] : opts.headers;
|
|
264
|
+
|
|
259
265
|
res.send(
|
|
260
266
|
layout.wrap({
|
|
261
267
|
title,
|