commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9228 - in trunk/gnue-samples/two-tier: forms schema


From: johannes
Subject: [gnue] r9228 - in trunk/gnue-samples/two-tier: forms schema
Date: Mon, 8 Jan 2007 08:58:47 -0600 (CST)

Author: johannes
Date: 2007-01-08 08:58:46 -0600 (Mon, 08 Jan 2007)
New Revision: 9228

Modified:
   trunk/gnue-samples/two-tier/forms/countries.gfd
   trunk/gnue-samples/two-tier/forms/customers.gfd
   trunk/gnue-samples/two-tier/forms/invoices.gfd
   trunk/gnue-samples/two-tier/forms/items.gfd
   trunk/gnue-samples/two-tier/schema/country.gsd
   trunk/gnue-samples/two-tier/schema/customer.gsd
   trunk/gnue-samples/two-tier/schema/invoice.gsd
   trunk/gnue-samples/two-tier/schema/invoice_item.gsd
   trunk/gnue-samples/two-tier/schema/item.gsd
Log:
Added some comments


Modified: trunk/gnue-samples/two-tier/forms/countries.gfd
===================================================================
--- trunk/gnue-samples/two-tier/forms/countries.gfd     2007-01-08 13:52:43 UTC 
(rev 9227)
+++ trunk/gnue-samples/two-tier/forms/countries.gfd     2007-01-08 14:58:46 UTC 
(rev 9228)
@@ -1,5 +1,28 @@
 <?xml version="1.0" encoding="utf-8"?>
 
+<!--
+  GNU Enterprise Sample Application - Countries
+ 
+  Copyright 2001-2007 Free Software Foundation
+ 
+  This file is part of GNU Enterprise
+ 
+  GNU Enterprise is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation; either
+  version 2, or (at your option) any later version.
+ 
+  GNU Enterprise is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied
+  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE. See the GNU General Public License for more details.
+ 
+  You should have received a copy of the GNU General Public
+  License along with program; see the file COPYING. If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place
+  - Suite 330, Boston, MA 02111-1307, USA.
+-->
+
 <form title="Countries">
   <options>
     <author>GNU Enterprise Team</author>
@@ -9,6 +32,10 @@
     </description>
   </options>
 
+  <!-- ==================================================================== -->
+  <!-- Datasources                                                          -->
+  <!-- ==================================================================== -->
+
   <datasource name="dts_country" connection="sample" table="country"
     prequery="Y">
     <sortorder>
@@ -16,6 +43,10 @@
     </sortorder>
   </datasource>
 
+  <!-- ==================================================================== -->
+  <!-- Logic                                                                -->
+  <!-- ==================================================================== -->
+
   <logic>
     <block name="blk_country" datasource="dts_country">
       <field name="code" field="code" datatype="text" maxLength="2" />
@@ -23,6 +54,10 @@
     </block>
   </logic>
 
+  <!-- ==================================================================== -->
+  <!-- Layout                                                               -->
+  <!-- ==================================================================== -->
+
   <layout>
     <page name="Countries" caption="Countries">
       <vbox name="box" block="blk_country">

Modified: trunk/gnue-samples/two-tier/forms/customers.gfd
===================================================================
--- trunk/gnue-samples/two-tier/forms/customers.gfd     2007-01-08 13:52:43 UTC 
(rev 9227)
+++ trunk/gnue-samples/two-tier/forms/customers.gfd     2007-01-08 14:58:46 UTC 
(rev 9228)
@@ -1,4 +1,26 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  GNU Enterprise Sample Application - Customers
+ 
+  Copyright 2001-2007 Free Software Foundation
+ 
+  This file is part of GNU Enterprise
+ 
+  GNU Enterprise is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation; either
+  version 2, or (at your option) any later version.
+ 
+  GNU Enterprise is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied
+  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE. See the GNU General Public License for more details.
+ 
+  You should have received a copy of the GNU General Public
+  License along with program; see the file COPYING. If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place
+  - Suite 330, Boston, MA 02111-1307, USA.
+  -->
 
 <form title="Customers">
   <options>
