commit-gnue
[Top][All Lists]
Advanced

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

r150 - in gnue-pim: . forms schema


From: kilo
Subject: r150 - in gnue-pim: . forms schema
Date: Thu, 2 Dec 2004 07:55:02 -0600 (CST)

Author: kilo
Date: 2004-12-02 07:55:01 -0600 (Thu, 02 Dec 2004)
New Revision: 150

Modified:
   gnue-pim/NEWS
   gnue-pim/forms/SelectAddr.gfd
   gnue-pim/forms/pim.gfd
   gnue-pim/schema/pim.gcd
Log:
GNUe PIM.
Big hackery:
Simplified naming in forms.
Close button on forms to help cleanup.
Removing leftover things.

Modified: gnue-pim/NEWS
===================================================================
--- gnue-pim/NEWS       2004-12-01 15:14:08 UTC (rev 149)
+++ gnue-pim/NEWS       2004-12-02 13:55:01 UTC (rev 150)
@@ -1,6 +1,12 @@
 *********************
 GNUe PIM - Project CV
 *********************
+New features / changes by 2004.12.02.
+*Simplified naming on main form.
+*Applied 'Close' button to main form, suppressed toolbar/menubar.
+    This way we can exit the form without the need to clear it, as it is done
+    by the Close button's trigger.
+*Simplified naming on address selector form.
 
 New features / changes by 2004.11.25.
 *Changed name format.

Modified: gnue-pim/forms/SelectAddr.gfd
===================================================================
--- gnue-pim/forms/SelectAddr.gfd       2004-12-01 15:14:08 UTC (rev 149)
+++ gnue-pim/forms/SelectAddr.gfd       2004-12-02 13:55:01 UTC (rev 150)
@@ -24,87 +24,143 @@
      $Id$
 -->
 
+<!--
+This form lists all available addresses on the left, and the addresses bound
+    to the given person on the right. An address can be present on both sides,
+    as addresses are differentiatied by address type (eg Home address,
+    Work address, Postal address, etc.).
+    If one edits an address on any side, it should be displayed with the
+    new value on both sides.
+-->
 <form style="dialog" xmlns:c="GNUe:Layout:Char" title="Select addresses">
-  <trigger type="On-Startup">
-    form.setFeature('GUI:MENUBAR:SUPPRESS', True)
-    #form.setFeature('GUI:TOOLBAR:SUPPRESS', True)
-    form.setFeature('GUI:STATUSBAR:SUPPRESS', True)
-  </trigger>
-
-  <options/>
   
-  <datasource name="dtsPIM_AdPe" connection="pim" table="PIM_AdPe"
-      prequery="Y">
-    <condition>
-      <null>
-        <cfield name="PIM_until"/>
-      </null>
-    </condition>
-  </datasource>
+  <!--*****************************************************
+                      Datasources
+  ******************************************************-->
+  <datasource name="dtsAdPe" connection="pim" table="PIM_AdPe"/>
   <datasource name="dtsBoundAddr" connection="pim" table="ADDR_Address"
-      master="dtsPIM_AdPe" masterlink="PIM_addr" detaillink="gnue_id"/>
+      master="dtsAdPe" masterlink="PIM_addr" detaillink="gnue_id"/>
   <datasource name="dtsFreeAddr" connection="pim" table="ADDR_Address"
       prequery="Y"/>
-              
+  <datasource name="dtsAddrType" connection="pim" table="ADDR_Type"/>
+
   <logic>
-    <block name="blkPIM_AdPe" datasource="dtspim_adpe">
+    <!--***************************************************
+                    Person-Address link
+    ****************************************************-->
+    <block name="blkAdPe" datasource="dtsAdPe">
       <field name="fldGnueId" field="gnue_id" maxLength="32"/>
