deprecating filter:server.create_routes and filter:admin.create_routes; maintains limited functionality but recommended you migrate asap

v1.18.x
psychobunny 11 years ago
parent 7183fda2eb
commit 23e4eb7cd9

@ -6,11 +6,15 @@ var _ = require('underscore'),
fs = require('fs'), fs = require('fs'),
validator = require('validator'), validator = require('validator'),
async = require('async'), async = require('async'),
winston = require('winston'),
plugins = require('../plugins'), plugins = require('../plugins'),
pluginRoutes = []; pluginRoutes = [];
/*
* TO BE DEPRECATED post 0.4x
*/
function setupPluginRoutes(app) { function setupPluginRoutes(app) {
var custom_routes = { var custom_routes = {
'routes': [], 'routes': [],
@ -19,10 +23,8 @@ function setupPluginRoutes(app) {
}; };
plugins.ready(function() { plugins.ready(function() {
/* plugins.fireHook('filter:server.create_routes', custom_routes, function(err, custom_routes) {
* TO BE DEPRECATED post 0.4x and replaced with something that isn't as complicated as this... winston.warn('[plugins] filter:server.create_routes is deprecated and will maintain limited functionality until 0.4x');
*/
/*plugins.fireHook('filter:server.create_routes', custom_routes, function(err, custom_routes) {
var route, var route,
routes = custom_routes.routes; routes = custom_routes.routes;
@ -33,11 +35,15 @@ function setupPluginRoutes(app) {
(function(route) { (function(route) {
app[routes[route].method || 'get'](routes[route].route, function(req, res) { app[routes[route].method || 'get'](routes[route].route, function(req, res) {
routes[route].options(req, res, function(options) { routes[route].options(req, res, function(options) {
app.build_header({ async.parallel([
req: options.req || req, function(next) {
res: options.res || res app.render('header', {}, next);
}, function (err, header) { },
//res.send(header + options.content + templates.footer); function(next) {
app.render('footer', {}, next);
}
], function(err, data) {
res.send(data[0] + options.content + data[1]);
}); });
}); });
}); });
@ -68,10 +74,13 @@ function setupPluginRoutes(app) {
}(route)); }(route));
} }
} }
});*/ });
}); });
} }
/*
* TO BE DEPRECATED post 0.4x
*/
function setupPluginAdminRoutes(app) { function setupPluginAdminRoutes(app) {
var custom_routes = { var custom_routes = {
'routes': [], 'routes': [],
@ -79,10 +88,8 @@ function setupPluginAdminRoutes(app) {
}; };
plugins.ready(function() { plugins.ready(function() {
/* plugins.fireHook('filter:admin.create_routes', custom_routes, function(err, custom_routes) {
* TO BE DEPRECATED post 0.4x and replaced with something that isn't as complicated as this... winston.warn('[plugins] filter:admin.create_routes is deprecated and will maintain limited functionality until 0.4x');
*/
/*plugins.fireHook('filter:admin.create_routes', custom_routes, function(err, custom_routes) {
var route, routes = custom_routes.routes; var route, routes = custom_routes.routes;
for (route in routes) { for (route in routes) {
@ -90,8 +97,15 @@ function setupPluginAdminRoutes(app) {
(function(route) { (function(route) {
app[routes[route].method || 'get']('/admin' + routes[route].route, function(req, res) { app[routes[route].method || 'get']('/admin' + routes[route].route, function(req, res) {
routes[route].options(req, res, function(options) { routes[route].options(req, res, function(options) {
Admin.buildHeader(req, res, function (err, header) { async.parallel([
res.send(header + options.content + templates['admin/footer']); function(next) {
app.render('admin/header', {}, next);
},
function(next) {
app.render('admin/footer', {}, next);
}
], function(err, data) {
res.send(data[0] + options.content + data[1]);
}); });
}); });
}); });
@ -111,7 +125,7 @@ function setupPluginAdminRoutes(app) {
}(route)); }(route));
} }
} }
});*/ });
}); });
} }

Loading…
Cancel
Save