[Zope] <dtml-in>, batches and <dtml-unless previous-sequence-start-number>

Derek Basch dbasch@yahoo.com
Mon, 26 May 2003 22:25:23 -0700 (PDT)


Hello,

I am attempting to build a:

<<< 1 2 (3) 4 5 6 >>>

style batch record control using DTML. I have gotten everything working except for the links to
the first and last batches in the previous-batches and next-batches mapping sequences. <<< and >>>
respectively.

I am able to sucessfully test for previous-sequence-start-number in the affirmative (<dtml-if
p.s.s.n>). However, a test in the negative seems to be broken (<dtml-unless p.s.s.n>). Such as in
the snippet below. In other words, a hyperlink is inserted if I use <dtml-if> but not if I use
<dtml-unless>. 

Can anyone tell me what I am doing wrong or is this a broken feature?

<dtml-call "REQUEST.set('batch_number', 0)">

<dtml-in expr="SQL(q=q)" previous size=bat_size start=query_start>
  <dtml-in previous-batches mapping>
    <dtml-unless previous-sequence-start-number>
      <a href="<dtml-var document_id><dtml-var sequence-query>query_start=<dtml-var
batch-start-number>"><<<</a>
    </dtml-unless>    
    <dtml-call "REQUEST.set('current_batch_number', _['sequence-length'] + 1)">
    <dtml-call "REQUEST.set('batch_number', _.int(batch_number) + 1)"> 
    <dtml-unless sequence-start>
      ,
    </dtml-unless>
    <dtml-if expr="batch_number >= current_batch_number - 10">
      <a href="<dtml-var document_id><dtml-var sequence-query>query_start=<dtml-var
batch-start-number>"><dtml-var batch_number></a>
    </dtml-if>       
  </dtml-in>
</dtml-in>

<dtml-call "REQUEST.set('batch_number', _.int(batch_number) + 1)"> 
<dtml-call "REQUEST.set('current_batch_number', _.int(batch_number))">
<dtml-var current_batch_number>

<dtml-in expr="SQL(q=q)" next size=bat_size start=query_start>
  <dtml-in next-batches mapping>
    <dtml-unless next-sequence-start-number>
      <a href="<dtml-var document_id><dtml-var sequence-query>query_start=<dtml-var
batch-start-number>"><<<</a>
    </dtml-unless> 

    <dtml-call "REQUEST.set('batch_number', _.int(batch_number) + 1)">
    <dtml-unless sequence-start>
      ,
    </dtml-unless>
    <dtml-if expr="batch_number <= current_batch_number + 10">
      <a href="<dtml-var document_id><dtml-var sequence-query>query_start=<dtml-var
batch-start-number>"><dtml-var batch_number></a>
    </dtml-if>
  </dtml-in>
</dtml-in>

Thanks,
Derek Basch

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com