version 1.204, 2010/11/03 14:59:05
|
version 1.205, 2010/11/08 15:04:06
|
Line 139 class MpdlXmlTextServer(SimpleItem):
|
Line 139 class MpdlXmlTextServer(SimpleItem):
|
docinfo['numPages']=int(getTextFromNode(result[0])) |
docinfo['numPages']=int(getTextFromNode(result[0])) |
return docinfo |
return docinfo |
|
|
#def getQueryResultHits(self, docinfo=None, pageinfo=None): |
|
|
|
|
|
def getGisPlaces(self, docinfo=None, pageinfo=None): |
def getGisPlaces(self, docinfo=None, pageinfo=None): |
""" Show all Gis Places of whole Page""" |
""" Show all Gis Places of whole Page""" |
xpath='//place' |
xpath='//place' |
Line 174 class MpdlXmlTextServer(SimpleItem):
|
Line 171 class MpdlXmlTextServer(SimpleItem):
|
text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'],xpath)) |
text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'],xpath)) |
dom =Parse(text) |
dom =Parse(text) |
result = dom.xpath("//result/resultPage/place") |
result = dom.xpath("//result/resultPage/place") |
|
|
for l in result: |
for l in result: |
hrefNode = l.getAttributeNodeNS(None, u"id") |
hrefNode = l.getAttributeNodeNS(None, u"id") |
href= hrefNode.nodeValue |
href= hrefNode.nodeValue |
Line 356 class MpdlXmlTextServer(SimpleItem):
|
Line 354 class MpdlXmlTextServer(SimpleItem):
|
logging.debug("documentViewer (gettoc) tc: %s"%(tc)) |
logging.debug("documentViewer (gettoc) tc: %s"%(tc)) |
return tc |
return tc |
|
|
|
def getQueryResultHits(self, docinfo=None, pageinfo=None, query=None, queryType=None, pn=1, optionsClose=None): |
|
|
|
"""number of hits in Search mode""" |
|
docpath = docinfo['textURLPath'] |
|
pagesize = pageinfo['queryPageSize'] |
|
pn = pageinfo['searchPN'] |
|
query =pageinfo['query'] |
|
queryType =pageinfo['queryType'] |
|
tocSearch = 0 |
|
tocDiv = None |
|
|
|
pagexml = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath, 'text', queryType, urllib.quote(query), pagesize, pn)) |
|
#pagexml=self.template.fulltextclient.eval("/mpdl/interface/doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath, 'text', queryType, query, pagesize, pn) ,outputUnicode=False) |
|
pagedom = Parse(pagexml) |
|
numdivs = pagedom.xpath("//div[@class='queryResultHits']") |
|
tocSearch = int(getTextFromNode(numdivs[0])) |
|
return tocSearch |
|
|
|
def getQueryResultHitsText(self, docinfo=None, pageinfo=None): |
|
"""number of hits in Text of Contents mode""" |
|
|
|
docpath = docinfo['textURLPath'] |
|
pagesize = pageinfo['queryPageSize'] |
|
pn = pageinfo['searchPN'] |
|
query =pageinfo['query'] |
|
queryType =pageinfo['queryType'] |
|
tocSearch = 0 |
|
tocDiv = None |
|
tocMode = pageinfo['tocMode'] |
|
tocPN = pageinfo['tocPN'] |
|
pagexml=self.getServerData("doc-query.xql", "document=%s&queryType=%s"%(docpath,'toc')) |
|
pagedom = Parse(pagexml) |
|
logging.debug("documentViewer (pagedom) pagedom: %s"%(pagedom)) |
|
numdivs = pagedom.xpath("//div[@class='queryResultHits']") |
|
tocSearch = int(getTextFromNode(numdivs[0])) |
|
return tocSearch |
|
|
|
def getQueryResultHitsFigures(self, docinfo=None, pageinfo=None): |
|
"""number of hits in Text of Figures mode""" |
|
|
|
docpath = docinfo['textURLPath'] |
|
pagesize = pageinfo['queryPageSize'] |
|
pn = pageinfo['searchPN'] |
|
query =pageinfo['query'] |
|
queryType =pageinfo['queryType'] |
|
tocSearch = 0 |
|
tocDiv = None |
|
tocMode = pageinfo['tocMode'] |
|
tocPN = pageinfo['tocPN'] |
|
pagexml=self.getServerData("doc-query.xql", "document=%s&queryType=%s"%(docpath,'figures')) |
|
pagedom = Parse(pagexml) |
|
logging.debug("documentViewer (pagedom) pagedom: %s"%(pagedom)) |
|
numdivs = pagedom.xpath("//div[@class='queryResultHits']") |
|
tocSearch = int(getTextFromNode(numdivs[0])) |
|
return tocSearch |
|
|
|
|
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)) |