@@ -7,6 +29,10 @@
     <description>Our customers.</description>
   </options>
 
+  <!-- ==================================================================== -->
+  <!-- Datasources                                                          -->
+  <!-- ==================================================================== -->
+
   <datasource name="dts_customer" connection="sample" table="customer" >
     <sortorder>
       <sortfield name="name" descending="False" ignorecase="True" />
@@ -14,6 +40,8 @@
     </sortorder>
   </datasource>
 
+  <!-- #################################################################### -->
+
   <datasource name="dts_billing" connection="sample" table="customer"
     prequery="Y">
     <sortorder>
@@ -22,6 +50,8 @@
     </sortorder>
   </datasource>
 
+  <!-- #################################################################### -->
+
   <datasource name="dts_country" connection="sample" table="country"
     prequery="Y">
     <sortorder>
@@ -29,6 +59,10 @@
     </sortorder>
   </datasource>
 
+  <!-- ==================================================================== -->
+  <!-- Logic                                                                -->
+  <!-- ==================================================================== -->
+
   <logic>
     <block name="blk_customer" datasource="dts_customer">
       <field name="code" field="code" datatype="text" maxLength="16"
@@ -48,14 +82,22 @@
       <field name="inactive" field="inactive" datatype="boolean" />
       <field name="last_invoice" field="last_invoice" datatype="date" />
 
+      <!-- 
+        The ON-NEWRECORD trigger is fired whenever a new record is created.
+        So this is a good place to set default values.
+        -->
       <trigger type="ON-NEWRECORD">
         import datetime
-        blk_customer.created = datetime.datetime.today()
+        blk_customer.created.value = datetime.datetime.today()
       </trigger>
 
     </block>
   </logic>
 
+  <!-- ==================================================================== -->
+  <!-- Layout                                                               -->
+  <!-- ==================================================================== -->
+
   <layout xmlns:s="GNUe:Layout:Sizer">
     <page name="pg_customer" caption="Customer">
       <vbox name="box" block="blk_customer">

Modified: trunk/gnue-samples/two-tier/forms/invoices.gfd
===================================================================
--- trunk/gnue-samples/two-tier/forms/invoices.gfd      2007-01-08 13:52:43 UTC 
(rev 9227)
+++ trunk/gnue-samples/two-tier/forms/invoices.gfd      2007-01-08 14:58:46 UTC 
(rev 9228)
@@ -1,4 +1,26 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  GNU Enterprise Sample Application - Invoices
+ 
+  Copyright 2001-2007 Free Software Foundation
+ 
+  This file is part of GNU Enterprise
+ 
+  GNU Enterprise is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation; either
+  version 2, or (at your option) any later version.
+ 
+  GNU Enterprise is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied
+  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE. See the GNU General Public License for more details.
+ 
+  You should have received a copy of the GNU General Public
+  License along with program; see the file COPYING. If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place
+  - Suite 330, Boston, MA 02111-1307, USA.
+  -->
 
 <form title="Invoices">
   <options>
@@ -7,6 +29,10 @@
     <description>Invoices.</description>
   </options>
 
+  <!-- ==================================================================== -->
+  <!-- Datasources                                                          -->
+  <!-- ==================================================================== -->
+
   <datasource name="dts_customer" connection="sample" table="customer"
     prequery="Y">
     <sortorder>
@@ -15,21 +41,31 @@
     </sortorder>
   </datasource>
 
+  <!-- #################################################################### -->
+
   <datasource name="dts_item" connection="sample" table="item" prequery="Y">
     <sortorder>
       <sortfield name="sku" descending="False" ignorecase="True" />
     </sortorder>
   </datasource>
 
