Merge branch 'bbmaster' of ssh://git.cy55.de/home/hplattner/git/loops into bbmaster
This commit is contained in:
commit
5e98c1cb6a
9 changed files with 125 additions and 24 deletions
|
@ -395,10 +395,22 @@ class ConceptView(BaseView):
|
||||||
fv = FilterView(self.context, self.request)
|
fv = FilterView(self.context, self.request)
|
||||||
rels = self.context.getResourceRelations()
|
rels = self.context.getResourceRelations()
|
||||||
for r in rels:
|
for r in rels:
|
||||||
#yield self.childViewFactory(r, self.request, contextIsSecond=True)
|
|
||||||
if fv.check(r.first):
|
if fv.check(r.first):
|
||||||
yield ResourceRelationView(r, self.request, contextIsSecond=True)
|
yield ResourceRelationView(r, self.request, contextIsSecond=True)
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def resourcesByType(self):
|
||||||
|
result = dict(texts=[], images=[], files=[])
|
||||||
|
for rv in self.resources():
|
||||||
|
r = rv.context
|
||||||
|
if r.contentType.startswith('text/'):
|
||||||
|
result['texts'].append(r)
|
||||||
|
if r.contentType.startswith('image/'):
|
||||||
|
result['images'].append(r)
|
||||||
|
else:
|
||||||
|
result['files'].append(r)
|
||||||
|
return result
|
||||||
|
|
||||||
def unique(self, rels):
|
def unique(self, rels):
|
||||||
result = Jeep()
|
result = Jeep()
|
||||||
for r in rels:
|
for r in rels:
|
||||||
|
|
|
@ -547,6 +547,12 @@
|
||||||
class="loops.browser.node.ObjectInfo"
|
class="loops.browser.node.ObjectInfo"
|
||||||
permission="zope.View" />
|
permission="zope.View" />
|
||||||
|
|
||||||
|
<page
|
||||||
|
name="meta_info.html"
|
||||||
|
for="loops.interfaces.INode"
|
||||||
|
class="loops.browser.node.MetaInfo"
|
||||||
|
permission="zope.View" />
|
||||||
|
|
||||||
<page
|
<page
|
||||||
name="create_object.html"
|
name="create_object.html"
|
||||||
for="loops.interfaces.INode"
|
for="loops.interfaces.INode"
|
||||||
|
|
|
@ -38,7 +38,29 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr tal:repeat="info item/additionalInfos">
|
<tr tal:repeat="info item/additionalInfos">
|
||||||
<td><span i18n:translate=""
|
<td><span i18n:translate=""
|
||||||
tal:content="info/label">Creators</span>:</td>
|
tal:content="info/label">Meta</span>:</td>
|
||||||
|
<td tal:content="structure info/value"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2"><br />
|
||||||
|
<input type="button" value="Close" onclick="closeDialog()"
|
||||||
|
i18n:attributes="value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</metal:info>
|
||||||
|
|
||||||
|
|
||||||
|
<metal:info define-macro="meta_info"
|
||||||
|
tal:define="item nocall:view/item">
|
||||||
|
<table class="object_info" width="400">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<h2 tal:content="item/title">Information</h2></td>
|
||||||
|
</tr>
|
||||||
|
<tr tal:repeat="info item/additionalInfos">
|
||||||
|
<td><span i18n:translate=""
|
||||||
|
tal:content="info/label">Meta</span>:</td>
|
||||||
<td tal:content="structure info/value"></td>
|
<td tal:content="structure info/value"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -48,5 +70,4 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</metal:info>
|
</metal:info>
|
||||||
|
|
|
@ -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;
|
<metal:image use-macro="item/macros/image" />
|
||||||
title cell/description">
|
<br />
|
||||||
<metal:image use-macro="item/macros/image" />
|
|
||||||
</a><br />
|
|
||||||
</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}/meta_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}/meta_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>
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -608,6 +608,15 @@ class ObjectInfo(NodeView):
|
||||||
return self.request.get('dialog', 'object_info')
|
return self.request.get('dialog', 'object_info')
|
||||||
|
|
||||||
|
|
||||||
|
class MetaInfo(ObjectInfo):
|
||||||
|
|
||||||
|
__call__ = innerHtml
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def macro(self):
|
||||||
|
return self.macros['meta_info']
|
||||||
|
|
||||||
|
|
||||||
class InlineEdit(NodeView):
|
class InlineEdit(NodeView):
|
||||||
""" Provides inline editor as inner HTML"""
|
""" Provides inline editor as inner HTML"""
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,13 @@ class MemberRegistrationManager(object):
|
||||||
options = IOptions(personType)
|
options = IOptions(personType)
|
||||||
pfName = options(self.principalfolder_key,
|
pfName = options(self.principalfolder_key,
|
||||||
(self.default_principalfolder,))[0]
|
(self.default_principalfolder,))[0]
|
||||||
# step 1: create an internal principal in the loops principal folder:
|
self.createPrincipal(pfName, userId, password, lastName, firstName)
|
||||||
|
groups = options(self.groups_key, ())
|
||||||
|
self.setGroupsForPrincipal(pfName, userId, groups=groups)
|
||||||
|
self.createPersonForPrincipal(self, pfName, userId, lastName, firstName=firstName, useExisting=useExisting, **kw)
|
||||||
|
|
||||||
|
def createPrincipal(self, pfName, userId, password, lastName,
|
||||||
|
firstName=u'', groups=[], useExisting=False, **kw):
|
||||||
pFolder = getPrincipalFolder(self.context, pfName)
|
pFolder = getPrincipalFolder(self.context, pfName)
|
||||||
if IPersonBasedAuthenticator.providedBy(pFolder):
|
if IPersonBasedAuthenticator.providedBy(pFolder):
|
||||||
pFolder.setPassword(userId, password)
|
pFolder.setPassword(userId, password)
|
||||||
|
@ -86,8 +92,9 @@ class MemberRegistrationManager(object):
|
||||||
return dict(fieldName='loginName', error='duplicate_loginname')
|
return dict(fieldName='loginName', error='duplicate_loginname')
|
||||||
else:
|
else:
|
||||||
pFolder[userId] = principal
|
pFolder[userId] = principal
|
||||||
# step 2 (optional): assign to group(s)
|
|
||||||
groups = options(self.groups_key, ())
|
def setGroupsForPrincipal(self, pfName, userId, groups=[]):
|
||||||
|
pFolder = getPrincipalFolder(self.context, pfName)
|
||||||
for groupInfo in groups:
|
for groupInfo in groups:
|
||||||
names = groupInfo.split(':')
|
names = groupInfo.split(':')
|
||||||
if len(names) == 1:
|
if len(names) == 1:
|
||||||
|
@ -101,7 +108,12 @@ class MemberRegistrationManager(object):
|
||||||
members = list(group.principals)
|
members = list(group.principals)
|
||||||
members.append(pFolder.prefix + userId)
|
members.append(pFolder.prefix + userId)
|
||||||
group.principals = members
|
group.principals = members
|
||||||
# step 3: create a corresponding person concept:
|
|
||||||
|
def createPersonForPrincipal(self, pfName, userId, lastName, firstName=u'', useExisting=False, **kw):
|
||||||
|
concepts = self.context.getConceptManager()
|
||||||
|
personType = adapted(concepts[self.person_typeName])
|
||||||
|
pFolder = getPrincipalFolder(self.context, pfName)
|
||||||
|
title = firstName and ' '.join((firstName, lastName)) or lastName
|
||||||
name = baseId = 'person.' + userId
|
name = baseId = 'person.' + userId
|
||||||
if useExisting and name in concepts:
|
if useExisting and name in concepts:
|
||||||
person = concepts[name]
|
person = concepts[name]
|
||||||
|
|
Loading…
Add table
Reference in a new issue