diff --git a/README.txt b/README.txt index df19c21..070991a 100755 --- a/README.txt +++ b/README.txt @@ -52,14 +52,23 @@ top-level loops container and a concept manager: Now we want to relate the second concept to the first one. In order to do this we first have to provide a relation registry. For -testing we use a simple dummy implementation. As relationships are -based on predicates that are themselves concepts we also need a -default predicate concept; the default name for this is 'standard'. +testing we use a simple dummy implementation. + >>> from zope.app.intid.interfaces import IIntIds + >>> from cybertools.relation.tests import IntIdsStub + >>> from zope.app.testing import ztapi + >>> ztapi.provideUtility(IIntIds, IntIdsStub()) >>> from cybertools.relation.interfaces import IRelationRegistry >>> from cybertools.relation.registry import DummyRelationRegistry - >>> from zope.app.testing import ztapi >>> ztapi.provideUtility(IRelationRegistry, DummyRelationRegistry()) + >>> from cybertools.relation.registry import RelationRegistry + >>> #ztapi.provideUtility(IRelationRegistry, RelationRegistry()) + >>> #zapi.getUtility(IRelationRegistry).setupIndexes() + +As relationships are based on predicates that are themselves concepts we +also need a default predicate concept; the default name for this is +'standard'. + >>> concepts['standard'] = Concept(u'subconcept') Now we can assign the concept c2 as a child to c1 (using the standard diff --git a/browser/concept.py b/browser/concept.py index 6bdbeb5..52d8d01 100644 --- a/browser/concept.py +++ b/browser/concept.py @@ -27,6 +27,7 @@ from zope.app.catalog.interfaces import ICatalog from zope.app.dublincore.interfaces import ICMFDublinCore from zope.app.event.objectevent import ObjectCreatedEvent from zope.app.form.browser.interfaces import ITerms +from zope.app.pagetemplate import ViewPageTemplateFile from zope.cachedescriptors.property import Lazy from zope.dottedname.resolve import resolve from zope.event import notify @@ -53,6 +54,9 @@ class ConceptEditForm(EditForm): class ConceptView(BaseView): + template = ViewPageTemplateFile('concept_macros.pt') + macro = template.macros['conceptlisting'] + def children(self): for r in self.context.getChildRelations(): yield ConceptRelationView(r, self.request, contextIsSecond=True) @@ -165,6 +169,8 @@ class ConceptConfigureView(ConceptView): criteria['loops_type'] = (start, end) cat = zapi.getUtility(ICatalog) result = cat.searchResults(**criteria) + # TODO: can this be done in a faster way? + result = [r for r in result if r.getLoopsRoot() == self.loopsRoot] else: result = self.loopsRoot.getConceptManager().values() if searchType == 'none': diff --git a/browser/concept_macros.pt b/browser/concept_macros.pt new file mode 100644 index 0000000..6202ae1 --- /dev/null +++ b/browser/concept_macros.pt @@ -0,0 +1,32 @@ + +
+

Concept: + Title

+ +
+

Parents

+
+ Resource Title +
+
+
+

Children

+
+ Resource Title +
+
+
+

Resources

+
+ Resource Title +
+
+
+
+
diff --git a/browser/configure.zcml b/browser/configure.zcml index 764572a..aeb3bdc 100644 --- a/browser/configure.zcml +++ b/browser/configure.zcml @@ -28,6 +28,13 @@ permission="zope.View" /> + + - - - + diff --git a/browser/node.py b/browser/node.py index 43711b1..0bc72ec 100644 --- a/browser/node.py +++ b/browser/node.py @@ -233,6 +233,8 @@ class ConfigureView(NodeView): criteria['loops_type'] = (start, end) cat = zapi.getUtility(ICatalog) result = cat.searchResults(**criteria) + # TODO: can this be done in a faster way? + result = [r for r in result if r.getLoopsRoot() == self.loopsRoot] else: result = (list(self.loopsRoot.getConceptManager().values()) + list(self.loopsRoot.getResourceManager().values())) diff --git a/browser/node_macros.pt b/browser/node_macros.pt index aca1286..744b7c5 100644 --- a/browser/node_macros.pt +++ b/browser/node_macros.pt @@ -35,19 +35,16 @@ - +
Node Body
- + +
+ diff --git a/browser/resource.py b/browser/resource.py index 4542498..513ed53 100644 --- a/browser/resource.py +++ b/browser/resource.py @@ -106,6 +106,8 @@ class ResourceConfigureView(ResourceView, ConceptConfigureView): criteria['loops_type'] = (start, end) cat = zapi.getUtility(ICatalog) result = cat.searchResults(**criteria) + # TODO: can this be done in a faster way? + result = [r for r in result if r.getLoopsRoot() == self.loopsRoot] else: result = self.loopsRoot.getConceptManager().values() if searchType == 'none': diff --git a/browser/resource_macros.pt b/browser/resource_macros.pt index 3805a1d..b106948 100644 --- a/browser/resource_macros.pt +++ b/browser/resource_macros.pt @@ -1,6 +1,6 @@
- Here comes a document... +

Title

@@ -8,7 +8,7 @@
- Here comes an image... +

Title

@@ -17,7 +17,7 @@