/[papo]/papo/forms/components/inlineSearch.nebc
ViewVC logotype

Diff of /papo/forms/components/inlineSearch.nebc

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

revision 1.6 by apronotti, Wed Sep 24 19:31:13 2003 UTC revision 1.7 by apronotti, Fri Oct 3 17:32:17 2003 UTC
# Line 61  Line 61 
61    
62  $label=>''  $label=>''
63  $table  $table
64    $with_history => '1' # Este parámetro indica si la tabla es histórica o sea lleva el sufijo "_data"
65  $target_block=>''  $target_block=>''
66  $target_field  $target_field
67    $rows=>'1'
68    
69  $object=> ''  $object=> ''
70  $object_form=> ''  $object_form=> ''
71    $disable_object_form=> ''
72  $object_select_form=> ''  $object_select_form=> ''
73    
74    
75  $ds_name=> ''  $ds_name=> ''
76  $block_name=> ''  $block_name=> ''
77    
# Line 91  $search_data_source => '' Line 95  $search_data_source => ''
95    
96  #trigger a llamar antes de cada búsqueda  #trigger a llamar antes de cada búsqueda
97  $pre_search_trigger => ''  $pre_search_trigger => ''
98    $search_trigger => ''
99  $cond_field => ''  $cond_field => ''
100  </neb:Vars>  </neb:Vars>
101    
# Line 111  $cond_field => '' Line 116  $cond_field => ''
116    my @data= split /\./, $target_field;    my @data= split /\./, $target_field;
117    if (scalar @data==2) {    if (scalar @data==2) {
118      ($target_table, $target_field)= @data;      ($target_table, $target_field)= @data;
119      if ($target_table!~ /^_.*_data$/) {      if (($target_table!~ /^_.*_data$/) and ($with_history)){
120        $target_table= "_${target_table}_data";        $target_table= "_${target_table}_data";
121        } else {
122          $target_table= "${target_table}";
123      }      }
124    }    }
125    
# Line 161  $cond_field => '' Line 168  $cond_field => ''
168    
169  <!-- this datasource searches the names/codes //-->  <!-- this datasource searches the names/codes //-->
170  <neb:Block>if ($search_data_source eq "") {</neb:Block>  <neb:Block>if ($search_data_source eq "") {</neb:Block>
171  <neb:Sub neb:src="datasource.nebc" search="neb:$object"    <neb:Sub neb:src="datasource.nebc" search="neb:$object"
172    zot="neb:$ENV{ZOTFILE}"      zot="neb:$ENV{ZOTFILE}"
173    name="neb:$ds_name" database="papo" order_by="neb:$name_field">      name="neb:$ds_name" database="papo" order_by="neb:$name_field">
174  </neb:Sub>    </neb:Sub>
175  <neb:Block>}</neb:Block>  <neb:Block>}</neb:Block>  
176      
177  <neb:Block>if ($use_code) {</neb:Block>    <neb:Block>if ($use_code) {</neb:Block>
178    <trigger name="neb:qq(idFor_${object}CodeTrigger)" type="NAMED">      <trigger name="neb:qq(idFor_${object}CodeTrigger)" type="NAMED">
179      if str(<neb:Inline>"$target_block\.$code_entry"</neb:Inline>):        if str(<neb:Inline>"$target_block\.$code_entry"</neb:Inline>):
180            callTrigger ('<neb:Inline>"idFor_${object}Trigger"</neb:Inline>')
181          else:
182            <neb:Inline>"$target_block\.hid_$code_entry"</neb:Inline>= ''
183            <neb:Inline>"$target_block\.$code_entry"</neb:Inline>= ''
184            <neb:Inline>"$target_block\.hid_$name_entry"</neb:Inline>= ''
185            <neb:Inline>"$target_block\.$name_entry"</neb:Inline>= ''
186            <neb:Inline>"$target_block\.$id_entry"</neb:Inline>= ''
187        </trigger>
188      <neb:Block>}</neb:Block>
189      
190      <trigger name="neb:qq(idFor_${object}NameTrigger)" type="NAMED">
191        if str(<neb:Inline>"$target_block\.$name_entry"</neb:Inline>):
192        callTrigger ('<neb:Inline>"idFor_${object}Trigger"</neb:Inline>')        callTrigger ('<neb:Inline>"idFor_${object}Trigger"</neb:Inline>')
193      else:      else:
194          <neb:Block>if ($use_code) {</neb:Block>
195          <!-- *dont't* ident -->
196        <neb:Inline>"$target_block\.hid_$code_entry"</neb:Inline>= ''        <neb:Inline>"$target_block\.hid_$code_entry"</neb:Inline>= ''
197        <neb:Inline>"$target_block\.$code_entry"</neb:Inline>= ''        <neb:Inline>"$target_block\.$code_entry"</neb:Inline>= ''
198          <neb:Block>}</neb:Block>
199        <neb:Inline>"$target_block\.hid_$name_entry"</neb:Inline>= ''        <neb:Inline>"$target_block\.hid_$name_entry"</neb:Inline>= ''
200        <neb:Inline>"$target_block\.$name_entry"</neb:Inline>= ''        <neb:Inline>"$target_block\.$name_entry"</neb:Inline>= ''
201        <neb:Inline>"$target_block\.$id_entry"</neb:Inline>= ''        <neb:Inline>"$target_block\.$id_entry"</neb:Inline>= ''
202    </trigger>    </trigger>
 <neb:Block>}</neb:Block>  
