@saltcorn/server 0.7.4 → 0.8.0-beta.1
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/app.js +18 -11
- package/auth/admin.js +370 -120
- package/auth/roleadmin.js +5 -23
- package/auth/routes.js +40 -15
- package/locales/de.json +1049 -273
- package/locales/en.json +58 -3
- package/locales/es.json +134 -134
- package/locales/it.json +6 -1
- package/locales/ru.json +44 -7
- package/markup/admin.js +46 -42
- package/markup/forms.js +4 -3
- package/package.json +8 -7
- package/public/blockly.js +19 -31
- package/public/diagram_utils.js +530 -0
- package/public/gridedit.js +4 -1
- package/public/jquery-menu-editor.min.js +112 -112
- package/public/saltcorn-common.js +31 -8
- package/public/saltcorn.css +11 -0
- package/public/saltcorn.js +211 -70
- package/restart_watcher.js +1 -0
- package/routes/actions.js +6 -14
- package/routes/admin.js +229 -79
- package/routes/api.js +19 -2
- package/routes/common_lists.js +137 -134
- package/routes/delete.js +6 -5
- package/routes/diagram.js +43 -117
- package/routes/edit.js +5 -10
- package/routes/fields.js +63 -29
- package/routes/files.js +137 -101
- package/routes/homepage.js +2 -2
- package/routes/infoarch.js +2 -2
- package/routes/list.js +12 -13
- package/routes/page.js +16 -3
- package/routes/pageedit.js +13 -8
- package/routes/scapi.js +1 -1
- package/routes/search.js +1 -1
- package/routes/tables.js +9 -14
- package/routes/tag_entries.js +31 -10
- package/routes/tags.js +10 -10
- package/routes/tenant.js +114 -50
- package/routes/utils.js +12 -0
- package/routes/view.js +3 -4
- package/routes/viewedit.js +57 -55
- package/serve.js +5 -0
- package/tests/admin.test.js +6 -2
- package/tests/auth.test.js +20 -0
- package/tests/fields.test.js +1 -0
- package/tests/files.test.js +11 -20
- package/tests/tenant.test.js +12 -2
- package/tests/viewedit.test.js +15 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
function MenuEditor(e, t) {
|
|
2
2
|
const radioValue = (e) =>
|
|
3
|
-
$(`input:radio[name
|
|
3
|
+
$(`input:radio[name=\"${$(e).attr("name")}\"]:checked`).val();
|
|
4
4
|
var s = $("#" + e).data("level", "0"),
|
|
5
5
|
l = {
|
|
6
6
|
labelEdit: '<i class="fas fa-edit clickable"></i>',
|
|
7
7
|
labelRemove: '<i class="fas fa-trash-alt clickable"></i>',
|
|
8
8
|
textConfirmDelete: "This item will be deleted. Are you sure?",
|
|
9
9
|
getLabelText: (e) => e.text,
|
|
10
|
-
onUpdate: () => {},
|
|
10
|
+
onUpdate: () => { },
|
|
11
11
|
iconPicker: { cols: 4, rows: 4, footer: !1, iconset: "fontawesome5" },
|
|
12
12
|
maxLevel: -1,
|
|
13
13
|
listOptions: {
|
|
@@ -113,8 +113,8 @@ function MenuEditor(e, t) {
|
|
|
113
113
|
var o = !1;
|
|
114
114
|
void 0 !== n.attr("id") && (o = n.attr("id").toString() === e),
|
|
115
115
|
n.children().length ||
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
o ||
|
|
117
|
+
(n.prev("div").children(".sortableListsOpener").first().remove(),
|
|
118
118
|
n.remove()),
|
|
119
119
|
MenuEditor.updateButtons(s);
|
|
120
120
|
l.onUpdate();
|
|
@@ -125,10 +125,10 @@ function MenuEditor(e, t) {
|
|
|
125
125
|
(function (e) {
|
|
126
126
|
var t = e.data();
|
|
127
127
|
$.each(t, function (e, t) {
|
|
128
|
-
var el = i.find("[name
|
|
128
|
+
var el = i.find("[name=\"" + e + "\"]");
|
|
129
129
|
if (el.prop("type") == "checkbox") el.prop("checked", !!t);
|
|
130
130
|
else if (el.prop("type") == "radio") {
|
|
131
|
-
$(`input[name
|
|
131
|
+
$(`input[name=\"${el.prop("name")}\"][value="${t}"]`).prop(
|
|
132
132
|
"checked",
|
|
133
133
|
true
|
|
134
134
|
);
|
|
@@ -173,7 +173,7 @@ function MenuEditor(e, t) {
|
|
|
173
173
|
l = $(this).closest("li");
|
|
174
174
|
l.closest("ul").closest("li").after(l),
|
|
175
175
|
t.children().length <= 0 &&
|
|
176
|
-
|
|
176
|
+
(t.prev("div").children(".sortableListsOpener").first().remove(),
|
|
177
177
|
t.remove()),
|
|
178
178
|
MenuEditor.updateButtons(s),
|
|
179
179
|
s.updateLevels();
|
|
@@ -219,8 +219,8 @@ function MenuEditor(e, t) {
|
|
|
219
219
|
$(this).attr("type") === "radio"
|
|
220
220
|
? radioValue(this)
|
|
221
221
|
: $(this).attr("type") === "checkbox"
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
? $(this).prop("checked")
|
|
223
|
+
: $(this).val()
|
|
224
224
|
);
|
|
225
225
|
}),
|
|
226
226
|
e.children().children("i").removeClass(t).addClass(e.data("icon")),
|
|
@@ -236,8 +236,8 @@ function MenuEditor(e, t) {
|
|
|
236
236
|
$(this).attr("type") === "radio"
|
|
237
237
|
? radioValue(this)
|
|
238
238
|
: $(this).attr("type") === "checkbox"
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
? $(this).prop("checked")
|
|
240
|
+
: $(this).val();
|
|
241
241
|
});
|
|
242
242
|
var t = u(),
|
|
243
243
|
l = $("<span>").addClass("txt").text(mqeSets.getLabelText(e)),
|
|
@@ -262,13 +262,13 @@ function MenuEditor(e, t) {
|
|
|
262
262
|
var t = Array.isArray(e)
|
|
263
263
|
? e
|
|
264
264
|
: (function (e) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
265
|
+
try {
|
|
266
|
+
var t = JSON.parse(e);
|
|
267
|
+
} catch (e) {
|
|
268
|
+
return console.log("The string is not a json valid."), null;
|
|
269
|
+
}
|
|
270
|
+
return t;
|
|
271
|
+
})(e);
|
|
272
272
|
if (null !== t) {
|
|
273
273
|
s.empty();
|
|
274
274
|
var n = (function e(t, l) {
|
|
@@ -277,9 +277,9 @@ function MenuEditor(e, t) {
|
|
|
277
277
|
0 === n
|
|
278
278
|
? s
|
|
279
279
|
: $("<ul>")
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
280
|
+
.addClass("pl-0")
|
|
281
|
+
.css("padding-top", "10px")
|
|
282
|
+
.data("level", n);
|
|
283
283
|
return (
|
|
284
284
|
$.each(t, function (t, s) {
|
|
285
285
|
var l = void 0 !== s.children && $.isArray(s.children),
|
|
@@ -311,9 +311,9 @@ function MenuEditor(e, t) {
|
|
|
311
311
|
})(t);
|
|
312
312
|
o
|
|
313
313
|
? s.find("li").each(function () {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
314
|
+
var e = $(this);
|
|
315
|
+
e.children("ul").length && f(e);
|
|
316
|
+
})
|
|
317
317
|
: (n.sortableLists(l.listOptions), (o = !0)),
|
|
318
318
|
MenuEditor.updateButtons(s);
|
|
319
319
|
}
|
|
@@ -409,8 +409,8 @@ function MenuEditor(e, t) {
|
|
|
409
409
|
"class" == n.opener.as
|
|
410
410
|
? c.addClass(n.opener.close)
|
|
411
411
|
: "html" == n.opener.as
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
? c.html(n.opener.close)
|
|
413
|
+
: console.error("Invalid setting for opener.as");
|
|
414
414
|
var d = {
|
|
415
415
|
isDragged: !1,
|
|
416
416
|
isRelEFP: null,
|
|
@@ -439,7 +439,7 @@ function MenuEditor(e, t) {
|
|
|
439
439
|
var t = e(this);
|
|
440
440
|
t.children(n.listSelector).length &&
|
|
441
441
|
(c.clone(!0).prependTo(t.children("div").first()),
|
|
442
|
-
|
|
442
|
+
t.hasClass("sortableListsOpen") ? L(t) : E(t));
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
return this.on("mousedown touchstart", function (t) {
|
|
@@ -452,41 +452,41 @@ function MenuEditor(e, t) {
|
|
|
452
452
|
a = e(this);
|
|
453
453
|
l[0] &&
|
|
454
454
|
(n.onDragStart(t, l),
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}),
|
|
468
|
-
(d.cEl = { el: s, mT: a, mL: f, mB: c, mR: h, offset: v }),
|
|
469
|
-
(d.cEl.xyOffsetDiff = {
|
|
470
|
-
X: t.pageX - d.cEl.offset.left,
|
|
471
|
-
Y: t.pageY - d.cEl.offset.top,
|
|
455
|
+
(function (t, s, l) {
|
|
456
|
+
d.isDragged = !0;
|
|
457
|
+
var a = parseInt(s.css("margin-top")),
|
|
458
|
+
c = parseInt(s.css("margin-bottom")),
|
|
459
|
+
f = parseInt(s.css("margin-left")),
|
|
460
|
+
h = parseInt(s.css("margin-right")),
|
|
461
|
+
v = s.offset(),
|
|
462
|
+
b = s.innerHeight();
|
|
463
|
+
(d.rootEl = {
|
|
464
|
+
el: l,
|
|
465
|
+
offset: l.offset(),
|
|
466
|
+
rootElClass: l.attr("class"),
|
|
472
467
|
}),
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
.
|
|
489
|
-
|
|
468
|
+
(d.cEl = { el: s, mT: a, mL: f, mB: c, mR: h, offset: v }),
|
|
469
|
+
(d.cEl.xyOffsetDiff = {
|
|
470
|
+
X: t.pageX - d.cEl.offset.left,
|
|
471
|
+
Y: t.pageY - d.cEl.offset.top,
|
|
472
|
+
}),
|
|
473
|
+
d.cEl.el.addClass("sortableListsCurrent " + n.currElClass),
|
|
474
|
+
s.before(i);
|
|
475
|
+
var g = (d.placeholderNode = e("#sortableListsPlaceholder"));
|
|
476
|
+
s
|
|
477
|
+
.css({
|
|
478
|
+
width: s.width(),
|
|
479
|
+
position: "absolute",
|
|
480
|
+
top: v.top - a,
|
|
481
|
+
left: v.left - f,
|
|
482
|
+
})
|
|
483
|
+
.prependTo(o),
|
|
484
|
+
g.css({ display: "block", height: b }),
|
|
485
|
+
r.css("height", b),
|
|
486
|
+
d.doc
|
|
487
|
+
.on("mousemove touchmove", p)
|
|
488
|
+
.on("mouseup touchend touchcancel", u);
|
|
489
|
+
})(t, l, a));
|
|
490
490
|
}
|
|
491
491
|
});
|
|
492
492
|
function p(t) {
|
|
@@ -496,12 +496,12 @@ function MenuEditor(e, t) {
|
|
|
496
496
|
o = d.win;
|
|
497
497
|
"touchmove" === t.type && v(t),
|
|
498
498
|
t.pageX ||
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
499
|
+
(function (e) {
|
|
500
|
+
(e.pageY = d.pY),
|
|
501
|
+
(e.pageX = d.pX),
|
|
502
|
+
(e.clientY = d.cY),
|
|
503
|
+
(e.clientX = d.cX);
|
|
504
|
+
})(t),
|
|
505
505
|
l.scrollTop() > d.rootEl.offset.top - 10 && t.clientY < 50
|
|
506
506
|
? d.upScroll
|
|
507
507
|
? ((t.pageY = t.pageY - n.scroll),
|
|
@@ -510,27 +510,27 @@ function MenuEditor(e, t) {
|
|
|
510
510
|
}),
|
|
511
511
|
f(t))
|
|
512
512
|
: (function (e) {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
513
|
+
if (d.upScroll) return;
|
|
514
|
+
d.upScroll = setInterval(function () {
|
|
515
|
+
d.doc.trigger("mousemove");
|
|
516
|
+
}, 50);
|
|
517
|
+
})()
|
|
518
518
|
: l.scrollTop() + o.height() <
|
|
519
|
-
|
|
519
|
+
d.rootEl.offset.top + d.rootEl.el.outerHeight(!1) + 10 &&
|
|
520
520
|
o.height() - t.clientY < 50
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
521
|
+
? d.downScroll
|
|
522
|
+
? ((t.pageY = t.pageY + n.scroll),
|
|
523
|
+
e("html, body").each(function (t) {
|
|
524
|
+
e(this).scrollTop(e(this).scrollTop() + n.scroll);
|
|
525
|
+
}),
|
|
526
|
+
f(t))
|
|
527
|
+
: (function (e) {
|
|
528
528
|
if (d.downScroll) return;
|
|
529
529
|
d.downScroll = setInterval(function () {
|
|
530
530
|
d.doc.trigger("mousemove");
|
|
531
531
|
}, 50);
|
|
532
532
|
})()
|
|
533
|
-
|
|
533
|
+
: h(d),
|
|
534
534
|
(d.oElOld = d.oEl),
|
|
535
535
|
(s.el[0].style.visibility = "hidden"),
|
|
536
536
|
(d.oEl = oEl =
|
|
@@ -542,17 +542,17 @@ function MenuEditor(e, t) {
|
|
|
542
542
|
(n = d.doc.scrollTop()) > 0 &&
|
|
543
543
|
(l =
|
|
544
544
|
null ==
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
545
|
+
(o = document.elementFromPoint(
|
|
546
|
+
0,
|
|
547
|
+
n + e(window).height() - 1
|
|
548
|
+
)) || "HTML" == o.tagName.toUpperCase()),
|
|
549
549
|
(n = d.doc.scrollLeft()) > 0 &&
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
550
|
+
(l =
|
|
551
|
+
null ==
|
|
552
|
+
(o = document.elementFromPoint(
|
|
553
|
+
n + e(window).width() - 1,
|
|
554
|
+
0
|
|
555
|
+
)) || "HTML" == o.tagName.toUpperCase());
|
|
556
556
|
}
|
|
557
557
|
l && ((t -= d.doc.scrollLeft()), (s -= d.doc.scrollTop()));
|
|
558
558
|
var i = e(document.elementFromPoint(t, s));
|
|
@@ -576,8 +576,8 @@ function MenuEditor(e, t) {
|
|
|
576
576
|
? g(e, s, 7 > o)
|
|
577
577
|
: l - 14 < o && C(e, s, l - 7 < o)
|
|
578
578
|
: 5 > o
|
|
579
|
-
|
|
580
|
-
|
|
579
|
+
? b(e, s)
|
|
580
|
+
: l - 5 < o && m(e, s);
|
|
581
581
|
})(t, d),
|
|
582
582
|
(function (e, t) {
|
|
583
583
|
var s = t.cEl;
|
|
@@ -620,12 +620,12 @@ function MenuEditor(e, t) {
|
|
|
620
620
|
f.length && f.prev("div").prepend(c.clone(!0)),
|
|
621
621
|
a
|
|
622
622
|
? d.placeholderNode.slideUp(150, function () {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
623
|
+
d.placeholderNode.remove(),
|
|
624
|
+
y(),
|
|
625
|
+
n.onChange(s.el),
|
|
626
|
+
n.complete(s.el),
|
|
627
|
+
(d.isDragged = !1);
|
|
628
|
+
})
|
|
629
629
|
: (d.placeholderNode.remove(),
|
|
630
630
|
y(),
|
|
631
631
|
n.complete(s.el),
|
|
@@ -657,7 +657,7 @@ function MenuEditor(e, t) {
|
|
|
657
657
|
function b(t, s) {
|
|
658
658
|
if (
|
|
659
659
|
(e("#sortableListsHintWrapper", d.rootEl.el).length && r.unwrap(),
|
|
660
|
-
|
|
660
|
+
t.pageX - s.offset().left < n.insertZone)
|
|
661
661
|
) {
|
|
662
662
|
if (s.prev("#sortableListsPlaceholder").length)
|
|
663
663
|
return void r.css("display", "none");
|
|
@@ -676,7 +676,7 @@ function MenuEditor(e, t) {
|
|
|
676
676
|
function g(t, s, l) {
|
|
677
677
|
if (
|
|
678
678
|
(e("#sortableListsHintWrapper", d.rootEl.el).length && r.unwrap(),
|
|
679
|
-
|
|
679
|
+
!l && t.pageX - s.offset().left > n.insertZone)
|
|
680
680
|
) {
|
|
681
681
|
var o = s.children(),
|
|
682
682
|
i = s.children(n.listSelector).first();
|
|
@@ -695,7 +695,7 @@ function MenuEditor(e, t) {
|
|
|
695
695
|
function m(t, s) {
|
|
696
696
|
if (
|
|
697
697
|
(e("#sortableListsHintWrapper", d.rootEl.el).length && r.unwrap(),
|
|
698
|
-
|
|
698
|
+
t.pageX - s.offset().left < n.insertZone)
|
|
699
699
|
) {
|
|
700
700
|
if (s.next("#sortableListsPlaceholder").length)
|
|
701
701
|
return void r.css("display", "none");
|
|
@@ -713,7 +713,7 @@ function MenuEditor(e, t) {
|
|
|
713
713
|
function C(t, s, l) {
|
|
714
714
|
if (
|
|
715
715
|
(e("#sortableListsHintWrapper", d.rootEl.el).length && r.unwrap(),
|
|
716
|
-
|
|
716
|
+
!l && t.pageX - s.offset().left > n.insertZone)
|
|
717
717
|
) {
|
|
718
718
|
var o = s.children(),
|
|
719
719
|
i = s.children(n.listSelector).last();
|
|
@@ -735,8 +735,8 @@ function MenuEditor(e, t) {
|
|
|
735
735
|
"html" == n.opener.as
|
|
736
736
|
? t.html(n.opener.close)
|
|
737
737
|
: "class" == n.opener.as
|
|
738
|
-
|
|
739
|
-
|
|
738
|
+
? t.addClass(n.opener.close).removeClass(n.opener.open)
|
|
739
|
+
: t.css("background-image", "url(" + n.opener.close + ")");
|
|
740
740
|
}
|
|
741
741
|
function E(e) {
|
|
742
742
|
e.removeClass("sortableListsOpen").addClass("sortableListsClosed"),
|
|
@@ -745,8 +745,8 @@ function MenuEditor(e, t) {
|
|
|
745
745
|
"html" == n.opener.as
|
|
746
746
|
? t.html(n.opener.open)
|
|
747
747
|
: "class" == n.opener.as
|
|
748
|
-
|
|
749
|
-
|
|
748
|
+
? t.addClass(n.opener.open).removeClass(n.opener.close)
|
|
749
|
+
: t.css("background-image", "url(" + n.opener.open + ")");
|
|
750
750
|
}
|
|
751
751
|
function y() {
|
|
752
752
|
e(n.listSelector, d.rootEl.el).each(function (t) {
|
|
@@ -756,7 +756,7 @@ function MenuEditor(e, t) {
|
|
|
756
756
|
.children(".sortableListsOpener")
|
|
757
757
|
.first()
|
|
758
758
|
.remove(),
|
|
759
|
-
|
|
759
|
+
e(this).remove());
|
|
760
760
|
});
|
|
761
761
|
}
|
|
762
762
|
}),
|
|
@@ -767,7 +767,7 @@ function MenuEditor(e, t) {
|
|
|
767
767
|
"html" === e.opener.as
|
|
768
768
|
? t.html(e.opener.close)
|
|
769
769
|
: "class" === e.opener.as &&
|
|
770
|
-
|
|
770
|
+
t.addClass(e.opener.close).removeClass(e.opener.open);
|
|
771
771
|
}),
|
|
772
772
|
(e.fn.iconClose = function (e) {
|
|
773
773
|
this.removeClass("sortableListsOpen").addClass("sortableListsClosed"),
|
|
@@ -776,7 +776,7 @@ function MenuEditor(e, t) {
|
|
|
776
776
|
"html" === e.opener.as
|
|
777
777
|
? t.html(e.opener.open)
|
|
778
778
|
: "class" === e.opener.as &&
|
|
779
|
-
|
|
779
|
+
t.addClass(e.opener.open).removeClass(e.opener.close);
|
|
780
780
|
}),
|
|
781
781
|
(e.fn.sortableListsToJson = function () {
|
|
782
782
|
var t = [];
|
|
@@ -808,8 +808,8 @@ function MenuEditor(e, t) {
|
|
|
808
808
|
n = ["Down"];
|
|
809
809
|
0 === s &&
|
|
810
810
|
(l.push("Out"),
|
|
811
|
-
|
|
812
|
-
|
|
811
|
+
n.push("Out"),
|
|
812
|
+
e(this).children("li").hideButtons(["Out"])),
|
|
813
813
|
e(this)
|
|
814
814
|
.children("li")
|
|
815
815
|
.each(function () {
|
|
@@ -28,6 +28,7 @@ function add_repeater(nm) {
|
|
|
28
28
|
var newix = es.length;
|
|
29
29
|
var newe = $(e).clone();
|
|
30
30
|
newe.find("[name]").each(function (ix, element) {
|
|
31
|
+
if ($(element).hasClass("omit-repeater-clone")) $(element).remove();
|
|
31
32
|
var newnm = (element.name || "").replace("_0", "_" + newix);
|
|
32
33
|
var newid = (element.id || "").replace("_0", "_" + newix);
|
|
33
34
|
$(element).attr("name", newnm).attr("id", newid);
|
|
@@ -191,14 +192,15 @@ function splitTargetMatch(elemValue, target, keySpec) {
|
|
|
191
192
|
|
|
192
193
|
function get_form_record(e, select_labels) {
|
|
193
194
|
const rec = {};
|
|
194
|
-
e.closest("form")
|
|
195
|
+
e.closest(".form-namespace")
|
|
195
196
|
.find("input[name],select[name]")
|
|
196
197
|
.each(function () {
|
|
198
|
+
const name = $(this).attr("data-fieldname") || $(this).attr("name")
|
|
197
199
|
if (select_labels && $(this).prop("tagName").toLowerCase() === "select")
|
|
198
|
-
rec[
|
|
200
|
+
rec[name] = $(this).find("option:selected").text();
|
|
199
201
|
else if ($(this).prop("type") === "checkbox")
|
|
200
|
-
rec[
|
|
201
|
-
else rec[
|
|
202
|
+
rec[name] = $(this).prop("checked");
|
|
203
|
+
else rec[name] = $(this).val();
|
|
202
204
|
});
|
|
203
205
|
return rec;
|
|
204
206
|
}
|
|
@@ -550,7 +552,13 @@ function common_done(res, isWeb = true) {
|
|
|
550
552
|
});
|
|
551
553
|
else if (res.goto) {
|
|
552
554
|
if (res.target === "_blank") window.open(res.goto, "_blank").focus();
|
|
553
|
-
else
|
|
555
|
+
else {
|
|
556
|
+
const prev = new URL(window.location.href)
|
|
557
|
+
const next = new URL(res.goto, prev.origin)
|
|
558
|
+
window.location.href = res.goto;
|
|
559
|
+
if (prev.origin === next.origin && prev.pathname === next.pathname && next.hash !== prev.hash)
|
|
560
|
+
location.reload()
|
|
561
|
+
}
|
|
554
562
|
}
|
|
555
563
|
if (res.popup) {
|
|
556
564
|
ajax_modal(res.popup)
|
|
@@ -720,16 +728,20 @@ function init_room(viewname, room_id) {
|
|
|
720
728
|
|
|
721
729
|
function cancel_form(form) {
|
|
722
730
|
if (!form) return;
|
|
731
|
+
$(form).trigger("reset");
|
|
732
|
+
$(form).trigger("change");
|
|
723
733
|
$(form).append(`<input type="hidden" name="_cancel" value="on">`);
|
|
724
734
|
$(form).submit();
|
|
725
735
|
}
|
|
726
736
|
|
|
727
737
|
function split_paste_handler(e) {
|
|
728
|
-
e.preventDefault();
|
|
729
738
|
let clipboardData = e.clipboardData || window.clipboardData || e.originalEvent.clipboardData;
|
|
730
739
|
|
|
731
740
|
const lines = clipboardData.getData('text').split(/\r\n/g)
|
|
732
741
|
|
|
742
|
+
// do normal thing if not multiline - do not interfere with ordinary copy paste
|
|
743
|
+
if (lines.length < 2) return;
|
|
744
|
+
e.preventDefault();
|
|
733
745
|
const form = $(e.target).closest('form')
|
|
734
746
|
|
|
735
747
|
let matched = false;
|
|
@@ -737,9 +749,20 @@ function split_paste_handler(e) {
|
|
|
737
749
|
form.find('input:not(:disabled):not([readonly]):not(:hidden)').each(function (ix, element) {
|
|
738
750
|
if (!matched && element === e.target) matched = true;
|
|
739
751
|
if (matched && lines.length > 0) {
|
|
740
|
-
$(element)
|
|
752
|
+
const $elem = $(element)
|
|
753
|
+
if (ix === 0 && $elem.attr("type") !== "number") {
|
|
754
|
+
//const existing = $elem.val()
|
|
755
|
+
//const pasted =
|
|
756
|
+
$elem.val(lines.shift())
|
|
757
|
+
|
|
758
|
+
} else
|
|
759
|
+
$elem.val(lines.shift())
|
|
741
760
|
}
|
|
742
761
|
})
|
|
743
762
|
|
|
744
763
|
|
|
745
|
-
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
function is_paging_param(key) {
|
|
767
|
+
return key.endsWith("_page") || key.endsWith("_pagesize");
|
|
768
|
+
}
|
package/public/saltcorn.css
CHANGED