+  <!-- #################################################################### -->
+
   <datasource name="dts_invoice" connection="sample" table="invoice" >
     <sortorder>
       <sortfield name="date" descending="True" />
     </sortorder>
   </datasource>
 
+  <!-- #################################################################### -->
+
   <datasource name="dts_invoice_item" connection="sample" table="invoice_item"
     master="dts_invoice" masterlink="id" detaillink="invoice" />
 
+  <!-- ==================================================================== -->
+  <!-- Logic                                                                -->
+  <!-- ==================================================================== -->
+
   <logic>
     <block name="blk_invoice" datasource="dts_invoice">
       <field name="id" field="id" datatype="number" length="8" scale="0"/>
@@ -40,6 +76,11 @@
 
       <field name="tax_rate" field="tax_rate" datatype="number" length="9"
         scale="4">
+
+        <!--
+          After changing the tax rate, make sure to recalculate all the total
+          values 
+          -->
         <trigger type="POST-CHANGE">
           activateTrigger('calculate_total')
         </trigger>
@@ -55,18 +96,30 @@
       <field name="customer" field="customer" fk_key="id" fk_description="name"
         fk_source="dts_customer" />
 
+      <!-- 
+        The ON-NEWRECORD trigger is fired whenever a new record is created.
+        This is a good place to set the default values.
+        -->
       <trigger type="ON-NEWRECORD">
         import datetime
         today = datetime.datetime.today()
 
-        blk_invoice.created = today
-        blk_invoice.date = today.date()
+        blk_invoice.created.value = today
+        blk_invoice.date.value = today.date()
       </trigger>
 
+      <!--
+        Before the block get's commited to the backend we recalculate all the
+        total values.
+        -->
       <trigger type="PRE-COMMIT">
         activateTrigger('calculate_total')
       </trigger>
 
+      <!--
+        This is a named trigger which calculates all total values of an
+        invoice.  It will be called from several places.
+        -->
       <trigger type="NAMED" name="calculate_total">
         # First get the sub-total
         subtotal = 0
@@ -80,9 +133,10 @@
         blk_invoice.tax_total = tax_total
         blk_invoice.grand_total = subtotal + tax_total
       </trigger>
-
     </block>
 
+    <!-- ################################################################## -->
+
     <block name="blk_invoice_item" datasource="dts_invoice_item">
       <field name="sku" field="sku" fk_source="dts_item" fk_key="id"
         fk_description="sku" />
@@ -92,10 +146,19 @@
         fk_description="price" />
 
       <field name="quantity" field="quantity" datatype="number" length="6">
+        <!--
+          Before the focus moves out of the quantity field, we have to ensure
+          it has a valid value.  If not, an exception will be raised.
+          -->
         <trigger type="PRE-FOCUSOUT">
           if not blk_invoice_item.quantity.value:
               abort('Please enter a valid quantity')
         </trigger>
+
+        <!--
+          After changing the quantity we have to recalculate the total values
+          of the invoice.  Note: POST-CHANGE is executed *before* PRE-FOCUSOUT.
+          -->
         <trigger type="POST-CHANGE">
           activateTrigger('calculate_total')
         </trigger>
@@ -103,18 +166,31 @@
 
       <field name="price" field="unit_price" datatype="number" length="9"
         scale="2" >
+        <!--
+          When the focus arrives in the price field and it is empty, the
+          default price of the item will be used.
+          -->
         <trigger type="PRE-FOCUSIN">
           if not blk_invoice_item.price.value:
-              blk_invoice_item.price = blk_invoice_item.default_price.value
+              blk_invoice_item.price.value = \
+                  blk_invoice_item.default_price.value
         </trigger>
+
+        <!--
+          After changing the price of an invoice item we have to recalculate
+          the totals of the invoice.
+          -->
         <trigger type="POST-CHANGE">
           activateTrigger('calculate_total')
         </trigger>
       </field>
     </block>
-
   </logic>
 
