- provide additional metaInfo field, e.g. for storing source and rights
information for media assets; show this in info popup; link image to info popup in Lobo skin standard views - Lobo listings: allow for restriction of children listed to certain types
This commit is contained in:
parent
3a30efffe3
commit
7223b08b5a
12 changed files with 87 additions and 20 deletions
|
@ -6,6 +6,10 @@ $Id$
|
|||
1.1
|
||||
---
|
||||
|
||||
- provide additional ``metaInfo`` field, e.g. for storing source and rights
|
||||
information for media assets; show this in info popup;
|
||||
link image to info popup in Lobo skin standard views
|
||||
- Lobo listings: allow for restriction of children listed to certain types
|
||||
- media assets: allow for access restriction for viewing larger than a
|
||||
given maximum size (via option ``media.unauthorized_max_size``)
|
||||
- external editor functionality: include title field in data in order to
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<tr tal:repeat="info item/additionalInfos">
|
||||
<td><span i18n:translate=""
|
||||
tal:content="info/label">Creators</span>:</td>
|
||||
<td tal:content="info/value"></td>
|
||||
<td tal:content="structure info/value"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><br />
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
<metal:block define-macro="header1">
|
||||
<div tal:define="cell part/getView">
|
||||
<metal:headline use-macro="item/macros/headline" />
|
||||
<div tal:attributes="class python:part.cssClass[0]">
|
||||
<div tal:define="showImageLink python:True"
|
||||
tal:attributes="class python:part.cssClass[0]">
|
||||
<metal:image use-macro="item/macros/image" />
|
||||
</div>
|
||||
<div tal:attributes="class python:part.cssClass[1]">
|
||||
|
@ -65,7 +66,8 @@
|
|||
|
||||
|
||||
<metal:block define-macro="header2">
|
||||
<div tal:define="cell part/getView">
|
||||
<div tal:define="cell part/getView;
|
||||
showImageLink python:True">
|
||||
<metal:headline use-macro="item/macros/headline" />
|
||||
<metal:image use-macro="item/macros/image" />
|
||||
<metal:text use-macro="item/macros/text" />
|
||||
|
@ -76,9 +78,18 @@
|
|||
<!-- basic component macros -->
|
||||
|
||||
<metal:image define-macro="image">
|
||||
<tal:img condition="cell/img">
|
||||
<a title="Information about this object."
|
||||
tal:omit-tag="not:showImageLink|python:False"
|
||||
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="src cell/img/src;
|
||||
class cell/img/cssClass" />
|
||||
</a>
|
||||
</tal:img>
|
||||
</metal:image>
|
||||
|
||||
|
||||
|
|
|
@ -50,6 +50,11 @@ class Base(BaseConceptView):
|
|||
def macro(self):
|
||||
return self.macros[self.macroName]
|
||||
|
||||
@Lazy
|
||||
def params(self):
|
||||
ann = self.request.annotations.get('loops.view', {})
|
||||
return parse_qs(ann.get('params') or '')
|
||||
|
||||
|
||||
class ConceptView(BaseConceptView):
|
||||
|
||||
|
@ -106,10 +111,10 @@ class ConceptView(BaseConceptView):
|
|||
@Lazy
|
||||
def img(self):
|
||||
for r in self.resources['images']:
|
||||
src = ('%s/mediaasset.html?v=%s' %
|
||||
(self.nodeView.getUrlForTarget(r),
|
||||
self.parentView.imageSize))
|
||||
return dict(src=src, cssClass=self.parentView.imageCssClass)
|
||||
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)
|
||||
|
||||
|
||||
class ConceptRelationView(BaseConceptRelationView, ConceptView):
|
||||
|
@ -127,9 +132,7 @@ class Layout(Base):
|
|||
|
||||
def getParts(self):
|
||||
result = []
|
||||
ann = self.request.annotations.get('loops.view', {})
|
||||
params = parse_qs(ann.get('params') or '')
|
||||
parts = (params.get('parts') or ['h1,g3'])[0].split(',')
|
||||
parts = (self.params.get('parts') or ['h1,g3'])[0].split(',')
|
||||
for p in parts:
|
||||
viewName = 'lobo_' + p
|
||||
view = component.queryMultiAdapter((self.context, self.request),
|
||||
|
@ -147,9 +150,14 @@ class BasePart(Base):
|
|||
gridPattern = []
|
||||
|
||||
def getChildren(self):
|
||||
subtypeNames = (self.params.get('subtypes') or [''])[0].split(',')
|
||||
subtypes = [self.conceptManager[st] for st in subtypeNames if st]
|
||||
result = []
|
||||
for idx, r in enumerate(
|
||||
self.context.getChildRelations([self.defaultPredicate])):
|
||||
childRels = self.context.getChildRelations([self.defaultPredicate])
|
||||
if subtypes:
|
||||
childRels = [r for r in childRels
|
||||
if r.second.conceptType in subtypes]
|
||||
for idx, r in enumerate(childRels):
|
||||
result.append(ConceptRelationView(r, self.request,
|
||||
contextIsSecond=True, parent=self, idx=idx))
|
||||
return result
|
||||
|
|
|
@ -107,6 +107,8 @@ class Concept(Contained, Persistent):
|
|||
|
||||
workspaceInformation = None
|
||||
|
||||
metaInfo = u''
|
||||
|
||||
def __init__(self, title=u''):
|
||||
self.title = title
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -90,6 +90,9 @@ class IConceptSchema(Interface):
|
|||
missing_value=u'',
|
||||
required=False)
|
||||
|
||||
metaInfo = Attribute('Optional additional information about the concept '
|
||||
'provided as text.')
|
||||
|
||||
# let these fields always appear on top:
|
||||
IConceptSchema['title'].order = 1
|
||||
IConceptSchema['description'].order = 2
|
||||
|
@ -291,6 +294,9 @@ class IBaseResource(ILoopsObject):
|
|||
missing_value='',
|
||||
required=False)
|
||||
|
||||
metaInfo = Attribute('Optional additional information about the resource '
|
||||
'provided as text.')
|
||||
|
||||
def getType():
|
||||
""" Return a concept that provides the object's type, i.e. the
|
||||
resourceType attribute.
|
||||
|
@ -361,6 +367,9 @@ class IResourceSchema(Interface):
|
|||
missing_value='',
|
||||
required=False)
|
||||
|
||||
metaInfo = Attribute('Optional additional information about the resource '
|
||||
'provided as text.')
|
||||
|
||||
|
||||
class IResource(ILoopsObject, IPotentialTarget):
|
||||
""" A resource is an atomic information element that is made
|
||||
|
@ -404,7 +413,7 @@ class IDocument(IDocumentSchema, IResource):
|
|||
|
||||
|
||||
# media asset is obsolete - replaced by plain Resource with
|
||||
# resourceType = file.
|
||||
# resourceType = file or the new media asset stuff in loops.media.
|
||||
|
||||
class IMediaAssetView(IResourceSchema):
|
||||
""" Used for accessing a media asset via a node's target attribute"""
|
||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
|||
|
||||
"Project-Id-Version: $Id$\n"
|
||||
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
||||
"PO-Revision-Date: 2011-04-30 12:00 CET\n"
|
||||
"PO-Revision-Date: 2011-08-21 12:00 CET\n"
|
||||
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -233,6 +233,9 @@ msgstr "Aktionen"
|
|||
msgid "Print this page"
|
||||
msgstr "Diese Seite ausdrucken"
|
||||
|
||||
msgid "Object Information"
|
||||
msgstr "Informationen über dieses Objekt"
|
||||
|
||||
msgid "Information about this object."
|
||||
msgstr "Informationen über dieses Objekt."
|
||||
|
||||
|
@ -245,6 +248,9 @@ msgstr "Mit 'External Editor' bearbeiten."
|
|||
msgid "Type"
|
||||
msgstr "Typ"
|
||||
|
||||
msgid "modified"
|
||||
msgstr "Änderungsdatum"
|
||||
|
||||
msgid "Modification Date"
|
||||
msgstr "Änderungsdatum"
|
||||
|
||||
|
@ -254,6 +260,12 @@ msgstr "Größe"
|
|||
msgid "Author(s)"
|
||||
msgstr "Autor(en)"
|
||||
|
||||
msgid "Creators"
|
||||
msgstr "Bearbeiter"
|
||||
|
||||
msgid "Meta Information"
|
||||
msgstr "Meta-Informationen"
|
||||
|
||||
msgid "Parents"
|
||||
msgstr "Oberbegriffe"
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ class MediaAsset(MediaAssetFile, ExternalFileAdapter):
|
|||
implements(IMediaAsset)
|
||||
|
||||
_adapterAttributes = ExternalFileAdapter._adapterAttributes + ('modified',)
|
||||
_contextAttributes = list(IMediaAsset)
|
||||
|
||||
isMediaAsset = True
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ from zope.security.interfaces import Unauthorized
|
|||
from loops.browser.node import NodeView
|
||||
from loops.browser.resource import ResourceView, resource_macros
|
||||
from loops.common import adapted
|
||||
from loops.util import _
|
||||
from loops import util
|
||||
|
||||
template = ViewPageTemplateFile('asset.pt')
|
||||
|
@ -81,6 +82,14 @@ class MediaAssetView(ResourceView):
|
|||
return False
|
||||
return True
|
||||
|
||||
@Lazy
|
||||
def additionalInfos(self):
|
||||
mi = self.adapted.metaInfo
|
||||
if not mi:
|
||||
return []
|
||||
return [dict(label=_(u'Meta Information'),
|
||||
value=self.renderDescription(mi))]
|
||||
|
||||
|
||||
class MediaAssetNodeView(NodeView):
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -22,11 +22,20 @@ Media asset management interface definitions.
|
|||
$Id$
|
||||
"""
|
||||
|
||||
from zope import schema
|
||||
|
||||
from cybertools.media.interfaces import IMediaAsset
|
||||
from loops.interfaces import IExternalFile
|
||||
from loops.util import _
|
||||
|
||||
|
||||
class IMediaAsset(IMediaAsset, IExternalFile):
|
||||
|
||||
pass
|
||||
metaInfo = schema.Text(
|
||||
title=_(u'Meta Information'),
|
||||
description=_(u'A text giving some background information '
|
||||
u'about a media asset, like source, rights, etc.'),
|
||||
default=u'',
|
||||
missing_value=u'',
|
||||
required=False)
|
||||
|
||||
|
|
|
@ -96,6 +96,8 @@ class Resource(Image, Contained):
|
|||
|
||||
storageName = None
|
||||
|
||||
metaInfo = u''
|
||||
|
||||
_size = _width = _height = 0
|
||||
|
||||
def __init__(self, title=u''):
|
||||
|
|
Loading…
Add table
Reference in a new issue