Logo Search packages:      
Sourcecode: zope-cmfplone version File versions

def zope-cmfplone-2.0.4::PloneBatch::Batch::__init__ (   self,
  sequence,
  size,
  start = 0,
  end = 0,
  orphan = 0,
  overlap = 0,
  pagerange = 7,
  quantumleap = 0,
  b_start_str = 'b_start' 
)

Encapsulate sequence in batches of size
sequence    - the data to batch.
size        - the number of items in each batch. This will be computed if left out.
start       - the first element of sequence to include in batch (0-index)
end         - the last element of sequence to include in batch (0-index, optional)
orphan      - the next page will be combined with the current page if it does not contain more than orphan elements
overlap     - the number of overlapping elements in each batch
pagerange   - the number of pages to display in the navigation
quantumleap - 0 or 1 to indicate if bigger increments should be used in the navigation list for big results.
b_start_str - the request variable used for start, default 'b_start'

Definition at line 39 of file PloneBatch.py.

00039                                                                                                                                :
        """ Encapsulate sequence in batches of size
        sequence    - the data to batch.
        size        - the number of items in each batch. This will be computed if left out.
        start       - the first element of sequence to include in batch (0-index)
        end         - the last element of sequence to include in batch (0-index, optional)
        orphan      - the next page will be combined with the current page if it does not contain more than orphan elements
        overlap     - the number of overlapping elements in each batch
        pagerange   - the number of pages to display in the navigation
        quantumleap - 0 or 1 to indicate if bigger increments should be used in the navigation list for big results.
        b_start_str - the request variable used for start, default 'b_start'
        """
        start = start + 1

        start,end,sz = opt(start,end,size,orphan,sequence)

        self._sequence = sequence
        self.size = sz
        self._size = size
        self.start = start
        self.end = end
        self.orphan = orphan
        self.overlap = overlap
        self.first = max(start - 1, 0)
        self.length = self.end - self.first

        self.b_start_str = b_start_str

        self.last = self.sequence_length - size

        # Set up next and previous
        if self.first == 0:
            self.previous = None

        # Set up the total number of pages
        self.numpages = calculate_pagenumber(self.sequence_length - self.orphan, self.size, self.overlap)

        # Set up the current page number
        self.pagenumber = calculate_pagenumber(self.start, self.size, self.overlap)

        # Set up pagerange for the navigation quick links
        self.pagerange, self.pagerangestart, self.pagerangeend = calculate_pagerange(self.pagenumber,self.numpages,pagerange)

        # Set up the lists for the navigation: 4 5 [6] 7 8
        #  navlist is the complete list, including pagenumber
        #  prevlist is the 4 5 in the example above
        #  nextlist is 7 8 in the example above
        self.navlist = self.prevlist = self.nextlist = []
        if self.pagerange and self.numpages >= 1:
            self.navlist  = range(self.pagerangestart, self.pagerangeend)
            self.prevlist = range(self.pagerangestart, self.pagenumber)
            self.nextlist = range(self.pagenumber + 1, self.pagerangeend)

        # QuantumLeap - faster navigation for big result sets
        self.quantumleap = quantumleap
        self.leapback = self.leapforward = []
        if self.quantumleap:
            self.leapback = calculate_leapback(self.pagenumber, self.numpages, self.pagerange)
            self.leapforward = calculate_leapforward(self.pagenumber, self.numpages, self.pagerange)

    def pageurl(self, formvariables, pagenumber=-1):


Generated by  Doxygen 1.6.0   Back to index