+  <!-- ==================================================================== -->
+  <!-- Layout                                                               -->
+  <!-- ==================================================================== -->
+
   <layout xmlns:s="GNUe:Layout:Sizer">
     <page name="pg_invoice" caption="Invoice">
       <vbox name="box" block="blk_invoice">
@@ -139,9 +215,7 @@
             </gridline>
           </grid>
         </vbox>
-
       </vbox>
-
     </page>
   </layout>
 

Modified: trunk/gnue-samples/two-tier/forms/items.gfd
===================================================================
--- trunk/gnue-samples/two-tier/forms/items.gfd 2007-01-08 13:52:43 UTC (rev 
9227)
+++ trunk/gnue-samples/two-tier/forms/items.gfd 2007-01-08 14:58:46 UTC (rev 
9228)
@@ -1,4 +1,26 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  GNU Enterprise Sample Application - Items
+ 
+  Copyright 2001-2007 Free Software Foundation
+ 
+  This file is part of GNU Enterprise
+ 
+  GNU Enterprise is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation; either
+  version 2, or (at your option) any later version.
+ 
+  GNU Enterprise is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied
+  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE. See the GNU General Public License for more details.
+ 
+  You should have received a copy of the GNU General Public
+  License along with program; see the file COPYING. If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place
+  - Suite 330, Boston, MA 02111-1307, USA.
+  -->
 
 <form title="Items">
   <options>
@@ -7,12 +29,20 @@
     <description>Our goods.</description>
   </options>
 
+  <!-- ==================================================================== -->
+  <!-- Datasources                                                          -->
+  <!-- ==================================================================== -->
+
   <datasource name="dts_item" connection="sample" table="item" >
     <sortorder>
       <sortfield name="sku" descending="False" ignorecase="True" />
     </sortorder>
   </datasource>
 
+  <!-- ==================================================================== -->
+  <!-- Logic                                                                -->
+  <!-- ==================================================================== -->
+
   <logic>
     <block name="blk_item" datasource="dts_item">
       <field name="sku" field="sku" datatype="text" maxLength="16"
@@ -25,13 +55,22 @@
       <field name="prep" field="prep_time" datatype="time" />
       <field name="picture" />
 
+      <!--
+        Whenever a record is loaded from the backend, we generate an apropriate
+        URL for it's picture.  This URL will be stored in the unbound field
+        'picture'.
+        -->
       <trigger type="ON-RECORDLOADED">
         url = "./images/%s.jpg" % blk_item.sku.get()
-        blk_item.picture = url
+        blk_item.picture.value = url
       </trigger>
     </block>
   </logic>
 
+  <!-- ==================================================================== -->
+  <!-- Layout                                                               -->
+  <!-- ==================================================================== -->
+
   <layout xmlns:s="GNUe:Layout:Sizer">
     <page name="pg_item" caption="Items">
       <vbox name="box" block="blk_item">

Modified: trunk/gnue-samples/two-tier/schema/country.gsd
===================================================================
--- trunk/gnue-samples/two-tier/schema/country.gsd      2007-01-08 13:52:43 UTC 
(rev 9227)
+++ trunk/gnue-samples/two-tier/schema/country.gsd      2007-01-08 14:58:46 UTC 
(rev 9228)
@@ -1,6 +1,31 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  GNU Enterprise Sample Application - Database Schema - Country 
+ 
+  Copyright 2001-2007 Free Software Foundation
+ 
+  This file is part of GNU Enterprise
+ 
+  GNU Enterprise is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation; either
+  version 2, or (at your option) any later version.
+ 
+  GNU Enterprise is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied
+  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE. See the GNU General Public License for more details.
+ 
+  You should have received a copy of the GNU General Public
+  License along with program; see the file COPYING. If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place
+  - Suite 330, Boston, MA 02111-1307, USA.
+  -->
 
 <schema>
