From 26472a280e89e1c92ac8dbe1f4dbd5dcc91b88bb Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 7 Oct 2011 20:41:15 +0200 Subject: [PATCH] show lightbox for links on images that do not lead to a child concept; provide info icon for resources that have the 'showInfo' flag set --- browser/lobo/standard.pt | 42 +++++++++++++++++++++++++++++----------- browser/lobo/standard.py | 26 +++++++++++++++++++------ interfaces.py | 1 + media/interfaces.py | 6 ++++++ 4 files changed, 58 insertions(+), 17 deletions(-) diff --git a/browser/lobo/standard.pt b/browser/lobo/standard.pt index f8a6afa..38322d9 100644 --- a/browser/lobo/standard.pt +++ b/browser/lobo/standard.pt @@ -12,9 +12,9 @@
+ -

@@ -29,10 +29,8 @@
- - -
  + +
 
@@ -51,6 +49,14 @@
@@ -74,7 +80,16 @@ style cell/style">
-
+ + + + + +
@@ -87,15 +102,20 @@ - + + + + diff --git a/browser/lobo/standard.py b/browser/lobo/standard.py index 91cc2f4..b6e02ef 100644 --- a/browser/lobo/standard.py +++ b/browser/lobo/standard.py @@ -120,8 +120,12 @@ class ConceptView(BaseConceptView): # fetch from iterator on layout object: avoid duplicates url = self.nodeView.getUrlForTarget(r) src = ('%s/mediaasset.html?v=%s' % (url, self.parentView.imageSize)) - return dict(src=src, url=url, - cssClass=self.parentView.imageCssClass) + fullSrc = ('%s/mediaasset.html?v=%s' % (url, self.parentView.fullImageSize)) + adImg = adapted(r) + showInfo = adImg.showInfo and adImg.metaInfo + return dict(src=src, fullImageUrl=fullSrc, title=r.title, + url=url, cssClass=self.parentView.imageCssClass, + showInfo=showInfo) class Layout(Base, ConceptView): @@ -149,6 +153,7 @@ class Layout(Base, ConceptView): class BasePart(Base): imageSize = 'small' + fullImageSize = 'medium' imageCssClass = '' height = 260 gridPattern = [] @@ -240,10 +245,15 @@ class ConceptRelationView(BaseConceptRelationView, ConceptView): def img(self): self.registerDojoLightbox() # also provides access to info popup for r in self.images: + # fetch from iterator on layout object: avoid duplicates url = self.nodeView.getUrlForTarget(r) src = ('%s/mediaasset.html?v=%s' % (url, self.parentView.imageSize)) - return dict(src=src, url=url, - cssClass=self.parentView.imageCssClass) + fullSrc = ('%s/mediaasset.html?v=%s' % (url, self.parentView.fullImageSize)) + adImg = adapted(r) + showInfo = adImg.showInfo and adImg.metaInfo + return dict(src=src, fullImageUrl=fullSrc, title=r.title, + url=url, cssClass=self.parentView.imageCssClass, + showInfo=showInfo) class ResourceView(BaseResourceView): @@ -272,6 +282,10 @@ class ResourceView(BaseResourceView): self.registerDojoLightbox() # also provides access to info popup url = self.nodeView.getUrlForTarget(self.context) src = ('%s/mediaasset.html?v=%s' % (url, self.parentView.imageSize)) - return dict(src=src, url=url, - cssClass=self.parentView.imageCssClass) + fullSrc = ('%s/mediaasset.html?v=%s' % (url, self.parentView.fullImageSize)) + adImg = adapted(self.context) + showInfo = adImg.showInfo and adImg.metaInfo + return dict(src=src, fullImageUrl=fullSrc, title=self.context.title, + url=url, cssClass=self.parentView.imageCssClass, + showInfo=showInfo) diff --git a/interfaces.py b/interfaces.py index ebd1fab..b4ec500 100644 --- a/interfaces.py +++ b/interfaces.py @@ -296,6 +296,7 @@ class IBaseResource(ILoopsObject): metaInfo = Attribute('Optional additional information about the resource ' 'provided as text.') + showInfo = Attribute('Show object information in the standard user interface.') def getType(): """ Return a concept that provides the object's type, i.e. the diff --git a/media/interfaces.py b/media/interfaces.py index 6254977..099e3fb 100644 --- a/media/interfaces.py +++ b/media/interfaces.py @@ -39,3 +39,9 @@ class IMediaAsset(IMediaAsset, IExternalFile): missing_value=u'', required=False) + showInfo = schema.Bool( + title=_(u'Show Object Information'), + description=_(u'Show object information in the standard user interface.'), + default=False, + required=False) +