# HG changeset patch # User casties # Date 1355855182 -3600 # Node ID 0c60562716547a0c96e20ba791297cf5d2e565e7 # Parent cb5a9c4f5e3a21da04b087e9174bc8ccb411c68b show is-part-of relation in header. diff -r cb5a9c4f5e3a -r 0c6056271654 css/docuviewer.css --- a/css/docuviewer.css Fri Dec 14 17:28:31 2012 -0500 +++ b/css/docuviewer.css Tue Dec 18 19:26:22 2012 +0100 @@ -41,6 +41,9 @@ border: 1px solid silver; padding: 0.5em; } +div.page-head div.title.part-of { + border-top: none; +} ul.view-switcher { padding-left: 0; diff -r cb5a9c4f5e3a -r 0c6056271654 documentViewer.py --- a/documentViewer.py Fri Dec 14 17:28:31 2012 -0500 +++ b/documentViewer.py Tue Dec 18 19:26:22 2012 +0100 @@ -553,7 +553,7 @@ # process index.meta contents if metaDom is not None and metaDom.tag == 'resource': # document directory name and path - resource = self.metadataService.getResourceData(dom=metaDom) + resource = self.metadataService.getResourceData(dom=metaDom, recursive=1) if resource: docinfo = self.getDocinfoFromResource(docinfo, resource) @@ -642,6 +642,15 @@ docinfo['minPageNo'] = docinfo.get('minPageNo', 1) docinfo['maxPageNo'] = docinfo.get('maxPageNo', docinfo['numPages']) + # part-of information + partOfPath = docinfo.get('partOfPath', None) + if partOfPath is not None: + partOfDom = self.metadataService.getDomFromPathOrUrl(partOfPath) + if partOfDom is not None: + docinfo['partOfLabel'] = self.metadataService.getBibFormattedLabel(dom=partOfDom) + docinfo['partOfUrl'] = "%s?url=%s"%(self.getDocumentViewerURL(), partOfPath) + logging.debug("partOfLabel=%s partOfUrl=%s"%(docinfo['partOfLabel'],docinfo['partOfUrl'])) + # normalize path if 'imagePath' in docinfo and not docinfo['imagePath'].startswith('/'): docinfo['imagePath'] = '/' + docinfo['imagePath'] @@ -654,9 +663,10 @@ def getDocinfoFromResource(self, docinfo, resource): """reads contents of resource element into docinfo""" - docName = resource.get('name', None) + logging.debug("getDocinfoFromResource: resource=%s"%(repr(resource))) + docName = getMDText(resource.get('name', None)) docinfo['documentName'] = docName - docPath = resource.get('archive-path', None) + docPath = getMDText(resource.get('archive-path', None)) if docPath: # clean up document path if docPath[0] != '/': @@ -670,11 +680,20 @@ docUrl = docinfo['documentURL'] if not docUrl.startswith('http:'): docPath = docUrl + if docPath: # fix URLs starting with /mpiwg/online docPath = docPath.replace('/mpiwg/online', '', 1) docinfo['documentPath'] = docPath + + # is this part-of? + partOf = resource.get('is-part-of', None) + if partOf is not None: + partOf = getMDText(partOf.get('archive-path', None)) + if partOf is not None: + docinfo['partOfPath'] = partOf.strip() + return docinfo def getDocinfoFromTexttool(self, docinfo, texttool): diff -r cb5a9c4f5e3a -r 0c6056271654 zpt/viewer/common_template.zpt --- a/zpt/viewer/common_template.zpt Fri Dec 14 17:28:31 2012 -0500 +++ b/zpt/viewer/common_template.zpt Tue Dec 18 19:26:22 2012 +0100 @@ -24,6 +24,9 @@ tal:content="string:[no bibliographical information for this document (type ${bibType})]" />
+
+ part of: +