+  <!-- ==================================================================== -->
+  <!-- Definition                                                           -->
+  <!-- ==================================================================== -->
 
   <tables>
     <table name="country">
@@ -19,6 +44,10 @@
     </table>
   </tables>
 
+  <!-- ==================================================================== -->
+  <!-- Data                                                                 -->
+  <!-- ==================================================================== -->
+
   <data>
     <tabledata name="iso_3166_country" tablename="country">
       <rows>

Modified: trunk/gnue-samples/two-tier/schema/customer.gsd
===================================================================
--- trunk/gnue-samples/two-tier/schema/customer.gsd     2007-01-08 13:52:43 UTC 
(rev 9227)
+++ trunk/gnue-samples/two-tier/schema/customer.gsd     2007-01-08 14:58:46 UTC 
(rev 9228)
@@ -1,6 +1,31 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  GNU Enterprise Sample Application - Database Schema - Customer
+ 
+  Copyright 2001-2007 Free Software Foundation
+ 
+  This file is part of GNU Enterprise
+ 
+  GNU Enterprise is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation; either
+  version 2, or (at your option) any later version.
+ 
+  GNU Enterprise is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied
+  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE. See the GNU General Public License for more details.
+ 
+  You should have received a copy of the GNU General Public
+  License along with program; see the file COPYING. If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place
+  - Suite 330, Boston, MA 02111-1307, USA.
+  -->
 
 <schema>
+  <!-- ==================================================================== -->
+  <!-- Definition                                                           -->
+  <!-- ==================================================================== -->
 
   <tables>
     <table name="customer">
@@ -37,6 +62,10 @@
     </table>
   </tables>
 
+  <!-- ==================================================================== -->
+  <!-- Data                                                                 -->
+  <!-- ==================================================================== -->
+
   <data>
     <tabledata name="customers" tablename="customer">
       <rows>

