Changeset 415:b93a2e5d5506 in documentViewer
- Timestamp:
- Dec 23, 2010, 4:12:23 PM (14 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MpdlXmlTextServer.py
r414 r415 121 121 def getNumTextPages (self, docinfo=None): 122 122 """get list of pages from fulltext (texts without images) and put in docinfo""" 123 logging.debug("getNumTextPages") 123 124 docpath = docinfo['textURLPath'] 124 125 selfurl = self.absolute_url() … … 138 139 def getTocEntries (self, docinfo=None): 139 140 """ number of text entries""" 140 docpath = docinfo['textURLPath'] 141 selfurl = self.absolute_url() 142 if 'tocEntries' in docinfo: 143 # allredy there 144 return docinfo['tocEntries'] 145 if (docpath!=None): 146 text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath'])) 147 dom =Parse(text) 148 pagedivs = dom.xpath("//div[@class='countTocEntries']") 149 #logging.debug ("pagedivs=%s"%(pagedivs)) 150 docinfo['tocEntries'] = getTextFromNode(pagedivs[0]) 151 #tc = int (originalPage) 152 return docinfo['tocEntries'] 141 self.getInfoFromPage(docinfo) 142 return docinfo['tocEntries'] 153 143 154 144 def getFigureEntries (self, docinfo=None): 155 145 """ number of figure entries""" 156 docpath = docinfo['textURLPath'] 157 selfurl = self.absolute_url() 158 if 'figureEntries' in docinfo: 159 # allredy there 160 return docinfo['figureEntries'] 161 if (docpath!=None): 162 text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath'])) 163 dom = Parse(text) 164 pagedivs = dom.xpath("//div[@class='countFigureEntries']") 165 #logging.debug ("pagedivs=%s"%(pagedivs)) 166 docinfo['figureEntries'] = getTextFromNode(pagedivs[0]) 167 #tc = int (docinfo['figureEntries']) 168 return docinfo['figureEntries'] 146 self.getInfoFromPage(docinfo) 147 return docinfo['figureEntries'] 169 148 170 149 def getGisPlaces(self, docinfo=None, pageinfo=None): … … 231 210 def getAllPlaces (self, docinfo=None): 232 211 """Show all Places if no places than 0""" 233 docpath = docinfo['textURLPath'] 234 selfurl = self.absolute_url() 212 self.getInfoFromPage(docinfo) 213 return docinfo['allPlaces'] 214 215 def getInfoFromPage(self, docinfo=None): 216 """ extract diverse info from page-fragment""" 217 docpath = docinfo['textURLPath'] 235 218 if 'allPlaces' in docinfo: 236 219 # allredy there 237 return docinfo['allPlaces'] 238 239 text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath'])) 240 dom =Parse(text) 241 pagedivs = dom.xpath("//div[@class='countPlaces']") 242 logging.debug ("pagedivs=%s"%(pagedivs)) 243 if len(pagedivs)>0: 220 return docinfo 221 222 if (docpath is not None): 223 text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath'])) 224 dom = Parse(text) 225 # figureEntries 226 pagedivs = dom.xpath("//div[@class='countFigureEntries']") 227 docinfo['figureEntries'] = getTextFromNode(pagedivs[0]) 228 # tocEntries 229 pagedivs = dom.xpath("//div[@class='countTocEntries']") 230 docinfo['tocEntries'] = getTextFromNode(pagedivs[0]) 231 # allPlaces 232 pagedivs = dom.xpath("//div[@class='countPlaces']") 244 233 docinfo['allPlaces']= getTextFromNode(pagedivs[0]) 245 #logging.debug ("docinfo['allPlaces']=%s"%(docinfo['allPlaces'])) 246 return docinfo['allPlaces'] 234 235 return docinfo 236 247 237 248 238 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):
Note: See TracChangeset
for help on using the changeset viewer.