version 1.19, 2010/08/24 10:47:37
|
version 1.22, 2010/08/24 12:34:32
|
Line 42 class MpdlXmlTextServer(SimpleItem):
|
Line 42 class MpdlXmlTextServer(SimpleItem):
|
"""get search list""" |
"""get search list""" |
docpath = docinfo['textURLPath'] |
docpath = docinfo['textURLPath'] |
url = docinfo['url'] |
url = docinfo['url'] |
logging.debug("documentViewer (gettoc) docpath: %s"%(docpath)) |
#logging.debug("documentViewer (gettoc) docpath: %s"%(docpath)) |
logging.debug("documentViewer (gettoc) url: %s"%(url)) |
#logging.debug("documentViewer (gettoc) url: %s"%(url)) |
pagesize = pageinfo['queryPageSize'] |
pagesize = pageinfo['queryPageSize'] |
pn = pageinfo['searchPN'] |
pn = pageinfo['searchPN'] |
sn = pageinfo['sn'] |
sn = pageinfo['sn'] |
Line 137 class MpdlXmlTextServer(SimpleItem):
|
Line 137 class MpdlXmlTextServer(SimpleItem):
|
url = docinfo['url'] |
url = docinfo['url'] |
viewMode= pageinfo['viewMode'] |
viewMode= pageinfo['viewMode'] |
tocMode = pageinfo['tocMode'] |
tocMode = pageinfo['tocMode'] |
#characterNormalization = pageinfo ['characterNormalization'] |
characterNormalization=pageinfo['characterNormalization'] |
tocPN = pageinfo['tocPN'] |
tocPN = pageinfo['tocPN'] |
selfurl = self.absolute_url() |
selfurl = self.absolute_url() |
if mode == "text_dict": |
if mode == "text_dict": |
Line 165 class MpdlXmlTextServer(SimpleItem):
|
Line 165 class MpdlXmlTextServer(SimpleItem):
|
if hrefNode: |
if hrefNode: |
href= hrefNode.nodeValue |
href= hrefNode.nodeValue |
if href.startswith('#note-'): |
if href.startswith('#note-'): |
hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn)) |
hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s&characterNormalization=%s#note-"%(url,viewMode,tocMode,tocPN,pn,characterNormalization)) |
return serializeNode(pagenode) |
return serializeNode(pagenode) |
if mode == "xml": |
if mode == "xml": |
# first div contains text |
# first div contains text |
Line 253 class MpdlXmlTextServer(SimpleItem):
|
Line 253 class MpdlXmlTextServer(SimpleItem):
|
numdivs = pagedom.xpath("//div[@class='queryResultHits']") |
numdivs = pagedom.xpath("//div[@class='queryResultHits']") |
tocSearch = int(getTextFromNode(numdivs[0])) |
tocSearch = int(getTextFromNode(numdivs[0])) |
tc=int((tocSearch/10)+1) |
tc=int((tocSearch/10)+1) |
logging.debug("documentViewer (gettoc) tc: %s"%(tc)) |
#logging.debug("documentViewer (gettoc) tc: %s"%(tc)) |
return tc |
return tc |
|
|
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": |
if mode == "none": |
return docinfo |
return docinfo |
if 'tocSize_%s'%mode in docinfo: |
if 'tocSize_%s'%mode in docinfo: |
Line 302 class MpdlXmlTextServer(SimpleItem):
|
Line 302 class MpdlXmlTextServer(SimpleItem):
|
url = docinfo['url'] |
url = docinfo['url'] |
selfurl = self.absolute_url() |
selfurl = self.absolute_url() |
viewMode= pageinfo['viewMode'] |
viewMode= pageinfo['viewMode'] |
#characterNormalization =pageinfo ['characterNormalization'] |
characterNormalization =pageinfo['characterNormalization'] |
tocMode = pageinfo['tocMode'] |
tocMode = pageinfo['tocMode'] |
tocPN = pageinfo['tocPN'] |
tocPN = pageinfo['tocPN'] |
|
|
data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType, pagesize, pn)) |
data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType, pagesize, pn)) |
page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s'%(selfurl,url, viewMode, tocMode, tocPN)) |
page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&characterNormalization=%s'%(selfurl,url, viewMode, tocMode, tocPN,characterNormalization)) |
text = page.replace('mode=image','mode=texttool') |
text = page.replace('mode=image','mode=texttool') |
#logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization)) |
logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization)) |
#logging.debug("documentViewer (characterNormalization) text: %s"%(text)) |
#logging.debug("documentViewer (characterNormalization) text: %s"%(text)) |
return text |
return text |
|
|