X-Git-Url: http://git.pjr.cc/?p=nodejsws.git;a=blobdiff_plain;f=lib%2Flayouts.js;h=fb4d503c3fdd0850d454d404b9384b5dbb3074d8;hp=26799874061ed9cb5566e7c71ac11bd967e2ecf7;hb=6beaec1f162befb123cc29c60566cd15da515750;hpb=f3610858364946faf944c86362b40b2644e4050a
diff --git a/lib/layouts.js b/lib/layouts.js
index 2679987..fb4d503 100644
--- a/lib/layouts.js
+++ b/lib/layouts.js
@@ -1,7 +1,7 @@
exports.standard = function () {
var lay = "
";
lay += " |
";
- lay += " | |
";
+ lay += " | |
";
lay += " |
";
return lay;
@@ -9,29 +9,39 @@ exports.standard = function () {
exports.straight = function () {
- var lay = "";
+ var lay = "";
lay += " |
";
- lay += " | |
";
+ lay += " | |
";
lay += " |
";
-
+
return lay;
}
exports.header = function(request, response, callback) {
// this function is the default header builder.
- response.write("mainname");
+ response.write(""+global.njsAppName+"");
callback(request, response);
}
exports.title = function(request, response, callback) {
// this is the default title builder
- response.write("mainname
");
+ response.write(""+global.njsAppName+"
");
callback(request, response);
}
exports.menu = function(request, response, callback) {
// this is the default title builder
- response.write("");
+ //response.write("");
+ if(typeof global.menu != "undefined") {
+ response.write("");
+ for(key in global.menu) {
+ response.write(""+key+" | ");
+ console.log("menu: '%s', '%s'", key, global.menu[key]);
+ }
+ response.write("
");
+ } else {
+ response.write("No Menu Defined");
+ }
callback(request, response);
}
@@ -49,7 +59,11 @@ exports.body = function(request, response, callback) {
exports.footer = function(request, response, callback) {
// this is the default title builder
- response.write("
Copyright PJR.cc");
+ if(typeof global.footerText != "undefined") {
+ response.write(global.footerText);
+ } else {
+ response.write("
Copyright PJR.cc");
+ }
callback(request, response);
}
@@ -57,3 +71,33 @@ exports.preResponse = function(request, response, callback) {
console.log("in preresponse - doing nothing");
callback();
}
+
+
+// global menu management functions
+exports.addMenu = function(menuname, menulink) {
+ console.log("add menu item, '%s' -> '%s'", menuname, menulink);
+ if(typeof global.menu == "undefined") {
+ global.menu = new Array();
+ global.menu[menuname] = menulink;
+ } else {
+ global.menu[menuname] = menulink;
+ }
+}
+
+exports.delMenu = function(menuname) {
+ var t = new Array();
+ for(key in global.menu) {
+ if(key != menuname) {
+ t[key] = global.menu[key];
+ }
+ }
+ global.menu = t;
+}
+
+exports.clearMenu = function() {
+ delete global.menu;
+}
+
+global.addMenu = exports.addMenu;
+global.delMenu = exports.delMenu;
+global.clearMenu = exports.clearMenu;
\ No newline at end of file