diff --git a/CHANGES.txt b/CHANGES.txt index ea091e2..b592d04 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/browser/info.pt b/browser/info.pt index 61a503e..ed0d7db 100644 --- a/browser/info.pt +++ b/browser/info.pt @@ -39,7 +39,7 @@ Creators: - +
diff --git a/browser/lobo/standard.pt b/browser/lobo/standard.pt index c165ef8..59e6e93 100644 --- a/browser/lobo/standard.pt +++ b/browser/lobo/standard.pt @@ -48,7 +48,8 @@
-
+
@@ -65,7 +66,8 @@ -
+
@@ -76,9 +78,18 @@ - + + + + + diff --git a/browser/lobo/standard.py b/browser/lobo/standard.py index 6044ca7..5b3e3de 100644 --- a/browser/lobo/standard.py +++ b/browser/lobo/standard.py @@ -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 diff --git a/concept.py b/concept.py index efd9528..9a27490 100644 --- a/concept.py +++ b/concept.py @@ -107,6 +107,8 @@ class Concept(Contained, Persistent): workspaceInformation = None + metaInfo = u'' + def __init__(self, title=u''): self.title = title diff --git a/interfaces.py b/interfaces.py index e760c85..16b1d42 100644 --- a/interfaces.py +++ b/interfaces.py @@ -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""" diff --git a/locales/de/LC_MESSAGES/loops.mo b/locales/de/LC_MESSAGES/loops.mo index 8cda197..5263c36 100644 Binary files a/locales/de/LC_MESSAGES/loops.mo and b/locales/de/LC_MESSAGES/loops.mo differ diff --git a/locales/de/LC_MESSAGES/loops.po b/locales/de/LC_MESSAGES/loops.po index 028544c..1c787c2 100644 --- a/locales/de/LC_MESSAGES/loops.po +++ b/locales/de/LC_MESSAGES/loops.po @@ -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 \n" "Language-Team: loops developers \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" diff --git a/media/asset.py b/media/asset.py index 2b0f503..1aa927a 100644 --- a/media/asset.py +++ b/media/asset.py @@ -52,6 +52,7 @@ class MediaAsset(MediaAssetFile, ExternalFileAdapter): implements(IMediaAsset) _adapterAttributes = ExternalFileAdapter._adapterAttributes + ('modified',) + _contextAttributes = list(IMediaAsset) isMediaAsset = True diff --git a/media/browser/asset.py b/media/browser/asset.py index 978f8b9..8797b46 100644 --- a/media/browser/asset.py +++ b/media/browser/asset.py @@ -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): diff --git a/media/interfaces.py b/media/interfaces.py index 5cafe7e..6254977 100644 --- a/media/interfaces.py +++ b/media/interfaces.py @@ -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) diff --git a/resource.py b/resource.py index bd90bbc..274fa5e 100644 --- a/resource.py +++ b/resource.py @@ -96,6 +96,8 @@ class Resource(Image, Contained): storageName = None + metaInfo = u'' + _size = _width = _height = 0 def __init__(self, title=u''):