Socket
Socket
Sign inDemoInstall

periodicjs.core.controller

Package Overview
Dependencies
21
Maintainers
2
Versions
170
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.90.200 to 1.90.300

175

lib/controller.js

@@ -15,3 +15,3 @@ /*

var logger,appSettings,theme;
var logger, appSettings, theme;

@@ -50,4 +50,4 @@ /**

exttemplatefile;
themetemplatefile = (themename && themefileext) ? path.join(path.resolve(process.cwd(), './content/themes'), themename, 'views', viewname + '.' + themefileext) : false;
exttemplatefile = (extname && themefileext) ? path.join(path.resolve(process.cwd(), './node_modules', extname), 'views', viewname + '.' + themefileext) : false;
themetemplatefile = (themename && themefileext) ? path.join(path.resolve(process.cwd(), './content/themes'), themename, 'views', viewname + '.' + themefileext) : false;
exttemplatefile = (extname && themefileext) ? path.join(path.resolve(process.cwd(), './node_modules', extname), 'views', viewname + '.' + themefileext) : false;

@@ -109,2 +109,3 @@ var getExtensionView = function (viewname, callback) {

Controller.prototype.handleDocumentQueryRender = function (options) {
var res = options.res,

@@ -148,2 +149,5 @@ req = options.req,

}
else if (req.is('json') || req.is('application/json')) {
res.json(responseData);
}
else {

@@ -172,4 +176,10 @@ res.render(options.renderView, responseData);

res.status(400);
if (res.statusCode !== 200 || res.statusCode !== 400) {
res.status(res.statusCode);
}
else {
res.status(400);
}
logger.error(err.stack);

@@ -222,3 +232,3 @@ logger.error(errormessage, req.url);

* short hand mongoose load document query
* @param {object} options model,docid - id or name,callback,population -mongoose population, selection - mongoose selection
* @param {object} options model,docid - id or name,callback,population -mongoose population, selection - mongoose selection
* @return {Function} callback(err,document)

@@ -296,3 +306,3 @@ */

* short hand mongoose create document query
* @param {object} options model,newdoc - document to insert, req, res,callback, successredirect, appendid - append the id of newly created document on redirect
* @param {object} options model,newdoc - document to insert, req, res,callback, successredirect, appendid - append the id of newly created document on redirect
* @return {object} responseData or redirected page

@@ -313,7 +323,7 @@ */