Modified: trunk/gnue-samples/two-tier/schema/invoice.gsd
===================================================================
--- trunk/gnue-samples/two-tier/schema/invoice.gsd      2007-01-08 13:52:43 UTC 
(rev 9227)
+++ trunk/gnue-samples/two-tier/schema/invoice.gsd      2007-01-08 14:58:46 UTC 
(rev 9228)
@@ -1,54 +1,85 @@
-<?xml version="1.0" encoding="utf-8"?>
-<schema>
-  <tables>
-    <table name="invoice">
-      <fields>
-        <field name="id" type="number" length="8" nullable="N"
-          defaultwith="serial"/>
-
-        <field name="customer" type="number" length="8" nullable="N" />
-        <field name="date" type="date" nullable="N" />
-        <field name="delivery" type="datetime" />
-        <field name="created" type="datetime" nullable="N" />
-
-        <field name="tax_rate" type="number" length="9" precision="4"
-          nullable="N"/>
-        <field name="subtotal" type="number" length="9" precision="2"
-          nullable="N"/>
-        <field name="tax_total" type="number" length="9" precision="2"
-          nullable="N"/>
-        <field name="grand_total" type="number" length="9" precision="2"
-          nullable="N"/>
-      </fields>
-      
-      <primarykey name="pk_invoice">
-        <pkfield name="id"/>
-      </primarykey>
-      
-      <constraints>
-        <foreignkey name="fk_invoice_customer" references="customer">
-          <fkfield name="customer" references="customer" />
-        </foreignkey>
-      </constraints>
-    </table>
-  </tables>
-
-  <data>
-    <tabledata name="invoice_data" tablename="invoice">
-      <rows>
-        <row>
-          <value field="id">1</value>
-          <value field="customer">1</value>
-          <value field="date">2007-01-31</value>
-          <value field="delivery">2007-01-15 13:30:00</value>
-          <value field="created">2006-12-30 14:21:03</value>
-          <value field="subtotal">100017</value>
-          <value field="tax_total">1001.7</value>
-          <value field="tax_rate">10</value>
-          <value field="grand_total">11018.7</value>
-        </row>
-      </rows>
-    </tabledata>
-  </data>
-
-</schema>
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  GNU Enterprise Sample Application - Database Schema - Invoice
+ 
+  Copyright 2001-2007 Free Software Foundation
+ 
+  This file is part of GNU Enterprise
+ 
+  GNU Enterprise is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation; either
+  version 2, or (at your option) any later version.
+ 
+  GNU Enterprise is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied
+  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE. See the GNU General Public License for more details.
+ 
+  You should have received a copy of the GNU General Public
+  License along with program; see the file COPYING. If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place
+  - Suite 330, Boston, MA 02111-1307, USA.
+  -->
+
+<schema>
+  <!-- ==================================================================== -->
+  <!-- Definition                                                           -->
+  <!-- ==================================================================== -->
+
+  <tables>
+    <table name="invoice">
+      <fields>
+        <field name="id" type="number" length="8" nullable="N"
+          defaultwith="serial"/>
+
+        <field name="customer" type="number" length="8" nullable="N" />
+        <field name="date" type="date" nullable="N" />
+        <field name="delivery" type="datetime" />
+        <field name="created" type="datetime" nullable="N" />
+
+        <field name="tax_rate" type="number" length="9" precision="4"
+          nullable="N"/>
+        <field name="subtotal" type="number" length="9" precision="2"
+          nullable="N"/>
+        <field name="tax_total" type="number" length="9" precision="2"
+          nullable="N"/>
+        <field name="grand_total" type="number" length="9" precision="2"
+          nullable="N"/>
+      </fields>
+      
+      <primarykey name="pk_invoice">
+        <pkfield name="id"/>
+      </primarykey>
+      
+      <constraints>
+        <foreignkey name="fk_invoice_customer" references="customer">
+          <fkfield name="customer" references="customer" />
+        </foreignkey>
+      </constraints>
+    </table>
+  </tables>
+
+  <!-- ==================================================================== -->
+  <!-- Data                                                                 -->
+  <!-- ==================================================================== -->
+
+  <data>
+    <tabledata name="invoice_data" tablename="invoice">
+      <rows>
+        <row>
+          <value field="id">1</value>
+          <value field="customer">1</value>
+          <value field="date">2007-01-31</value>
+          <value field="delivery">2007-01-15 13:30:00</value>
+          <value field="created">2006-12-30 14:21:03</value>
+          <value field="subtotal">100017</value>
+          <value field="tax_total">1001.7</value>
+          <value field="tax_rate">10</value>
+          <value field="grand_total">11018.7</value>
+        </row>
+      </rows>
+    </tabledata>
+  </data>
+
+</schema>