-      <field name="fldPimAddr" field="PIM_addr" maxLength="32"/>
-      <field name="fldPimPerson" field="PIM_person" maxLength="32"/>
+      <field name="fldType" field="PIM_type" maxLength="32"
+          fk_source="dtsAddrType" fk_key="gnue_id"
+          fk_description="ADDR_name"/>
     </block>
     
+    <!--***************************************************
+            Details of addresses linked to the person
+    ****************************************************-->
     <block name="blkBoundAddr" datasource="dtsBoundAddr">
       <field name="fldFormatted" field="gnue_id"
           fk_source="dtsBoundAddr" fk_key="gnue_id"
           fk_description="ADDR_formatted"/>
     </block>
     
+    <!--***************************************************
+            Details of any addresses
+    ****************************************************-->
     <block name="blkFreeAddr" datasource="dtsFreeAddr">
       <field name="fldFormatted" field="gnue_id"
           fk_source="dtsFreeAddr" fk_key="gnue_id"
           fk_description="ADDR_formatted"/>
     </block>
   </logic>
-  
+
+
+  <!--*****************************************************
+                          Form layout
+  ******************************************************-->
   <layout c:height="10" c:width="70">
     <page>
+      <entry name="entAddrType" c:height="1" c:width="10" c:x="20" c:y="0"
+          block="blkAdPe" field="fldType" style="dropdown"/>
+          
+      <!--Available addresses-->
+      <label name="lblFreeAdd" c:height="1" c:width="30" c:x="1" c:y="0"
+          text="Available addresses" alignment="center"/>
       <entry name="entFreeAddr" c:height="8" c:width="30" c:x="1" c:y="1"
           block="blkFreeAddr" field="fldFormatted" style="listbox"/>
       <button name="btnEditFree" c:height="1" c:width="7" c:x="12" c:y="9"
           label="Edit...">
         <trigger type="ON-ACTION" name="btnEditFreeTrigger">
-          params = {'id': blkFreeAddr.fldFormatted.get() or None}
-          form.runForm('ADDR_Address.gfd', params)
-          blkFreeAddr.fldFormatted.resetForeignKey()
+          addr = blkFreeAddr.fldFormatted.get()
+          if addr:
+            form.runForm('ADDR_Address.gfd', {'id': addr})
+            blkFreeAddr.fldFormatted.resetForeignKey()
         </trigger>
       </button>
+      
+      <!--Linked addresses-->
+      <label name="lblBoundAdd" c:height="1" c:width="30" c:x="40" c:y="0"
+          text="Bound addresses" alignment="center"/>
       <entry name="entBoundAddr" c:height="8" c:width="30" c:x="40" c:y="1"
           block="blkBoundAddr" field="fldFormatted" style="listbox"/>
       <button name="btnEditBound" c:height="1" c:width="7" c:x="52" c:y="9"
           label="Edit...">
         <trigger type="ON-ACTION" name="btnEditBoundTrigger">
-          params = {'id': blkBoundAddr.fldFormatted.get() or None}
-          form.runForm('ADDR_Address.gfd', params)
-          blkBoundAddr.fldFormatted.resetForeignKey()
+          addr = blkBoundAddr.fldFormatted.get()
+          if addr:
+            form.runForm('ADDR_Address.gfd', {'id': addr})
+            form.activateTrigger('Refresh')
+            #blkFreeAddr.fldFormatted.resetForeignKey()
+            <!--somehow we should refresh the free addresses too...-->
         </trigger>
       </button>
           
+      <!--Add/Remove buttons-->
       <button name="btnAdd" c:height="1" c:width="9" c:x="31" c:y="3"
           label="Add &gt;">
         <trigger type="ON-ACTION" name="add">
-          person = blkPIM_AdPe.fldPimPerson.get() or None
-          addr = blkFreeAddr.fldFormatted.get() or None
-          blkPIM_AdPe.call('PIM_add', {'person':person, 'addr':addr})
+          person = getParameter('person')
+          addr = blkFreeAddr.fldFormatted.get()
+          blkAdPe.call('PIM_add', {'person':person, 'addr':addr})
         </trigger>
       </button>
       <button name="btnRemove" c:height="1" c:width="9" c:x="31" c:y="5"
           label="&lt; Remove">
         <trigger type="ON-ACTION" name="remove">
