Diff for /documentViewer/documentViewer.py between versions 1.173 and 1.178

version 1.173, 2011/04/28 09:58:39 version 1.178, 2012/01/04 07:38:17
Line 595  class documentViewer(Folder): Line 595  class documentViewer(Folder):
                   
     def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None,cut=0):      def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None,cut=0):
         """gets bibliographical info from the index.meta file at path or given by dom"""          """gets bibliographical info from the index.meta file at path or given by dom"""
         logging.debug("documentViewer (getbibinfofromindexmeta) path: %s"%(path))          #logging.debug("documentViewer (getbibinfofromindexmeta) path: %s"%(path))
                   
         if docinfo is None:          if docinfo is None:
             docinfo = {}              docinfo = {}
Line 607  class documentViewer(Folder): Line 607  class documentViewer(Folder):
                   
         docinfo['indexMetaPath']=self.getIndexMetaPath(path);          docinfo['indexMetaPath']=self.getIndexMetaPath(path);
                   
         logging.debug("documentViewer (getbibinfofromindexmeta cutted) path: %s"%(path))          #logging.debug("documentViewer (getbibinfofromindexmeta cutted) path: %s"%(path))
         # put in all raw bib fields as dict "bib"          # put in all raw bib fields as dict "bib"
         bib = dom.xpath("//bib/*")          bib = dom.xpath("//bib/*")
         if bib and len(bib)>0:          if bib and len(bib)>0:
Line 627  class documentViewer(Folder): Line 627  class documentViewer(Folder):
         bibtype=bibtype.replace("-"," ") # wrong typesiin index meta "-" instead of " " (not wrong! ROC)          bibtype=bibtype.replace("-"," ") # wrong typesiin index meta "-" instead of " " (not wrong! ROC)
         docinfo['bib_type'] = bibtype          docinfo['bib_type'] = bibtype
         bibmap=metaData.generateMappingForType(bibtype)          bibmap=metaData.generateMappingForType(bibtype)
         logging.debug("documentViewer (getbibinfofromindexmeta) bibmap:"+repr(bibmap))          #logging.debug("documentViewer (getbibinfofromindexmeta) bibmap:"+repr(bibmap))
         logging.debug("documentViewer (getbibinfofromindexmeta) bibtype:"+repr(bibtype))          #logging.debug("documentViewer (getbibinfofromindexmeta) bibtype:"+repr(bibtype))
         # if there is no mapping bibmap is empty (mapping sometimes has empty fields)          # if there is no mapping bibmap is empty (mapping sometimes has empty fields)
         if len(bibmap) > 0 and len(bibmap['author'][0]) > 0:          if len(bibmap) > 0 and len(bibmap['author'][0]) > 0:
             try:              try:
Line 640  class documentViewer(Folder): Line 640  class documentViewer(Folder):
             try:              try:
                 docinfo['year']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['year'][0])[0])                  docinfo['year']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['year'][0])[0])
             except: pass              except: pass
             logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype)              #logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype)
             try:              try:
                 docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0])                  docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0])
             except:              except:
Line 685  class documentViewer(Folder): Line 685  class documentViewer(Folder):
                 docinfo['isbn_issn']=getTextFromNode(dom.xpath("//bib/isbn_issn")[0])                  docinfo['isbn_issn']=getTextFromNode(dom.xpath("//bib/isbn_issn")[0])
             except:              except:
                 docinfo['isbn_issn']=''                             docinfo['isbn_issn']=''           
           #logging.debug("I NEED BIBTEX %s"%docinfo)
         return docinfo          return docinfo
           
             
Line 777  class documentViewer(Folder): Line 778  class documentViewer(Folder):
                           
             docinfo['textURL'] = textUrl              docinfo['textURL'] = textUrl
           
   
               #TODO: hack-DW for annalen
               if (textUrl is not None) and (textUrl.startswith("/permanent/einstein/annalen")):
                   textUrl=textUrl.replace("/permanent/einstein/annalen/","/diverse/de/") 
                   splitted=textUrl.split("/fulltext")
                   textUrl=splitted[0]+".xml"
                   textUrlkurz = string.split(textUrl, ".")[0]
                   docinfo['textURLPathkurz'] = textUrlkurz
                   docinfo['textURLPath'] = textUrl
                   logging.debug("hack")
                   logging.debug(textUrl)
               
               
         # new style text-url-path          # new style text-url-path
         textUrls = dom.xpath("//texttool/text-url-path")          textUrls = dom.xpath("//texttool/text-url-path")
         if textUrls and (len(textUrls) > 0):          if textUrls and (len(textUrls) > 0):
