/[papo]/papo/forms/product_classification.neb
ViewVC logotype

Diff of /papo/forms/product_classification.neb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by apronotti, Fri May 30 15:19:21 2003 UTC revision 1.3 by apronotti, Fri May 30 15:21:28 2003 UTC
# Line 1  Line 1 
1  <?xml version="1.0" encoding="ISO-8859-1"?>  <?xml version="1.0" encoding="ISO-8859-1"?>
2    <form title="ABM de Clasificación de Producto" tabbed="top" width="80" height="25">
3    
4  <form tabbed="top" title="ABM de Clasificación de Producto">    <datasource name="focusDataSource" cache="1"></datasource>
5    <neb:Block>    <datasource name="searchDataSource" cache="1"></datasource>
6  my $database = 'papo';    <!--  This component is originally based on neb/examples/db.neb,      -->
7  my $table = 'product_classification';    <!--  although it might diverge in the future. The idea that this is  -->
8  my $order_by = 'name';    <!--  the working version, whereas that is a simple example. So any   -->
9      <!--  hacks go here; keep the example clean, if less "magic".         -->
10  my $search = [  
11                { 'field' => 'name',    <datasource name="resultDataSource" database="papo" table="_product_classification_data" order_by="_product_classification_data.name" >
12                  'search_label' => 'Clasificación a buscar',      <condition>
13                  'result_label' => 'Nombre',        <and><!-- Only current product_classification's, please -->
14                },          <null>
15               ];            <cfield name="_product_classification_data._end_t"></cfield>
16  my $fields = [          </null>
17                { 'field' => 'name',        </and>
18                  'desc'  => 'Nombre',      </condition>
19                },    </datasource>
20               ];    <!--  This component is originally based on neb/examples/db.neb,      -->
21  my $pages = { 'search' => 'Clasificaciones de producto',    <!--  although it might diverge in the future. The idea that this is  -->
22                'edit' => 'Datos de la clasificación',    <!--  the working version, whereas that is a simple example. So any   -->
23              };    <!--  hacks go here; keep the example clean, if less "magic".         -->
24    
25      <datasource name="editDataSource" database="papo" table="product_classification,_product_classification_data"
26    </neb:Block>      historytable="_product_classification_data" order_by="_product_classification_data.name">
27    <neb:Sub neb:src="generic.nebc" search="neb:$search"      <condition>
28      fields="neb:$fields" pages="neb:$pages" database="neb:$database"        <and><!-- pega product_classification con su _table -->
29      table="neb:$table" order_by="neb:$order_by"/>          <eq>
30              <cfield name="product_classification.id"></cfield>
31              <cfield name="_product_classification_data._table"></cfield>
32            </eq><!-- Only current product_classification's, please -->
33            <null>
34              <cfield name="_product_classification_data._end_t"></cfield>
35            </null>
36          </and>
37        </condition>
38      </datasource>
39      <trigger name="searchTrigger" type="NAMED">
40        try:
41          from gnue.forms.GFEvent import GFEvent
42        except ImportError:
43          from gnue.common.events.Event import Event as GFEvent
44          
45        setStatusText('buscando...')
46          
47        self._object.dispatchEvent(GFEvent('beginWAIT'))
48    
49        resultBlock.clear()
50        resultBlock.initQuery()
51        resultBlock.listEntry0 = str(searchBlock.searchEntry0)+'%'
52        resultBlock.processQuery()
53    
54        setStatusText('Aceptar')
55        self._object.dispatchEvent(GFEvent('endWAIT'))
56    
57        if resultBlock.isEmpty():
58          searchBlock.notificationEntry = ' no se encontraron registros'
59        else:
60          searchBlock.notificationEntry ='%6d registros encontrados' % resultBlock.getRecordCount()
61    
62      </trigger>
63      <trigger name="commitTrigger" type="NAMED">
64        from gnue.common.GDataObjects import ConnectionError as DBError
65    
66        try:
67          editBlock.postChanges()
68          commitConnection()
69        except DBError, err:
70          rollbackConnection()
71          genericBox("Hay problemas para grabar los datos\n"+str(err),['Aceptar'])
72          
73      </trigger>
74      <trigger name="deleteTrigger" type="NAMED">
75      from gnue.common.GDataObjects import ConnectionError as DBError
76      
77      try:
78        editBlock.deleteRecord()
79        editBlock.postChanges()
80        commitConnection()
81      except DBError, err:
82        rollbackConnection()
83        genericBox("Hay problemas para borrar los datos \n"+str(err),['Aceptar'])
84      </trigger>
85      <trigger name="rollbackTrigger" type="NAMED">
86      editBlock.reset()
87      </trigger>
88      <trigger name="askForChangesTrigger" type="NAMED">
89      import hack
90      hack.confirmPageChanges(self, 'commitTrigger', editBlock)
91        </trigger>
92      <trigger name="newTrigger" type="NAMED">
93      import hack
94      hack.confirmRollback (self, editBlock, 'commitTrigger')
95      </trigger>
96      <page name="Búsqueda">
97        <trigger type="Pre-Focusout">
98        editBlock.clear()
99        if resultBlock.getRecordCount() > 0 and not resultBlock.getCurrentRecord().isEmpty():
100          editBlock.initQuery()
101          editBlock.idEntry = ("%s" % resultBlock.idREntry)
102          editBlock.processQuery()
103    
104        </trigger>
105        <block name="searchBlock" transparentBlock="" datasource="searchDataSource" restrictInsert="">
106          <label text="Clasificación a buscar" x="2" y="1" width="23"></label>
107          <entry name="searchEntry0" x="2" y="2" width="76" height="1"></entry>
108          <button name="searchBtn" trigger="searchTrigger" label="Buscar" x="2" y="3" width="10" height="1"></button>
109          <entry style="label" name="notificationEntry" x="1" y="24" width="67"/>
110        </block>
111        
112        <block name="resultBlock" transparentBlock="y" datasource="resultDataSource" restrictInsert="y">
113          <entry name="idREntry" hidden="y" field="_table" x="2" y="5"></entry>
114          
115          <label text="Nombre" x="2" y="5" width="6"></label>
116          <entry name="listEntry0" max_length="255" rows="18" field="_product_classification_data.name" x="2" y="6" width="72" height="1"></entry>
117          
118          
119          <label text="" x="76" y="5" width="0"></label>
120          <scrollbar page="18" x="76" y="6" width="1" height="18"></scrollbar>
121        </block>
122        
123      </page>
124      <page name="Gestión">
125        <trigger src="askForChangesTrigger" type="pre-Focusout"></trigger>
126        <block name="editBlock" restrictInsert="y" datasource="editDataSource">
127          <entry name="idEntry" hidden="y" field="product_classification.id" x="0" y="0"></entry>
128          <button name="newButton" label="Nuevo" trigger="newTrigger" x="68" y="1" width="10" height="1"></button>
129          <label text="Nombre" x="1" y="2" width="6"></label>
130          <entry name="nameField" max_length="255" field="_product_classification_data.name" x="1" y="3" width="77" height="1"></entry>
131    
132          <button name="commitBtn" label="Aceptar" trigger="commitTrigger" x="12" y="10" width="10" height="1"></button>
133          <button name="rollbackBtn" label="Cancelar" trigger="rollbackTrigger" x="33" y="10" width="10" height="1"></button>
134          <button name="deleteBtn" label="Borrar" trigger="deleteTrigger" x="54" y="10" width="10" height="1"></button>
135        </block>
136      </page>
137  </form>  </form>

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26