-          id = blkPIM_AdPe.fldGnueId.get() or None
-          blkPIM_AdPe.call('PIM_remove', {'id':id})
+          id = blkAdPe.fldGnueId.get()
+          blkAdPe.call('PIM_remove', {'id':id})
         </trigger>
       </button>
+      
+      <!--Close button-->
+      <button name="btnClose" c:height="1" c:width="7" c:x="32" c:y="9"
+          label="Close">
+        <trigger type="ON-ACTION" name="btnCloseTrigger">
+          blkFreeAddr.rollback()
+          blkBoundAddr.rollback()
+          close()
+        </trigger>
+      </button>
           
     </page>
   </layout>
+
+
+  <!--*****************************************************
+                      Triggieros
+  ******************************************************-->
+  <trigger type="On-Startup">
+    form.setFeature('GUI:MENUBAR:SUPPRESS', True)
+    #form.setFeature('GUI:TOOLBAR:SUPPRESS', True)
+    form.setFeature('GUI:STATUSBAR:SUPPRESS', True)
+  </trigger>
+
+  <trigger type="On-Activation" src="Refresh" />
+  
+  <trigger type="NAMED" name="Refresh">
+    person = getParameter('person')
+    if person:
+      dtsAdPe.simpleQuery({'PIM_person': person})#, 'PIM_until': None})
+  </trigger>
+  
 </form>

Modified: gnue-pim/forms/pim.gfd
===================================================================
--- gnue-pim/forms/pim.gfd      2004-12-01 15:14:08 UTC (rev 149)
+++ gnue-pim/forms/pim.gfd      2004-12-02 13:55:01 UTC (rev 150)
@@ -25,119 +25,181 @@
 -->
 
 <form title="GNUe PIM">
-  <options/>
 
-  <trigger type="NAMED" name="Refresh">
-    person = blkPIM_AdPe.fldAdpePerson.get()
-    if person:
-      print 'Refresh.person: %s' % person
-      #dtsPIM_AdPe.simpleQuery({'PIM_person': person})
-  </trigger>
+  <!--*****************************************************
+                      Datasources
+  ******************************************************-->
+  <datasource name="dtsPerson" connection="pim" table="PERSON_Person"
+      prequery="Y" />
+      
+  <datasource name="dtsAdPe" connection="pim" table="PIM_AdPe" />
+  <datasource name="dtsPeCo" connection="pim" table="PIM_PeCo" />
+  <datasource name="dtsPaPe" connection="pim" table="PIM_PaPe" />
   
-  <datasource name="dtsPERSON_Person" connection="pim" table="PERSON_Person"
-      prequery="Y" />
-  <datasource name="dtsPIM_AdPe" connection="pim" table="PIM_AdPe" />
-<!--
-  <datasource name="dtsPIM_PeCo" connection="pim" table="PIM_PeCo" />
-  <datasource name="dtsPIM_PaPe" connection="pim" table="PIM_PaPe" />
--->
-  <datasource name="dtsADDR_Address" connection="pim" table="ADDR_Address"
-      master="dtsPIM_AdPe" masterlink="PIM_addr" detaillink="gnue_id" />
-<!--
-  <datasource name="dtsCOMM_Comm" connection="pim" table="COMM_Comm"
-      master="dtsPIM_PeCo" masterlink="PIM_comm" detaillink="gnue_id" />
-  <datasource name="dtsPARTY_Party" connection="pim" table="PARTY_Party"
-      master="dtsPIM_PaPe" masterlink="PIM_party" detaillink="gnue_id" />
--->
+  <datasource name="dtsAddress" connection="pim" table="ADDR_Address"
+      master="dtsAdPe" masterlink="PIM_addr" detaillink="gnue_id" />
+  <datasource name="dtsComm" connection="pim" table="COMM_Comm"
+      master="dtsPeCo" masterlink="PIM_comm" detaillink="gnue_id" />
+  <datasource name="dtsParty" connection="pim" table="PARTY_Party"
+      master="dtsPaPe" masterlink="PIM_party" detaillink="gnue_id" />
 
