semi-functional
[nodejsws.git] / lib / layouts.js
index a6c0a81..2679987 100644 (file)
@@ -1,8 +1,8 @@
 exports.standard = function () {
-       var lay = "<html><head><?njs header ?></head><body><?nfs title ?>";
+       var lay = "<html><head><?njs header ?></head><body><?njs title ?>";
        lay += "<table width=\"100%\"><tr><td><?njs menu ?></td></tr>";
-       lay += "<tr valign=\"top\"><td></td><?njs sidebar ?><td><?njs body ?></td></tr>";
-       lay += "<tr><td><?njs footer ?></td></tr></table>";
+       lay += "<tr valign=\"top\"><td width=\"120px\"><?njs sidebar ?></td><td><?njs body ?></td></tr>";
+       lay += "<tr><td><?njs footer ?></td></tr></table><?njs totalend ?></body></html>";
        
        return lay;
 }
@@ -12,7 +12,48 @@ exports.straight = function () {
        var lay = "<html><head><?njs header ?></head><body><?nfs title ?>";
        lay += "<table width=\"100%\"><tr><td><?njs menu ?></td></tr>";
        lay += "<tr valign=\"top\"><td></td><?njs sidebar ?><td><?njs body ?></td></tr>";
-       lay += "<tr><td><?njs footer ?></td></tr></table>";
+       lay += "<tr><td><?njs footer ?></td></tr></table><?njs totalend ?></body></html>";
        
        return lay;
-}
\ No newline at end of file
+}
+
+exports.header = function(request, response, callback) {
+       // this function is the default header builder.
+       response.write("<title>mainname</title>");
+       callback(request, response);
+}
+
+exports.title = function(request, response, callback) {
+       // this is the default title builder
+       response.write("<h1>mainname</h1>");
+       callback(request, response);
+}
+
+exports.menu = function(request, response, callback) {
+       // this is the default title builder
+       response.write("<table><tr><th>Menu</th><td>item 1</td><td>item2</td></tr></table>");
+       callback(request, response);
+}
+
+exports.sidebar = function(request, response, callback) {
+       // this is the default title builder
+       response.write("Sidebar!");
+       callback(request, response);
+}
+
+exports.body = function(request, response, callback) {
+       // this is the default title builder
+       response.write("Body!");
+       callback(request, response);
+}
+
+exports.footer = function(request, response, callback) {
+       // this is the default title builder
+       response.write("<br><br><font size=\"-1\"><i>Copyright PJR.cc</i></font>");
+       callback(request, response);
+}
+
+exports.preResponse = function(request, response, callback) {
+       console.log("in preresponse - doing nothing");
+       callback();
+}