From 8851759a11751664bdb21c34b19a87dc19e09116 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 2 Dec 2011 09:54:15 +0100 Subject: [PATCH] MicroArticle basically working --- browser/lobo/standard.py | 2 +- compound/README.txt | 26 ++++++++++++++++++++++-- compound/microart/base.py | 17 ++++++++-------- compound/microart/browser.py | 33 ++++++++++++++++++++++--------- compound/microart/interfaces.py | 8 +++++++- compound/microart/view_macros.pt | 22 +++++++++++++++------ locales/de/LC_MESSAGES/loops.mo | Bin 15279 -> 16160 bytes locales/de/LC_MESSAGES/loops.po | 32 +++++++++++++++++++++++++++++- 8 files changed, 112 insertions(+), 28 deletions(-) diff --git a/browser/lobo/standard.py b/browser/lobo/standard.py index 9acced9..1c636ac 100644 --- a/browser/lobo/standard.py +++ b/browser/lobo/standard.py @@ -139,7 +139,7 @@ class Layout(Base, ConceptView): parts = (self.options('parts') or self.typeOptions('parts') or ['h1', 'g3']) - ti = adapted(self.context.conceptType).typeInterface + #ti = adapted(self.context.conceptType).typeInterface for p in parts: viewName = 'lobo_' + p view = component.queryMultiAdapter((self.context, self.request), diff --git a/compound/README.txt b/compound/README.txt index 06b6e2e..58ac802 100644 --- a/compound/README.txt +++ b/compound/README.txt @@ -321,10 +321,32 @@ Micro Articles >>> from loops.compound.microart.base import MicroArt >>> from loops.compound.microart.interfaces import IMicroArt - >>> component.provideAdapter(BlogPost, provides=IMicroArt) + >>> component.provideAdapter(MicroArt, provides=IMicroArt) >>> tMicroArt = addAndConfigureObject(concepts, Concept, 'microart', - ... title=u'MicroArt', conceptType=tType) + ... title=u'MicroArt', conceptType=tType, + ... typeInterface=IMicroArt) + + >>> ma01 = addAndConfigureObject(concepts, Concept, 'ma01', + ... conceptType=tMicroArt, + ... title=u'Organizational Knowledge', + ... story=u'Systemic KM talks about organizational knowledge.', + ... insight=u'Organizational knowledge is not visible.', + ... consequences=u'Use examples. Look for strucure and rules. ' + ... u'Knowledge shows itself in actions.', + ... followUps=u'What about collective intelligence? ' + ... u'How does an organization express itself?') + + >>> ma01._insight + u'Organizational knowledge is not visible.' + >>> list(resources) + [..., u'ma01_story'] + + >>> adMa01 = adapted(ma01) + >>> adMa01.insight + u'Organizational knowledge is not visible.' + >>> adMa01.story + u'Systemic KM talks about organizational knowledge.' Fin de partie diff --git a/compound/microart/base.py b/compound/microart/base.py index 3b568be..0133ad0 100644 --- a/compound/microart/base.py +++ b/compound/microart/base.py @@ -43,25 +43,26 @@ class MicroArt(Compound): implements(IMicroArt) - _adapterAttributes = Compound._adapterAttributes + ('text',) - _noexportAttributes = ('text',) - _textIndexAttributes = ('text',) + _contextAttributes = list(IMicroArt) + _adapterAttributes = Compound._adapterAttributes + ('story',) + _noexportAttributes = ('story',) + _textIndexAttributes = ('story', 'insight', 'consequences', 'folloUps') - defaultTextContentType = 'text/restructured' + defaultTextContentType = 'text/html' textContentType = defaultTextContentType - def getText(self): + def getStory(self): res = self.getParts() if len(res) > 0: return adapted(res[0]).data return u'' - def setText(self, value): + def setStory(self, value): res = self.getParts() if len(res) > 0: res = adapted(res[0]) else: tTextDocument = self.conceptManager['textdocument'] - name = getName(self.context) + '_text' + name = getName(self.context) + '_story' res = addAndConfigureObject(self.resourceManager, Resource, name, title=self.title, contentType=self.defaultTextContentType, resourceType=tTextDocument) @@ -70,4 +71,4 @@ class MicroArt(Compound): res = adapted(res) res.data = value notify(ObjectModifiedEvent(res.context)) - text = property(getText, setText) + story = property(getStory, setStory) diff --git a/compound/microart/browser.py b/compound/microart/browser.py index f35c83a..816bc30 100755 --- a/compound/microart/browser.py +++ b/compound/microart/browser.py @@ -26,7 +26,7 @@ from zope import component from zope.app.pagetemplate import ViewPageTemplateFile from zope.cachedescriptors.property import Lazy -from loops.browser.concept import ConceptView, ConceptRelationView +from loops.browser.concept import ConceptView from loops.common import adapted from loops import util from loops.util import _ @@ -37,16 +37,31 @@ view_macros = ViewPageTemplateFile('view_macros.pt') class MicroArtView(ConceptView): + @Lazy + def contentType(self): + return 'text/restructured' + + @Lazy + def macros(self): + return self.controller.getTemplateMacros('microart.view', view_macros) + @Lazy def macro(self): - return view_macros.macros['microart'] + return self.macros['main'] - def render(self): - return self.renderText(self.data['text'], self.adapted.textContentType) + @Lazy + def story(self): + return self.renderText(self.adapted.story, self.contentType) - def resources(self): - stdPred = self.loopsRoot.getConceptManager().getDefaultPredicate() - rels = self.context.getResourceRelations([stdPred]) - for r in rels: - yield self.childViewFactory(r, self.request, contextIsSecond=True) + @Lazy + def insight(self): + return self.renderText(self.adapted.insight, self.contentType) + + @Lazy + def consequences(self): + return self.renderText(self.adapted.consequences, self.contentType) + + @Lazy + def followUps(self): + return self.renderText(self.adapted.followUps, self.contentType) diff --git a/compound/microart/interfaces.py b/compound/microart/interfaces.py index 691bff7..e85ec2b 100644 --- a/compound/microart/interfaces.py +++ b/compound/microart/interfaces.py @@ -27,6 +27,11 @@ from loops.compound.interfaces import ICompound from loops.util import _ +class HtmlField(schema.Text): + + __typeInfo__ = ('html',) + + class IMicroArt(ICompound): """ A short article with a few elements, for collecting relevant information in a knowledge management environment. @@ -34,6 +39,7 @@ class IMicroArt(ICompound): # title = Ueberschrift, Thema + #story = HtmlField( # Geschichte story = schema.Text( # Geschichte title=_(u'Story'), description=_(u'The story, i.e. the main text of your ' @@ -54,7 +60,7 @@ class IMicroArt(ICompound): followUps = schema.Text( #Anschlussfragen title=_(u'Follow-up Questions'), - description=_(u'Question for helping to solve or avoid ' + description=_(u'Questions for helping to solve or avoid ' u'similar problems in the future.'), required=False) diff --git a/compound/microart/view_macros.pt b/compound/microart/view_macros.pt index ff15b1f..7dadf5d 100755 --- a/compound/microart/view_macros.pt +++ b/compound/microart/view_macros.pt @@ -1,6 +1,8 @@ + -
@@ -9,9 +11,17 @@ tal:condition="description"> Description
-
Here comes the text...
- - - +
+
+
+
+

