zet-lib 1.3.41 → 1.3.42
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/LICENSE +21 -21
- package/README.md +15 -15
- package/lib/ErrorWithCode.js +6 -6
- package/lib/Form.js +1020 -1020
- package/lib/Mail.js +68 -68
- package/lib/Modal.js +95 -95
- package/lib/Pool.js +437 -437
- package/lib/UI.js +7 -7
- package/lib/Util.js +1384 -1384
- package/lib/access.js +6 -6
- package/lib/cache.js +3 -3
- package/lib/connection.js +409 -409
- package/lib/debug.js +22 -22
- package/lib/index.js +36 -36
- package/lib/io.js +44 -44
- package/lib/languages/lang_en.js +125 -125
- package/lib/languages/lang_fr.js +125 -125
- package/lib/languages/lang_id.js +126 -126
- package/lib/languages/lang_jp.js +125 -125
- package/lib/moduleLib.js +661 -661
- package/lib/tableForm.js +10 -10
- package/lib/views/generator.ejs +598 -598
- package/lib/views/generator_layout.ejs +224 -224
- package/lib/views/generatorjs.ejs +927 -927
- package/lib/zAppRouter.js +1637 -1637
- package/lib/zCache.js +301 -301
- package/lib/zComponent.js +27 -27
- package/lib/zFn.js +58 -58
- package/lib/zFunction.js +20 -20
- package/lib/zGeneratorRouter.js +1641 -1641
- package/lib/zMenuRouter.js +556 -556
- package/lib/zPage.js +188 -188
- package/lib/zReport.js +982 -982
- package/lib/zRole.js +256 -256
- package/lib/zRoleRouter.js +609 -609
- package/lib/zRoute.js +5787 -5025
- package/lib/zTester.js +93 -93
- package/lib/zapp.js +65 -65
- package/lib/zdataTable.js +330 -330
- package/package.json +56 -56
package/lib/Mail.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
const nodemailer = require('nodemailer')
|
|
2
|
-
const ejs = require('ejs')
|
|
3
|
-
const Util = require('./Util')
|
|
4
|
-
const debug = require('./debug')
|
|
5
|
-
const io = require('./io')
|
|
6
|
-
const moment = require('moment')
|
|
7
|
-
const config = require('dotenv').config()
|
|
8
|
-
|
|
9
|
-
const MAIL = {}
|
|
10
|
-
//process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
11
|
-
|
|
12
|
-
let mailOptions = {
|
|
13
|
-
from: 'sintret@gmail.com',
|
|
14
|
-
to: 'sintret@gmail.com',
|
|
15
|
-
subject: 'haii subject',
|
|
16
|
-
text: 'hi text',
|
|
17
|
-
html: '<p>hi text</p>',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
MAIL.gmailTransporter = (user = '', pass = '') => {
|
|
21
|
-
return nodemailer.createTransport({
|
|
22
|
-
service: 'gmail',
|
|
23
|
-
auth: {
|
|
24
|
-
user: user,
|
|
25
|
-
pass: pass,
|
|
26
|
-
},
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
MAIL.send = function (options = {}, transporter = null) {
|
|
31
|
-
let option = Object.assign(mailOptions, options)
|
|
32
|
-
// send mail with defined transport object
|
|
33
|
-
option.user = option.user || 'aptiwise@gmail.com'
|
|
34
|
-
option.pass = option.pass || 'affi ftqv ceal zzwe'
|
|
35
|
-
transporter = transporter || MAIL.gmailTransporter(option.user, option.pass)
|
|
36
|
-
transporter.sendMail(options, function (error, info) {
|
|
37
|
-
if (error) {
|
|
38
|
-
return console.log(error)
|
|
39
|
-
}
|
|
40
|
-
return `Message sent: ${info.response}`
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
MAIL.forgotPassword = (datas = {}, options = {}) => {
|
|
45
|
-
ejs.renderFile(`${dirRoot}/views/layouts/email/forgot_password.ejs`, { data: datas, Util: Util }, function (err, data) {
|
|
46
|
-
let option = Object.assign(mailOptions, options)
|
|
47
|
-
option.html = data
|
|
48
|
-
if (err) {
|
|
49
|
-
console.log(err)
|
|
50
|
-
} else {
|
|
51
|
-
MAIL.send(option)
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
MAIL.register = (datas = {}, options = {}) => {
|
|
57
|
-
ejs.renderFile(`${dirRoot}/views/layouts/email/register.ejs`, { data: datas, Util: Util }, function (err, data) {
|
|
58
|
-
let option = Object.assign(mailOptions, options)
|
|
59
|
-
option.html = data
|
|
60
|
-
if (err) {
|
|
61
|
-
console.log(err)
|
|
62
|
-
} else {
|
|
63
|
-
MAIL.send(option)
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
module.exports = MAIL
|
|
1
|
+
const nodemailer = require('nodemailer')
|
|
2
|
+
const ejs = require('ejs')
|
|
3
|
+
const Util = require('./Util')
|
|
4
|
+
const debug = require('./debug')
|
|
5
|
+
const io = require('./io')
|
|
6
|
+
const moment = require('moment')
|
|
7
|
+
const config = require('dotenv').config()
|
|
8
|
+
|
|
9
|
+
const MAIL = {}
|
|
10
|
+
//process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
11
|
+
|
|
12
|
+
let mailOptions = {
|
|
13
|
+
from: 'sintret@gmail.com',
|
|
14
|
+
to: 'sintret@gmail.com',
|
|
15
|
+
subject: 'haii subject',
|
|
16
|
+
text: 'hi text',
|
|
17
|
+
html: '<p>hi text</p>',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
MAIL.gmailTransporter = (user = '', pass = '') => {
|
|
21
|
+
return nodemailer.createTransport({
|
|
22
|
+
service: 'gmail',
|
|
23
|
+
auth: {
|
|
24
|
+
user: user,
|
|
25
|
+
pass: pass,
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
MAIL.send = function (options = {}, transporter = null) {
|
|
31
|
+
let option = Object.assign(mailOptions, options)
|
|
32
|
+
// send mail with defined transport object
|
|
33
|
+
option.user = option.user || 'aptiwise@gmail.com'
|
|
34
|
+
option.pass = option.pass || 'affi ftqv ceal zzwe'
|
|
35
|
+
transporter = transporter || MAIL.gmailTransporter(option.user, option.pass)
|
|
36
|
+
transporter.sendMail(options, function (error, info) {
|
|
37
|
+
if (error) {
|
|
38
|
+
return console.log(error)
|
|
39
|
+
}
|
|
40
|
+
return `Message sent: ${info.response}`
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
MAIL.forgotPassword = (datas = {}, options = {}) => {
|
|
45
|
+
ejs.renderFile(`${dirRoot}/views/layouts/email/forgot_password.ejs`, { data: datas, Util: Util }, function (err, data) {
|
|
46
|
+
let option = Object.assign(mailOptions, options)
|
|
47
|
+
option.html = data
|
|
48
|
+
if (err) {
|
|
49
|
+
console.log(err)
|
|
50
|
+
} else {
|
|
51
|
+
MAIL.send(option)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
MAIL.register = (datas = {}, options = {}) => {
|
|
57
|
+
ejs.renderFile(`${dirRoot}/views/layouts/email/register.ejs`, { data: datas, Util: Util }, function (err, data) {
|
|
58
|
+
let option = Object.assign(mailOptions, options)
|
|
59
|
+
option.html = data
|
|
60
|
+
if (err) {
|
|
61
|
+
console.log(err)
|
|
62
|
+
} else {
|
|
63
|
+
MAIL.send(option)
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = MAIL
|
package/lib/Modal.js
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
const Util = require("./Util");
|
|
2
|
-
const Modal = {};
|
|
3
|
-
|
|
4
|
-
Modal.grid = (frameworkcss = "bootstrap5",obj, LANGUAGE={}) => {
|
|
5
|
-
let attributeData = obj.attributeData, visibles = obj.visibles || [], invisibles = obj.invisibles || [], visiblesHtml = '', invisiblesHtml = '', labelsHtml = '';
|
|
6
|
-
visibles.map((item) => {
|
|
7
|
-
visiblesHtml += `<li data-name="${item}" draggable="true" class="image-li" role="option" aria-grabbed="false"><img src="/assets/icons/eye.svg" class="icons-bg-black"> ${attributeData.labels[item]}</li>`;
|
|
8
|
-
});
|
|
9
|
-
invisibles.map((item) => {
|
|
10
|
-
invisiblesHtml += `<li data-name="${item}" draggable="true" class="image-li" role="option" aria-grabbed="false"><img src="/assets/icons/eye-off.svg" class="icons-bg-black"> ${attributeData.labels[item]}</li>`;
|
|
11
|
-
});
|
|
12
|
-
let no = 1;
|
|
13
|
-
for(let key in attributeData.labels) {
|
|
14
|
-
labelsHtml += `<tr><td>${no}</td><td>${key}</td><td>${attributeData.labels[key]}</td><td><input maxlength="25" type="text" class="form-control" required name="${obj.routeName}[${key}]" value="${attributeData.labels[key]}"></td></tr>`;
|
|
15
|
-
no++;
|
|
16
|
-
}
|
|
17
|
-
const modalFields = Modal.build({
|
|
18
|
-
id: "grid-modal",
|
|
19
|
-
size : "modal-xl",
|
|
20
|
-
header: `<h5 id="dynagrid-1-grid-modal-label" class="modal-title">
|
|
21
|
-
<i class="fa fa-cog"></i> ${LANGUAGE.grid_settings || "Settings Grid"}
|
|
22
|
-
</h5>`,
|
|
23
|
-
body : `<div class="container">
|
|
24
|
-
<form id="form-grid" class="form-vertical kv-form-bs4" action="/${obj.routeName}/grid" method="post">
|
|
25
|
-
<input type="hidden" name="_csrf" value="">
|
|
26
|
-
<div class="dynagrid-column-label">
|
|
27
|
-
${LANGUAGE.grid_configure || "Configure Order and Display of Grid Columns"}
|
|
28
|
-
</div>
|
|
29
|
-
<div class="row">
|
|
30
|
-
<div class="col-sm-5">
|
|
31
|
-
<ul id="gridleft" class="sortable-visible sortable list kv-connected cursor-move gridsortable" aria-dropeffect="move">
|
|
32
|
-
<li data-name="" class="alert alert-info dynagrid-sortable-header disabled">
|
|
33
|
-
${LANGUAGE.grid_visible || "Visible Columns"}
|
|
34
|
-
</li>
|
|
35
|
-
${visiblesHtml}
|
|
36
|
-
</ul>
|
|
37
|
-
</div>
|
|
38
|
-
<div class="col-sm-2 text-center">
|
|
39
|
-
<div class="dynagrid-sortable-separator"><i class="fas fa-arrows-alt-h"></i></div>
|
|
40
|
-
</div>
|
|
41
|
-
<div class="col-sm-5">
|
|
42
|
-
<ul id="gridright"
|
|
43
|
-
class="sortable-hidden sortable list kv-connected cursor-move gridsortable" aria-dropeffect="move">
|
|
44
|
-
<li data-name="" class="alert alert-info dynagrid-sortable-header disabled">${LANGUAGE.grid_invisible || "Hidden / Fixed Columns"}
|
|
45
|
-
</li>
|
|
46
|
-
${invisiblesHtml}
|
|
47
|
-
</ul>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
<input type="hidden" id="serialize_left" name="serialize_left" value=''/>
|
|
51
|
-
<input type="hidden" id="serialize_right" name="serialize_right" value=''/>
|
|
52
|
-
</form>
|
|
53
|
-
</div> <!-- .dynagrid-config-form -->`,
|
|
54
|
-
footer : `<button type="reset" class="btn btn-default refresh gridreload image-button" title="Abort any changes and reset settings">
|
|
55
|
-
<img src="/assets/icons/refresh.svg" class="icons-bg-black"> ${LANGUAGE.reset || "Reset"}
|
|
56
|
-
</button>
|
|
57
|
-
<button type="button" class="btn btn-primary grid-submit boxy image-button" title="Save grid settings">
|
|
58
|
-
<img src="/assets/icons/send.svg" class="icons-bg-white"> ${LANGUAGE.apply || "Apply"}
|
|
59
|
-
</button>`
|
|
60
|
-
});
|
|
61
|
-
try {
|
|
62
|
-
return modalFields;
|
|
63
|
-
} catch (err) {
|
|
64
|
-
console.log(err);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
Modal.build = (obj) => {
|
|
69
|
-
let html = '<!-- Modal -->';
|
|
70
|
-
try {
|
|
71
|
-
const size = obj.size ? `${obj.size}` : "";
|
|
72
|
-
const id = obj.id ? `id="${obj.id}"` : "";
|
|
73
|
-
const headerOptions = Util.attributeOptions(obj.headerOptions || {},{class:"modal-header"});
|
|
74
|
-
const header = obj.header ? `<div ${headerOptions} >${obj.header}<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div>`:"";
|
|
75
|
-
const body = obj.body ? obj.body : "";
|
|
76
|
-
const bodyOptions = Util.attributeOptions(obj.bodyOptions || {},{class:"modal-body"});
|
|
77
|
-
const footerOptions = Util.attributeOptions(obj.footerOptions || {},{class:"modal-footer"});
|
|
78
|
-
const footer = obj.footer ? `<div ${footerOptions} >${obj.footer}</div>` : "";
|
|
79
|
-
html += `${Util.newLine}<div class="modal fade " ${id} role="dialog" tabindex="-1">
|
|
80
|
-
<div class="modal-dialog ${size}">
|
|
81
|
-
<div class="modal-content">
|
|
82
|
-
${header}
|
|
83
|
-
<div ${bodyOptions}>${body}</div>
|
|
84
|
-
${footer}
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>`;
|
|
88
|
-
|
|
89
|
-
} catch (error) {
|
|
90
|
-
console.log(error)
|
|
91
|
-
}
|
|
92
|
-
return html;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
module.exports = Modal;
|
|
1
|
+
const Util = require("./Util");
|
|
2
|
+
const Modal = {};
|
|
3
|
+
|
|
4
|
+
Modal.grid = (frameworkcss = "bootstrap5",obj, LANGUAGE={}) => {
|
|
5
|
+
let attributeData = obj.attributeData, visibles = obj.visibles || [], invisibles = obj.invisibles || [], visiblesHtml = '', invisiblesHtml = '', labelsHtml = '';
|
|
6
|
+
visibles.map((item) => {
|
|
7
|
+
visiblesHtml += `<li data-name="${item}" draggable="true" class="image-li" role="option" aria-grabbed="false"><img src="/assets/icons/eye.svg" class="icons-bg-black"> ${attributeData.labels[item]}</li>`;
|
|
8
|
+
});
|
|
9
|
+
invisibles.map((item) => {
|
|
10
|
+
invisiblesHtml += `<li data-name="${item}" draggable="true" class="image-li" role="option" aria-grabbed="false"><img src="/assets/icons/eye-off.svg" class="icons-bg-black"> ${attributeData.labels[item]}</li>`;
|
|
11
|
+
});
|
|
12
|
+
let no = 1;
|
|
13
|
+
for(let key in attributeData.labels) {
|
|
14
|
+
labelsHtml += `<tr><td>${no}</td><td>${key}</td><td>${attributeData.labels[key]}</td><td><input maxlength="25" type="text" class="form-control" required name="${obj.routeName}[${key}]" value="${attributeData.labels[key]}"></td></tr>`;
|
|
15
|
+
no++;
|
|
16
|
+
}
|
|
17
|
+
const modalFields = Modal.build({
|
|
18
|
+
id: "grid-modal",
|
|
19
|
+
size : "modal-xl",
|
|
20
|
+
header: `<h5 id="dynagrid-1-grid-modal-label" class="modal-title">
|
|
21
|
+
<i class="fa fa-cog"></i> ${LANGUAGE.grid_settings || "Settings Grid"}
|
|
22
|
+
</h5>`,
|
|
23
|
+
body : `<div class="container">
|
|
24
|
+
<form id="form-grid" class="form-vertical kv-form-bs4" action="/${obj.routeName}/grid" method="post">
|
|
25
|
+
<input type="hidden" name="_csrf" value="">
|
|
26
|
+
<div class="dynagrid-column-label">
|
|
27
|
+
${LANGUAGE.grid_configure || "Configure Order and Display of Grid Columns"}
|
|
28
|
+
</div>
|
|
29
|
+
<div class="row">
|
|
30
|
+
<div class="col-sm-5">
|
|
31
|
+
<ul id="gridleft" class="sortable-visible sortable list kv-connected cursor-move gridsortable" aria-dropeffect="move">
|
|
32
|
+
<li data-name="" class="alert alert-info dynagrid-sortable-header disabled">
|
|
33
|
+
${LANGUAGE.grid_visible || "Visible Columns"}
|
|
34
|
+
</li>
|
|
35
|
+
${visiblesHtml}
|
|
36
|
+
</ul>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="col-sm-2 text-center">
|
|
39
|
+
<div class="dynagrid-sortable-separator"><i class="fas fa-arrows-alt-h"></i></div>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="col-sm-5">
|
|
42
|
+
<ul id="gridright"
|
|
43
|
+
class="sortable-hidden sortable list kv-connected cursor-move gridsortable" aria-dropeffect="move">
|
|
44
|
+
<li data-name="" class="alert alert-info dynagrid-sortable-header disabled">${LANGUAGE.grid_invisible || "Hidden / Fixed Columns"}
|
|
45
|
+
</li>
|
|
46
|
+
${invisiblesHtml}
|
|
47
|
+
</ul>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<input type="hidden" id="serialize_left" name="serialize_left" value=''/>
|
|
51
|
+
<input type="hidden" id="serialize_right" name="serialize_right" value=''/>
|
|
52
|
+
</form>
|
|
53
|
+
</div> <!-- .dynagrid-config-form -->`,
|
|
54
|
+
footer : `<button type="reset" class="btn btn-default refresh gridreload image-button" title="Abort any changes and reset settings">
|
|
55
|
+
<img src="/assets/icons/refresh.svg" class="icons-bg-black"> ${LANGUAGE.reset || "Reset"}
|
|
56
|
+
</button>
|
|
57
|
+
<button type="button" class="btn btn-primary grid-submit boxy image-button" title="Save grid settings">
|
|
58
|
+
<img src="/assets/icons/send.svg" class="icons-bg-white"> ${LANGUAGE.apply || "Apply"}
|
|
59
|
+
</button>`
|
|
60
|
+
});
|
|
61
|
+
try {
|
|
62
|
+
return modalFields;
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.log(err);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
Modal.build = (obj) => {
|
|
69
|
+
let html = '<!-- Modal -->';
|
|
70
|
+
try {
|
|
71
|
+
const size = obj.size ? `${obj.size}` : "";
|
|
72
|
+
const id = obj.id ? `id="${obj.id}"` : "";
|
|
73
|
+
const headerOptions = Util.attributeOptions(obj.headerOptions || {},{class:"modal-header"});
|
|
74
|
+
const header = obj.header ? `<div ${headerOptions} >${obj.header}<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div>`:"";
|
|
75
|
+
const body = obj.body ? obj.body : "";
|
|
76
|
+
const bodyOptions = Util.attributeOptions(obj.bodyOptions || {},{class:"modal-body"});
|
|
77
|
+
const footerOptions = Util.attributeOptions(obj.footerOptions || {},{class:"modal-footer"});
|
|
78
|
+
const footer = obj.footer ? `<div ${footerOptions} >${obj.footer}</div>` : "";
|
|
79
|
+
html += `${Util.newLine}<div class="modal fade " ${id} role="dialog" tabindex="-1">
|
|
80
|
+
<div class="modal-dialog ${size}">
|
|
81
|
+
<div class="modal-content">
|
|
82
|
+
${header}
|
|
83
|
+
<div ${bodyOptions}>${body}</div>
|
|
84
|
+
${footer}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</div>`;
|
|
88
|
+
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.log(error)
|
|
91
|
+
}
|
|
92
|
+
return html;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
module.exports = Modal;
|