+
   <logic>
-    <block name="blkPIM_AdPe" datasource="dtspim_adpe">
-      <field name="fldAdpePerson" field="PIM_person"
-          fk_source="dtsPERSON_Person" fk_key="gnue_id"
+    <!--***************************************************
+                Person selector unbound block
+    ****************************************************-->
+    <block name="blkPerson" datasource="dtsPerson">
+      <field name="fldPerson" field="gnue_id"
+          fk_source="dtsPerson" fk_key="gnue_id"
           fk_description="PERSON_formatted">
         <trigger type="POST-CHANGE" name="postchange" src="Refresh"/>
       </field>
-      <field name="fldAdpeAddress" field="PIM_addr"/>
     </block>
+  
+    <!--***************************************************
+                    Person-Address link
+    ****************************************************-->
+    <block name="blkAdPe" datasource="dtsAdPe">
+      <field name="fldPerson" field="PIM_person"/>
+    </block>
 
-<!--
-    <block name="blkPIM_PeCo" datasource="dtspim_peco">
-      <field name="fldPecoPerson" field="PIM_person"></field>
+    <!--***************************************************
+                    Person-Comm link
+    ****************************************************-->
+    <block name="blkPeCo" datasource="dtsPeCo">
+      <field name="fldPerson" field="PIM_person"></field>
     </block>
 
-    <block name="blkPIM_PaPe" datasource="dtspim_pape">
-      <field name="fldPapePerson" field="PIM_person"></field>
+    <!--***************************************************
+                    Person-Company link
+    ****************************************************-->
+    <block name="blkPaPe" datasource="dtsPaPe">
+      <field name="fldPerson" field="PIM_person"></field>
     </block>
--->
 
-    <block name="blkADDR_Address" datasource="dtsaddr_address" rows="3">
-      <field name="fldGnueId" field="gnue_id" maxLength="32"/>
-      <field name="fldAddrFormatted" field="ADDR_formatted" readonly="Y"/>
+    <!--***************************************************
+                        Address details
+    ****************************************************-->
+    <block name="blkAddress" datasource="dtsAddress" rows="3">
+      <field name="fldFormatted" field="ADDR_formatted" readonly="Y"/>
     </block>
 
-<!--
-    <block name="blkCOMM_Comm" datasource="dtscomm_comm" rows="3">
-      <field name="fldCommFormatted" field="COMM_formatted" readonly="Y"/>
+    <!--***************************************************
+                        Comm details
+    ****************************************************-->
+    <block name="blkComm" datasource="dtsComm" rows="3">
+      <field name="fldFormatted" field="COMM_formatted" readonly="Y"/>
     </block>
 
-    <block name="blkPARTY_Party" datasource="dtsparty_party" rows="3">
-      <field name="fldPartyFormatted" field="PARTY_formatted" readonly="Y"/>
+    <!--***************************************************
+                        Company details
+    ****************************************************-->
+    <block name="blkParty" datasource="dtsParty" rows="3">
+      <field name="fldFormatted" field="PARTY_formatted" readonly="Y"/>
     </block>
--->
 
   </logic>
 
 
 
+  <!--*****************************************************
+                          Form layout
+  ******************************************************-->
   <layout xmlns:c="GNUe:Layout:Char" c:height="21" c:width="60" tabbed="top">
     <page name="Person">
