version 1.60, 2010/05/21 14:29:17
|
version 1.68, 2010/06/09 10:29:33
|
Line 195 class documentViewer(Folder):
|
Line 195 class documentViewer(Folder):
|
# get table of contents |
# get table of contents |
docinfo = self.getToc(mode=tocMode, docinfo=docinfo) |
docinfo = self.getToc(mode=tocMode, docinfo=docinfo) |
|
|
pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo,viewMode=viewMode,tocMode=tocMode) |
|
|
|
if viewMode=="auto": # automodus gewaehlt |
if viewMode=="auto": # automodus gewaehlt |
if docinfo.get("textURL",''): #texturl gesetzt und textViewer konfiguriert |
if docinfo.get("textURL",''): #texturl gesetzt und textViewer konfiguriert |
viewMode="text" |
viewMode="text_dict" |
else: |
else: |
viewMode="images" |
viewMode="images" |
|
|
|
pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo,viewMode=viewMode,tocMode=tocMode) |
|
|
pt = getattr(self.template, 'viewer_main') |
pt = getattr(self.template, 'viewer_main') |
return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode,mk=self.generateMarks(mk)) |
return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode,mk=self.generateMarks(mk)) |
|
|
Line 222 class documentViewer(Folder):
|
Line 222 class documentViewer(Folder):
|
url = self.template.zogilib.getDLBaseUrl() |
url = self.template.zogilib.getDLBaseUrl() |
return url |
return url |
|
|
|
def getDocumentViewerURL(self): |
|
"""returns the URL of this instance""" |
|
return self.absolute_url() |
|
|
def getStyle(self, idx, selected, style=""): |
def getStyle(self, idx, selected, style=""): |
"""returns a string with the given style and append 'sel' if path == selected.""" |
"""returns a string with the given style and append 'sel' if path == selected.""" |
#logger("documentViewer (getstyle)", logging.INFO, "idx: %s selected: %s style: %s"%(idx,selected,style)) |
#logger("documentViewer (getstyle)", logging.INFO, "idx: %s selected: %s style: %s"%(idx,selected,style)) |
Line 725 class documentViewer(Folder):
|
Line 729 class documentViewer(Folder):
|
|
|
if (queryType=="fulltextMorph"): |
if (queryType=="fulltextMorph"): |
pagedivs = pagedom.xpath("//div[@class='queryResult']") |
pagedivs = pagedom.xpath("//div[@class='queryResult']") |
|
|
if len(pagedivs)>0: |
if len(pagedivs)>0: |
pagenode=pagedivs[0] |
pagenode=pagedivs[0] |
links=pagenode.xpath("//a") |
links=pagenode.xpath("//a") |
Line 738 class documentViewer(Folder):
|
Line 741 class documentViewer(Folder):
|
pagexml=href.replace('mode=text','mode=texttool&viewMode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&tocMode=%s&searchPN=%s&tocPN=%s'%(viewMode,queryType,query,pagesize,pn,tocMode,pn,tocPN)) |
pagexml=href.replace('mode=text','mode=texttool&viewMode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&tocMode=%s&searchPN=%s&tocPN=%s'%(viewMode,queryType,query,pagesize,pn,tocMode,pn,tocPN)) |
hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) |
hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) |
if href.startswith('../lt/lemma.xql'): |
if href.startswith('../lt/lemma.xql'): |
selfurl = self.absolute_url() |
|
hrefNode.nodeValue = href.replace('..lt/lemma.xql','%s/template/head_main_lemma'%selfurl) |
hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma'%selfurl) |
l.setAttributeNS(None, 'target', '_blank') |
l.setAttributeNS(None, 'target', '_blank') |
l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") |
l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") |
l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') |
l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') |
|
pagedivs = pagedom.xpath("//div[@class='queryResultMorphExpansion']") |
return serializeNode(pagenode) |
return serializeNode(pagenode) |
|
|
if (queryType=="ftIndex")or(queryType=="ftIndexMorph"): |
if (queryType=="ftIndex")or(queryType=="ftIndexMorph"): |
Line 777 class documentViewer(Folder):
|
Line 781 class documentViewer(Folder):
|
docinfo['numPages'] = text.count("<pb ") |
docinfo['numPages'] = text.count("<pb ") |
return docinfo |
return docinfo |
|
|
def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None): |
def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None, tocMode=None, tocPN=None): |
"""returns single page from fulltext""" |
"""returns single page from fulltext""" |
docpath = docinfo['textURLPath'] |
docpath = docinfo['textURLPath'] |
path = docinfo['textURLPath'] |
path = docinfo['textURLPath'] |
Line 823 class documentViewer(Folder):
|
Line 827 class documentViewer(Folder):
|
if len(pagedivs) > 0: |
if len(pagedivs) > 0: |
pagenode = pagedivs[0] |
pagenode = pagedivs[0] |
return serializeNode(pagenode) |
return serializeNode(pagenode) |
|
if mode == "pureXml": |
|
# first div contains text |
|
pagedivs = pagedom.xpath("/div") |
|
if len(pagedivs) > 0: |
|
pagenode = pagedivs[0] |
|
return serializeNode(pagenode) |
# text-with-links mode |
# text-with-links mode |
if mode == "text_dict": |
if mode == "text_dict": |
# first div contains text |
# first div contains text |
Line 894 class documentViewer(Folder):
|
Line 904 class documentViewer(Folder):
|
def getToc(self, mode="text", docinfo=None): |
def getToc(self, mode="text", docinfo=None): |
"""loads table of contents and stores in docinfo""" |
"""loads table of contents and stores in docinfo""" |
logging.debug("documentViewer (gettoc) mode: %s"%(mode)) |
logging.debug("documentViewer (gettoc) mode: %s"%(mode)) |
|
if mode == "none": |
|
return docinfo |
|
|
if 'tocSize_%s'%mode in docinfo: |
if 'tocSize_%s'%mode in docinfo: |
# cached toc |
# cached toc |
return docinfo |
return docinfo |
|
|
docpath = docinfo['textURLPath'] |
docpath = docinfo['textURLPath'] |
# we need to set a result set size |
# we need to set a result set size |
pagesize = 1000 |
pagesize = 1000 |
Line 956 class documentViewer(Folder):
|
Line 970 class documentViewer(Folder):
|
#else: |
#else: |
# return "No TOC!" |
# return "No TOC!" |
|
|
|
|
def changeDocumentViewer(self,title="",digilibBaseUrl=None,thumbrows=2,thumbcols=5,authgroups='mpiwg',RESPONSE=None): |
def changeDocumentViewer(self,title="",digilibBaseUrl=None,thumbrows=2,thumbcols=5,authgroups='mpiwg',RESPONSE=None): |
"""init document viewer""" |
"""init document viewer""" |
self.title=title |
self.title=title |