Line 791  class documentViewer(Folder): Line 805  class documentViewer(Folder):
                     
         presentationUrls = dom.xpath("//texttool/presentation")          presentationUrls = dom.xpath("//texttool/presentation")
         docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom)   # get info von bib tag          docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom)   # get info von bib tag
           #docinfo = self.getDownloadfromDocinfoToBibtex(url, docinfo=docinfo, dom=dom)
         docinfo = self.getNameFromIndexMeta(url, docinfo=docinfo, dom=dom)          docinfo = self.getNameFromIndexMeta(url, docinfo=docinfo, dom=dom)
                   
                   
Line 846  class documentViewer(Folder): Line 861  class documentViewer(Folder):
                   
         #path ist the path to the images it assumes that the index.meta file is one level higher.          #path ist the path to the images it assumes that the index.meta file is one level higher.
         docinfo = self.getBibinfoFromIndexMeta(pathorig,docinfo=docinfo,cut=cut+1)          docinfo = self.getBibinfoFromIndexMeta(pathorig,docinfo=docinfo,cut=cut+1)
           #docinfo = self.getDownloadfromDocinfoToBibtex(pathorig,docinfo=docinfo,cut=cut+1)
         docinfo = self.getAuthinfoFromIndexMeta(pathorig,docinfo=docinfo,cut=cut+1)          docinfo = self.getAuthinfoFromIndexMeta(pathorig,docinfo=docinfo,cut=cut+1)
         return docinfo          return docinfo
           
Line 906  class documentViewer(Folder): Line 922  class documentViewer(Folder):
         pageinfo['viewMode'] = viewMode          pageinfo['viewMode'] = viewMode
         pageinfo['tocMode'] = tocMode          pageinfo['tocMode'] = tocMode
         pageinfo['characterNormalization'] = self.REQUEST.get('characterNormalization','reg')          pageinfo['characterNormalization'] = self.REQUEST.get('characterNormalization','reg')
         pageinfo['optionToggle'] = self.REQUEST.get('optionToggle','1')          #pageinfo['optionToggle'] = self.REQUEST.get('optionToggle','1')
         pageinfo['query'] = self.REQUEST.get('query','')           pageinfo['query'] = self.REQUEST.get('query','') 
         pageinfo['queryType'] = self.REQUEST.get('queryType','')          pageinfo['queryType'] = self.REQUEST.get('queryType','')
         pageinfo['querySearch'] =self.REQUEST.get('querySearch', 'fulltext')          pageinfo['querySearch'] =self.REQUEST.get('querySearch', 'fulltext')
         pageinfo['textPN'] = self.REQUEST.get('textPN','1')          pageinfo['textPN'] = self.REQUEST.get('textPN','1')
         pageinfo['highlightQuery'] = self.REQUEST.get('highlightQuery','')          pageinfo['highlightQuery'] = self.REQUEST.get('highlightQuery','')
           
           pageinfo ['highlightElementPos'] = self.REQUEST.get('highlightElementPos','')
           pageinfo ['highlightElement'] = self.REQUEST.get('highlightElement','')
           
           pageinfo ['xpointer'] = self.REQUEST.get('xpointer','')
           
         pageinfo['tocPageSize'] = self.REQUEST.get('tocPageSize', '30')          pageinfo['tocPageSize'] = self.REQUEST.get('tocPageSize', '30')
         pageinfo['queryPageSize'] =self.REQUEST.get('queryPageSize', '10')          pageinfo['queryPageSize'] =self.REQUEST.get('queryPageSize', '10')
         pageinfo['tocPN'] = self.REQUEST.get('tocPN', '1')               pageinfo['tocPN'] = self.REQUEST.get('tocPN', '1')     
Line 928  class documentViewer(Folder): Line 950  class documentViewer(Folder):
                 tocPages=tocSize/tocPageSize                  tocPages=tocSize/tocPageSize
             pageinfo['tocPN'] = min (tocPages,toc)                                  pageinfo['tocPN'] = min (tocPages,toc)                    
         pageinfo['searchPN'] =self.REQUEST.get('searchPN','1')          pageinfo['searchPN'] =self.REQUEST.get('searchPN','1')
         pageinfo['sn'] =self.REQUEST.get('sn','')          #pageinfo['sn'] =self.REQUEST.get('sn','')
           pageinfo['s'] =self.REQUEST.get('s','')
         return pageinfo          return pageinfo
           
 def changeDocumentViewer(self,title="",digilibBaseUrl=None,thumbrows=2,thumbcols=5,authgroups='mpiwg',RESPONSE=None):  def changeDocumentViewer(self,title="",digilibBaseUrl=None,thumbrows=2,thumbcols=5,authgroups='mpiwg',RESPONSE=None):

Removed from v.1.173  
changed lines
  Added in v.1.178


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>