-      <entry name="entSelectPerson" c:height="1" c:width="20" c:x="1" c:y="1"
-          block="blkPIM_AdPe" field="fldAdpePerson" style="dropdown" />
-      <button name="btnEditPerson" c:height="1" c:width="12" c:x="22" c:y="1"
+      <!--Person selector-->
+      <entry name="entSelectPerson" c:height="1" c:width="20" c:x="3" c:y="1"
+          block="blkPerson" field="fldPerson" style="dropdown" />
+      <button name="btnEditPerson" c:height="1" c:width="12" c:x="24" c:y="1"
           label="Add/Edit...">
         <trigger type="ON-ACTION" name="btnEditPersonTrigger">
-          params = {'id': blkPIM_AdPe.fldAdpePerson.get() or None}
-          form.runForm('PERSON_Person.gfd', params)
-          blkPIM_AdPe.fldAdpePerson.resetForeignKey()
+          person = blkPerson.fldPerson.get()
+          runForm('PERSON_Person.gfd', {'id': person})
+          blkPerson.fldPerson.resetForeignKey()
         </trigger>
       </button>
 
       <!--Address box-->
-      <box name="boxAddress" c:height="6" c:width="58" c:x="1" c:y="3"
+      <box name="boxAddress" c:height="6" c:width="58" c:x="1" c:y="2"
           label="Addresses" />
-      <button name="btnAddAddress" c:height="1" c:width="9" c:x="3" c:y="4"
+      <button name="btnManageAddress" c:height="1" c:width="9" c:x="3" c:y="3"
           label="Manage...">
         <trigger type="ON-ACTION" name="btnManageAddressTrigger">
-          params = {'person': blkPIM_AdPe.fldAdpePerson.get() or None}
-          form.runForm('SelectAddr.gfd', params)
-          form.activateTrigger('Refresh')
+          person = blkAdPe.fldPerson.get()
+          if person:
+            runForm('SelectAddr.gfd', {'person': person})
+            activateTrigger('Refresh')
         </trigger>
       </button>
-      <entry name="entAddrFormatted" c:height="1" c:width="40" c:x="3" c:y="5"
-          block="blkADDR_Address" field="fldAddrFormatted" />
-
+      <entry name="entAddrFormatted" c:height="1" c:width="40" c:x="3" c:y="4"
+          block="blkAddress" field="fldFormatted" />
+ 
       <!--Comm box-->
-      <box name="boxComm" c:height="6" c:width="58" c:x="1" c:y="9"
+      <box name="boxComm" c:height="6" c:width="58" c:x="1" c:y="8"
           label="Communication" />
-<!--
-      <button name="btnAddComm" c:height="1" c:width="12" c:x="3" c:y="10"
-          label="Add/Edit...">
+      <button name="btnManageComm" c:height="1" c:width="9" c:x="3" c:y="9"
+          label="Manage...">
+        <trigger type="ON-ACTION" name="btnManageCommTrigger">
+          person = blkPeCo.fldPerson.get()
+          if person:
+            runForm('SelectComm.gfd', {'person': person})
+            activateTrigger('Refresh')
+        </trigger>
       </button>
-      <entry name="entCommFormatted" c:height="1" c:width="40" c:x="3" c:y="11"
-          block="blkCOMM_Comm" field="fldCommFormatted" />
--->
+      <entry name="entCommFormatted" c:height="1" c:width="40" c:x="3" c:y="10"
+          block="blkComm" field="fldFormatted" />
 
       <!--Party box-->
-      <box name="boxParty" c:height="6" c:width="58" c:x="1" c:y="15"
+      <box name="boxParty" c:height="6" c:width="58" c:x="1" c:y="14"
           label="Parties" />
-<!--
-      <button name="btnAddParty" c:height="1" c:width="12" c:x="3" c:y="16"
-          label="Add/Edit...">
+      <button name="btnManageParty" c:height="1" c:width="9" c:x="3" c:y="15"
+          label="Manage...">
+        <trigger type="ON-ACTION" name="btnManagePartyTrigger">
+          person = blkPaPe.fldPerson.get()
+          if person:
+            runForm('SelectParty.gfd', {'person': person})
+            activateTrigger('Refresh')
+        </trigger>
       </button>
