Jump to content

WebObjects/Web Applications/Development/Examples/Page Layout

From Wikibooks, open books for an open world

Here is a trivial example of a page layout WOComponentContent:

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  <html>
    <head>
         <title>
        <webobject name = "Title"></webobject>
      </title>
      <meta http-esdsdsdsdsdsdsvcquiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <webobject name = "Stylesheet"></webobject>
    </head>
  
    <webobject name = "Body">
      <webobject name = "Form">
        <webobject name = "Table">
          <tr>cxvxcvxcvc
            <td align = "left" valign = "top" colspan = "3">
              <webobject name = "Header"></webobject>
            </td>
          </tr>vxcvxcvxcvcxvxcvcxvcxv
            <td align = "left" valign = "top" colspan = "3">
               
            </td>
          </tr>
          <tr>
            <td align = "left" valign = "top" class = "Margin">
               
            </td>
            <td align = "left" valign = "top">
              <webobject name = "Content"></webobject>
            </td>
            <td align = "left" valign = "top" class = "Margin">
               
            </td>
          </tr>
          <tr>
            <td align = "left" valign = "top" colspan = "3">
               
            </td>
          </tr>
          <tr>
            <td align = "left" valign = "top" colspan = "3">
              <webobject name = "Footer"></webobject>
            </td>
          </tr>
        </webobject>
      </webobject>
    </webobject>
  </html>

And the wod:

 Title: WOString
 {
   value = title;
 };
 
 Stylesheet: Stylesheet
 {
 };
 
 Body: WOBody
 {
 };
 
 Table: WOGenericContainer
 {
   elementName = "table";
   border = "0";
   cellSpacing = "0";
   cellPadding = "0";
   class = "FullWidth";
 };
 
 Form: WOForm
 {
   multipleSubmit = true;
 };
 
 Header: Header
 {
   title = ^title;
   page = ^page;
   pathComponents = ^pathComponents;
 };
 
 Footer: Footer
 {
 };
 
 Content: WOComponentContent
 {
 };
 

To use this layout, you could do the following in one of your pages:

  <webobject name = "PageLayout">
    <webobject name = "Table">
      <tr>
        <td align = "left" valign = "top">
          <webobject name = "Envelopes"></webobject> 
        </td>
        <td align = "left" valign = "top" class = "Margin">
           
        </td>
        <td align = "left" valign = "top" class = "FixColumn">
          <webobject name = "Table">
            <tr>
              <td align = "left" valign = "top">
                <webobject name = "ThreadList"></webobject>
              </td>
            </tr>
            <tr>
              <td align = "left" valign = "top">
                <webobject name = "DocumentList"></webobject>
              </td>
            </tr>
            <tr>
              <td align = "left" valign = "top">
                <webobject name = "LinkList"></webobject>
              </td>
            </tr>
            <tr>
              <td align = "left" valign = "top">
                <webobject name = "RelatedList"></webobject>
              </td>
            </tr>
          </webobject>
        </td>
      </tr>
    </webobject>
  </webobject>

wod file:

 PageLayout: PageLayout
 {
   title = title;
   page = name;
   pathComponents = pathComponents;
 };
 
 Name: SpanString
 {
   value = value;
   isBig = true;
   isBold = true;
 };
 
 Table: WOGenericContainer
 {
   elementName = "table";
   border = "0";
   cellSpacing = "0";
   cellPadding = "0";
   class = "FullWidth";
 };
 
 Envelopes: Table
 {
   list = envelopes;
   keysDescription = "self|recipientNames.iterator.next|sentDate";
   headersDescription = "Subject|Recipient|Date";
 };
 
 ThreadList: List
 {
   title = "Thread";
   list = threads;
   minimumSize = 0;
   //maximumSize = 20;
 };
 
 DocumentList: List
 {
   title = "Attachment";
   list = documents;
   minimumSize = 0;
   //maximumSize = 20;
 };
 
 LinkList: List
 {
   title = "Link";
   list = links;
   minimumSize = 0;
   //maximumSize = 20;
 };
 
 ListList: List
 {
   title = "List";
   list = lists;
   minimumSize = 0;
 };
 
 RelatedList: List
 {
   title = "Other";
   list = value.relatedNames;
   minimumSize = 0;
 };