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

This commit is contained in:
Helmut Merz 2011-10-07 20:41:15 +02:00
parent 0390c4084b
commit 26472a280e
4 changed files with 58 additions and 17 deletions

View file

@ -12,9 +12,9 @@
<tal:cell repeat="cell part/getChildren"> <tal:cell repeat="cell part/getChildren">
<div tal:attributes="class cell/cssClass; <div tal:attributes="class cell/cssClass;
style cell/style"> style cell/style">
<metal:image use-macro="item/macros/image" />
<a tal:attributes="href cell/targetUrl; <a tal:attributes="href cell/targetUrl;
title cell/description"> title cell/description">
<metal:image use-macro="item/macros/image" />
<div class="legend"> <div class="legend">
<b tal:content="cell/title" /><br /> <b tal:content="cell/title" /><br />
<i tal:content="cell/description" /> <i tal:content="cell/description" />
@ -29,10 +29,8 @@
<tal:cell repeat="cell part/getChildren"> <tal:cell repeat="cell part/getChildren">
<div tal:condition="cell/img" <div tal:condition="cell/img"
tal:attributes="class python:cell.cssClass[0]"> tal:attributes="class python:cell.cssClass[0]">
<a tal:attributes="href cell/targetUrl;
title cell/description">
<metal:image use-macro="item/macros/image" /> <metal:image use-macro="item/macros/image" />
</a><br />&nbsp; <br />&nbsp;
</div> </div>
<div tal:attributes="class python:cell.cssClass[1]"> <div tal:attributes="class python:cell.cssClass[1]">
<a tal:attributes="href cell/targetUrl"> <a tal:attributes="href cell/targetUrl">
@ -51,6 +49,14 @@
<div tal:define="showImageLink python:True" <div tal:define="showImageLink python:True"
tal:attributes="class python:part.cssClass[0]"> tal:attributes="class python:part.cssClass[0]">
<metal:image use-macro="item/macros/image" /> <metal:image use-macro="item/macros/image" />
<span tal:condition="cell/img/showInfo|nothing">
<a tal:define="url string:${cell/img/url}/object_info.html"
tal:attributes="href url;
onclick string:objectDialog('', '$url');;
return false">
<img tal:attributes="src
string:${controller/resourceBase}/cybertools.icons/info.png" />
</a></span>
</div> </div>
<div tal:attributes="class python:part.cssClass[1]"> <div tal:attributes="class python:part.cssClass[1]">
<span tal:content="structure cell/renderedTextDescription" /> <span tal:content="structure cell/renderedTextDescription" />
@ -74,7 +80,16 @@
style cell/style"> style cell/style">
<metal:image use-macro="item/macros/image" /> <metal:image use-macro="item/macros/image" />
<div class="legend"> <div class="legend">
<b tal:content="cell/title" /><br /> <b tal:content="cell/title" />
<span tal:condition="cell/img/showInfo|nothing">
<a tal:define="url string:${cell/img/url}/object_info.html"
tal:attributes="href url;
onclick string:objectDialog('', '$url');;
return false">
<img tal:attributes="src
string:${controller/resourceBase}/cybertools.icons/info.png" />
</a></span>
<br />
<i tal:content="cell/description" /> <i tal:content="cell/description" />
</div> </div>
</div> </div>
@ -87,15 +102,20 @@
<metal:image define-macro="image"> <metal:image define-macro="image">
<tal:img condition="cell/img"> <tal:img condition="cell/img">
<a title="Information about this object." <a title="Information about this object."
tal:omit-tag="not:showImageLink|python:False" dojoType="dojox.image.Lightbox" group="mediasset"
i18n:attributes="title" i18n:attributes="title"
tal:define="url string:${cell/img/url}/object_info.html" tal:attributes="href cell/img/fullImageUrl;
tal:attributes="href url; title cell/img/title">
onclick string:objectDialog('', '$url?dialog=');; return false"> <img tal:condition="showImageLink|python:False"
<img tal:condition="cell/img"
tal:attributes="src cell/img/src; tal:attributes="src cell/img/src;
class cell/img/cssClass" /> class cell/img/cssClass" />
</a> </a>
<a tal:condition="not:showImageLink|python:False"
tal:attributes="href cell/targetUrl;
title cell/description">
<img tal:attributes="src cell/img/src;
class cell/img/cssClass" />
</a>
</tal:img> </tal:img>
</metal:image> </metal:image>

View file

@ -120,8 +120,12 @@ class ConceptView(BaseConceptView):
# fetch from iterator on layout object: avoid duplicates # fetch from iterator on layout object: avoid duplicates
url = self.nodeView.getUrlForTarget(r) url = self.nodeView.getUrlForTarget(r)
src = ('%s/mediaasset.html?v=%s' % (url, self.parentView.imageSize)) src = ('%s/mediaasset.html?v=%s' % (url, self.parentView.imageSize))
return dict(src=src, url=url, fullSrc = ('%s/mediaasset.html?v=%s' % (url, self.parentView.fullImageSize))
cssClass=self.parentView.imageCssClass) 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): class Layout(Base, ConceptView):
@ -149,6 +153,7 @@ class Layout(Base, ConceptView):
class BasePart(Base): class BasePart(Base):
imageSize = 'small' imageSize = 'small'
fullImageSize = 'medium'
imageCssClass = '' imageCssClass = ''
height = 260 height = 260
gridPattern = [] gridPattern = []
@ -240,10 +245,15 @@ class ConceptRelationView(BaseConceptRelationView, ConceptView):
def img(self): def img(self):
self.registerDojoLightbox() # also provides access to info popup self.registerDojoLightbox() # also provides access to info popup
for r in self.images: for r in self.images:
# fetch from iterator on layout object: avoid duplicates
url = self.nodeView.getUrlForTarget(r) url = self.nodeView.getUrlForTarget(r)
src = ('%s/mediaasset.html?v=%s' % (url, self.parentView.imageSize)) src = ('%s/mediaasset.html?v=%s' % (url, self.parentView.imageSize))
return dict(src=src, url=url, fullSrc = ('%s/mediaasset.html?v=%s' % (url, self.parentView.fullImageSize))
cssClass=self.parentView.imageCssClass) 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): class ResourceView(BaseResourceView):
@ -272,6 +282,10 @@ class ResourceView(BaseResourceView):
self.registerDojoLightbox() # also provides access to info popup self.registerDojoLightbox() # also provides access to info popup
url = self.nodeView.getUrlForTarget(self.context) url = self.nodeView.getUrlForTarget(self.context)
src = ('%s/mediaasset.html?v=%s' % (url, self.parentView.imageSize)) src = ('%s/mediaasset.html?v=%s' % (url, self.parentView.imageSize))
return dict(src=src, url=url, fullSrc = ('%s/mediaasset.html?v=%s' % (url, self.parentView.fullImageSize))
cssClass=self.parentView.imageCssClass) 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)

View file

@ -296,6 +296,7 @@ class IBaseResource(ILoopsObject):
metaInfo = Attribute('Optional additional information about the resource ' metaInfo = Attribute('Optional additional information about the resource '
'provided as text.') 'provided as text.')
showInfo = Attribute('Show object information in the standard user interface.')
def getType(): def getType():
""" Return a concept that provides the object's type, i.e. the """ Return a concept that provides the object's type, i.e. the

View file

@ -39,3 +39,9 @@ class IMediaAsset(IMediaAsset, IExternalFile):
missing_value=u'', missing_value=u'',
required=False) required=False)
showInfo = schema.Bool(
title=_(u'Show Object Information'),
description=_(u'Show object information in the standard user interface.'),
default=False,
required=False)