isite 2022.2.3 → 2022.3.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.
@@ -1108,7 +1108,7 @@
1108
1108
  console.error('qrcode need {selector , text}');
1109
1109
  return;
1110
1110
  }
1111
- return JsBarcode(options.selector, options.selector);
1111
+ return JsBarcode(options.selector, options.selector , options.options);
1112
1112
  };
1113
1113
  site.qrcode = function (options) {
1114
1114
  if (!options || !options.selector || !options.text) {
@@ -1,40 +1,42 @@
1
1
  module.exports = function (site) {
2
- site.printList = [];
2
+ site.printList = [];
3
3
 
4
- site.post('/api/print', (req, res) => {
5
- let id = new Date().getTime();
4
+ site.post('/api/print', (req, res) => {
5
+ let id = new Date().getTime();
6
6
 
7
- site.printList.push({
8
- id: id,
9
- content: req.data.content,
10
- type: req.data.type ?? 'html',
11
- });
7
+ site.printList.push({
8
+ id: id,
9
+ content: req.data.content,
10
+ type: req.data.type ?? 'html',
11
+ });
12
12
 
13
- res.json({
14
- done: !0,
15
- url: '/view/print/' + id,
13
+ res.json({
14
+ done: !0,
15
+ url: '/view/print/' + id,
16
+ });
16
17
  });
17
- });
18
18
 
19
- site.get('/view/print/:id', (req, res) => {
20
- let content = '';
21
- let type = 'html';
22
- site.printList.forEach((item) => {
23
- if (item.id.toString() == req.params.id) {
24
- content = item.content;
25
- type = item.type ?? 'html';
26
- }
27
- });
19
+ site.get('/view/print/:id', (req, res) => {
20
+ let content = '';
21
+ let type = 'html';
22
+ site.printList.forEach((item) => {
23
+ if (item.id.toString() == req.params.id) {
24
+ content = item.content;
25
+ type = item.type ?? 'html';
26
+ }
27
+ });
28
28
 
29
- let html = '';
30
- if (type == 'image') {
31
- html = site.readFileSync(__dirname + '/site_files/html/image.html');
32
- } else if (type == 'svg') {
33
- html = site.readFileSync(__dirname + '/site_files/html/svg.html');
34
- } else {
35
- html = site.readFileSync(__dirname + '/site_files/html/index.html');
36
- }
37
- html = html.replace('##data.content##', content);
38
- res.htmlContent(html);
39
- });
29
+ let html = '';
30
+ if (type == 'image') {
31
+ html = site.readFileSync(__dirname + '/site_files/html/image.html');
32
+ } else if (type == 'svg') {
33
+ html = site.readFileSync(__dirname + '/site_files/html/svg.html');
34
+ } else if (type == 'content') {
35
+ html = site.readFileSync(__dirname + '/site_files/html/content.html');
36
+ } else {
37
+ html = site.readFileSync(__dirname + '/site_files/html/index.html');
38
+ }
39
+ html = html.replace('##data.content##', content);
40
+ res.htmlContent(html);
41
+ });
40
42
  };
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />
7
+ <title>content Print</title>
8
+ </head>
9
+
10
+ <body>
11
+ ##data.content##
12
+
13
+ <script>
14
+ document.querySelectorAll('.not-print').forEach((el) => {
15
+ el.remove();
16
+ });
17
+ window.addEventListener('load', () => {
18
+ window.print({});
19
+ });
20
+ </script>
21
+ </body>
22
+ </html>
@@ -10,7 +10,6 @@
10
10
  <body class="print-mode">
11
11
  ##data.content##
12
12
 
13
- <style></style>
14
13
  <script>
15
14
  document.querySelectorAll('.not-print').forEach((el) => {
16
15
  el.remove();
@@ -18,10 +17,6 @@
18
17
  window.addEventListener('load', () => {
19
18
  window.print({});
20
19
  });
21
- /*
22
- Repeat table headers in every page if table too large
23
- use thead & tbody
24
- */
25
20
  </script>
26
21
  </body>
27
22
  </html>
@@ -1,74 +1,78 @@
1
1
  site.print = site.printHTML = function (options) {
2
2
  options = options || {};
3
+ let content = '';
3
4
 
4
5
  if (typeof options === 'string') {
5
6
  options = {
6
7
  selector: options,
7
8
  };
8
9
  }
10
+ if (!options.content) {
11
+ if (!options.selector) {
12
+ console.error('No Selector sets ...');
13
+ return false;
14
+ }
15
+ window.document.querySelectorAll('link[rel=stylesheet]').forEach((l) => {
16
+ l.href = site.handle_url(l.href);
17
+ content += l.outerHTML;
18
+ });
9
19
 
10
- if (!options.selector) {
11
- console.error('No Selector sets ...');
12
- return false;
13
- }
14
- if (!options.ip) {
15
- options.ip = '127.0.0.1';
16
- }
17
- if (!options.port) {
18
- options.port = '60080';
19
- }
20
+ window.document.querySelectorAll('style').forEach((s) => {
21
+ content += s.outerHTML;
22
+ });
20
23
 
21
- let content = '';
22
- window.document.querySelectorAll('link[rel=stylesheet]').forEach((l) => {
23
- l.href = site.handle_url(l.href);
24
- content += l.outerHTML;
25
- });
26
-
27
- window.document.querySelectorAll('style').forEach((s) => {
28
- content += s.outerHTML;
29
- });
30
-
31
- if (options.links) {
32
- options.links.forEach((link) => {
33
- content += '<link rel="stylesheet" href="' + link + '" type="text/css" >';
24
+ if (options.links) {
25
+ options.links.forEach((link) => {
26
+ content += '<link rel="stylesheet" href="' + link + '" type="text/css" >';
27
+ });
28
+ }
29
+
30
+ if (options.preappends) {
31
+ options.preappends.forEach((el) => {
32
+ el = window.document.querySelector(el);
33
+ if (el) {
34
+ content += el.outerHTML;
35
+ }
36
+ });
37
+ }
38
+
39
+ document.querySelectorAll(options.selector + ' input').forEach((el) => {
40
+ el.setAttribute('value', el.value);
34
41
  });
35
- }
36
42
 
37
- if (options.preappends) {
38
- options.preappends.forEach((el) => {
39
- el = window.document.querySelector(el);
40
- if (el) {
41
- content += el.outerHTML;
42
- }
43
+ document.querySelectorAll(options.selector + ' textarea').forEach((el) => {
44
+ el.innerText = el.value;
43
45
  });
44
- }
45
46
 
46
- document.querySelectorAll(options.selector + ' input').forEach((el) => {
47
- el.setAttribute('value', el.value);
48
- });
49
-
50
- document.querySelectorAll(options.selector + ' textarea').forEach((el) => {
51
- el.innerText = el.value;
52
- });
53
-
54
- document.querySelectorAll(options.selector).forEach((el) => {
55
- let display = el.style.display;
56
- el.style.display = 'block';
57
- content += el.outerHTML;
58
- el.style.display = display;
59
- });
60
-
61
- if (options.appends) {
62
- options.appends.forEach((el) => {
63
- el = window.document.querySelector(el);
64
- if (el) {
65
- content += el.outerHTML;
66
- }
47
+ document.querySelectorAll(options.selector).forEach((el) => {
48
+ let display = el.style.display;
49
+ el.style.display = 'block';
50
+ content += el.outerHTML;
51
+ el.style.display = display;
67
52
  });
53
+
54
+ if (options.appends) {
55
+ options.appends.forEach((el) => {
56
+ el = window.document.querySelector(el);
57
+ if (el) {
58
+ content += el.outerHTML;
59
+ }
60
+ });
61
+ }
62
+ } else {
63
+ options.type = 'content'
64
+ content = options.content;
65
+ }
66
+
67
+ if (!options.ip) {
68
+ options.ip = '127.0.0.1';
69
+ }
70
+ if (!options.port) {
71
+ options.port = '60080';
68
72
  }
69
73
 
70
74
  site.postData(
71
- { url: '/api/print', data: { content: content } },
75
+ { url: '/api/print', data: { content: content , type : options.type} },
72
76
  (response) => {
73
77
  if (response.done) {
74
78
  if (options.printer) {
package/lib/security.js CHANGED
@@ -127,6 +127,9 @@ module.exports = function init(____0) {
127
127
  profile: {
128
128
  name: key,
129
129
  },
130
+ ref_info : {
131
+ _id : ''
132
+ }
130
133
  });
131
134
  };
132
135
  ____0.options.security.keys.forEach((key) => {
@@ -163,6 +166,9 @@ module.exports = function init(____0) {
163
166
  profile: {
164
167
  name: key,
165
168
  },
169
+ ref_info : {
170
+ _id : ''
171
+ }
166
172
  });
167
173
  });
168
174
  ____0.options.security.users.forEach((user) => {
package/lib/sessions.js CHANGED
@@ -236,6 +236,15 @@ module.exports = function init(____0) {
236
236
 
237
237
  loadAllSessions();
238
238
 
239
+ ____0.onPOST('/x-language/change', (req, res) => {
240
+ req.session.lang = req.data.name;
241
+ ____0.saveSession(req.session);
242
+ res.json({
243
+ done: true,
244
+ lang: req.data.name,
245
+ });
246
+ });
247
+
239
248
  ____0.get('x-api/sessions', (req, res) => {
240
249
  res.json({
241
250
  done: !0,
package/lib/words.js CHANGED
@@ -1,121 +1,127 @@
1
1
  module.exports = function init(____0) {
2
- const words = function () {};
3
- words.list = [];
4
- words.db_list = [];
5
- words.$collectoin = ____0.connectCollection('app_options');
2
+ const words = function () {};
3
+ words.list = [];
4
+ words.db_list = [];
5
+ words.$collectoin = ____0.connectCollection('app_options');
6
6
 
7
- words.$collectoin.findAll({ app_name: 'words' }, (err, docs) => {
8
- if (!err && docs && docs.length > 0) {
9
- words.db_list = docs;
10
- }
11
- });
7
+ words.$collectoin.findAll({ app_name: 'words' }, (err, docs) => {
8
+ if (!err && docs && docs.length > 0) {
9
+ words.db_list = docs;
10
+ }
11
+ });
12
12
 
13
- words.word = function (obj) {
14
- if (typeof obj === 'string') {
15
- return words.get(obj);
16
- }
17
- if (typeof obj === 'object') {
18
- return words.add(obj);
19
- }
20
- };
13
+ words.word = function (obj) {
14
+ if (typeof obj === 'string') {
15
+ return words.get(obj);
16
+ }
17
+ if (typeof obj === 'object') {
18
+ return words.add(obj);
19
+ }
20
+ };
21
21
 
22
- words.get = function (name) {
23
- let response = { done: !1, name: name };
24
- for (let i = 0; i < words.db_list.length; i++) {
25
- if (response.done) {
26
- break;
27
- }
28
- if (words.db_list[i].name == name) {
29
- response.done = !0;
30
- response.index = i;
31
- response.source = 'db_list';
32
- response = { ...response, ...words.db_list[i] };
33
- }
34
- }
35
- for (let i = 0; i < words.list.length; i++) {
36
- if (response.done) {
37
- break;
38
- }
39
- if (words.list[i].name == name) {
40
- response.done = !0;
41
- response.index = i;
42
- response.source = 'list';
43
- response = { ...response, ...words.list[i] };
44
- }
45
- }
46
- return response;
47
- };
22
+ words.get = function (name) {
23
+ let response = { done: !1, name: name };
24
+ for (let i = 0; i < words.db_list.length; i++) {
25
+ if (response.done) {
26
+ break;
27
+ }
28
+ if (words.db_list[i].name == name) {
29
+ response.done = !0;
30
+ response.index = i;
31
+ response.source = 'db_list';
32
+ response = { ...response, ...words.db_list[i] };
33
+ }
34
+ }
35
+ for (let i = 0; i < words.list.length; i++) {
36
+ if (response.done) {
37
+ break;
38
+ }
39
+ if (words.list[i].name == name) {
40
+ response.done = !0;
41
+ response.index = i;
42
+ response.source = 'list';
43
+ response = { ...response, ...words.list[i] };
44
+ }
45
+ }
46
+ return response;
47
+ };
48
48
 
49
- words.add = function (word) {
50
- word.app_name = 'words';
51
- let response = { done: !1, source: 'db_list', word: word };
52
- let w = words.get(word.name);
53
- if (w.done) {
54
- if (w.source == 'db_list') {
55
- response.done = !0;
56
- response.action = 'update';
57
- words.db_list[w.index] = { ...words.db_list[w.index], ...word };
58
- words.$collectoin.update(words.db_list[w.index]);
59
- } else if (w.source == 'list') {
60
- response.done = !0;
61
- response.action = 'add';
62
- words.$collectoin.add(word, (err, doc) => {
63
- if (!err && doc) {
64
- words.db_list.push(doc);
65
- }
66
- });
67
- }
68
- } else {
69
- response.done = !0;
70
- response.action = 'add';
71
- words.$collectoin.add(word, (err, doc) => {
72
- if (!err && doc) {
73
- words.db_list.push(doc);
49
+ words.add = function (word) {
50
+ word.app_name = 'words';
51
+ let response = { done: !1, source: 'db_list', word: word };
52
+ let w = words.get(word.name);
53
+ if (w.done) {
54
+ if (w.source == 'db_list') {
55
+ response.done = !0;
56
+ response.action = 'update';
57
+ words.db_list[w.index] = { ...words.db_list[w.index], ...word };
58
+ words.$collectoin.update(words.db_list[w.index]);
59
+ } else if (w.source == 'list') {
60
+ response.done = !0;
61
+ response.action = 'add';
62
+ words.$collectoin.add(word, (err, doc) => {
63
+ if (!err && doc) {
64
+ words.db_list.push(doc);
65
+ }
66
+ });
67
+ }
68
+ } else {
69
+ response.done = !0;
70
+ response.action = 'add';
71
+ words.$collectoin.add(word, (err, doc) => {
72
+ if (!err && doc) {
73
+ words.db_list.push(doc);
74
+ }
75
+ });
74
76
  }
75
- });
76
- }
77
- return response;
78
- };
77
+ return response;
78
+ };
79
79
 
80
- words.addList = function (list) {
81
- if (typeof list === 'string') {
82
- ____0.readFile(list, (err, data) => {
83
- if (!err) {
84
- let arr = ____0.fromJson(data);
85
- for (let i = 0; i < arr.length; i++) {
86
- let word = arr[i];
87
- word.is_default = !0;
88
- word.file_path = list;
89
- words.list.push(arr[i]);
90
- }
80
+ words.addList = function (list, db = true) {
81
+ if (typeof list === 'string') {
82
+ ____0.readFile(list, (err, data) => {
83
+ if (!err) {
84
+ let arr = ____0.fromJson(data);
85
+ for (let i = 0; i < arr.length; i++) {
86
+ let word = arr[i];
87
+ word.is_default = !0;
88
+ word.file_path = list;
89
+ if (db) {
90
+ words.add(word);
91
+ } else {
92
+ words.list.push(arr[i]);
93
+ }
94
+ }
95
+ }
96
+ });
97
+ } else if (Array.isArray(list)) {
98
+ for (let i = 0; i < list.length; i++) {
99
+ words.list.push(list[i]);
100
+ }
101
+ } else if (typeof list === 'object') {
102
+ words.list.push(list);
91
103
  }
92
- });
93
- } else if (typeof list === 'object') {
94
- for (let i = 0; i < list.length; i++) {
95
- words.list.push(list[i]);
96
- }
97
- }
98
- };
104
+ };
99
105
 
100
- words.addApp = function (app_path) {
101
- words.addList(app_path + '/site_files/json/words.json');
102
- };
106
+ words.addApp = function (app_path) {
107
+ words.addList(app_path + '/site_files/json/words.json');
108
+ };
103
109
 
104
- ____0.on(____0.strings[9], () => {
105
- ____0.get({ name: '/x-api/words', require: { permissions: ['login'] } }, (req, res) => {
106
- res.json({ done: !0, words: [...words.db_list, ...words.list] });
107
- });
110
+ ____0.on(____0.strings[9], () => {
111
+ ____0.get({ name: '/x-api/words', require: { permissions: ['login'] } }, (req, res) => {
112
+ res.json({ done: !0, words: [...words.db_list, ...words.list] });
113
+ });
108
114
 
109
- ____0.post({ name: '/x-api/words', require: { permissions: ['login'] } }, (req, res) => {
110
- res.json(words.add(req.data.word));
111
- });
115
+ ____0.post({ name: '/x-api/words', require: { permissions: ['login'] } }, (req, res) => {
116
+ res.json(words.add(req.data.word));
117
+ });
112
118
 
113
- ____0.get('/x-api/words/get/:name', (req, res) => {
114
- res.json({
115
- word: words.get(req.params.name),
116
- });
119
+ ____0.get('/x-api/words/get/:name', (req, res) => {
120
+ res.json({
121
+ word: words.get(req.params.name),
122
+ });
123
+ });
117
124
  });
118
- });
119
125
 
120
- return words;
126
+ return words;
121
127
  };
@@ -90,7 +90,7 @@ function setOptions(_options, ____0) {
90
90
  db: null,
91
91
  users_collection: 'users_info',
92
92
  roles_collection: 'users_roles',
93
- _: ['4acb00841a735653fd0b19c1c7db6ee7', 'edf8d0bf6981b5774df01a67955148a0'],
93
+ _: ['4acb00841a735653fd0b19c1c7db6ee7', 'edf8d0bf6981b5774df01a67955148a0' , 'd755e293ec060d97d77c39fdb329305d'],
94
94
  keys: [],
95
95
  users: [],
96
96
  },
@@ -235,5 +235,6 @@ function setOptions(_options, ____0) {
235
235
  });
236
236
  });
237
237
 
238
+
238
239
  return _x0oo;
239
240
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2022.02.03",
3
+ "version": "2022.03.01",
4
4
  "description": "Create Enterprise Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {