]> git.decadent.org.uk Git - maypole.git/commitdiff
moved templates
authorAaron Trevena <aaron.trevena@gmail.com>
Sat, 19 Nov 2005 16:46:53 +0000 (16:46 +0000)
committerAaron Trevena <aaron.trevena@gmail.com>
Sat, 19 Nov 2005 16:46:53 +0000 (16:46 +0000)
git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@428 48953598-375a-da11-a14b-00016c27c3ee

32 files changed:
lib/Maypole/templates/beer/addnew [new file with mode: 0644]
lib/Maypole/templates/factory/addnew [new file with mode: 0644]
lib/Maypole/templates/factory/edit [new file with mode: 0644]
lib/Maypole/templates/factory/footer [new file with mode: 0644]
lib/Maypole/templates/factory/frontpage [new file with mode: 0644]
lib/Maypole/templates/factory/header [new file with mode: 0644]
lib/Maypole/templates/factory/list [new file with mode: 0644]
lib/Maypole/templates/factory/login [new file with mode: 0644]
lib/Maypole/templates/factory/macros [new file with mode: 0644]
lib/Maypole/templates/factory/maypole [new file with mode: 0644]
lib/Maypole/templates/factory/maypole.css [new file with mode: 0644]
lib/Maypole/templates/factory/navbar [new file with mode: 0644]
lib/Maypole/templates/factory/pager [new file with mode: 0644]
lib/Maypole/templates/factory/search_form [new file with mode: 0644]
lib/Maypole/templates/factory/title [new file with mode: 0644]
lib/Maypole/templates/factory/view [new file with mode: 0644]
templates/beer/addnew [deleted file]
templates/factory/addnew [deleted file]
templates/factory/edit [deleted file]
templates/factory/footer [deleted file]
templates/factory/frontpage [deleted file]
templates/factory/header [deleted file]
templates/factory/list [deleted file]
templates/factory/login [deleted file]
templates/factory/macros [deleted file]
templates/factory/maypole [deleted file]
templates/factory/maypole.css [deleted file]
templates/factory/navbar [deleted file]
templates/factory/pager [deleted file]
templates/factory/search_form [deleted file]
templates/factory/title [deleted file]
templates/factory/view [deleted file]

diff --git a/lib/Maypole/templates/beer/addnew b/lib/Maypole/templates/beer/addnew
new file mode 100644 (file)
index 0000000..ad51f01
--- /dev/null
@@ -0,0 +1,21 @@
+[% USE element_maker = Class("HTML::Element") %]
+<div id="addnew">
+<form method="post" action="[% base %]/[% classmetadata.moniker %]/do_edit/">
+<fieldset>
+<legend>Add a new [%classmetadata.moniker%]</legend>
+    <input type="hidden" name="action" value="create"/>
+    <input type="hidden" name="class" value="[% classmetadata.name %]"/>
+        [% FOR col = classmetadata.columns;
+            NEXT IF col == "id";
+            SET element = classmetadata.cgi.$col;
+            %]
+       <label>
+                <span class="field">[% classmetadata.colnames.$col; %]</span>
+                [% element.as_XML; %]</label>
+               
+        [% END; %]
+       
+    <input type="submit" name="create" value="create"/>
+    </fieldset>
+</form>
+</div>
diff --git a/lib/Maypole/templates/factory/addnew b/lib/Maypole/templates/factory/addnew
new file mode 100644 (file)
index 0000000..bf2b9ce
--- /dev/null
@@ -0,0 +1,41 @@
+[%#
+
+=head1 addnew
+
+This is the interface to adding a new instance of an object. (or a new
+row in the database, if you want to look at it that way) It displays a
+form containing a list of HTML components for each of the columns in the
+table.
+
+=cut
+
+#%]
+
+<div id="addnew">
+<form method="post" action="[% base %]/[% classmetadata.table %]/do_edit/">
+    <fieldset>
+<legend>Add a new [% classmetadata.moniker %]</legend>
+    [% FOR col = classmetadata.columns %]
+        [% NEXT IF col == "id" %]
+            <label><span class="field">[% classmetadata.colnames.$col %]</span>
+            [% 
+            SET elem = classmetadata.cgi.$col.clone;
+            IF request.action == 'do_edit';
+                IF elem.tag == "textarea";
+                    elem = elem.push_content(request.param(col));
+                ELSE;
+                    elem.attr("value", request.param(col));
+                END;
+            END;
+            elem.as_XML; %]
+           </label>
+        [% IF errors.$col %]
+           <span class="error">[% errors.$col %]</span>
+        [% END %]
+
+    [% END; %]
+    <input type="submit" name="create" value="create" />
+    <input type="hidden" name="__form_id" value="[% request.make_random_id %]" />
+</fieldset>
+</form>
+</div>
diff --git a/lib/Maypole/templates/factory/edit b/lib/Maypole/templates/factory/edit
new file mode 100644 (file)
index 0000000..6bdad79
--- /dev/null
@@ -0,0 +1,38 @@
+[%#
+
+=head1 edit
+
+This is the edit page. It edits the passed-in object, by displaying a
+form similar to L<addnew> but with the current values filled in.
+
+=cut
+
+#%]
+[% PROCESS macros %]
+[% INCLUDE header %]
+[% INCLUDE title %]
+[% IF objects.size %]
+<div id="title">Edit a [% classmetadata.moniker %]</div>
+[% FOR item = objects; %]
+<form action="[% base %]/[% item.table %]/do_edit/[% item.id %]" method="post">
+<fieldset>
+<legend>Edit [% item.name %]</legend>
+[% FOR col = classmetadata.columns;
+    NEXT IF col == "id";
+    '<label><span class="field">';
+    classmetadata.colnames.$col; ":</span>";
+    item.to_field(col).as_XML;
+    "</label>";
+    IF errors.$col; 
+       '<span class="error">'; errors.$col;'</span>';
+    END;
+    END %]
+    <input type="submit" name="edit" value="edit"/>
+    <input type="hidden" name="__form_id" value="[% request.make_random_id %]">
+    </fieldset></form>
+    
+    [% END %]
+[% ELSE %]
+[% INCLUDE addnew %]
+[% END %]
+[% INCLUDE footer %]
diff --git a/lib/Maypole/templates/factory/footer b/lib/Maypole/templates/factory/footer
new file mode 100644 (file)
index 0000000..1b8ae55
--- /dev/null
@@ -0,0 +1,3 @@
+       </div>
+    </body>
+</html>
diff --git a/lib/Maypole/templates/factory/frontpage b/lib/Maypole/templates/factory/frontpage
new file mode 100644 (file)
index 0000000..ac47269
--- /dev/null
@@ -0,0 +1,27 @@
+[%#
+
+=head1 frontpage
+
+This is the frontpage for your Maypole application.
+It shows a list of all tables it is allowed to display.
+
+=cut
+
+#%]
+[% INCLUDE header %]
+<div id="title">
+    [% config.application_name || "A poorly configured Maypole application" %]
+</div>
+<div id="frontpage_list">
+<ul>
+[% FOR table = config.display_tables %]
+    <li>
+        <a href="[% base %]/[%table%]/list">List by [%table %]</a>
+    </li>      
+[% END %]
+</ul>
+</div>
+
+[% INCLUDE maypole %]
+
+[% INCLUDE footer %]
diff --git a/lib/Maypole/templates/factory/header b/lib/Maypole/templates/factory/header
new file mode 100644 (file)
index 0000000..5c8a592
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>
+            [%
+              title || config.application_name ||
+                "A poorly configured Maypole application"
+            %]
+        </title>
+        <meta http-equiv="Content-Type" content="text/html; charset=[% request.document_encoding %]" />
+       <base href="[% config.uri_base%]"/>
+        <link title="Maypole" href="/maypole.css" type="text/css" rel="stylesheet" />
+   </head>
+    <body>
+        <div class="content">
diff --git a/lib/Maypole/templates/factory/list b/lib/Maypole/templates/factory/list
new file mode 100644 (file)
index 0000000..dbbedaf
--- /dev/null
@@ -0,0 +1,62 @@
+[% PROCESS macros %]
+[% INCLUDE header %]
+[% INCLUDE title %]
+[% IF search %]
+    <div id="title">Search results</div>
+[% ELSE %]
+    <div id="title">Listing of all [% classmetadata.plural %]</div>
+[% END %]
+[% INCLUDE navbar %]
+<div class="list">
+    <table id="matrix">
+        <tr>
+            [% FOR col = classmetadata.list_columns.list;
+                NEXT IF col == "id";
+                "<th>"; 
+                SET additional = "?order=" _ col;
+                SET additional = additional _ "&page=" _ pager.current_page
+                    IF pager;
+                SET additional = additional _ "&o2=desc" 
+                IF col == request.params.order and request.params.o2 != "desc";
+                SET action = "list";
+                FOR name = classmetadata.columns.list;
+                  IF request.query.$name;
+                    SET additional =
+                        additional  _ "&" _ name _ "=" _
+                        request.params.$name;
+                    SET action = "search";
+                  END;
+                END;
+               IF model_obj.find_column(col);
+                  link(classmetadata.table, action, additional,
+                    classmetadata.colnames.$col);
+                  IF col == request.params.order;
+                    IF request.params.o2 != "desc";
+                        "&darr;";
+                    ELSE;
+                        "&uarr;";
+                    END;
+                  END;
+               ELSE;
+                 classmetadata.colnames.$col || col FILTER ucfirst;
+               END;
+                "</th>";
+            END %]
+           <th id="actionth">Actions</th>
+        </tr>
+        [%  SET count = 0;
+        FOR item = objects;
+            SET count = count + 1;
+            "<tr";
+            ' class="alternate"' IF count % 2;
+            ">";
+            display_line(item);
+            "</tr>";
+        END %]
+    </table>
+
+[% INCLUDE pager %]
+[% INCLUDE addnew %]
+[% INCLUDE search_form %]
+</div>
+[% INCLUDE footer %]
diff --git a/lib/Maypole/templates/factory/login b/lib/Maypole/templates/factory/login
new file mode 100644 (file)
index 0000000..266921a
--- /dev/null
@@ -0,0 +1,25 @@
+[% PROCESS macros %]
+[% INCLUDE header %]
+[% INCLUDE title %]
+    <div id="title">You need to log in</div>
+
+    <div id="login">
+    [% IF login_error %]
+        <div class="error"> [% login_error %] </div>
+    [% END %]
+    <form method="post" action="[% base %]/[% request.path %]">
+    <fieldset>
+    <legend>Login</legend>
+        <label>
+            <span class="field">Username:</span>
+           <input name="[% config.auth.user_field || "user" %]" type="text" />
+        </label>
+       <label>
+           <span class="field">Password:</span>
+                   <input name="password" type="password" />
+       </label>        
+        <input type="submit" name="login" value="Submit"/>
+    </fieldset>
+    </form>
+    </div>
+
diff --git a/lib/Maypole/templates/factory/macros b/lib/Maypole/templates/factory/macros
new file mode 100644 (file)
index 0000000..59d6c92
--- /dev/null
@@ -0,0 +1,174 @@
+[%#
+
+=head1 MACROS
+
+These are some default macros which are used by various templates in the
+system.
+
+=head2 link
+
+This creates an <A HREF="..."> to a command in the Apache::MVC system by
+catenating the base URL, table, command, and any arguments.
+
+#%]
+[%
+MACRO link(table, command, additional, label) BLOCK;
+    SET lnk = base _ "/" _ table _ "/" _ command _ "/" _ additional;
+    lnk = lnk | uri | html;
+    '<a href="' _ lnk _ '">';
+    label;
+    "</a>";
+END;
+%]
+
+[%#
+
+=head2 maybe_link_view
+
+C<maybe_link_view> takes something returned from the database - either
+some ordinary data, or an object in a related class expanded by a
+has-a relationship. If it is an object, it constructs a link to the view
+command for that object. Otherwise, it just displays the data.
+
+#%]
+
+[%
+MACRO maybe_link_view(object) BLOCK;
+    IF object.isa('Maypole::Model::Base');
+        link(object.table, "view", object.id.join('/'), object);
+    ELSE;
+        object;
+    END;
+END;
+%]
+
+[%#
+
+=head2 display_line
+
+C<display_line> is used in the list template to display a row from the
+database, by iterating over the columns and displaying the data for each
+column. It misses out the C<id> column by default, and magically
+URLifies columns called C<url>. This may be considered too much magic
+for some.
+
+#%]
+[% MACRO display_line(item) BLOCK;
+    FOR col = classmetadata.list_columns;
+        NEXT IF col == "id";
+        "<td>";
+        IF col == "url" AND item.url;
+            '<a href="'; item.url; '"> '; item.url; '</a>';
+        ELSIF col == classmetadata.stringify_column;
+            maybe_link_view(item);
+        ELSE;
+            accessor = item.accessor_name(col);
+            maybe_link_view(item.$accessor);
+        END;
+        "</td>";
+    END;
+    '<td class="actions">';
+    button(item, "edit");
+    button(item, "delete");
+    "</td>";
+END %]
+[%#
+
+=head2 button
+
+This is a generic button, which performs an action on an object.
+
+=cut
+
+#%]
+[% MACRO button(obj, action) BLOCK; %]
+[% IF obj.is_public(action) %]
+<form class="actionform" action="[% base %]/[% obj.table %]/[% action %]/[% obj.id.join('/') %]" method="post">
+<div class="field"><input class="actionbutton" type="submit" value="[% action %]" /></div></form>
+[% END %]
+[% END %]
+[%#
+
+=head2 view_related
+
+This takes an object, and looks up the C<related_accessors>; this should
+give a list of accessors that can be called to get a list of related
+objects. It then displays a title for that accessor, (i.e. "Beers" for a
+brewery) calls the accesor, and displays a list of the results. 
+
+=cut
+
+#%]
+[% 
+MACRO view_related(object) BLOCK;
+    FOR accessor = classmetadata.related_accessors.list;
+        "<div id=\"subtitle\">"; accessor | ucfirst; "</div>\n";
+        "<ul id=\"vlist\">";
+        FOR thing = object.$accessor;
+            "<li>"; maybe_link_view(thing); "</li>\n";
+        END;
+        "</ul>";
+    END; 
+END;
+
+MACRO test_xxxx(myblock) BLOCK;
+    FOR col = classmetadata.columns;
+        NEXT IF col == "id";
+        myblock;
+    END;
+END;
+%]
+[%#
+
+=head2 view_item
+
+This takes an object and and displays its properties in a table. 
+
+=cut
+
+#%]
+[% MACRO view_item(item) BLOCK; %]
+    [% SET string = classmetadata.stringifycolumn %]
+    <div id="title"> [% item.$string %]</div>
+    [% INCLUDE navbar %]
+    <table class="view">
+        <tr>
+            <td class="field">[% classmetadata.colnames.$string %]</td>
+            <td>[% item.$string %]</td>
+        </tr>
+        [% FOR col = classmetadata.columns.list;
+            NEXT IF col == "id" OR col == string;
+            NEXT UNLESS item.$col;
+        %]
+[%# 
+
+=for doc
+
+It gets the displayable form of a column's name from the hash returned
+from the C<column_names> method:
+
+#%]
+            <tr>
+                <td class="field">[% classmetadata.colnames.$col; %]</td>
+                <td>
+                    [% IF col == "url" && item.url;  # Possibly too much magic.
+                        '<a href="'; item.url; '"> '; item.url; '</a>';
+                    ELSE;
+                        maybe_link_view(item.$col); 
+                    END; %]
+[%#
+
+This tests whether or not the returned value is an object, and if so,
+creates a link to a page viewing that object; if not, it just displays
+the text as normal. The object is linked using its stringified name;
+by default this calls the C<name> method, or returns the object's ID
+if there is no C<name> method or other stringification method defined.
+
+=cut
+
+#%] 
+                </td>
+            </tr>
+        [% END; %]
+    </table>
+[% END %]
diff --git a/lib/Maypole/templates/factory/maypole b/lib/Maypole/templates/factory/maypole
new file mode 100644 (file)
index 0000000..7ab2744
--- /dev/null
@@ -0,0 +1,7 @@
+<!-- boxes -->
+<div style='position:absolute;top:220px;left:130px;border-bottom-width:260px;border-right-width:370px;' class='deco1'>&nbsp;</div>
+<div style='position:absolute;top:260px;left:190px;border-bottom-width:170px;border-right-width:530px;' class='deco2'>&nbsp;</div>
+<div style='position:absolute;top:240px;left:220px;border-bottom-width:340px;border-right-width:440px;' class='deco4'>&nbsp;</div>
+<div style='position:absolute;top:160px;left:330px;border-bottom-width:160px;border-right-width:280px;' class='deco1'>&nbsp;</div>
+<div style='position:absolute;top:190px;left:290px;border-bottom-width:430px;border-right-width:130px;' class='deco2'>&nbsp;</div>
+<!-- end of boxes -->
diff --git a/lib/Maypole/templates/factory/maypole.css b/lib/Maypole/templates/factory/maypole.css
new file mode 100644 (file)
index 0000000..51d99a4
--- /dev/null
@@ -0,0 +1,376 @@
+html {
+    padding-right: 0px;
+    padding-left: 0px; 
+    padding-bottom: 0px; 
+    margin: 0px; 
+    padding-top: 0px
+}
+body {
+    font-family: sans-serif;
+    padding-right: 0px; 
+    padding-left: 0px; 
+    padding-bottom: 0px;
+    margin: 0px; padding-top: 0px;
+    background-color: #fff;
+}
+#frontpage_list {
+    position: absolute;
+    z-index: 5;
+    padding: 0px 100px 0px 0px;
+    margin:0 0.5%;     
+    margin-bottom:1em; 
+    margin-top: 1em;
+    background-color: #fff;
+}
+
+#frontpage_list a:hover {
+    background-color: #d0d8e4;
+}
+
+#frontpage_list ul {
+    list-style-type: square;
+}
+
+.content {
+    padding: 12px;
+    margin-top: 1px;  
+    margin-bottom:0px;
+    margin-left: 15px; 
+    margin-right: 15px;
+    border-color: #000000;
+    border-top: 0px;
+    border-bottom: 0px;
+    border-left: 1px;
+    border-right: 1px;
+}
+
+A { 
+    text-decoration: none; 
+    color:#225 
+}
+A:hover { 
+    text-decoration: underline; 
+    color:#222 
+}
+
+#title {
+    z-index: 6;
+    width: 100%;
+    height: 18px;
+    margin-top: 10px;
+    font-size: 90%;
+    border-bottom: 1px solid #ddf;
+    text-align: left;
+}
+
+#subtitle {
+    postion: absolute;
+    z-index: 6;
+    padding: 10px;
+    margin-top: 2em;
+    height: 18px;
+    text-align: left;
+    background-color: #fff;
+}
+
+input[type=text] {
+    height: 16px;
+    width: 136px;
+    font-family: sans-serif;
+    font-size: 11px;
+    color: #2E415A;
+    padding: 0px;
+    margin-bottom: 5px;
+}
+
+input[type=submit] {
+    height: 18px;
+    width: 60px;
+    font-family: sans-serif;
+    font-size: 11px;
+    border: 1px outset;
+    background-color: #fff;
+    padding: 0px 0px 2px 0px;
+    margin-bottom: 5px;
+}
+
+input:hover[type=submit] {
+    color: #fff;
+    background-color: #7d95b5;
+}
+
+textarea {
+    width: 136px;
+    font-family: sans-serif;
+    font-size: 11px;
+    color: #2E415A;
+    padding: 0px;
+    margin-bottom: 5px;
+}
+
+select {
+    height: 16px;
+    width: 140px;
+    font-family: sans-serif;
+    font-size: 12px;
+    color: #202020;
+    padding: 0px;
+    margin-bottom: 5px;
+}
+
+.deco1 {
+    font-size: 0px;
+    z-index:1;
+    border:0px;
+    border-style:solid;
+    border-color:#4d6d99;
+    background-color:#4d6d99;
+}
+
+.deco2 {
+    z-index:2;
+    border:0px;
+    border-style:solid;
+    border-color:#627ea5;
+    background-color:#627ea5;
+}
+
+
+.deco3 {
+    z-index:3;
+    border:0px;
+    border-style:solid;
+    border-color:#7d95b5;
+    background-color:#7d95b5;
+}
+                   
+.deco4 {
+    z-index:4;
+    border:0px;
+    border-style:solid;
+    border-color:#d0d8e4;
+    background-color:#d0d8e4;
+}
+                   
+
+table { 
+    border: 0px solid; 
+    background-color: #ffffff;
+}
+
+#matrix { width: 100%; }
+
+#matrix th {
+    background-color: #b5cadc;
+    border: 1px solid #778;
+    font: bold 12px Verdana, sans-serif;
+}
+
+#matrix #actionth {
+    width: 1px; 
+    padding: 0em 1em 0em 1em;
+}
+
+#matrix tr.alternate { background-color:#e3eaf0; }
+#matrix tr:hover { background-color: #b5cadc; }
+#matrix td { font: 12px Verdana, sans-serif; }
+
+#navlist {
+    padding: 3px 0;
+    margin-left: 0;
+    margin-top:3em;
+    border-bottom: 1px solid #778;
+    font: bold 12px Verdana, sans-serif;
+}
+
+#navlist li {
+    list-style: none;
+    margin: 0;
+    display: inline;
+}
+
+#navlist li a {
+    padding: 3px 0.5em;
+    margin-left: 3px;
+    border: 1px solid #778;
+    border-bottom: none;
+    background: #b5cadc;
+    text-decoration: none;
+}
+
+#navlist li a:link { color: #448; }
+#navlist li a:visited { color: #667; }
+
+#navlist li a:hover {
+    color: #000;
+    background: #eef;
+    border-top: 4px solid #7d95b5;
+    border-color: #227;
+}
+
+#navlist #active a {
+    background: white;
+    border-bottom: 1px solid white;
+    border-top: 4px solid;
+}
+
+td { font: 12px Verdana, sans-serif; }
+
+
+fieldset {
+    margin-top: 1em;
+    padding: 1em;
+    background-color: #f3f6f8;
+    font:80%/1 sans-serif;
+    border:1px solid #ddd;
+}
+
+legend {
+    padding: 0.2em 0.5em;
+    background-color: #fff;
+    border:1px solid #aaa;
+    font-size:90%;
+    text-align:right;
+}
+
+label {
+    display:block;
+}
+
+label .field {
+    float:left;
+    width:25%;
+    margin-right:0.5em;
+    padding-top:0.2em;
+    text-align:right;
+    font-weight:bold;
+}
+
+#vlist {
+    padding: 0 1px 1px;
+    margin-left: 0;
+    font: bold 12px Verdana, sans-serif;
+    background: gray;
+    width: 13em;
+}
+
+#vlist li {
+    list-style: none;
+    margin: 0;
+    border-top: 1px solid gray;
+    text-align: left;
+}
+
+#vlist li a {
+    display: block;
+    padding: 0.25em 0.5em 0.25em 0.75em;
+    border-left: 1em solid #7d95b5;
+    background: #d0d8e4;
+    text-decoration: none;
+}
+
+#vlist li a:hover { 
+    border-color: #227;
+}
+
+.view .field {
+    background-color: #f3f6f8;
+    border-left: 1px solid #7695b5;
+    border-top: 1px solid #7695b5;
+    padding: 1px 10px 0px 2px;
+}
+
+#addnew {
+    width: 50%;
+    float: left;
+}
+
+#search {
+    width: 50%;
+    float:right;
+}
+
+.error { color: #d00; }
+
+.action {
+    border: 1px outset #7d95b5;
+    style:block;
+}
+
+.action:hover {
+    color: #fff;
+    text-decoration: none;
+    background-color: #7d95b5;
+}
+
+.actionform {
+    display: inline;
+}
+
+.actionbutton {
+    height: 16px;
+    width: 40px;
+    font-family: sans-serif;
+    font-size: 10px;
+    border: 1px outset;
+    background-color: #fff;
+    margin-bottom: 0px;
+}
+
+.actionbutton:hover {
+    color: #fff;
+    background-color: #7d95b5;
+}
+
+.actions {
+    white-space: nowrap;
+}
+
+.field {
+    display:inline;
+}
+
+#login { width: 400px; }
+
+#login input[type=text] { width: 150px; }
+#login input[type=password] { width: 150px; }
+
+.pager {
+    font: 11px Arial, Helvetica, sans-serif;
+    text-align: center;
+    border: solid 1px #e2e2e2;
+    border-left: 0;
+    border-right: 0;
+    padding-top: 10px;
+    padding-bottom: 10px;
+    margin: 0px;
+    background-color: #f3f6f8;
+}
+
+.pager a {
+    padding: 2px 6px;
+    border: solid 1px #ddd;
+    background: #fff;
+    text-decoration: none;
+}
+
+.pager a:visited {
+    padding: 2px 6px;
+    border: solid 1px #ddd;
+    background: #fff;
+    text-decoration: none;
+}
+
+.pager .current-page {
+    padding: 2px 6px;
+    font-weight: bold;
+    vertical-align: top;
+}
+
+.pager a:hover {
+    color: #fff;
+    background: #7d95b5;
+    border-color: #036;
+    text-decoration: none;
+}
+
diff --git a/lib/Maypole/templates/factory/navbar b/lib/Maypole/templates/factory/navbar
new file mode 100644 (file)
index 0000000..0c8b168
--- /dev/null
@@ -0,0 +1,22 @@
+[%#
+
+=head1 navbar
+
+This is a navigation bar to go across the page. (Or down the side, or
+whatetver you want to do with it.) It displays all the tables which are
+accessible, with a link to the list page for each one.
+
+#%]
+[% PROCESS macros %]
+<div id="navcontainer">
+<ul id="navlist">
+[%
+    FOR table = config.display_tables;
+        '<li '; 'id="active"' IF table == classmetadata.table; '>';
+        # Hack
+        link(table, "list", "", table);
+        '</li>';
+    END;
+%]
+</ul>
+</div> 
diff --git a/lib/Maypole/templates/factory/pager b/lib/Maypole/templates/factory/pager
new file mode 100644 (file)
index 0000000..78c89fd
--- /dev/null
@@ -0,0 +1,48 @@
+[%#
+
+=head1 pager
+
+This controls the pager display at the bottom (by default) of the list
+and search views. It expects a C<pager> template argument which responds
+to the L<Data::Page> interface.
+
+#%]
+[%
+IF pager AND pager.first_page != pager.last_page;
+%]
+<p class="pager">Pages: 
+[%
+    UNLESS pager_action;
+       SET pager_action = request.action;
+    END;
+   
+    SET begin_page = pager.current_page - 10;
+    IF begin_page < 1;
+        SET begin_page = pager.first_page;
+    END;
+    SET end_page = pager.current_page + 10;
+    IF pager.last_page < end_page;
+        SET end_page = pager.last_page;
+    END;
+     FOREACH num = [begin_page .. end_page];
+          IF num == pager.current_page;
+            "<span class='current-page'>"; num; "</span>";
+          ELSE;
+            SET label = num;
+            SET args = "?page=" _ num;
+           SET args = args _ "&order=" _ request.params.order
+             IF request.params.order;
+           SET args = args _ "&amp;o2=desc"
+             IF request.params.o2 == "desc";
+            FOR col = classmetadata.columns.list;
+              IF request.params.$col;
+                SET args = args _ "&" _ col _ "=" _ request.params.$col;
+                SET action = "search";
+              END;
+            END;
+            link(classmetadata.table, pager_action, args, label);
+          END;
+     END;
+%]
+</p>
+[% END %]
diff --git a/lib/Maypole/templates/factory/search_form b/lib/Maypole/templates/factory/search_form
new file mode 100644 (file)
index 0000000..1f07194
--- /dev/null
@@ -0,0 +1,22 @@
+<div id="search">
+<form method="get" action="[% base %]/[% classmetadata.moniker %]/search/">
+<fieldset>
+<legend>Search</legend>
+        [% FOR col = classmetadata.columns;
+            NEXT IF col == "id";
+         %]
+           <label>
+                <span class="field">[% classmetadata.colnames.$col; %]</span>
+                    [% SET element = classmetadata.cgi.$col;
+                    IF element.tag == "select";
+                        USE element_maker = Class("HTML::Element");
+                        SET element = element.unshift_content(
+                            element_maker.new("option", value," "));
+                    END;
+                   element.as_XML; %]
+                  </label>
+        [% END; %]
+    <input type="submit" name="search" value="search"/>
+    </fieldset>
+</form>
+</div>
diff --git a/lib/Maypole/templates/factory/title b/lib/Maypole/templates/factory/title
new file mode 100644 (file)
index 0000000..401f0a3
--- /dev/null
@@ -0,0 +1 @@
+    <a href="[% base %]/frontpage">[% config.application_name %]</a>
diff --git a/lib/Maypole/templates/factory/view b/lib/Maypole/templates/factory/view
new file mode 100644 (file)
index 0000000..328678c
--- /dev/null
@@ -0,0 +1,34 @@
+[%#
+
+=for doc
+
+The C<view> template takes some objects (usually just one) from
+C<objects> and displays the object's properties in a table. 
+
+=cut
+
+#%]
+[% PROCESS macros %]
+[% INCLUDE header %]
+[% FOR item = objects %]
+[% view_item(item); %]
+[%#
+
+=for doc
+
+The C<view> template also displays a list of other objects related to the first
+one via C<has_many> style relationships; this is done by calling the
+C<related_accessors> method - see L<Model/related_accessors> - to return
+a list of has-many accessors. Next it calls each of those accessors, and
+displays the results in a table.
+
+#%]
+    <br /><a href="[%base%]/[%item.table%]/list">Back to listing</a>
+[% view_related(item); %]
+    
+[%
+    button(item, "edit");
+    button(item, "delete");
+%]
+[% END; %]
+[% INCLUDE footer %]
diff --git a/templates/beer/addnew b/templates/beer/addnew
deleted file mode 100644 (file)
index ad51f01..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-[% USE element_maker = Class("HTML::Element") %]
-<div id="addnew">
-<form method="post" action="[% base %]/[% classmetadata.moniker %]/do_edit/">
-<fieldset>
-<legend>Add a new [%classmetadata.moniker%]</legend>
-    <input type="hidden" name="action" value="create"/>
-    <input type="hidden" name="class" value="[% classmetadata.name %]"/>
-        [% FOR col = classmetadata.columns;
-            NEXT IF col == "id";
-            SET element = classmetadata.cgi.$col;
-            %]
-       <label>
-                <span class="field">[% classmetadata.colnames.$col; %]</span>
-                [% element.as_XML; %]</label>
-               
-        [% END; %]
-       
-    <input type="submit" name="create" value="create"/>
-    </fieldset>
-</form>
-</div>
diff --git a/templates/factory/addnew b/templates/factory/addnew
deleted file mode 100644 (file)
index bf2b9ce..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-[%#
-
-=head1 addnew
-
-This is the interface to adding a new instance of an object. (or a new
-row in the database, if you want to look at it that way) It displays a
-form containing a list of HTML components for each of the columns in the
-table.
-
-=cut
-
-#%]
-
-<div id="addnew">
-<form method="post" action="[% base %]/[% classmetadata.table %]/do_edit/">
-    <fieldset>
-<legend>Add a new [% classmetadata.moniker %]</legend>
-    [% FOR col = classmetadata.columns %]
-        [% NEXT IF col == "id" %]
-            <label><span class="field">[% classmetadata.colnames.$col %]</span>
-            [% 
-            SET elem = classmetadata.cgi.$col.clone;
-            IF request.action == 'do_edit';
-                IF elem.tag == "textarea";
-                    elem = elem.push_content(request.param(col));
-                ELSE;
-                    elem.attr("value", request.param(col));
-                END;
-            END;
-            elem.as_XML; %]
-           </label>
-        [% IF errors.$col %]
-           <span class="error">[% errors.$col %]</span>
-        [% END %]
-
-    [% END; %]
-    <input type="submit" name="create" value="create" />
-    <input type="hidden" name="__form_id" value="[% request.make_random_id %]" />
-</fieldset>
-</form>
-</div>
diff --git a/templates/factory/edit b/templates/factory/edit
deleted file mode 100644 (file)
index 6bdad79..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-[%#
-
-=head1 edit
-
-This is the edit page. It edits the passed-in object, by displaying a
-form similar to L<addnew> but with the current values filled in.
-
-=cut
-
-#%]
-[% PROCESS macros %]
-[% INCLUDE header %]
-[% INCLUDE title %]
-[% IF objects.size %]
-<div id="title">Edit a [% classmetadata.moniker %]</div>
-[% FOR item = objects; %]
-<form action="[% base %]/[% item.table %]/do_edit/[% item.id %]" method="post">
-<fieldset>
-<legend>Edit [% item.name %]</legend>
-[% FOR col = classmetadata.columns;
-    NEXT IF col == "id";
-    '<label><span class="field">';
-    classmetadata.colnames.$col; ":</span>";
-    item.to_field(col).as_XML;
-    "</label>";
-    IF errors.$col; 
-       '<span class="error">'; errors.$col;'</span>';
-    END;
-    END %]
-    <input type="submit" name="edit" value="edit"/>
-    <input type="hidden" name="__form_id" value="[% request.make_random_id %]">
-    </fieldset></form>
-    
-    [% END %]
-[% ELSE %]
-[% INCLUDE addnew %]
-[% END %]
-[% INCLUDE footer %]
diff --git a/templates/factory/footer b/templates/factory/footer
deleted file mode 100644 (file)
index 1b8ae55..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-       </div>
-    </body>
-</html>
diff --git a/templates/factory/frontpage b/templates/factory/frontpage
deleted file mode 100644 (file)
index ac47269..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-[%#
-
-=head1 frontpage
-
-This is the frontpage for your Maypole application.
-It shows a list of all tables it is allowed to display.
-
-=cut
-
-#%]
-[% INCLUDE header %]
-<div id="title">
-    [% config.application_name || "A poorly configured Maypole application" %]
-</div>
-<div id="frontpage_list">
-<ul>
-[% FOR table = config.display_tables %]
-    <li>
-        <a href="[% base %]/[%table%]/list">List by [%table %]</a>
-    </li>      
-[% END %]
-</ul>
-</div>
-
-[% INCLUDE maypole %]
-
-[% INCLUDE footer %]
diff --git a/templates/factory/header b/templates/factory/header
deleted file mode 100644 (file)
index 5c8a592..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-    <head>
-        <title>
-            [%
-              title || config.application_name ||
-                "A poorly configured Maypole application"
-            %]
-        </title>
-        <meta http-equiv="Content-Type" content="text/html; charset=[% request.document_encoding %]" />
-       <base href="[% config.uri_base%]"/>
-        <link title="Maypole" href="/maypole.css" type="text/css" rel="stylesheet" />
-   </head>
-    <body>
-        <div class="content">
diff --git a/templates/factory/list b/templates/factory/list
deleted file mode 100644 (file)
index dbbedaf..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-[% PROCESS macros %]
-[% INCLUDE header %]
-[% INCLUDE title %]
-[% IF search %]
-    <div id="title">Search results</div>
-[% ELSE %]
-    <div id="title">Listing of all [% classmetadata.plural %]</div>
-[% END %]
-[% INCLUDE navbar %]
-<div class="list">
-    <table id="matrix">
-        <tr>
-            [% FOR col = classmetadata.list_columns.list;
-                NEXT IF col == "id";
-                "<th>"; 
-                SET additional = "?order=" _ col;
-                SET additional = additional _ "&page=" _ pager.current_page
-                    IF pager;
-                SET additional = additional _ "&o2=desc" 
-                IF col == request.params.order and request.params.o2 != "desc";
-                SET action = "list";
-                FOR name = classmetadata.columns.list;
-                  IF request.query.$name;
-                    SET additional =
-                        additional  _ "&" _ name _ "=" _
-                        request.params.$name;
-                    SET action = "search";
-                  END;
-                END;
-               IF model_obj.find_column(col);
-                  link(classmetadata.table, action, additional,
-                    classmetadata.colnames.$col);
-                  IF col == request.params.order;
-                    IF request.params.o2 != "desc";
-                        "&darr;";
-                    ELSE;
-                        "&uarr;";
-                    END;
-                  END;
-               ELSE;
-                 classmetadata.colnames.$col || col FILTER ucfirst;
-               END;
-                "</th>";
-            END %]
-           <th id="actionth">Actions</th>
-        </tr>
-        [%  SET count = 0;
-        FOR item = objects;
-            SET count = count + 1;
-            "<tr";
-            ' class="alternate"' IF count % 2;
-            ">";
-            display_line(item);
-            "</tr>";
-        END %]
-    </table>
-
-[% INCLUDE pager %]
-[% INCLUDE addnew %]
-[% INCLUDE search_form %]
-</div>
-[% INCLUDE footer %]
diff --git a/templates/factory/login b/templates/factory/login
deleted file mode 100644 (file)
index 266921a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-[% PROCESS macros %]
-[% INCLUDE header %]
-[% INCLUDE title %]
-    <div id="title">You need to log in</div>
-
-    <div id="login">
-    [% IF login_error %]
-        <div class="error"> [% login_error %] </div>
-    [% END %]
-    <form method="post" action="[% base %]/[% request.path %]">
-    <fieldset>
-    <legend>Login</legend>
-        <label>
-            <span class="field">Username:</span>
-           <input name="[% config.auth.user_field || "user" %]" type="text" />
-        </label>
-       <label>
-           <span class="field">Password:</span>
-                   <input name="password" type="password" />
-       </label>        
-        <input type="submit" name="login" value="Submit"/>
-    </fieldset>
-    </form>
-    </div>
-
diff --git a/templates/factory/macros b/templates/factory/macros
deleted file mode 100644 (file)
index 59d6c92..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-[%#
-
-=head1 MACROS
-
-These are some default macros which are used by various templates in the
-system.
-
-=head2 link
-
-This creates an <A HREF="..."> to a command in the Apache::MVC system by
-catenating the base URL, table, command, and any arguments.
-
-#%]
-[%
-MACRO link(table, command, additional, label) BLOCK;
-    SET lnk = base _ "/" _ table _ "/" _ command _ "/" _ additional;
-    lnk = lnk | uri | html;
-    '<a href="' _ lnk _ '">';
-    label;
-    "</a>";
-END;
-%]
-
-[%#
-
-=head2 maybe_link_view
-
-C<maybe_link_view> takes something returned from the database - either
-some ordinary data, or an object in a related class expanded by a
-has-a relationship. If it is an object, it constructs a link to the view
-command for that object. Otherwise, it just displays the data.
-
-#%]
-
-[%
-MACRO maybe_link_view(object) BLOCK;
-    IF object.isa('Maypole::Model::Base');
-        link(object.table, "view", object.id.join('/'), object);
-    ELSE;
-        object;
-    END;
-END;
-%]
-
-[%#
-
-=head2 display_line
-
-C<display_line> is used in the list template to display a row from the
-database, by iterating over the columns and displaying the data for each
-column. It misses out the C<id> column by default, and magically
-URLifies columns called C<url>. This may be considered too much magic
-for some.
-
-#%]
-[% MACRO display_line(item) BLOCK;
-    FOR col = classmetadata.list_columns;
-        NEXT IF col == "id";
-        "<td>";
-        IF col == "url" AND item.url;
-            '<a href="'; item.url; '"> '; item.url; '</a>';
-        ELSIF col == classmetadata.stringify_column;
-            maybe_link_view(item);
-        ELSE;
-            accessor = item.accessor_name(col);
-            maybe_link_view(item.$accessor);
-        END;
-        "</td>";
-    END;
-    '<td class="actions">';
-    button(item, "edit");
-    button(item, "delete");
-    "</td>";
-END %]
-[%#
-
-=head2 button
-
-This is a generic button, which performs an action on an object.
-
-=cut
-
-#%]
-[% MACRO button(obj, action) BLOCK; %]
-[% IF obj.is_public(action) %]
-<form class="actionform" action="[% base %]/[% obj.table %]/[% action %]/[% obj.id.join('/') %]" method="post">
-<div class="field"><input class="actionbutton" type="submit" value="[% action %]" /></div></form>
-[% END %]
-[% END %]
-[%#
-
-=head2 view_related
-
-This takes an object, and looks up the C<related_accessors>; this should
-give a list of accessors that can be called to get a list of related
-objects. It then displays a title for that accessor, (i.e. "Beers" for a
-brewery) calls the accesor, and displays a list of the results. 
-
-=cut
-
-#%]
-[% 
-MACRO view_related(object) BLOCK;
-    FOR accessor = classmetadata.related_accessors.list;
-        "<div id=\"subtitle\">"; accessor | ucfirst; "</div>\n";
-        "<ul id=\"vlist\">";
-        FOR thing = object.$accessor;
-            "<li>"; maybe_link_view(thing); "</li>\n";
-        END;
-        "</ul>";
-    END; 
-END;
-
-MACRO test_xxxx(myblock) BLOCK;
-    FOR col = classmetadata.columns;
-        NEXT IF col == "id";
-        myblock;
-    END;
-END;
-%]
-[%#
-
-=head2 view_item
-
-This takes an object and and displays its properties in a table. 
-
-=cut
-
-#%]
-[% MACRO view_item(item) BLOCK; %]
-    [% SET string = classmetadata.stringifycolumn %]
-    <div id="title"> [% item.$string %]</div>
-    [% INCLUDE navbar %]
-    <table class="view">
-        <tr>
-            <td class="field">[% classmetadata.colnames.$string %]</td>
-            <td>[% item.$string %]</td>
-        </tr>
-        [% FOR col = classmetadata.columns.list;
-            NEXT IF col == "id" OR col == string;
-            NEXT UNLESS item.$col;
-        %]
-[%# 
-
-=for doc
-
-It gets the displayable form of a column's name from the hash returned
-from the C<column_names> method:
-
-#%]
-            <tr>
-                <td class="field">[% classmetadata.colnames.$col; %]</td>
-                <td>
-                    [% IF col == "url" && item.url;  # Possibly too much magic.
-                        '<a href="'; item.url; '"> '; item.url; '</a>';
-                    ELSE;
-                        maybe_link_view(item.$col); 
-                    END; %]
-[%#
-
-This tests whether or not the returned value is an object, and if so,
-creates a link to a page viewing that object; if not, it just displays
-the text as normal. The object is linked using its stringified name;
-by default this calls the C<name> method, or returns the object's ID
-if there is no C<name> method or other stringification method defined.
-
-=cut
-
-#%] 
-                </td>
-            </tr>
-        [% END; %]
-    </table>
-[% END %]
diff --git a/templates/factory/maypole b/templates/factory/maypole
deleted file mode 100644 (file)
index 7ab2744..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<!-- boxes -->
-<div style='position:absolute;top:220px;left:130px;border-bottom-width:260px;border-right-width:370px;' class='deco1'>&nbsp;</div>
-<div style='position:absolute;top:260px;left:190px;border-bottom-width:170px;border-right-width:530px;' class='deco2'>&nbsp;</div>
-<div style='position:absolute;top:240px;left:220px;border-bottom-width:340px;border-right-width:440px;' class='deco4'>&nbsp;</div>
-<div style='position:absolute;top:160px;left:330px;border-bottom-width:160px;border-right-width:280px;' class='deco1'>&nbsp;</div>
-<div style='position:absolute;top:190px;left:290px;border-bottom-width:430px;border-right-width:130px;' class='deco2'>&nbsp;</div>
-<!-- end of boxes -->
diff --git a/templates/factory/maypole.css b/templates/factory/maypole.css
deleted file mode 100644 (file)
index 51d99a4..0000000
+++ /dev/null
@@ -1,376 +0,0 @@
-html {
-    padding-right: 0px;
-    padding-left: 0px; 
-    padding-bottom: 0px; 
-    margin: 0px; 
-    padding-top: 0px
-}
-body {
-    font-family: sans-serif;
-    padding-right: 0px; 
-    padding-left: 0px; 
-    padding-bottom: 0px;
-    margin: 0px; padding-top: 0px;
-    background-color: #fff;
-}
-#frontpage_list {
-    position: absolute;
-    z-index: 5;
-    padding: 0px 100px 0px 0px;
-    margin:0 0.5%;     
-    margin-bottom:1em; 
-    margin-top: 1em;
-    background-color: #fff;
-}
-
-#frontpage_list a:hover {
-    background-color: #d0d8e4;
-}
-
-#frontpage_list ul {
-    list-style-type: square;
-}
-
-.content {
-    padding: 12px;
-    margin-top: 1px;  
-    margin-bottom:0px;
-    margin-left: 15px; 
-    margin-right: 15px;
-    border-color: #000000;
-    border-top: 0px;
-    border-bottom: 0px;
-    border-left: 1px;
-    border-right: 1px;
-}
-
-A { 
-    text-decoration: none; 
-    color:#225 
-}
-A:hover { 
-    text-decoration: underline; 
-    color:#222 
-}
-
-#title {
-    z-index: 6;
-    width: 100%;
-    height: 18px;
-    margin-top: 10px;
-    font-size: 90%;
-    border-bottom: 1px solid #ddf;
-    text-align: left;
-}
-
-#subtitle {
-    postion: absolute;
-    z-index: 6;
-    padding: 10px;
-    margin-top: 2em;
-    height: 18px;
-    text-align: left;
-    background-color: #fff;
-}
-
-input[type=text] {
-    height: 16px;
-    width: 136px;
-    font-family: sans-serif;
-    font-size: 11px;
-    color: #2E415A;
-    padding: 0px;
-    margin-bottom: 5px;
-}
-
-input[type=submit] {
-    height: 18px;
-    width: 60px;
-    font-family: sans-serif;
-    font-size: 11px;
-    border: 1px outset;
-    background-color: #fff;
-    padding: 0px 0px 2px 0px;
-    margin-bottom: 5px;
-}
-
-input:hover[type=submit] {
-    color: #fff;
-    background-color: #7d95b5;
-}
-
-textarea {
-    width: 136px;
-    font-family: sans-serif;
-    font-size: 11px;
-    color: #2E415A;
-    padding: 0px;
-    margin-bottom: 5px;
-}
-
-select {
-    height: 16px;
-    width: 140px;
-    font-family: sans-serif;
-    font-size: 12px;
-    color: #202020;
-    padding: 0px;
-    margin-bottom: 5px;
-}
-
-.deco1 {
-    font-size: 0px;
-    z-index:1;
-    border:0px;
-    border-style:solid;
-    border-color:#4d6d99;
-    background-color:#4d6d99;
-}
-
-.deco2 {
-    z-index:2;
-    border:0px;
-    border-style:solid;
-    border-color:#627ea5;
-    background-color:#627ea5;
-}
-
-
-.deco3 {
-    z-index:3;
-    border:0px;
-    border-style:solid;
-    border-color:#7d95b5;
-    background-color:#7d95b5;
-}
-                   
-.deco4 {
-    z-index:4;
-    border:0px;
-    border-style:solid;
-    border-color:#d0d8e4;
-    background-color:#d0d8e4;
-}
-                   
-
-table { 
-    border: 0px solid; 
-    background-color: #ffffff;
-}
-
-#matrix { width: 100%; }
-
-#matrix th {
-    background-color: #b5cadc;
-    border: 1px solid #778;
-    font: bold 12px Verdana, sans-serif;
-}
-
-#matrix #actionth {
-    width: 1px; 
-    padding: 0em 1em 0em 1em;
-}
-
-#matrix tr.alternate { background-color:#e3eaf0; }
-#matrix tr:hover { background-color: #b5cadc; }
-#matrix td { font: 12px Verdana, sans-serif; }
-
-#navlist {
-    padding: 3px 0;
-    margin-left: 0;
-    margin-top:3em;
-    border-bottom: 1px solid #778;
-    font: bold 12px Verdana, sans-serif;
-}
-
-#navlist li {
-    list-style: none;
-    margin: 0;
-    display: inline;
-}
-
-#navlist li a {
-    padding: 3px 0.5em;
-    margin-left: 3px;
-    border: 1px solid #778;
-    border-bottom: none;
-    background: #b5cadc;
-    text-decoration: none;
-}
-
-#navlist li a:link { color: #448; }
-#navlist li a:visited { color: #667; }
-
-#navlist li a:hover {
-    color: #000;
-    background: #eef;
-    border-top: 4px solid #7d95b5;
-    border-color: #227;
-}
-
-#navlist #active a {
-    background: white;
-    border-bottom: 1px solid white;
-    border-top: 4px solid;
-}
-
-td { font: 12px Verdana, sans-serif; }
-
-
-fieldset {
-    margin-top: 1em;
-    padding: 1em;
-    background-color: #f3f6f8;
-    font:80%/1 sans-serif;
-    border:1px solid #ddd;
-}
-
-legend {
-    padding: 0.2em 0.5em;
-    background-color: #fff;
-    border:1px solid #aaa;
-    font-size:90%;
-    text-align:right;
-}
-
-label {
-    display:block;
-}
-
-label .field {
-    float:left;
-    width:25%;
-    margin-right:0.5em;
-    padding-top:0.2em;
-    text-align:right;
-    font-weight:bold;
-}
-
-#vlist {
-    padding: 0 1px 1px;
-    margin-left: 0;
-    font: bold 12px Verdana, sans-serif;
-    background: gray;
-    width: 13em;
-}
-
-#vlist li {
-    list-style: none;
-    margin: 0;
-    border-top: 1px solid gray;
-    text-align: left;
-}
-
-#vlist li a {
-    display: block;
-    padding: 0.25em 0.5em 0.25em 0.75em;
-    border-left: 1em solid #7d95b5;
-    background: #d0d8e4;
-    text-decoration: none;
-}
-
-#vlist li a:hover { 
-    border-color: #227;
-}
-
-.view .field {
-    background-color: #f3f6f8;
-    border-left: 1px solid #7695b5;
-    border-top: 1px solid #7695b5;
-    padding: 1px 10px 0px 2px;
-}
-
-#addnew {
-    width: 50%;
-    float: left;
-}
-
-#search {
-    width: 50%;
-    float:right;
-}
-
-.error { color: #d00; }
-
-.action {
-    border: 1px outset #7d95b5;
-    style:block;
-}
-
-.action:hover {
-    color: #fff;
-    text-decoration: none;
-    background-color: #7d95b5;
-}
-
-.actionform {
-    display: inline;
-}
-
-.actionbutton {
-    height: 16px;
-    width: 40px;
-    font-family: sans-serif;
-    font-size: 10px;
-    border: 1px outset;
-    background-color: #fff;
-    margin-bottom: 0px;
-}
-
-.actionbutton:hover {
-    color: #fff;
-    background-color: #7d95b5;
-}
-
-.actions {
-    white-space: nowrap;
-}
-
-.field {
-    display:inline;
-}
-
-#login { width: 400px; }
-
-#login input[type=text] { width: 150px; }
-#login input[type=password] { width: 150px; }
-
-.pager {
-    font: 11px Arial, Helvetica, sans-serif;
-    text-align: center;
-    border: solid 1px #e2e2e2;
-    border-left: 0;
-    border-right: 0;
-    padding-top: 10px;
-    padding-bottom: 10px;
-    margin: 0px;
-    background-color: #f3f6f8;
-}
-
-.pager a {
-    padding: 2px 6px;
-    border: solid 1px #ddd;
-    background: #fff;
-    text-decoration: none;
-}
-
-.pager a:visited {
-    padding: 2px 6px;
-    border: solid 1px #ddd;
-    background: #fff;
-    text-decoration: none;
-}
-
-.pager .current-page {
-    padding: 2px 6px;
-    font-weight: bold;
-    vertical-align: top;
-}
-
-.pager a:hover {
-    color: #fff;
-    background: #7d95b5;
-    border-color: #036;
-    text-decoration: none;
-}
-
diff --git a/templates/factory/navbar b/templates/factory/navbar
deleted file mode 100644 (file)
index 0c8b168..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-[%#
-
-=head1 navbar
-
-This is a navigation bar to go across the page. (Or down the side, or
-whatetver you want to do with it.) It displays all the tables which are
-accessible, with a link to the list page for each one.
-
-#%]
-[% PROCESS macros %]
-<div id="navcontainer">
-<ul id="navlist">
-[%
-    FOR table = config.display_tables;
-        '<li '; 'id="active"' IF table == classmetadata.table; '>';
-        # Hack
-        link(table, "list", "", table);
-        '</li>';
-    END;
-%]
-</ul>
-</div> 
diff --git a/templates/factory/pager b/templates/factory/pager
deleted file mode 100644 (file)
index 78c89fd..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-[%#
-
-=head1 pager
-
-This controls the pager display at the bottom (by default) of the list
-and search views. It expects a C<pager> template argument which responds
-to the L<Data::Page> interface.
-
-#%]
-[%
-IF pager AND pager.first_page != pager.last_page;
-%]
-<p class="pager">Pages: 
-[%
-    UNLESS pager_action;
-       SET pager_action = request.action;
-    END;
-   
-    SET begin_page = pager.current_page - 10;
-    IF begin_page < 1;
-        SET begin_page = pager.first_page;
-    END;
-    SET end_page = pager.current_page + 10;
-    IF pager.last_page < end_page;
-        SET end_page = pager.last_page;
-    END;
-     FOREACH num = [begin_page .. end_page];
-          IF num == pager.current_page;
-            "<span class='current-page'>"; num; "</span>";
-          ELSE;
-            SET label = num;
-            SET args = "?page=" _ num;
-           SET args = args _ "&order=" _ request.params.order
-             IF request.params.order;
-           SET args = args _ "&amp;o2=desc"
-             IF request.params.o2 == "desc";
-            FOR col = classmetadata.columns.list;
-              IF request.params.$col;
-                SET args = args _ "&" _ col _ "=" _ request.params.$col;
-                SET action = "search";
-              END;
-            END;
-            link(classmetadata.table, pager_action, args, label);
-          END;
-     END;
-%]
-</p>
-[% END %]
diff --git a/templates/factory/search_form b/templates/factory/search_form
deleted file mode 100644 (file)
index 1f07194..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<div id="search">
-<form method="get" action="[% base %]/[% classmetadata.moniker %]/search/">
-<fieldset>
-<legend>Search</legend>
-        [% FOR col = classmetadata.columns;
-            NEXT IF col == "id";
-         %]
-           <label>
-                <span class="field">[% classmetadata.colnames.$col; %]</span>
-                    [% SET element = classmetadata.cgi.$col;
-                    IF element.tag == "select";
-                        USE element_maker = Class("HTML::Element");
-                        SET element = element.unshift_content(
-                            element_maker.new("option", value," "));
-                    END;
-                   element.as_XML; %]
-                  </label>
-        [% END; %]
-    <input type="submit" name="search" value="search"/>
-    </fieldset>
-</form>
-</div>
diff --git a/templates/factory/title b/templates/factory/title
deleted file mode 100644 (file)
index 401f0a3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-    <a href="[% base %]/frontpage">[% config.application_name %]</a>
diff --git a/templates/factory/view b/templates/factory/view
deleted file mode 100644 (file)
index 328678c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-[%#
-
-=for doc
-
-The C<view> template takes some objects (usually just one) from
-C<objects> and displays the object's properties in a table. 
-
-=cut
-
-#%]
-[% PROCESS macros %]
-[% INCLUDE header %]
-[% FOR item = objects %]
-[% view_item(item); %]
-[%#
-
-=for doc
-
-The C<view> template also displays a list of other objects related to the first
-one via C<has_many> style relationships; this is done by calling the
-C<related_accessors> method - see L<Model/related_accessors> - to return
-a list of has-many accessors. Next it calls each of those accessors, and
-displays the results in a table.
-
-#%]
-    <br /><a href="[%base%]/[%item.table%]/list">Back to listing</a>
-[% view_related(item); %]
-    
-[%
-    button(item, "edit");
-    button(item, "delete");
-%]
-[% END; %]
-[% INCLUDE footer %]