Changeset 608:0c6056271654 in documentViewer


Ignore:
Timestamp:
Dec 18, 2012, 6:26:22 PM (11 years ago)
Author:
casties
Branch:
default
Message:

show is-part-of relation in header.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • css/docuviewer.css

    r607 r608  
    4141        border: 1px solid silver;
    4242    padding: 0.5em; 
     43}
     44div.page-head div.title.part-of {
     45    border-top: none;
    4346}
    4447
  • documentViewer.py

    r607 r608  
    554554        if metaDom is not None and metaDom.tag == 'resource':
    555555            # document directory name and path
    556             resource = self.metadataService.getResourceData(dom=metaDom)
     556            resource = self.metadataService.getResourceData(dom=metaDom, recursive=1)
    557557            if resource:
    558558                docinfo = self.getDocinfoFromResource(docinfo, resource)
     
    643643        docinfo['maxPageNo'] = docinfo.get('maxPageNo', docinfo['numPages'])
    644644
     645        # part-of information
     646        partOfPath = docinfo.get('partOfPath', None)
     647        if partOfPath is not None:
     648            partOfDom = self.metadataService.getDomFromPathOrUrl(partOfPath)
     649            if partOfDom is not None:
     650                docinfo['partOfLabel'] = self.metadataService.getBibFormattedLabel(dom=partOfDom)
     651                docinfo['partOfUrl'] = "%s?url=%s"%(self.getDocumentViewerURL(), partOfPath)
     652                logging.debug("partOfLabel=%s partOfUrl=%s"%(docinfo['partOfLabel'],docinfo['partOfUrl']))
     653
    645654        # normalize path
    646655        if 'imagePath' in docinfo and not docinfo['imagePath'].startswith('/'):
     
    655664    def getDocinfoFromResource(self, docinfo, resource):
    656665        """reads contents of resource element into docinfo"""
    657         docName = resource.get('name', None)
     666        logging.debug("getDocinfoFromResource: resource=%s"%(repr(resource)))
     667        docName = getMDText(resource.get('name', None))
    658668        docinfo['documentName'] = docName
    659         docPath = resource.get('archive-path', None)
     669        docPath = getMDText(resource.get('archive-path', None))
    660670        if docPath:
    661671            # clean up document path
     
    671681            if not docUrl.startswith('http:'):
    672682                docPath = docUrl
     683               
    673684        if docPath:
    674685            # fix URLs starting with /mpiwg/online
     
    676687
    677688        docinfo['documentPath'] = docPath
     689       
     690        # is this part-of?
     691        partOf = resource.get('is-part-of', None)
     692        if partOf is not None:
     693            partOf = getMDText(partOf.get('archive-path', None))
     694            if partOf is not None:
     695                docinfo['partOfPath'] = partOf.strip()
     696               
    678697        return docinfo
    679698
  • zpt/viewer/common_template.zpt

    r607 r608  
    2525      </div>
    2626      <div class="title" tal:condition="formattedLabel" tal:content="structure formattedLabel" />
     27      <div class="title part-of" tal:condition="exists:docinfo/partOfPath">
     28        part of: <a tal:attributes="href docinfo/partOfUrl" target="_blank" tal:content="structure docinfo/partOfLabel"/>
     29      </div>
    2730      <ul class="view-switcher" metal:define-slot="view-switcher">
    2831        <li tal:condition="docpath" tal:attributes="class python:here.getStyle(viewMode, 'text')"><a
Note: See TracChangeset for help on using the changeset viewer.