Modified: trunk/gnue-samples/two-tier/schema/invoice_item.gsd
===================================================================
--- trunk/gnue-samples/two-tier/schema/invoice_item.gsd 2007-01-08 13:52:43 UTC 
(rev 9227)
+++ trunk/gnue-samples/two-tier/schema/invoice_item.gsd 2007-01-08 14:58:46 UTC 
(rev 9228)
@@ -1,54 +1,85 @@
-<?xml version="1.0" encoding="utf-8"?>
-<schema>
-  <tables>
-    <table name="invoice_item">
-      <fields>
-        <field name="id" type="number" length="8" nullable="N"
-          defaultwith="serial"/>
-
-        <field name="invoice" type="number" length="8" nullable="N"/>
-        <field name="sku" type="number" length="8" nullable="N"/>
-        <field name="quantity" type="number" length="6" nullable="N"/>
-        <field name="unit_price" type="number" length="9" precision="2"
-          nullable="N"/>
-      </fields>
-      
-      <primarykey name="pk_invoice_item">
-        <pkfield name="id"/>
-      </primarykey>
-      
-      <constraints>
-        <foreignkey name="fk_invoice_item_sku"  references="items">
-          <fkfield name="sku" references="id"/>
-        </foreignkey>
-
-        <foreignkey name="fk_invoice_item_invoice" references="invoice">
-          <fkfield name="invoice" references="id" />
-        </foreignkey>
-      </constraints>
-
-    </table>
-  </tables>
-  
-  <data>
-    <tabledata name="invoice_item_data" tablename="invoice_item">
-      <rows>
-        <row>
-          <value field="id">0</value>
-          <value field="invoice">1</value>
-          <value field="sku">1</value>
-          <value field="quantity">1</value>
-          <value field="unit_price">17.50</value>
-        </row>
-        <row>
-          <value field="id">1</value>
-          <value field="invoice">1</value>
-          <value field="sku">0</value>
-          <value field="quantity">5</value>
-          <value field="unit_price">1999.90</value>
-        </row>
-      </rows>
-    </tabledata>
-  </data>
-
-</schema>
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  GNU Enterprise Sample Application - Database Schema - Invoice item
+ 
+  Copyright 2001-2007 Free Software Foundation
+ 
+  This file is part of GNU Enterprise
+ 
+  GNU Enterprise is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation; either
+  version 2, or (at your option) any later version.
+ 
+  GNU Enterprise is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied
+  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE. See the GNU General Public License for more details.
+ 
+  You should have received a copy of the GNU General Public
+  License along with program; see the file COPYING. If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place
+  - Suite 330, Boston, MA 02111-1307, USA.
+  -->
+
+<schema>
+  <!-- ==================================================================== -->
+  <!-- Definition                                                           -->
+  <!-- ==================================================================== -->
+
+  <tables>
+    <table name="invoice_item">
+      <fields>
+        <field name="id" type="number" length="8" nullable="N"
+          defaultwith="serial"/>
+
+        <field name="invoice" type="number" length="8" nullable="N"/>
+        <field name="sku" type="number" length="8" nullable="N"/>
+        <field name="quantity" type="number" length="6" nullable="N"/>
+        <field name="unit_price" type="number" length="9" precision="2"
+          nullable="N"/>
+      </fields>
+      
+      <primarykey name="pk_invoice_item">
+        <pkfield name="id"/>
+      </primarykey>
+      
+      <constraints>
+        <foreignkey name="fk_invoice_item_sku"  references="items">
+          <fkfield name="sku" references="id"/>
+        </foreignkey>
+
+        <foreignkey name="fk_invoice_item_invoice" references="invoice">
+          <fkfield name="invoice" references="id" />
+        </foreignkey>
+      </constraints>
+
+    </table>
+  </tables>
+  
+  <!-- ==================================================================== -->
+  <!-- Data                                                                 -->
+  <!-- ==================================================================== -->
+
+  <data>
+    <tabledata name="invoice_item_data" tablename="invoice_item">
+      <rows>
+        <row>
+          <value field="id">0</value>
+          <value field="invoice">1</value>
+          <value field="sku">1</value>
+          <value field="quantity">1</value>
+          <value field="unit_price">17.50</value>
+        </row>
+        <row>
+          <value field="id">1</value>
+          <value field="invoice">1</value>
+          <value field="sku">0</value>
+          <value field="quantity">5</value>
+          <value field="unit_price">1999.90</value>
+        </row>
+      </rows>
+    </tabledata>
+  </data>
+
+</schema>