if(callback){
callback(null,saveddoc);
if (callback) {
callback(null, saveddoc);
}
else{
else {
this.handleDocumentQueryErrorResponse({

@@ -324,8 +334,8 @@ err: err,

req: req
});
});
}
}
else {
if(callback){
callback(null,saveddoc);
if (callback) {
callback(null, saveddoc);
}

@@ -352,37 +362,38 @@ else if (req.query.format === 'json' || req.params.ext === 'json') {

var returnObjectDifference = function(original,revision){
var changesetdata={},comparestatus;
for(var prop in revision){
if(!original[prop] || (JSON.stringify(revision[prop]) !== JSON.stringify(original[prop]) )){
if(Array.isArray(revision[prop]) && original[prop] ){
for(var op =0; op <revision[prop].length; op++){
if(original[prop][op] && original[prop][op]._id && revision[prop][op].toString() === original[prop][op]._id.toString()){
comparestatus='array of prop('+prop+') is same';
var returnObjectDifference = function (original, revision) {
var changesetdata = {},
comparestatus;
for (var prop in revision) {
if (!original[prop] || (JSON.stringify(revision[prop]) !== JSON.stringify(original[prop]))) {
if (Array.isArray(revision[prop]) && original[prop]) {
for (var op = 0; op < revision[prop].length; op++) {
if (original[prop][op] && original[prop][op]._id && revision[prop][op].toString() === original[prop][op]._id.toString()) {
comparestatus = 'array of prop(' + prop + ') is same';
}
else if(
original[prop][op] &&
original[prop][op].entity_item &&
revision[prop][op].entity_item &&
revision[prop][op].entity_item.toString() === original[prop][op].entity_item._id.toString()
){
comparestatus='array entity_item of prop('+prop+') is the same';
else if (
original[prop][op] &&
original[prop][op].entity_item &&
revision[prop][op].entity_item &&
revision[prop][op].entity_item.toString() === original[prop][op].entity_item._id.toString()
) {
comparestatus = 'array entity_item of prop(' + prop + ') is the same';
}
else if(
original[prop][op] &&
original[prop][op].entity_collection &&
revision[prop][op].entity_collection &&
revision[prop][op].entity_collection.toString() === original[prop][op].entity_collection._id.toString()
){
comparestatus='array entity_collection of prop('+prop+') is same';
else if (
original[prop][op] &&
original[prop][op].entity_collection &&
revision[prop][op].entity_collection &&
revision[prop][op].entity_collection.toString() === original[prop][op].entity_collection._id.toString()
) {
comparestatus = 'array entity_collection of prop(' + prop + ') is same';
}
else if(
original[prop][op] &&
original[prop][op].item &&
revision[prop][op].item &&
revision[prop][op].item.toString() === original[prop][op].item._id.toString()
){
comparestatus='array item of prop('+prop+') is same';
else if (
original[prop][op] &&
original[prop][op].item &&
revision[prop][op].item &&
revision[prop][op].item.toString() === original[prop][op].item._id.toString()
) {
comparestatus = 'array item of prop(' + prop + ') is same';
}
else{
comparestatus='array prop('+prop+') is different';
else {
comparestatus = 'array prop(' + prop + ') is different';
changesetdata[prop] = revision[prop];

@@ -392,7 +403,7 @@ }

}
else if(original[prop] && original[prop]._id && (original[prop]._id.toString() === revision[prop].toString())){
comparestatus=' prop('+prop+') id is the same';
else if (original[prop] && original[prop]._id && (original[prop]._id.toString() === revision[prop].toString())) {
comparestatus = ' prop(' + prop + ') id is the same';
}
else{
comparestatus=' prop('+prop+') id is different';
else {
comparestatus = ' prop(' + prop + ') id is different';
changesetdata[prop] = revision[prop];

@@ -402,3 +413,3 @@ }

}
logger.silly('changesetdata',changesetdata);
logger.silly('changesetdata', changesetdata);
return changesetdata;

@@ -409,3 +420,3 @@ };

* short hand mongoose update document query
* @param {object} options model, id - objectid of mongoose document,updatedoc - document to update, req, res,callback, successredirect, appendid - append the id of newly created document on redirect, removefromarray - sets the update operation to manipulate an array of documents with mongo $pull, appendArray - sets the update operation to manipulate an array of documents with mongo $push, saverevision - save revisions
* @param {object} options model, id - objectid of mongoose document,updatedoc - document to update, req, res,callback, successredirect, appendid - append the id of newly created document on redirect, removefromarray - sets the update operation to manipulate an array of documents with mongo $pull, appendArray - sets the update operation to manipulate an array of documents with mongo $push, saverevision - save revisions
* @return {object} responseData or redirected page

@@ -445,9 +456,11 @@ */

if(options.forceupdate){
model.update({_id:id},updateOperation,function(err,numAffected){
if (options.forceupdate) {
model.update({
_id: id
}, updateOperation, function (err, numAffected) {
if (err) {
if(callback){
callback(err,null);
if (callback) {
callback(err, null);
}
else{
else {
this.handleDocumentQueryErrorResponse({

@@ -458,8 +471,8 @@ err: err,

req: req
});
});
}
}
else {
if(callback){
callback(null,numAffected);
if (callback) {
callback(null, numAffected);
}

@@ -469,3 +482,5 @@ else if (req.query.format === 'json' || req.params.ext === 'json') {

responseData.result = 'success';
responseData.data = {numAffected:numAffected};
responseData.data = {
numAffected: numAffected
};
responseData.data.flash_messages = req.flash();

@@ -481,10 +496,10 @@ res.send(responseData);

}
else{
model.findByIdAndUpdate(id, updateOperation, function (err, saveddoc) {
console.log('tried to save',updateOperation);
else {
model.findByIdAndUpdate(id, updateOperation, function (err, saveddoc) {
console.log('tried to save', updateOperation);
if (err) {
if(callback){
callback(err,null);
if (callback) {
callback(err, null);
}
else{
else {
this.handleDocumentQueryErrorResponse({

@@ -495,8 +510,8 @@ err: err,

req: req
});
});
}
}
else {
if(callback){
callback(null,saveddoc);
if (callback) {
callback(null, saveddoc);
}

@@ -548,10 +563,10 @@ else if (req.query.format === 'json' || req.params.ext === 'json') {

delete changesetdata.doctypename;
delete changesetdata.doctypenamelink;
delete changesetdata.time;
delete changesetdata.searchdocumentsbutton;
delete changesetdata.date;
delete changesetdata.mediafiles;
delete changesetdata.doctypenamelink;
delete changesetdata.time;
delete changesetdata.searchdocumentsbutton;
delete changesetdata.date;
delete changesetdata.mediafiles;
changesetdiff = returnObjectDifference(originalrevision, changesetdata);
if(Object.keys(changesetdiff).length>0){
if (Object.keys(changesetdiff).length > 0) {
model.findByIdAndUpdate(

@@ -562,7 +577,7 @@ id, {

changeset: changesetdiff,
editor:req.user._id,
editor_username:req.user.username
editor: req.user._id,
editor_username: req.user.username
}
}
},// // {safe: true, upsert: true},
}, // // {safe: true, upsert: true},
function (err) {

@@ -575,3 +590,3 @@ if (err) {

}
else{
else {
logger.silly('no changes to save');

@@ -588,3 +603,3 @@ }

* @param {object} options model,deleteid - id to delete,callback
* @return {Function} callback(err)
* @return {Function} callback(err)
*/

@@ -603,2 +618,2 @@ Controller.prototype.deleteModel = function (options) {

module.exports = Controller;
module.exports = Controller;
{
"name": "periodicjs.core.controller",
"description": "Customizable CMS platform",
"version": "1.90.200",
"main": "index.js",
"engines": {
"node": ">=0.10.x"
},
"author": {
"name": "Yaw Joseph Etse",
"email": "yaw.etse@gmail.com",
"url": "http://about.me/yawjosephetse"
},
"repository": {
"type": "git",
"url": "git://github.com/typesettin/periodicjs.core.controller.git"
},
"scripts": {
"test": "mocha -R spec --recursive"
},
"dependencies": {
"async": "0.9.0",
"fs-extra": "0.9.1",
"semver": "2.3.0",
"periodicjs.core.utilities": "~1.90.10"
},
"devDependencies": {
"chai": "1.9.1",
"grunt": ">=0.4.5",
"grunt-contrib-jshint": ">=0.4.3",
"grunt-contrib-watch": ">=0.4.1",
"grunt-jsbeautifier": ">=0.2.7",
"grunt-jsdoc": ">=0.5.6",
"jsdoc": "3.3.0-alpha5",
"grunt-newer": ">=0.7.0",
"grunt-simple-mocha": ">=0.4.0",
"mocha": "1.9.0"
},
"keywords": [
"content management framework",
"typeset",
"wysiwyg",
"ui manager",
"CMS",
"CDS",
"Content Delivery System",
"Content Management System",
"Periodic Decoupled Framework"
],
"contributors": [
{
"name": "Yaw Joseph Etse",
"email": "yaw.etse@gmail.com"
}
],
"gitHead": "5f461eac9506e2d6538741fef9e5854306b00258",
"bugs": {
"url": "https://github.com/typesettin/periodicjs.core.controllerhelper/issues"
},
"homepage": "https://github.com/typesettin/periodicjs.core.controllerhelper",
"_id": "periodicjs.core.controller@1.90.119",
"_shasum": "90f35d1e33c27afd8263988541973314f226d94c",
"_from": "periodicjs.core.controller@1.90.119",
"_npmVersion": "1.5.0-alpha-4",
"_npmUser": {
"name": "yawetse",
"email": "yaw.etse@gmail.com"
},
"maintainers": [
{
"name": "yawetse",
"email": "yaw.etse@gmail.com"
}
],
"dist": {
"shasum": "90f35d1e33c27afd8263988541973314f226d94c",
"tarball": "http://registry.npmjs.org/periodicjs.core.controller/-/periodicjs.core.controller-1.90.119.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/periodicjs.core.controller/-/periodicjs.core.controller-1.90.119.tgz"
"name": "periodicjs.core.controller",
"description": "Customizable CMS platform",
"version": "1.90.300",
"main": "index.js",
"engines": {
"node": ">=0.10.x"
},
"author": {
"name": "Yaw Joseph Etse",
"email": "yaw.etse@gmail.com",
"url": "http://about.me/yawjosephetse"
},
"repository": {
"type": "git",
"url": "git://github.com/typesettin/periodicjs.core.controller.git"
},
"scripts": {
"test": "mocha -R spec --recursive"
},
"dependencies": {
"async": "0.9.0",
"fs-extra": "0.9.1",
"semver": "2.3.0",
"periodicjs.core.utilities": "~1.90.10"
},
"devDependencies": {
"chai": "1.9.1",
"grunt": ">=0.4.5",
"grunt-contrib-jshint": ">=0.4.3",
"grunt-contrib-watch": ">=0.4.1",
"grunt-jsbeautifier": ">=0.2.7",
"grunt-jsdoc": ">=0.5.6",
"jsdoc": "3.3.0-alpha5",
"grunt-newer": ">=0.7.0",
"grunt-simple-mocha": ">=0.4.0",
"mocha": "1.9.0"
},
"keywords": [
"content management framework",
"typeset",
"wysiwyg",
"ui manager",
"CMS",
"CDS",
"Content Delivery System",
"Content Management System",
"Periodic Decoupled Framework"
],
"contributors": [{
"name": "Yaw Joseph Etse",
"email": "yaw.etse@gmail.com"
}],
"gitHead": "5f461eac9506e2d6538741fef9e5854306b00258",
"bugs": {
"url": "https://github.com/typesettin/periodicjs.core.controllerhelper/issues"
},
"homepage": "https://github.com/typesettin/periodicjs.core.controllerhelper",
"_id": "periodicjs.core.controller@1.90.119",
"_shasum": "90f35d1e33c27afd8263988541973314f226d94c",
"_from": "periodicjs.core.controller@1.90.119",
"_npmVersion": "1.5.0-alpha-4",
"_npmUser": {
"name": "yawetse",
"email": "yaw.etse@gmail.com"
},
"maintainers": [{
"name": "yawetse",
"email": "yaw.etse@gmail.com"
}],
"dist": {
"shasum": "90f35d1e33c27afd8263988541973314f226d94c",
"tarball": "http://registry.npmjs.org/periodicjs.core.controller/-/periodicjs.core.controller-1.90.119.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/periodicjs.core.controller/-/periodicjs.core.controller-1.90.119.tgz"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc