diff --git a/browser/concept.py b/browser/concept.py
index e795ade..0aa03e3 100644
--- a/browser/concept.py
+++ b/browser/concept.py
@@ -413,7 +413,7 @@ class ConceptView(BaseView):
if r.order != pos:
r.order = pos
- def resources(self):
+ def getResources(self):
form = self.request.form
#if form.get('loops.viewName') == 'index.html' and self.editable:
if self.editable:
@@ -430,6 +430,9 @@ class ConceptView(BaseView):
if fv.check(r.first):
yield ResourceRelationView(r, self.request, contextIsSecond=True)
+ def resources(self):
+ return self.getResources()
+
@Lazy
def resourcesList(self):
from loops.browser.resource import ResourceRelationView
diff --git a/common.py b/common.py
index 27e0ede..0b00e65 100644
--- a/common.py
+++ b/common.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
+# Copyright (c) 2012 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
@@ -98,7 +98,7 @@ class AdapterBase(object):
adapts(IConcept)
- _adapterAttributes = ('context', '__parent__')
+ _adapterAttributes = ('context', '__parent__', 'request')
_contextAttributes = list(IConcept)
_noexportAttributes = ()
_textIndexAttributes = ()
@@ -106,6 +106,7 @@ class AdapterBase(object):
__is_dummy__ = False
__type__ = None
+ request = None
languageInfo = None
def __init__(self, context):
diff --git a/compound/book/browser.py b/compound/book/browser.py
index d6e2232..533e12d 100644
--- a/compound/book/browser.py
+++ b/compound/book/browser.py
@@ -77,6 +77,30 @@ class SectionView(Base, ConceptView):
def sectionType(self):
return self.conceptManager['section']
+ def getResources(self):
+ relViews = super(SectionView, self).getResources()
+ return relViews
+
+ @Lazy
+ def textResources(self):
+ self.images = [[]]
+ result = []
+ idx = 0
+ for rv in self.getResources():
+ if rv.context.contentType.startswith('text/'):
+ idx += 1
+ result.append(rv)
+ self.images.append([])
+ else:
+ self.registerDojoLightbox()
+ url = self.nodeView.getUrlForTarget(rv.context)
+ src = '%s/mediaasset.html?v=small' % url
+ fullSrc = '%s/mediaasset.html?v=medium' % url
+ img = dict(src=src, fullImageUrl=fullSrc, title=rv.title,
+ description=rv.description, url=url, object=rv)
+ self.images[idx].append(img)
+ return result
+
def getCssClassForResource(self, r):
for c in r.context.getConcepts([self.defaultPredicate]):
if c.conceptType == self.documentTypeType:
diff --git a/compound/book/loops_book_de.dmp b/compound/book/loops_book_de.dmp
index 171323d..0d3d92d 100644
--- a/compound/book/loops_book_de.dmp
+++ b/compound/book/loops_book_de.dmp
@@ -21,6 +21,7 @@ concept(u'issubtype', u'is Subtype', u'predicate', options=u'hide_children',
# document types
concept(u'keyquestions', u'Leitfragen', u'documenttype')
concept(u'textelement', u'Textabschnitt', u'documenttype')
+concept(u'textelement2', u'Textabschnitt separat', u'documenttype')
concept(u'quote', u'Zitat', u'documenttype')
concept(u'story', u'Geschichte', u'documenttype')
concept(u'usecase', u'Fallbeispiel', u'documenttype')
diff --git a/compound/book/view_macros.pt b/compound/book/view_macros.pt
index d64994d..cef53c2 100644
--- a/compound/book/view_macros.pt
+++ b/compound/book/view_macros.pt
@@ -14,7 +14,7 @@
-
+
![]()
@@ -45,6 +46,15 @@
+
+
+ ![]()
+
diff --git a/integrator/README.txt b/integrator/README.txt
index cba0381..62b6532 100644
--- a/integrator/README.txt
+++ b/integrator/README.txt
@@ -231,7 +231,7 @@ Extracting Document Properties from MS Office Files
>>> path = os.path.join(dataDir, 'office')
>>> fn = os.path.join(path, 'example.docx')
>>> os.path.getsize(fn)
- 20337...
+ 23561...
>>> officeFile = addAndConfigureObject(resources, Resource, 'test.docx',
... title=u'Example Word File', resourceType=tOfficeFile,
@@ -241,7 +241,7 @@ Extracting Document Properties from MS Office Files
>>> content = aOfficeFile.data
>>> len(content)
- 17409
+ 20327
Clean up:
>>> shutil.copy(fn + '.sav', fn)
diff --git a/integrator/browser.py b/integrator/browser.py
index 0ecf9bd..aeafa87 100644
--- a/integrator/browser.py
+++ b/integrator/browser.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
+# Copyright (c) 2012 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
@@ -18,8 +18,6 @@
"""
View class(es) for integrating external objects.
-
-$Id$
"""
from zope import interface, component
@@ -42,7 +40,9 @@ class ExternalCollectionView(ConceptView):
def update(self):
if 'update' in self.request.form:
cta = adapted(self.context)
- if cta is not None:
- cta.update()
+ cta.request = self.request
+ cta.update()
+ if cta.updateMessage is not None:
+ self.request.form['message'] = cta.updateMessage
return True
diff --git a/integrator/collection.py b/integrator/collection.py
index a6a6670..35d4a9c 100644
--- a/integrator/collection.py
+++ b/integrator/collection.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
+# Copyright (c) 2012 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
@@ -19,8 +19,6 @@
"""
Concept adapter(s) for external collections, e.g. a directory in the
file system.
-
-$Id$
"""
from datetime import datetime
@@ -62,10 +60,12 @@ class ExternalCollectionAdapter(AdapterBase):
implements(IExternalCollection)
adapts(IConcept)
- _adapterAttributes = ('context', '__parent__', 'exclude', 'newResources')
+ _adapterAttributes = AdapterBase._adapterAttributes + (
+ 'exclude', 'newResources', 'updateMessage')
_contextAttributes = list(IExternalCollection) + list(IConcept)
newResources = None
+ updateMessage = None
def getExclude(self):
return getattr(self.context, '_exclude', None) or []
@@ -101,12 +101,17 @@ class ExternalCollectionAdapter(AdapterBase):
adobj = adapted(obj)
directory = provider.getDirectory(self)
adobj.storageParams=dict(subdirectory=directory)
+ adobj.request = self.request
adobj.externalAddress = addr
+ # collect error information
+ if adobj.processingErrors:
+ message = self.updateMessage or u''
+ message += u'
'.join(adobj.processingErrors)
+ self.updateMessage = message
# force reindexing
notify(ObjectModifiedEvent(obj))
else:
new.append(addr)
- #print '*** new', new
if new:
self.newResources = provider.createExtFileObjects(self, new)
for r in self.newResources:
@@ -205,7 +210,13 @@ class DirectoryCollectionProvider(object):
contentType=contentType,
)
adobj = adapted(obj)
+ adobj.request = client.request
adobj.externalAddress = addr # must be set last
+ # collect error information
+ if adobj.processingErrors:
+ message = client.updateMessage or u''
+ message += u'
'.join(adobj.processingErrors)
+ client.updateMessage = message
yield obj
def getDirectory(self, client):
diff --git a/integrator/collection_macros.pt b/integrator/collection_macros.pt
index 6df9ca0..8c3e898 100644
--- a/integrator/collection_macros.pt
+++ b/integrator/collection_macros.pt
@@ -7,6 +7,10 @@
+