Modified: trunk/gnue-samples/two-tier/schema/item.gsd
===================================================================
--- trunk/gnue-samples/two-tier/schema/item.gsd 2007-01-08 13:52:43 UTC (rev 
9227)
+++ trunk/gnue-samples/two-tier/schema/item.gsd 2007-01-08 14:58:46 UTC (rev 
9228)
@@ -1,53 +1,84 @@
-<?xml version="1.0" encoding="utf-8"?>
-<schema>
-  <tables>
-    <table name="item">
-      <fields>
-        <field name="id" type="number" length="8" nullable="N"
-          defaultwith="serial"/>
-
-        <field name="sku" type="string" length="16" nullable="N" />
-        <field name="description" type="string" length="50" />
-        <field name="price" type="number" length="9" precision="2" />
-        <field name="text" type="string" length="1000" />
-        <field name="prep_time" type="time" />
-      </fields>
-      
-      <primarykey name="pk_item">
-        <pkfield name="id"/>
-      </primarykey>
-      
-      <indexes>
-        <index name="unique_sku" unique="True">
-          <indexfield name="sku"/>
-        </index>
-      </indexes>
-
-      <constraints/>
-    </table>
-  </tables>
-  
-  <data>
-    <tabledata name="items" tablename="item">
-      <rows>
-        <row>
-          <value field="id">0</value>
-          <value field="sku">MAC-G5</value>
-          <value field="description">iMac G5 2GHZ</value>
-          <value field="price">2125.00</value>
-          <value field="text">Fine computer having lots of RAM and a very big 
hard disk drive</value>
-          <value field="prep_time">00:30:00</value>
-        </row>
-        <row>
-          <value field="id">1</value>
-          <value field="sku">LHARDY</value>
-          <value field="description">Thumb on fire! 100 x 60 cm</value>
-          <value field="price">17.50</value>
-          <value field="text">Picture of Stan Laurel and Oliver Hardy</value>
-          <value field="prep_time">01:15:00</value>
-        </row>
-      </rows>
-    </tabledata>
-  </data>
-
-</schema>
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  GNU Enterprise Sample Application - Database Schema - Item
+ 
+  Copyright 2001-2007 Free Software Foundation
+ 
+  This file is part of GNU Enterprise
+ 
+  GNU Enterprise is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation; either
+  version 2, or (at your option) any later version.
+ 
+  GNU Enterprise is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied
+  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE. See the GNU General Public License for more details.
+ 
+  You should have received a copy of the GNU General Public
+  License along with program; see the file COPYING. If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place
+  - Suite 330, Boston, MA 02111-1307, USA.
+  -->
+
+<schema>
+  <!-- ==================================================================== -->
+  <!-- Definition                                                           -->
+  <!-- ==================================================================== -->
+
+  <tables>
+    <table name="item">
+      <fields>
+        <field name="id" type="number" length="8" nullable="N"
+          defaultwith="serial"/>
+
+        <field name="sku" type="string" length="16" nullable="N" />
+        <field name="description" type="string" length="50" />
+        <field name="price" type="number" length="9" precision="2" />
+        <field name="text" type="string" length="1000" />
+        <field name="prep_time" type="time" />
+      </fields>
+      
+      <primarykey name="pk_item">
+        <pkfield name="id"/>
+      </primarykey>
+      
+      <indexes>
+        <index name="unique_sku" unique="True">
+          <indexfield name="sku"/>
+        </index>
+      </indexes>
+
+      <constraints/>
+    </table>
+  </tables>
+  
+  <!-- ==================================================================== -->
+  <!-- Data                                                                 -->
+  <!-- ==================================================================== -->
+
+  <data>
+    <tabledata name="items" tablename="item">
+      <rows>
+        <row>
+          <value field="id">0</value>
+          <value field="sku">MAC-G5</value>
+          <value field="description">iMac G5 2GHZ</value>
+          <value field="price">2125.00</value>
+          <value field="text">Fine computer having lots of RAM and a very big 
hard disk drive</value>
+          <value field="prep_time">00:30:00</value>
+        </row>
+        <row>
+          <value field="id">1</value>
+          <value field="sku">LHARDY</value>
+          <value field="description">Thumb on fire! 100 x 60 cm</value>
+          <value field="price">17.50</value>
+          <value field="text">Picture of Stan Laurel and Oliver Hardy</value>
+          <value field="prep_time">01:15:00</value>
+        </row>
+      </rows>
+    </tabledata>
+  </data>
+
+</schema>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]