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 72fad95..bbd6148 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 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"