semi-functional
[nodejsws.git] / lib / layouts.js
1 exports.standard = function () {
2         var lay = "<html><head><?njs header ?></head><body><?njs title ?>";
3         lay += "<table width=\"100%\"><tr><td><?njs menu ?></td></tr>";
4         lay += "<tr valign=\"top\"><td width=\"120px\"><?njs sidebar ?></td><td><?njs body ?></td></tr>";
5         lay += "<tr><td><?njs footer ?></td></tr></table><?njs totalend ?></body></html>";
6         
7         return lay;
8 }
9
10
11 exports.straight = function () {
12         var lay = "<html><head><?njs header ?></head><body><?nfs title ?>";
13         lay += "<table width=\"100%\"><tr><td><?njs menu ?></td></tr>";
14         lay += "<tr valign=\"top\"><td></td><?njs sidebar ?><td><?njs body ?></td></tr>";
15         lay += "<tr><td><?njs footer ?></td></tr></table><?njs totalend ?></body></html>";
16         
17         return lay;
18 }
19
20 exports.header = function(request, response, callback) {
21         // this function is the default header builder.
22         response.write("<title>mainname</title>");
23         callback(request, response);
24 }
25
26 exports.title = function(request, response, callback) {
27         // this is the default title builder
28         response.write("<h1>mainname</h1>");
29         callback(request, response);
30 }
31
32 exports.menu = function(request, response, callback) {
33         // this is the default title builder
34         response.write("<table><tr><th>Menu</th><td>item 1</td><td>item2</td></tr></table>");
35         callback(request, response);
36 }
37
38 exports.sidebar = function(request, response, callback) {
39         // this is the default title builder
40         response.write("Sidebar!");
41         callback(request, response);
42 }
43
44 exports.body = function(request, response, callback) {
45         // this is the default title builder
46         response.write("Body!");
47         callback(request, response);
48 }
49
50 exports.footer = function(request, response, callback) {
51         // this is the default title builder
52         response.write("<br><br><font size=\"-1\"><i>Copyright PJR.cc</i></font>");
53         callback(request, response);
54 }
55
56 exports.preResponse = function(request, response, callback) {
57         console.log("in preresponse - doing nothing");
58         callback();
59 }