|
|
| version 1.175.2.26, 2011/08/15 19:09:08 | version 1.175.2.27, 2011/08/16 16:27:08 |
|---|---|
| Line 555 class documentViewer(Folder): | Line 555 class documentViewer(Folder): |
| # override image path from texttool with url | # override image path from texttool with url |
| docinfo['imagePath'] = url.replace('/mpiwg/online/', '', 1) | docinfo['imagePath'] = url.replace('/mpiwg/online/', '', 1) |
| # number of images from digilib | # number of images from digilib |
| if docinfo.get('imagePath', None): | if docinfo.get('imagePath', None): |
| docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + docinfo['imagePath'] | docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + docinfo['imagePath'] |
| Line 786 class documentViewer(Folder): | Line 784 class documentViewer(Folder): |
| return pageinfo | return pageinfo |
| def getPageBatch(self, start=None, rows=None, cols=None, pageFlowLtr=True, pageZero=False, minIdx=1, maxIdx=0): | def getPageBatch(self, start=1, rows=10, cols=2, pageFlowLtr=True, pageZero=False, minIdx=1, maxIdx=0): |
| """returns dict with array of page informations for one screenfull of thumbnails""" | """returns dict with array of page informations for one screenfull of thumbnails""" |
| batch = {} | |
| grpsize = rows * cols | grpsize = rows * cols |
| if maxIdx == 0: | if maxIdx == 0: |
| maxIdx = start + grpsize | maxIdx = start + grpsize |
| nb = int(math.ceil(maxIdx / float(grpsize))) | |
| # list of all batch start and end points | |
| batches = [] | |
| if pageZero: | |
| ofs = 0 | |
| else: | |
| ofs = 1 | |
| for i in range(nb): | |
| s = i * grpsize + ofs | |
| e = min((i + 1) * grpsize + ofs - 1, maxIdx) | |
| batches.append({'start':s, 'end':e}) | |
| batch['batches'] = batches | |
| pages = [] | pages = [] |
| if pageZero and start == 1: | if pageZero and start == 1: |
| # correct beginning | # correct beginning |
| Line 815 class documentViewer(Folder): | Line 829 class documentViewer(Folder): |
| pages.append(row) | pages.append(row) |
| batch = {} | |
| if start > 1: | if start > 1: |
| batch['prevStart'] = max(start - grpsize, 1) | batch['prevStart'] = max(start - grpsize, 1) |
| else: | else: |
| Line 827 class documentViewer(Folder): | Line 840 class documentViewer(Folder): |
| batch['nextStart'] = None | batch['nextStart'] = None |
| batch['pages'] = pages | batch['pages'] = pages |
| #logging.debug("getPageList returns=%s"%(batch)) | return batch |
| def getBatch(self, start=1, size=10, end=0, data=None, fullData=True): | |
| """returns dict with information for one screenfull of data.""" | |
| batch = {} | |
| if end == 0: | |
| end = start + size | |
| nb = int(math.ceil(end / float(size))) | |
| # list of all batch start and end points | |
| batches = [] | |
| for i in range(nb): | |
| s = i * size + 1 | |
| e = min((i + 1) * size, end) | |
| batches.append({'start':s, 'end':e}) | |
| batch['batches'] = batches | |
| # list of elements in this batch | |
| this = [] | |
| j = 0 | |
| for i in range(start, min(start+size, end)): | |
| if data: | |
| if fullData: | |
| d = data[i] | |
| else: | |
| d = data[j] | |
| j += 1 | |
| else: | |
| d = i+1 | |
| this.append(d) | |
| batch['this'] = this | |
| if start > 1: | |
| batch['prevStart'] = max(start - size, 1) | |
| else: | |
| batch['prevStart'] = None | |
| if start + size < end: | |
| batch['nextStart'] = start + size | |
| else: | |
| batch['nextStart'] = None | |
| return batch | return batch |