203    
 <trigger name="neb:qq(idFor_${object}NameTrigger)" type="NAMED">  
   if str(<neb:Inline>"$target_block\.$name_entry"</neb:Inline>):  
     callTrigger ('<neb:Inline>"idFor_${object}Trigger"</neb:Inline>')  
   else:  
     <neb:Block>if ($use_code) {</neb:Block>  
     <!-- *dont't* ident -->  
     <neb:Inline>"$target_block\.hid_$code_entry"</neb:Inline>= ''  
     <neb:Inline>"$target_block\.$code_entry"</neb:Inline>= ''  
     <neb:Block>}</neb:Block>  
     <neb:Inline>"$target_block\.hid_$name_entry"</neb:Inline>= ''  
     <neb:Inline>"$target_block\.$name_entry"</neb:Inline>= ''  
     <neb:Inline>"$target_block\.$id_entry"</neb:Inline>= ''  
 </trigger>  
204    
205  <!-- the trigger called when <enter> is hit //-->  <!-- the trigger called when <enter> is hit //-->
206  <trigger name="neb:qq(idFor_${object}Trigger)" type="NAMED">  <trigger name="neb:qq(idFor_${object}Trigger)" type="NAMED">
207    callTrigger('startWaitingModeTrigger')  <neb:Block>if (!$search_trigger) {</neb:Block>
208    def set_<neb:Inline>$object</neb:Inline> (recNo):      callTrigger('startWaitingModeTrigger')
209      if recNo>=0:      def set_<neb:Inline>$object</neb:Inline> (recNo):
210        <neb:Inline>$block_name</neb:Inline>.jumpRecord (recNo)        if recNo>=0:
211        <neb:Inline>"$target_block\.$id_entry"</neb:Inline>= str(<neb:Inline>"$block_name\.idEntry"</neb:Inline>)          <neb:Inline>$block_name</neb:Inline>.jumpRecord (recNo)
212        <neb:Block>if ($use_code) {</neb:Block>          <neb:Inline>"$target_block\.$id_entry"</neb:Inline>= str(<neb:Inline>"$block_name\.idEntry"</neb:Inline>)
213        <!-- don't ident! -->          <neb:Block>if ($use_code) {</neb:Block>
214        <neb:Inline>"$target_block\.$code_entry"</neb:Inline>= str(<neb:Inline>"$block_name\.codeEntry"</neb:Inline>)          <!-- don't ident! -->
215        callTrigger ('<neb:Inline>"${object}_codePFI"</neb:Inline>')          <neb:Inline>"$target_block\.$code_entry"</neb:Inline>= str(<neb:Inline>"$block_name\.codeEntry"</neb:Inline>)
216        <neb:Block>}</neb:Block>          callTrigger ('<neb:Inline>"${object}_codePFI"</neb:Inline>')
217        <neb:Inline>"$target_block\.$name_entry"</neb:Inline>= str(<neb:Inline>"$block_name\.nameEntry"</neb:Inline>)          <neb:Block>}</neb:Block>
218        callTrigger ('<neb:Inline>"${object}_namePFI"</neb:Inline>')          <neb:Inline>"$target_block\.$name_entry"</neb:Inline>= str(<neb:Inline>"$block_name\.nameEntry"</neb:Inline>)
219            callTrigger ('<neb:Inline>"${object}_namePFI"</neb:Inline>')
220    # go fetch!...    
221    <neb:Inline>$block_name</neb:Inline>.clear ()      # go fetch!...
222    <neb:Inline>$block_name</neb:Inline>.initQuery ()      <neb:Inline>$block_name</neb:Inline>.clear ()
223        <neb:Inline>$block_name</neb:Inline>.initQuery ()
224      
225    <neb:Block>if ($use_code) {</neb:Block>    
226    <!-- don't ident! -->      <neb:Block>if ($use_code) {</neb:Block>
227    if str(<neb:Inline>"$target_block\.hid_$code_entry"</neb:Inline>)!=str(<neb:Inline>"$target_block\.$code_entry"</neb:Inline>):      <!-- don't ident! -->
228      <neb:Inline>"$block_name\.codeEntry"</neb:Inline>= str(<neb:Inline>"$target_block\.$code_entry"</neb:Inline>)+'%'      if str(<neb:Inline>"$target_block\.hid_$code_entry"</neb:Inline>)!=str(<neb:Inline>"$target_block\.$code_entry"</neb:Inline>):
229    else:        <neb:Inline>"$block_name\.codeEntry"</neb:Inline>= str(<neb:Inline>"$target_block\.$code_entry"</neb:Inline>)+'%'
230      <neb:Inline>"$block_name\.codeEntry"</neb:Inline>= ''      else:
231          <neb:Inline>"$block_name\.codeEntry"</neb:Inline>= ''
232        <neb:Block>}</neb:Block>
233      <neb:Block>if ($pre_search_trigger) {</neb:Block>
234        callTrigger('<neb:Inline>$pre_search_trigger</neb:Inline>')
235      <neb:Block>}</neb:Block>
236        if str(<neb:Inline>"$target_block\.hid_$name_entry"</neb:Inline>)!=str(<neb:Inline>"$target_block\.$name_entry"</neb:Inline>):
237          <neb:Inline>"$block_name\.nameEntry"</neb:Inline>= str(<neb:Inline>"$target_block\.$name_entry"</neb:Inline>)+'%'
238        else:
239          <neb:Inline>"$block_name\.nameEntry"</neb:Inline>= ''
240        <neb:Inline>$block_name</neb:Inline>.processQuery ()
241      
242        callTrigger('endWaitingModeTrigger')
243      
244        # are there too much results?
245        resultCount= <neb:Inline>$block_name</neb:Inline>.getRecordCount ()
246        if resultCount>1:
247          # do the select-man
248          runForm ('<neb:Inline>$object_select_form</neb:Inline>', {
249            'data': <neb:Inline>$block_name</neb:Inline>,
250            'callback': set_<neb:Inline>$object</neb:Inline>
251          })
252          setStatusText('Listo')
253        elif resultCount==1:
254          set_<neb:Inline>$object</neb:Inline> (0)
255          setStatusText('Listo')
256        else:
257          setStatusText('No se encontraron registros')
258    <neb:Block>} else {</neb:Block>
259        <neb:Block>if ($use_code) {</neb:Block>
260        <!-- don't ident! -->
261        if str(<neb:Inline>"$target_block\.hid_$code_entry"</neb:Inline>)!=str(<neb:Inline>"$target_block\.$code_entry"</neb:Inline>):
262          <neb:Inline>"$block_name\.codeEntry"</neb:Inline>= str(<neb:Inline>"$target_block\.$code_entry"</neb:Inline>)+'%'
263        else:
264          <neb:Inline>"$block_name\.codeEntry"</neb:Inline>= ''
265        <neb:Block>}</neb:Block>
266      <neb:Block>if ($pre_search_trigger) {</neb:Block>
267        callTrigger('<neb:Inline>$pre_search_trigger</neb:Inline>')
268    <neb:Block>}</neb:Block>    <neb:Block>}</neb:Block>
269  <neb:Block>if ($pre_search_trigger) {</neb:Block>      if str(<neb:Inline>"$target_block\.hid_$name_entry"</neb:Inline>)!=str(<neb:Inline>"$target_block\.$name_entry"</neb:Inline>):
270    callTrigger('<neb:Inline>$pre_search_trigger</neb:Inline>')        <neb:Inline>"$block_name\.nameEntry"</neb:Inline>= str(<neb:Inline>"$target_block\.$name_entry"</neb:Inline>)+'%'
271        else:
272          <neb:Inline>"$block_name\.nameEntry"</neb:Inline>= ''
273        callTrigger('<neb:Inline>$search_trigger</neb:Inline>')
274  <neb:Block>}</neb:Block>  <neb:Block>}</neb:Block>
   if str(<neb:Inline>"$target_block\.hid_$name_entry"</neb:Inline>)!=str(<neb:Inline>"$target_block\.$name_entry"</neb:Inline>):  
     <neb:Inline>"$block_name\.nameEntry"</neb:Inline>= str(<neb:Inline>"$target_block\.$name_entry"</neb:Inline>)+'%'  
   else:  
     <neb:Inline>"$block_name\.nameEntry"</neb:Inline>= ''  
   <neb:Inline>$block_name</neb:Inline>.processQuery ()  
   
