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:
parent
0390c4084b
commit
26472a280e
4 changed files with 58 additions and 17 deletions
|
@ -12,9 +12,9 @@
|
|||
<tal:cell repeat="cell part/getChildren">
|
||||
<div tal:attributes="class cell/cssClass;
|
||||
style cell/style">
|
||||
<metal:image use-macro="item/macros/image" />
|
||||
<a tal:attributes="href cell/targetUrl;
|
||||
title cell/description">
|
||||
<metal:image use-macro="item/macros/image" />
|
||||
<div class="legend">
|
||||
<b tal:content="cell/title" /><br />
|
||||
<i tal:content="cell/description" />
|
||||
|
@ -29,10 +29,8 @@
|
|||
<tal:cell repeat="cell part/getChildren">
|
||||
<div tal:condition="cell/img"
|
||||
tal:attributes="class python:cell.cssClass[0]">
|
||||
<a tal:attributes="href cell/targetUrl;
|
||||
title cell/description">
|
||||
<metal:image use-macro="item/macros/image" />
|
||||
</a><br />
|
||||
<metal:image use-macro="item/macros/image" />
|
||||
<br />
|
||||
</div>
|
||||
<div tal:attributes="class python:cell.cssClass[1]">
|
||||
<a tal:attributes="href cell/targetUrl">
|
||||
|
@ -51,6 +49,14 @@
|
|||
<div tal:define="showImageLink python:True"
|
||||
tal:attributes="class python:part.cssClass[0]">
|
||||
<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 tal:attributes="class python:part.cssClass[1]">
|
||||
<span tal:content="structure cell/renderedTextDescription" />
|
||||
|
@ -74,7 +80,16 @@
|
|||
style cell/style">
|
||||
<metal:image use-macro="item/macros/image" />
|
||||
<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" />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -87,15 +102,20 @@
|
|||
<metal:image define-macro="image">
|
||||
<tal:img condition="cell/img">
|
||||
<a title="Information about this object."
|
||||
tal:omit-tag="not:showImageLink|python:False"
|
||||
dojoType="dojox.image.Lightbox" group="mediasset"
|
||||
i18n:attributes="title"
|
||||
tal:define="url string:${cell/img/url}/object_info.html"
|
||||
tal:attributes="href url;
|
||||
onclick string:objectDialog('', '$url?dialog=');; return false">
|
||||
<img tal:condition="cell/img"
|
||||
tal:attributes="href cell/img/fullImageUrl;
|
||||
title cell/img/title">
|
||||
<img tal:condition="showImageLink|python:False"
|
||||
tal:attributes="src cell/img/src;
|
||||
class cell/img/cssClass" />
|
||||
</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>
|
||||
</metal:image>
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue