]> git.decadent.org.uk Git - maypole.git/commitdiff
Here are the templates!
authorSimon Cozens <simon@simon-cozens.org>
Thu, 29 Jan 2004 17:03:35 +0000 (17:03 +0000)
committerSimon Cozens <simon@simon-cozens.org>
Thu, 29 Jan 2004 17:03:35 +0000 (17:03 +0000)
git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@18 48953598-375a-da11-a14b-00016c27c3ee

templates/beer/addnew [new file with mode: 0644]
templates/custom/frontpage [new file with mode: 0644]
templates/custom/header [new file with mode: 0644]
templates/factory/addnew [new file with mode: 0644]
templates/factory/edit [new file with mode: 0644]
templates/factory/frontpage [new file with mode: 0644]
templates/factory/header [new file with mode: 0644]
templates/factory/list [new file with mode: 0644]
templates/factory/list_macros [new file with mode: 0644]
templates/factory/navbar [new file with mode: 0644]
templates/factory/view [new file with mode: 0644]

diff --git a/templates/beer/addnew b/templates/beer/addnew
new file mode 100644 (file)
index 0000000..c3d351c
--- /dev/null
@@ -0,0 +1,29 @@
+<h3>Add a new [%classmetadata.moniker%]</h3>
+[% USE element_maker = Class("HTML::Element") %]
+<P>
+<FORM METHOD="post" ACTION="[%base%]/[%classmetadata.moniker%]/do_edit/">
+    <INPUT TYPE="hidden" NAME="action" VALUE="create">
+    <INPUT TYPE="hidden" NAME="class" VALUE="[%classmetadata.name%]">
+     [% FOR col = classmetadata.columns;
+        NEXT IF col == "id";
+        "<b>";classmetadata.colnames.$col;"</b> : "; 
+        SET element = classmetadata.cgi.$col;
+        IF col == "brewery";
+            SET create_url = base _ "/brewery/edit";
+            SET new_element = element_maker.new("option", 
+                "class", "redirect",
+                "value", create_url).push_content("Create new brewery");
+            SET child = element.content_list.first;
+            SET foo = element.attr("name", "navi");
+            SET child = child.attr("selected", "selected");
+            SET element =
+            element.unshift_content(element_maker.new("option", value," "));
+            element.attr("onChange", "go()");
+            SET element = element.unshift_content(new_element);
+        END;
+        element.as_HTML;
+        %]
+    <BR>
+    [% END; %]
+    <INPUT TYPE="submit" NAME="create" VALUE="create">
+</FORM>
diff --git a/templates/custom/frontpage b/templates/custom/frontpage
new file mode 100644 (file)
index 0000000..f19217b
--- /dev/null
@@ -0,0 +1,49 @@
+[% INCLUDE header %]
+
+<h2> Main menu </h2>
+
+<TABLE BORDER="0" ALIGN="center" WIDTH="70%">
+<TR>
+<TD ALIGN="left">
+<P>
+<A HREF="/user/list"><IMG SRC="/images/users.png"> Administer users</A>
+</P>
+</TD>
+<TD ALIGN="right">
+<P>
+<A HREF="/computer/list"><IMG SRC="/images/computer.png"> Administer
+computers</A>
+</P>
+</TD>
+</TR>
+
+<TR>
+<TD ALIGN="left">
+<P>
+<A HREF="/blog/"><IMG SRC="/images/blog.png"> House blog</A>
+</P>
+</TD>
+<TD ALIGN="right">
+<P>
+<A HREF="/phoneNumber/list"><IMG SRC="/images/phone.png"> Register
+phone calls</A>
+</P>
+</TD>
+</TR>
+<TR>
+<TD ALIGN="left">
+<P>
+<A HREF="http://mp3z.trinity-house.org.uk/"><IMG
+SRC="/images/itunes.png">Stream music</A>
+</P>
+</TD>
+<TD ALIGN="right">
+<P>
+</P>
+</TD>
+</TR>
+
+</TABLE>
+
+<BR>
+[% INCLUDE small_blog %]
diff --git a/templates/custom/header b/templates/custom/header
new file mode 100644 (file)
index 0000000..bbc32bd
--- /dev/null
@@ -0,0 +1,23 @@
+<HTML>
+    <HEAD>
+        <TITLE> Beer Database </TITLE>
+<META http-equiv=Content-Type content="text/html; charset=utf-8">
+
+<LINK title=myStyle href="/trinity.css" type=text/css rel=stylesheet>
+
+<script language="javascript" type="text/javascript">
+<!--
+function go()
+{
+    box = document.forms[-1].navi;
+    destination = box.options[box.selectedIndex].value;
+    if (box.options[box.selectedIndex].class == 'redirect')
+        location.href = destination;
+}
+
+// -->
+</SCRIPT>
+</HEAD>
+<BODY>
+<DIV class="content">
+
diff --git a/templates/factory/addnew b/templates/factory/addnew
new file mode 100644 (file)
index 0000000..daacf9c
--- /dev/null
@@ -0,0 +1,13 @@
+<h3>Add a new [%classmetadata.moniker%]</h3>
+<FORM METHOD="post" ACTION="[%base%]/[%classmetadata.moniker%]/do_edit/">
+    <INPUT TYPE="hidden" NAME="action" VALUE="create">
+    <INPUT TYPE="hidden" NAME="class" VALUE="[%classmetadata.name%]">
+     [% FOR col = classmetadata.columns;
+        NEXT IF col == "id";
+        "<b>";classmetadata.colnames.$col;"</b> : "; 
+    classmetadata.cgi.$col.as_HTML;
+        %]
+    <BR>
+    [% END; %]
+    <INPUT TYPE="submit" NAME="create" VALUE="create">
+</FORM>
diff --git a/templates/factory/edit b/templates/factory/edit
new file mode 100644 (file)
index 0000000..11a2539
--- /dev/null
@@ -0,0 +1,21 @@
+[% PROCESS list_macros %]
+[% INCLUDE header %]
+
+[% FOR item = objects; %]
+<h2> Edit [% item.name %]</h2>
+
+<FORM ACTION="[% base %]/[% classmetadata.moniker %]/do_edit/[% item.id %]" METHOD="post">
+[%
+     FOR col = classmetadata.columns;
+        NEXT IF col == "id";
+        "<P>";
+        "<B>"; classmetadata.colnames.$col; "</B>";
+        ": ";
+            item.to_field(col).as_HTML;
+        "</P>";
+        IF errors.$col; 
+            "<FONT COLOR=\"#ff0000\">"; errors.$col; "</FONT>";
+        END;
+    END;
+     '<INPUT TYPE="submit" NAME="edit" VALUE="edit">';
+END %]
diff --git a/templates/factory/frontpage b/templates/factory/frontpage
new file mode 100644 (file)
index 0000000..3da9ea3
--- /dev/null
@@ -0,0 +1,37 @@
+[% INCLUDE header %]
+
+<h2> Main menu </h2>
+
+<TABLE BORDER="0" ALIGN="center" WIDTH="70%">
+<TR>
+<TD ALIGN="left">
+<P>
+<A HREF="/user/list"><IMG SRC="/images/users.png"> Administer users</A>
+</P>
+</TD>
+<TD ALIGN="right">
+<P>
+<A HREF="/computer/list"><IMG SRC="/images/computer.png"> Administer
+computers</A>
+</P>
+</TD>
+</TR>
+
+<TR>
+<TD ALIGN="left">
+<P>
+<A HREF="/blog/"><IMG SRC="/images/blog.png"> House blog</A>
+</P>
+</TD>
+<TD ALIGN="right">
+<P>
+<A HREF="/phoneNumber/list"><IMG SRC="/images/phone.png"> Register
+phone calls</A>
+</P>
+</TD>
+</TR>
+
+</TABLE>
+
+<BR>
+[% INCLUDE small_blog %]
diff --git a/templates/factory/header b/templates/factory/header
new file mode 100644 (file)
index 0000000..213c22b
--- /dev/null
@@ -0,0 +1,5 @@
+<HTML>
+    <HEAD>
+        <TITLE> You want to put the title of your application here <TITLE>
+    </HEAD>
+    <BODY>
diff --git a/templates/factory/list b/templates/factory/list
new file mode 100644 (file)
index 0000000..69bb868
--- /dev/null
@@ -0,0 +1,29 @@
+[% PROCESS list_macros %]
+
+[% INCLUDE header %]
+
+<h2> Listing of all [% classmetadata.plural %]</h2>
+
+[% INCLUDE navbar %]
+
+<TABLE id="matrix" WIDTH="100%">
+<TR>
+[% FOR col = classmetadata.columns.list;
+    NEXT IF col == "id";
+    "<TH>"; classmetadata.colnames.$col; "</TH>";
+END %]
+</TR>
+
+[%  SET count = 0;
+FOR item = objects;
+    SET count = count + 1;
+    "<tr";
+    ' class="alternate"' IF count % 2;
+    ">";
+    display_line(item);
+    "</tr>";
+END %]
+</TABLE>
+
+
+[% INCLUDE addnew; %]
diff --git a/templates/factory/list_macros b/templates/factory/list_macros
new file mode 100644 (file)
index 0000000..0a88996
--- /dev/null
@@ -0,0 +1,22 @@
+[% MACRO display_line(item) BLOCK;
+     FOR col = classmetadata.columns;
+        NEXT IF col == "id";
+        "<td>";
+        "<A HREF='" _ base _ item.$col.moniker _ "/view/" _ 
+            item.$col.id _"'>" IF item.$col.moniker; # it's an object
+        item.$col;
+        "</A>" IF item.$col.moniker; 
+        "</td>";
+     END;
+    button(item, "edit");
+    button(item, "delete");
+END %]
+[% MACRO button(obj, action) BLOCK; %]
+
+<TD>
+<FORM METHOD="post" ACTION="[%base%]/[%classmetadata.moniker%]/[%action%]/[%obj.id%]">
+    <INPUT TYPE="submit" NAME="[%action%]" VALUE="[%action%]">
+</FORM>
+</TD>
+[% END %]
+
diff --git a/templates/factory/navbar b/templates/factory/navbar
new file mode 100644 (file)
index 0000000..3e5c1c5
--- /dev/null
@@ -0,0 +1,16 @@
+<div id="navcontainer">
+<ul id="navlist">
+[%
+    FOR table = config.display_tables;
+        '<LI '; 'id="active"' IF table == classmetadata.moniker;
+        '>';
+        '<A HREF="';
+        base; table; "/list/";
+        '"';
+        ' id="current"' IF table == classmetadata.moniker;
+        '> '; table; "</A>";
+    END;
+%]
+</ul>
+</div> 
+
diff --git a/templates/factory/view b/templates/factory/view
new file mode 100644 (file)
index 0000000..48dec99
--- /dev/null
@@ -0,0 +1,26 @@
+[% MACRO button(obj, action) BLOCK; %]
+
+<TD>
+<FORM METHOD="post" ACTION="[%base%]/[%classmetadata.moniker%]/[%action%]/[%obj.id%]">
+    <INPUT TYPE="submit" NAME="[%action%]" VALUE="[%action%]">
+</FORM>
+</TD>
+[% END %]
+
+[% INCLUDE header %]
+
+[% FOR item = objects %]
+<h2> [% item.name %]</h2>
+
+[% FOR col = classmetadata.columns.list;
+    NEXT IF col == "id";
+    "<P>";
+    classmetadata.colnames.$col; ":";
+    " "; item.$col;"</p>";
+     END;
+    button(item, "edit");
+    button(item, "delete");
+    "</tr>";
+END;
+%]
+