-      <entry name="entPartyFormatted" c:height="1" c:width="40" c:x="3" 
c:y="17"
-          block="blkPARTY_Party" field="fldPartyFormatted" />
--->
+      <entry name="entPartyFormatted" c:height="1" c:width="40" c:x="3" 
c:y="16"
+          block="blkParty" field="fldFormatted" />
 
+      <button name="btnClose" c:height="1" c:width="10" c:x="3" c:y="20"
+          label="Close">
+        <trigger type="ON-ACTION" name="btnCloseTrigger">
+          rollback()
+          close()
+        </trigger>
+      </button>
+
     </page>
   </layout>
+
+  <!--*****************************************************
+                      Named triggers
+  ******************************************************-->
+  <trigger type="On-Startup">
+    form.setFeature('GUI:MENUBAR:SUPPRESS', True)
+    form.setFeature('GUI:TOOLBAR:SUPPRESS', True)
+    form.setFeature('GUI:STATUSBAR:SUPPRESS', True)
+  </trigger>
+  
+  <trigger type="On-Activation">
+    blkPerson.fldPerson.set(None)
+  </trigger>
+  
+  <trigger type="NAMED" name="Refresh">
+    <!--Refreshes page, based on selected person-->
+    person = blkPerson.fldPerson.get()
+    if person:
+      #print 'Refresh.person: %s' % person
+      dtsAdPe.simpleQuery({'PIM_person': person})
+      dtsPeCo.simpleQuery({'PIM_person': person})
+      dtsPaPe.simpleQuery({'PIM_person': person})
+    else:
+      blkAdPe.clear()
+      blkPeCo.clear()
+      blkPaPe.clear()
+  </trigger>
+
 </form>

Modified: gnue-pim/schema/pim.gcd
===================================================================
--- gnue-pim/schema/pim.gcd     2004-12-01 15:14:08 UTC (rev 149)
+++ gnue-pim/schema/pim.gcd     2004-12-02 13:55:01 UTC (rev 150)
@@ -37,30 +37,36 @@
       <parameter name="addr" type="ADDR_Address"/>
       <parameter name="person" type="PERSON_Person"/>
       print "PIM_AdPe::add person %s\n, addr %s" % (person, addr)
-      import mx.DateTime
+      if (addr is not None) and (person is not None):
+        import mx.DateTime
       
-      adpe = new('PIM_AdPe')
+        adpe = new('PIM_AdPe')
       
-      adpe.PIM_person = person
-      adpe.PIM_addr = addr
-      adpe.PIM_from = mx.DateTime.now()
+        adpe.PIM_person = person
+        adpe.PIM_addr = addr
+        adpe.PIM_from = mx.DateTime.now()
       
-      session.commit()
-      return True
+        session.commit()
+        return True
+      else:
+        return False
     </procedure>
     
     <procedure name="remove" type="boolean" comment="Invalidate an 
address/person connection">
       <parameter name="id" type="id"/>
       print "PIM_AdPe::remove id %s" % id
-      import mx.DateTime
+      if id is not None:
+        import mx.DateTime
       
-      adpeList = find('PIM_AdPe',{'gnue_id':id}, [], [])
-      print "PIM_AdPe::remove found %d records" % len(adpeList)
-      adpe = adpeList[0]
-      adpe.PIM_until = mx.DateTime.now()
+        adpeList = find('PIM_AdPe',{'gnue_id':id}, [], [])
+        print "PIM_AdPe::remove found %d records" % len(adpeList)
+        adpe = adpeList[0]
+        adpe.PIM_until = mx.DateTime.now()
       
-      session.commit()
-      return True
+        session.commit()
+        return True
+      else:
+        return False
     </procedure>
   </class>
 





reply via email to

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