version 1.227, 2011/02/18 11:21:46
|
version 1.229, 2011/03/01 14:53:15
|
Line 130 class MpdlXmlTextServer(SimpleItem):
|
Line 130 class MpdlXmlTextServer(SimpleItem):
|
return serializeNode(pagenode) |
return serializeNode(pagenode) |
return "no text here" |
return "no text here" |
|
|
|
|
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 183 class MpdlXmlTextServer(SimpleItem):
|
Line 182 class MpdlXmlTextServer(SimpleItem):
|
url = docinfo.get('url',None) |
url = docinfo.get('url',None) |
name = docinfo.get('name',None) |
name = docinfo.get('name',None) |
pn =pageinfo['current'] |
pn =pageinfo['current'] |
#viewMode= pageinfo['viewMode'] |
|
|
|
sn = pageinfo['sn'] |
sn = pageinfo['sn'] |
highlightQuery = pageinfo['highlightQuery'] |
highlightQuery = pageinfo['highlightQuery'] |
#mode = pageinfo ['viewMode'] |
#mode = pageinfo ['viewMode'] |
Line 203 class MpdlXmlTextServer(SimpleItem):
|
Line 200 class MpdlXmlTextServer(SimpleItem):
|
|
|
pagexml = self.getServerData("page-fragment.xql",textParam) |
pagexml = self.getServerData("page-fragment.xql",textParam) |
dom = Parse(pagexml) |
dom = Parse(pagexml) |
|
|
#original Pages |
#original Pages |
pagedivs = dom.xpath("//div[@class='pageNumberOrig']") |
pagedivs = dom.xpath("//div[@class='pageNumberOrig']") |
if pagedivs == dom.xpath("//div[@class='pageNumberOrig']"): |
if pagedivs == dom.xpath("//div[@class='pageNumberOrig']"): |
if len(pagedivs)>0: |
if len(pagedivs)>0: |
docinfo['pageNumberOrig']= getTextFromNode(pagedivs[0]) |
docinfo['pageNumberOrig']= getTextFromNode(pagedivs[0]) |
logging.debug("ORIGINAL PAGES: %s"%(docinfo['pageNumberOrig'])) |
|
|
|
#original Pages Norm |
#original Pages Norm |
pagedivs = dom.xpath("//div[@class='pageNumberOrigNorm']") |
pagedivs = dom.xpath("//div[@class='pageNumberOrigNorm']") |
if pagedivs == dom.xpath("//div[@class='pageNumberOrigNorm']"): |
if pagedivs == dom.xpath("//div[@class='pageNumberOrigNorm']"): |
if len(pagedivs)>0: |
if len(pagedivs)>0: |
docinfo['pageNumberOrigNorm']= getTextFromNode(pagedivs[0]) |
docinfo['pageNumberOrigNorm']= getTextFromNode(pagedivs[0]) |
logging.debug("ORIGINAL PAGES: %s"%(docinfo['pageNumberOrigNorm'])) |
|
|
|
|
|
#figureEntries |
#figureEntries |
pagedivs = dom.xpath("//div[@class='countFigureEntries']") |
pagedivs = dom.xpath("//div[@class='countFigureEntries']") |
Line 228 class MpdlXmlTextServer(SimpleItem):
|
Line 221 class MpdlXmlTextServer(SimpleItem):
|
if s=='0': |
if s=='0': |
try: |
try: |
docinfo['countFigureEntries'] = int(s) |
docinfo['countFigureEntries'] = int(s) |
logging.debug("FIGURE ENTRIES: %s"%(s)) |
|
except: |
except: |
docinfo['countFigureEntries'] = 0 |
docinfo['countFigureEntries'] = 0 |
else: |
else: |
s1 = int(s)/30+1 |
s1 = int(s)/30+1 |
try: |
try: |
docinfo['countFigureEntries'] = int(s1) |
docinfo['countFigureEntries'] = int(s1) |
logging.debug("FIGURE ENTRIES: %s"%(s1)) |
|
except: |
except: |
docinfo['countFigureEntries'] = 0 |
docinfo['countFigureEntries'] = 0 |
|
|
Line 247 class MpdlXmlTextServer(SimpleItem):
|
Line 238 class MpdlXmlTextServer(SimpleItem):
|
s = getTextFromNode(pagedivs[0]) |
s = getTextFromNode(pagedivs[0]) |
try: |
try: |
docinfo['countPlaces'] = int(s) |
docinfo['countPlaces'] = int(s) |
logging.debug("PLACES HERE: %s"%(s)) |
|
except: |
except: |
docinfo['countPlaces'] = 0 |
docinfo['countPlaces'] = 0 |
|
|
Line 260 class MpdlXmlTextServer(SimpleItem):
|
Line 250 class MpdlXmlTextServer(SimpleItem):
|
if s=='0': |
if s=='0': |
try: |
try: |
docinfo['countTocEntries'] = int(s) |
docinfo['countTocEntries'] = int(s) |
logging.debug("TEXT ENTRIES: %s"%(s)) |
|
except: |
except: |
docinfo['countTocEntries'] = 0 |
docinfo['countTocEntries'] = 0 |
else: |
else: |
s1 = int(s)/30+1 |
s1 = int(s)/30+1 |
try: |
try: |
docinfo['countTocEntries'] = int(s1) |
docinfo['countTocEntries'] = int(s1) |
logging.debug("TEXT ENTRIES: %s"%(s1)) |
|
except: |
except: |
docinfo['countTocEntries'] = 0 |
docinfo['countTocEntries'] = 0 |
|
|
Line 280 class MpdlXmlTextServer(SimpleItem):
|
Line 268 class MpdlXmlTextServer(SimpleItem):
|
|
|
try: |
try: |
docinfo['numPages'] = int(s) |
docinfo['numPages'] = int(s) |
logging.debug("PAGE NUMBER: %s"%(s)) |
#logging.debug("PAGE NUMBER: %s"%(s)) |
|
|
np = docinfo['numPages'] |
np = docinfo['numPages'] |
pageinfo['end'] = min(pageinfo['end'], np) |
pageinfo['end'] = min(pageinfo['end'], np) |
Line 303 class MpdlXmlTextServer(SimpleItem):
|
Line 291 class MpdlXmlTextServer(SimpleItem):
|
# plain text mode |
# plain text mode |
if mode == "text": |
if mode == "text": |
# first div contains text |
# first div contains text |
#mode = viewMode |
|
pagedivs = dom.xpath("/div") |
pagedivs = dom.xpath("/div") |
if len(pagedivs) > 0: |
if len(pagedivs) > 0: |
pagenode = pagedivs[0] |
pagenode = pagedivs[0] |
Line 408 class MpdlXmlTextServer(SimpleItem):
|
Line 395 class MpdlXmlTextServer(SimpleItem):
|
pagedom = Parse(pagexml) |
pagedom = Parse(pagexml) |
numdivs = pagedom.xpath("//div[@class='queryResultHits']") |
numdivs = pagedom.xpath("//div[@class='queryResultHits']") |
tocSearch = int(getTextFromNode(numdivs[0])) |
tocSearch = int(getTextFromNode(numdivs[0])) |
logging.debug("documentViewer (gettoc) tocSearch: %s"%(tocSearch)) |
|
tc=int((tocSearch/10)+1) |
tc=int((tocSearch/10)+1) |
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)) |
|
if mode == "none": |
if mode == "none": |
return docinfo |
return docinfo |
if 'tocSize_%s'%mode in docinfo: |
if 'tocSize_%s'%mode in docinfo: |
Line 467 class MpdlXmlTextServer(SimpleItem):
|
Line 451 class MpdlXmlTextServer(SimpleItem):
|
data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s&characterNormalization=regPlusNorm&optionToggle=1"%(docpath,queryType, pagesize, pn)) |
data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s&characterNormalization=regPlusNorm&optionToggle=1"%(docpath,queryType, pagesize, pn)) |
page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&optionToggle=1'%(selfurl,url, viewMode, tocMode, tocPN)) |
page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&optionToggle=1'%(selfurl,url, viewMode, tocMode, tocPN)) |
text = page.replace('mode=image','mode=texttool') |
text = page.replace('mode=image','mode=texttool') |
#logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization)) |
|
logging.debug("TEXT %s"%(text)) |
|
return text |
return text |
|
|
def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None): |
def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None): |