275    
   callTrigger('endWaitingModeTrigger')  
   
   # are there too much results?  
   resultCount= <neb:Inline>$block_name</neb:Inline>.getRecordCount ()  
   if resultCount>1:  
     # do the select-man  
     runForm ('<neb:Inline>$object_select_form</neb:Inline>', {  
       'data': <neb:Inline>$block_name</neb:Inline>,  
       'callback': set_<neb:Inline>$object</neb:Inline>  
     })  
     setStatusText('Listo')  
   elif resultCount==1:  
     set_<neb:Inline>$object</neb:Inline> (0)  
     setStatusText('Listo')  
   else:  
     setStatusText('No se encontraron registros')  
276  </trigger>  </trigger>
277    
278  <neb:Block>if ($use_code) {</neb:Block>  <neb:Block>if ($use_code) {</neb:Block>
# Line 287  $cond_field => '' Line 313  $cond_field => ''
313    
314    <lam:box lam:boxtype="h">    <lam:box lam:boxtype="h">
315      <!-- the one holding the foreign_key -->      <!-- the one holding the foreign_key -->
316      <entry name="neb:qq($id_entry)" field="neb:qq($target_table.$target_field)" hidden="y"/>      <entry name="neb:qq($id_entry)" field="neb:qq($target_table.$target_field)" hidden="y" rows="neb:$rows"/>
317      <!-- as these are the input only entries, should have no field -->      <!-- as these are the input only entries, should have no field -->
318      <neb:Block>if ($use_code) {</neb:Block>      <neb:Block>if ($use_code) {</neb:Block>
319        <entry name="neb:qq(hid_$code_entry)" hidden="y"/>        <entry name="neb:qq(hid_$code_entry)" hidden="y" rows="neb:$rows"/>
320        <!-- left for debug purposses -->        <!-- left for debug purposses -->
321        <!-- label text=">"/ -->        <!-- label text=">"/ -->
322        <entry name="neb:$code_entry" trigger="neb:qq(idFor_${object}CodeTrigger)" width="neb:$code_width">        <entry name="neb:$code_entry" trigger="neb:qq(idFor_${object}CodeTrigger)" width="neb:$code_width" rows="neb:$rows">
323          <trigger src="neb:qq(${object}_codePFI)" type="Pre-FocusIn"/>          <trigger src="neb:qq(${object}_codePFI)" type="Pre-FocusIn"/>
324          <trigger src="neb:qq(${object}_codePFO)" type="Pre-FocusOut"/>          <trigger src="neb:qq(${object}_codePFO)" type="Pre-FocusOut"/>
325        </entry>        </entry>
326      <neb:Block>}</neb:Block>      <neb:Block>}</neb:Block>
327      <entry name="neb:qq(hid_$name_entry)" hidden="y"/>      <entry name="neb:qq(hid_$name_entry)" hidden="y" rows="neb:$rows"/>
328      <!-- ditto -->      <!-- ditto -->
329      <!-- label text=">"/ -->      <!-- label text=">"/ -->
330      <entry name="neb:$name_entry" trigger="neb:qq(idFor_${object}NameTrigger)">      <entry name="neb:$name_entry" trigger="neb:qq(idFor_${object}NameTrigger)" rows="neb:$rows">
331        <trigger src="neb:qq(${object}_namePFI)" type="Pre-FocusIn"/>        <trigger src="neb:qq(${object}_namePFI)" type="Pre-FocusIn"/>
332        <trigger src="neb:qq(${object}_namePFO)" type="Pre-FocusOut"/>        <trigger src="neb:qq(${object}_namePFO)" type="Pre-FocusOut"/>
333      </entry>      </entry>
334        <neb:Block>if (!$disable_object_form) {</neb:Block>
335      <button label="..." trigger="neb:$object.'ABMFormTrigger'" width="5">      <button label="..." trigger="neb:$object.'ABMFormTrigger'" width="5">
336        <trigger name="neb:$object.'ABMFormTrigger'" type="NAMED">        <trigger name="neb:$object.'ABMFormTrigger'" type="NAMED">
337          runForm ('<neb:Inline>$object_form</neb:Inline>')          runForm ('<neb:Inline>$object_form</neb:Inline>')
338        </trigger>        </trigger>
339      </button>      </button>
340        <neb:Block>}</neb:Block>
341    </lam:box>    </lam:box>
342    
343    <neb:Block>if (!$search_trigger) {</neb:Block>
344    <lam:box lam:boxtype="h">    <lam:box lam:boxtype="h">
345      <!-- the block that is used to do the actual search -->      <!-- the block that is used to do the actual search -->
346      <block name="neb:$block_name" datasource="neb:$ds_name">      <block name="neb:$block_name" datasource="neb:$ds_name">
# Line 326  $cond_field => '' Line 355  $cond_field => ''
355  <neb:Block>}</neb:Block>                              <neb:Block>}</neb:Block>                            
356      </block>      </block>
357    </lam:box>    </lam:box>
358    <neb:Block>}</neb:Block>
359  </lam:box>  </lam:box>
360    
361    <neb:Block>if (!$search_trigger) {</neb:Block>
362  <!-- the trigger that shows values given id -->  <!-- the trigger that shows values given id -->
363  <trigger name="neb:qq(${object}ForId)" type="NAMED">  <trigger name="neb:qq(${object}ForId)" type="NAMED">
364    if str(<neb:Inline>qq($target_block.$id_entry)</neb:Inline>)!='':    if str(<neb:Inline>qq($target_block.$id_entry)</neb:Inline>)!='':
# Line 348  $cond_field => '' Line 379  $cond_field => ''
379      <neb:Block>}</neb:Block>      <neb:Block>}</neb:Block>
380      <neb:Inline>qq($target_block.$name_entry)</neb:Inline>= ''      <neb:Inline>qq($target_block.$name_entry)</neb:Inline>= ''
381  </trigger>  </trigger>
382    <neb:Block>}</neb:Block>

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

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