version 1.217, 2010/12/23 15:38:41
|
version 1.218, 2010/12/23 16:12:23
|
Line 120 class MpdlXmlTextServer(SimpleItem):
|
Line 120 class MpdlXmlTextServer(SimpleItem):
|
|
|
def getNumTextPages (self, docinfo=None): |
def getNumTextPages (self, docinfo=None): |
"""get list of pages from fulltext (texts without images) and put in docinfo""" |
"""get list of pages from fulltext (texts without images) and put in docinfo""" |
|
logging.debug("getNumTextPages") |
docpath = docinfo['textURLPath'] |
docpath = docinfo['textURLPath'] |
selfurl = self.absolute_url() |
selfurl = self.absolute_url() |
#viewMode= pageinfo['viewMode'] |
#viewMode= pageinfo['viewMode'] |
Line 137 class MpdlXmlTextServer(SimpleItem):
|
Line 138 class MpdlXmlTextServer(SimpleItem):
|
|
|
def getTocEntries (self, docinfo=None): |
def getTocEntries (self, docinfo=None): |
""" number of text entries""" |
""" number of text entries""" |
docpath = docinfo['textURLPath'] |
self.getInfoFromPage(docinfo) |
selfurl = self.absolute_url() |
|
if 'tocEntries' in docinfo: |
|
# allredy there |
|
return docinfo['tocEntries'] |
|
if (docpath!=None): |
|
text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath'])) |
|
dom =Parse(text) |
|
pagedivs = dom.xpath("//div[@class='countTocEntries']") |
|
#logging.debug ("pagedivs=%s"%(pagedivs)) |
|
docinfo['tocEntries'] = getTextFromNode(pagedivs[0]) |
|
#tc = int (originalPage) |
|
return docinfo['tocEntries'] |
return docinfo['tocEntries'] |
|
|
def getFigureEntries (self, docinfo=None): |
def getFigureEntries (self, docinfo=None): |
""" number of figure entries""" |
""" number of figure entries""" |
docpath = docinfo['textURLPath'] |
self.getInfoFromPage(docinfo) |
selfurl = self.absolute_url() |
|
if 'figureEntries' in docinfo: |
|
# allredy there |
|
return docinfo['figureEntries'] |
|
if (docpath!=None): |
|
text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath'])) |
|
dom = Parse(text) |
|
pagedivs = dom.xpath("//div[@class='countFigureEntries']") |
|
#logging.debug ("pagedivs=%s"%(pagedivs)) |
|
docinfo['figureEntries'] = getTextFromNode(pagedivs[0]) |
|
#tc = int (docinfo['figureEntries']) |
|
return docinfo['figureEntries'] |
return docinfo['figureEntries'] |
|
|
def getGisPlaces(self, docinfo=None, pageinfo=None): |
def getGisPlaces(self, docinfo=None, pageinfo=None): |
Line 230 class MpdlXmlTextServer(SimpleItem):
|
Line 209 class MpdlXmlTextServer(SimpleItem):
|
|
|
def getAllPlaces (self, docinfo=None): |
def getAllPlaces (self, docinfo=None): |
"""Show all Places if no places than 0""" |
"""Show all Places if no places than 0""" |
|
self.getInfoFromPage(docinfo) |
|
return docinfo['allPlaces'] |
|
|
|
def getInfoFromPage(self, docinfo=None): |
|
""" extract diverse info from page-fragment""" |
docpath = docinfo['textURLPath'] |
docpath = docinfo['textURLPath'] |
selfurl = self.absolute_url() |
|
if 'allPlaces' in docinfo: |
if 'allPlaces' in docinfo: |
# allredy there |
# allredy there |
return docinfo['allPlaces'] |
return docinfo |
|
|
|
if (docpath is not None): |
text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath'])) |
text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath'])) |
dom =Parse(text) |
dom =Parse(text) |
|
# figureEntries |
|
pagedivs = dom.xpath("//div[@class='countFigureEntries']") |
|
docinfo['figureEntries'] = getTextFromNode(pagedivs[0]) |
|
# tocEntries |
|
pagedivs = dom.xpath("//div[@class='countTocEntries']") |
|
docinfo['tocEntries'] = getTextFromNode(pagedivs[0]) |
|
# allPlaces |
pagedivs = dom.xpath("//div[@class='countPlaces']") |
pagedivs = dom.xpath("//div[@class='countPlaces']") |
logging.debug ("pagedivs=%s"%(pagedivs)) |
|
if len(pagedivs)>0: |
|
docinfo['allPlaces']= getTextFromNode(pagedivs[0]) |
docinfo['allPlaces']= getTextFromNode(pagedivs[0]) |
#logging.debug ("docinfo['allPlaces']=%s"%(docinfo['allPlaces'])) |
|
return docinfo['allPlaces'] |
return docinfo |
|
|
|
|
def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization="reg", highlightQuery=None, sn=None, optionToggle=None): |
def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization="reg", highlightQuery=None, sn=None, optionToggle=None): |
"""returns single page from fulltext""" |
"""returns single page from fulltext""" |