+
+ + + \ No newline at end of file diff --git a/locales/de/LC_MESSAGES/loops.mo b/locales/de/LC_MESSAGES/loops.mo index 72fad95c341c5318a67892cf39cac7935a17724d..bbd614853603af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{P9ZI z!$9uz33u*K1 z^13P%`r<_2|2zs4h^Nx)`Iw4-K5O&vXQAEz>r=lU8-{yw9pPIUJwbMm7KAe!CDXPQ zE+i?GSKuw=9FjvlmAudR71w3__dK$kyhn1$+hi2+Dko#esbnsBjZ|LaDcnrnARm)2 z$d9B3@p_gNkdMf0QiXv>qF3Ur*ouR7kn)q{5ZO;UlAp+6@+z56CKIn5vW;ABh3hUd zh#Vou$r+^bN@Kv4R0_k5f8ca-qu>8k6mAF~)S=;4%C+!C982nv=A`nfPhmu51@9pn zLj7d)x8e%&Ao(vDKq{|KD0~?z_u^3B|8EqkGvN2(gHLf8`71d=?j~OKXtO;oMje83 zG?ZHgR|kEy)5!It4Vgq2E8@(h_nZY50# zzv&g%V*cBYoJ;N`j}>R-WG7lv@_L=5lW$2aavSME_K@}DF!A~~d6ZmZh3hNwzlu^6 z-5&f;aBA=a+!xAE2lKJ9ySa`OKHQW{Y2 diff --git a/locales/de/LC_MESSAGES/loops.po b/locales/de/LC_MESSAGES/loops.po index a14d767..a5bea16 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-11-19 12:00 CET\n" +"PO-Revision-Date: 2011-12-02 12:00 CET\n" "Last-Translator: Helmut Merz \n" "Language-Team: loops developers \n" "MIME-Version: 1.0\n" @@ -83,6 +83,8 @@ msgstr "Thema bearbeiten..." msgid "Modify topic." msgstr "Thema ändern" +# blog + msgid "Edit Blog Post..." msgstr "Eintrag bearbeiten..." @@ -104,6 +106,34 @@ msgstr "Tagebucheintrag anlegen" msgid "Export Blog" msgstr "Tagebuch exportieren" +# micro article + +msgid "Story" +msgstr "Story" + +msgid "The story, i.e. the main text of your micro article. Who did what? What happend?" +msgstr "Die Geschichte, der Haupttext Ihres MikroArtikels. Wer hat was getan? Was geschah?" + +msgid "Insight" +msgstr "Einsicht" + +msgid "What can we learn from the story? What has gone wrong? What was good?" +msgstr "Was können wir aus der Geschichte lernen? Was ist schiefgegangen? Was war gut?" + +msgid "Consequences" +msgstr "Folgerungen" + +msgid "What we will do next time in a similar situation?" +msgstr "Was werden wir das nächste Mal in einer ähnlichen Situation tun?" + +msgid "Follow-up Questions" +msgstr "Anschlussfragen" + +msgid "Questions for helping to solve or avoid similar problems in the future." +msgstr "Fragen, die einem dabei helfen können, das Problem in der Zukunft zu lösen oder zu vermeiden." + +# glossary + msgid "Glossary Item" msgstr "Glossareintrag"