jsharmony-cms 1.7.3 → 1.8.0
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/jsHarmonyCMS.js +11 -3
- package/jsHarmonyCMSSFTPServer.js +1 -1
- package/jsHarmonyCMSTransform.js +7 -0
- package/models/Admin_SysUser.json +2 -0
- package/models/Publish_Add.onroute.js +4 -0
- package/models/_funcs.deploy.js +2 -2
- package/models/_funcs.page.js +1 -1
- package/models/js/site.js +2 -0
- package/models/sql/objects/system.json +8 -0
- package/package.json +1 -1
package/jsHarmonyCMS.js
CHANGED
|
@@ -37,7 +37,10 @@ var jsHarmonyCMSTransform = require('./jsHarmonyCMSTransform.js');
|
|
|
37
37
|
|
|
38
38
|
function jsHarmonyCMS(name, options){
|
|
39
39
|
options = _.extend({
|
|
40
|
-
schema: 'cms'
|
|
40
|
+
schema: 'cms',
|
|
41
|
+
factory: null,
|
|
42
|
+
createRoles: true,
|
|
43
|
+
isSubmodule: false,
|
|
41
44
|
}, options);
|
|
42
45
|
|
|
43
46
|
var _this = this;
|
|
@@ -47,6 +50,9 @@ function jsHarmonyCMS(name, options){
|
|
|
47
50
|
_this.basepath = path.dirname(module.filename);
|
|
48
51
|
_this.schema = options.schema;
|
|
49
52
|
|
|
53
|
+
_this.createRoles = options.createRoles;
|
|
54
|
+
_this.isSubmodule = options.isSubmodule;
|
|
55
|
+
|
|
50
56
|
_this.SystemPageTemplates = {};
|
|
51
57
|
_this.SystemComponentTemplates = {};
|
|
52
58
|
_this.SystemSiteConfig = {};
|
|
@@ -61,6 +67,8 @@ function jsHarmonyCMS(name, options){
|
|
|
61
67
|
|
|
62
68
|
_this.funcs = new funcs(_this);
|
|
63
69
|
_this.transform = new jsHarmonyCMSTransform(_this);
|
|
70
|
+
|
|
71
|
+
_this._factoryOptions = options.factory;
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
jsHarmonyCMS.prototype = new jsHarmonyModule();
|
|
@@ -68,7 +76,7 @@ jsHarmonyCMS.prototype = new jsHarmonyModule();
|
|
|
68
76
|
jsHarmonyCMS.prototype.Application = function(){
|
|
69
77
|
var _this = this;
|
|
70
78
|
var jsh = new jsHarmony();
|
|
71
|
-
var factory = new jsHarmonyFactory();
|
|
79
|
+
var factory = new jsHarmonyFactory(null, _this._factoryOptions);
|
|
72
80
|
jsh.AddModule(factory);
|
|
73
81
|
jsh.AddModule(this);
|
|
74
82
|
jsh.Sites[factory.mainSiteID] = _.extend(this.getFactoryConfig(),jsh.Sites[factory.mainSiteID]);
|
|
@@ -89,7 +97,7 @@ jsHarmonyCMS.prototype.Application = function(){
|
|
|
89
97
|
return jsh;
|
|
90
98
|
};
|
|
91
99
|
|
|
92
|
-
jsHarmonyCMS.Application = function(){ return (new jsHarmonyCMS()).Application(); };
|
|
100
|
+
jsHarmonyCMS.Application = function(options){ return (new jsHarmonyCMS(null, options)).Application(); };
|
|
93
101
|
|
|
94
102
|
jsHarmonyCMS.prototype.Init = function(cb){
|
|
95
103
|
var _this = this;
|
|
@@ -896,7 +896,7 @@ jsHarmonyCMSSFTPServer.prototype.Run = function(run_cb){
|
|
|
896
896
|
dirPage.push(file);
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
|
-
async.
|
|
899
|
+
async.eachOfLimit(pageFiles, 50, function(pageFile, idx, file_cb){
|
|
900
900
|
if(!pageFile) return file_cb();
|
|
901
901
|
fs.stat(fspath.join(handleInfo.syspath, pageFile), function(err, fstat){
|
|
902
902
|
if(err) return file_cb();
|
package/jsHarmonyCMSTransform.js
CHANGED
|
@@ -22,6 +22,13 @@ var jsHarmonyModuleTransform = require('jsharmony/jsHarmonyModuleTransform');
|
|
|
22
22
|
function jsHarmonyCMSTransform(module){
|
|
23
23
|
this.sql = {
|
|
24
24
|
'{deployment_env}': 'default',
|
|
25
|
+
'{create_sys_roles}': (module.createRoles ? '1' : '0'),
|
|
26
|
+
'{is_submodule}': (module.isSubmodule ? '1' : '0'),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
this.ignore_errors = {
|
|
30
|
+
'0': true,
|
|
31
|
+
'1': true,
|
|
25
32
|
};
|
|
26
33
|
|
|
27
34
|
jsHarmonyModuleTransform.call(this, module);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
//:if:{create_sys_roles}:
|
|
2
3
|
"/jsHarmonyFactory/Admin/SysUser": {
|
|
3
4
|
"inherits":"/jsHarmonyFactory/Admin/SysUser",
|
|
4
5
|
"fields": [
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
},
|
|
27
28
|
],
|
|
28
29
|
},
|
|
30
|
+
//:endif:
|
|
29
31
|
"SysUser_Site": {
|
|
30
32
|
"layout":"grid",
|
|
31
33
|
"table":"{schema}.v_sys_user_site_access",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//(routetype, req, res, callback, require, jsh, modelid, params)
|
|
2
2
|
|
|
3
3
|
var Helper = require('../Helper.js');
|
|
4
|
+
var querystring = require('querystring');
|
|
4
5
|
|
|
5
6
|
var model = jsh.getModelClone(req, modelid);
|
|
6
7
|
|
|
@@ -16,5 +17,8 @@ jsh.AppSrv.ExecRecordset(req._DBContext, 'select (select {schema}.my_current_bra
|
|
|
16
17
|
if(!rslt[0][0].branch_id){
|
|
17
18
|
return res.end('***JSHARMONY_REDIRECT***\n'+req.baseurl+model.namespace+'Publish_Add_Release');
|
|
18
19
|
}
|
|
20
|
+
else if(req.query.target=='branch'){
|
|
21
|
+
return res.end('***JSHARMONY_REDIRECT***\n'+req.baseurl+model.namespace+'Publish_Add_Branch?'+querystring.stringify({ action: 'update', branch_id: rslt[0][0].branch_id }));
|
|
22
|
+
}
|
|
19
23
|
else return callback();
|
|
20
24
|
});
|
package/models/_funcs.deploy.js
CHANGED
|
@@ -1030,7 +1030,7 @@ module.exports = exports = function(module, funcs){
|
|
|
1030
1030
|
async.waterfall([
|
|
1031
1031
|
//Perform file delete operations
|
|
1032
1032
|
function(file_cb){
|
|
1033
|
-
async.
|
|
1033
|
+
async.eachOfLimit(branchData.fsOps.deletedFilesUpper, 50, function(fpath, fpathUpper, delete_cb){
|
|
1034
1034
|
if(!(fpath in branchData.site_files)) return delete_cb(new Error('Could not delete "' + fpath + '" - file not found in site_files'));
|
|
1035
1035
|
delete branchData.site_files[fpath];
|
|
1036
1036
|
fpath = path.join(publish_params.publish_path, fpath);
|
|
@@ -1040,7 +1040,7 @@ module.exports = exports = function(module, funcs){
|
|
|
1040
1040
|
|
|
1041
1041
|
//Perform file add operations
|
|
1042
1042
|
function(file_cb){
|
|
1043
|
-
async.
|
|
1043
|
+
async.eachOfLimit(branchData.fsOps.addedFiles, 50, function(fcontent, fpath, add_cb){
|
|
1044
1044
|
branchData.site_files[fpath] = {
|
|
1045
1045
|
md5: crypto.createHash('md5').update(fcontent).digest('hex')
|
|
1046
1046
|
};
|
package/models/_funcs.page.js
CHANGED
|
@@ -1028,7 +1028,7 @@ module.exports = exports = function(module, funcs){
|
|
|
1028
1028
|
//Read URL and querystring
|
|
1029
1029
|
var parsedUrl = null;
|
|
1030
1030
|
try{
|
|
1031
|
-
parsedUrl = new urlparser.URL(url);
|
|
1031
|
+
parsedUrl = new urlparser.URL(url, req.protocol + '://' + req.get('host'));
|
|
1032
1032
|
template_variables._ = template_variables.timestamp;
|
|
1033
1033
|
if(Q.devMode) template_variables.page_template_location = page_template.location;
|
|
1034
1034
|
var changedUrl = false;
|
package/models/js/site.js
CHANGED
|
@@ -187,6 +187,8 @@
|
|
|
187
187
|
jsh.globalparams.site_id = site_id;
|
|
188
188
|
jsh.globalparams.site_name = site_name;
|
|
189
189
|
|
|
190
|
+
if({is_submodule}) return; // eslint-disable-line no-undef, no-constant-condition
|
|
191
|
+
|
|
190
192
|
//Render site dropdown in header
|
|
191
193
|
jsh.$root('.xlogo .xsublogo').html(XExt.renderEJS(jsh.GetEJS('jsHarmonyCMS.SiteSelection')));
|
|
192
194
|
jsh.$root('.xlogo .xsublogo').attr('onclick','return false;').off('click').on('click', function(e){
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
]
|
|
33
33
|
},
|
|
34
34
|
|
|
35
|
+
//:if:{create_sys_roles}:
|
|
35
36
|
"jsharmony.sys_role": {
|
|
36
37
|
"init_data": [
|
|
37
38
|
{ "sys_role_name": "VIEWER", "sys_role_desc": "All Sites - Viewer", "sys_role_seq": 1 },
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
{ "sql": "delete from jsharmony.sys_role where sys_role_name in ('DADMIN','X_B','X_X')" }
|
|
44
45
|
],
|
|
45
46
|
},
|
|
47
|
+
//:endif:
|
|
46
48
|
|
|
47
49
|
"jsharmony.sys_user_role": {
|
|
48
50
|
"type":"table",
|
|
@@ -55,11 +57,13 @@
|
|
|
55
57
|
{ "name": "sys_user_role_snotes", "type": "varchar", "length": 255 },
|
|
56
58
|
],
|
|
57
59
|
"init_data": [
|
|
60
|
+
//:if:{create_sys_roles}:
|
|
58
61
|
{ "sys_user_id": 1, "sys_role_name": "VIEWER" },
|
|
59
62
|
{ "sys_user_id": 1, "sys_role_name": "AUTHOR" },
|
|
60
63
|
{ "sys_user_id": 1, "sys_role_name": "PUBLISHER" },
|
|
61
64
|
{ "sys_user_id": 1, "sys_role_name": "WEBMASTER" },
|
|
62
65
|
{ "sys_user_id": 1, "sys_role_name": "CMSHOST" }
|
|
66
|
+
//:endif:
|
|
63
67
|
],
|
|
64
68
|
"triggers": [
|
|
65
69
|
{ "prefix": "{schema}_", "on": ["update"], "exec": [
|
|
@@ -94,6 +98,8 @@
|
|
|
94
98
|
}
|
|
95
99
|
],
|
|
96
100
|
},
|
|
101
|
+
|
|
102
|
+
//:if:{is_submodule}::else:
|
|
97
103
|
|
|
98
104
|
"jsharmony.txt": {
|
|
99
105
|
"init_data": [
|
|
@@ -177,4 +183,6 @@
|
|
|
177
183
|
{ "help_target_code": "*", "help_title": "jsHarmony CMS", "help_text": "<p><span style=\"font-size:16px\">Explore the full jsHarmony CMS Reference at <a href=\"https://www.jsharmonycms.com/resources/\" target=\"_blank\">jsHarmonyCMS.com</a>, including:</span></p><table border=\"0\" cellpadding=\"7\" cellspacing=\"1\"><tbody><tr><td><span style=\"font-size:16px\">:: Getting Started Video Tutorials</span></td></tr><tr><td><span style=\"font-size:16px\">:: Starter Templates</span></td></tr><tr><td><span style=\"font-size:16px\">:: Documentation</span></td></tr><tr><td><span style=\"font-size:16px\">:: Source Code</span></td></tr></tbody></table>" }
|
|
178
184
|
]
|
|
179
185
|
}
|
|
186
|
+
|
|
187
|
+
//:endif:
|
|
180
188
|
}
|