(self, list_selection_name, listbox_uid, uids=None, REQUEST=None)
return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
Access the last page of a list
Access the last page of a list
Access the last page of a list
def lastPage(self, list_selection_name, listbox_uid, uids=None, REQUEST=None):
      """
        Access the last page of a list
      """
      if uids is None: uids = []
      selection = self.getSelectionFor(list_selection_name, REQUEST)
      if selection is not None:
        params = selection.getParams()
        # XXX This will not work if the number of lines shown in the listbox is greater
        #       than the BIG_INT constan. Such a case has low probability but is not
        #       impossible. If you are in this case, send me a mail ! -- Kev
        BIG_INT = 10000000
        last_page_start = BIG_INT
        total_lines = int(params.get('total_size', BIG_INT))
        if total_lines != BIG_INT:
          lines_per_page  = int(params.get('list_lines', 1))
          if total_lines % lines_per_page:
            # Example: if we have 105 documents and display 40 per line,
            # it is 105 // 40 * 40 = 80
            last_page_start = total_lines // lines_per_page * lines_per_page
          else:
            # Example; if we have 120 documents and display 40 per line,
            # it is 120 // (40 - 1) * 40 = 80
            last_page_start = (total_lines // lines_per_page - 1) * lines_per_page
        params['list_start'] = last_page_start
        selection.edit(params=params)
      self.uncheckAll(list_selection_name, listbox_uid)
      return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
def lastPage ( self , list_selection_name , listbox_uid , uids = None , REQUEST = None ) : if uids is None : uids = [ ] selection = self . getSelectionFor ( list_selection_name , REQUEST ) if selection is not None : params = selection . getParams ( ) # XXX This will not work if the number of lines shown in the listbox is greater #       than the BIG_INT constan. Such a case has low probability but is not #       impossible. If you are in this case, send me a mail ! -- Kev BIG_INT = 10000000 last_page_start = BIG_INT total_lines = int ( params . get ( 'total_size' , BIG_INT ) ) if total_lines != BIG_INT : lines_per_page = int ( params . get ( 'list_lines' , 1 ) ) if total_lines % lines_per_page : # Example: if we have 105 documents and display 40 per line, # it is 105 // 40 * 40 = 80 last_page_start = total_lines // lines_per_page * lines_per_page else : # Example; if we have 120 documents and display 40 per line, # it is 120 // (40 - 1) * 40 = 80 last_page_start = ( total_lines // lines_per_page - 1 ) * lines_per_page params [ 'list_start' ] = last_page_start selection . edit ( params = params ) self . uncheckAll ( list_selection_name , listbox_uid ) return self . checkAll ( list_selection_name , uids , REQUEST = REQUEST )