MicroArticle basically working
This commit is contained in:
parent
eb46739b93
commit
8851759a11
8 changed files with 112 additions and 28 deletions
|
@ -139,7 +139,7 @@ class Layout(Base, ConceptView):
|
||||||
parts = (self.options('parts') or
|
parts = (self.options('parts') or
|
||||||
self.typeOptions('parts') or
|
self.typeOptions('parts') or
|
||||||
['h1', 'g3'])
|
['h1', 'g3'])
|
||||||
ti = adapted(self.context.conceptType).typeInterface
|
#ti = adapted(self.context.conceptType).typeInterface
|
||||||
for p in parts:
|
for p in parts:
|
||||||
viewName = 'lobo_' + p
|
viewName = 'lobo_' + p
|
||||||
view = component.queryMultiAdapter((self.context, self.request),
|
view = component.queryMultiAdapter((self.context, self.request),
|
||||||
|
|
|
@ -321,10 +321,32 @@ Micro Articles
|
||||||
|
|
||||||
>>> from loops.compound.microart.base import MicroArt
|
>>> from loops.compound.microart.base import MicroArt
|
||||||
>>> from loops.compound.microart.interfaces import IMicroArt
|
>>> from loops.compound.microart.interfaces import IMicroArt
|
||||||
>>> component.provideAdapter(BlogPost, provides=IMicroArt)
|
>>> component.provideAdapter(MicroArt, provides=IMicroArt)
|
||||||
|
|
||||||
>>> tMicroArt = addAndConfigureObject(concepts, Concept, 'microart',
|
>>> 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
|
Fin de partie
|
||||||
|
|
|
@ -43,25 +43,26 @@ class MicroArt(Compound):
|
||||||
|
|
||||||
implements(IMicroArt)
|
implements(IMicroArt)
|
||||||
|
|
||||||
_adapterAttributes = Compound._adapterAttributes + ('text',)
|
_contextAttributes = list(IMicroArt)
|
||||||
_noexportAttributes = ('text',)
|
_adapterAttributes = Compound._adapterAttributes + ('story',)
|
||||||
_textIndexAttributes = ('text',)
|
_noexportAttributes = ('story',)
|
||||||
|
_textIndexAttributes = ('story', 'insight', 'consequences', 'folloUps')
|
||||||
|
|
||||||
defaultTextContentType = 'text/restructured'
|
defaultTextContentType = 'text/html'
|
||||||
textContentType = defaultTextContentType
|
textContentType = defaultTextContentType
|
||||||
|
|
||||||
def getText(self):
|
def getStory(self):
|
||||||
res = self.getParts()
|
res = self.getParts()
|
||||||
if len(res) > 0:
|
if len(res) > 0:
|
||||||
return adapted(res[0]).data
|
return adapted(res[0]).data
|
||||||
return u''
|
return u''
|
||||||
def setText(self, value):
|
def setStory(self, value):
|
||||||
res = self.getParts()
|
res = self.getParts()
|
||||||
if len(res) > 0:
|
if len(res) > 0:
|
||||||
res = adapted(res[0])
|
res = adapted(res[0])
|
||||||
else:
|
else:
|
||||||
tTextDocument = self.conceptManager['textdocument']
|
tTextDocument = self.conceptManager['textdocument']
|
||||||
name = getName(self.context) + '_text'
|
name = getName(self.context) + '_story'
|
||||||
res = addAndConfigureObject(self.resourceManager, Resource, name,
|
res = addAndConfigureObject(self.resourceManager, Resource, name,
|
||||||
title=self.title, contentType=self.defaultTextContentType,
|
title=self.title, contentType=self.defaultTextContentType,
|
||||||
resourceType=tTextDocument)
|
resourceType=tTextDocument)
|
||||||
|
@ -70,4 +71,4 @@ class MicroArt(Compound):
|
||||||
res = adapted(res)
|
res = adapted(res)
|
||||||
res.data = value
|
res.data = value
|
||||||
notify(ObjectModifiedEvent(res.context))
|
notify(ObjectModifiedEvent(res.context))
|
||||||
text = property(getText, setText)
|
story = property(getStory, setStory)
|
||||||
|
|
|
@ -26,7 +26,7 @@ from zope import component
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
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.common import adapted
|
||||||
from loops import util
|
from loops import util
|
||||||
from loops.util import _
|
from loops.util import _
|
||||||
|
@ -37,16 +37,31 @@ view_macros = ViewPageTemplateFile('view_macros.pt')
|
||||||
|
|
||||||
class MicroArtView(ConceptView):
|
class MicroArtView(ConceptView):
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def contentType(self):
|
||||||
|
return 'text/restructured'
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def macros(self):
|
||||||
|
return self.controller.getTemplateMacros('microart.view', view_macros)
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def macro(self):
|
def macro(self):
|
||||||
return view_macros.macros['microart']
|
return self.macros['main']
|
||||||
|
|
||||||
def render(self):
|
@Lazy
|
||||||
return self.renderText(self.data['text'], self.adapted.textContentType)
|
def story(self):
|
||||||
|
return self.renderText(self.adapted.story, self.contentType)
|
||||||
|
|
||||||
def resources(self):
|
@Lazy
|
||||||
stdPred = self.loopsRoot.getConceptManager().getDefaultPredicate()
|
def insight(self):
|
||||||
rels = self.context.getResourceRelations([stdPred])
|
return self.renderText(self.adapted.insight, self.contentType)
|
||||||
for r in rels:
|
|
||||||
yield self.childViewFactory(r, self.request, contextIsSecond=True)
|
@Lazy
|
||||||
|
def consequences(self):
|
||||||
|
return self.renderText(self.adapted.consequences, self.contentType)
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def followUps(self):
|
||||||
|
return self.renderText(self.adapted.followUps, self.contentType)
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,11 @@ from loops.compound.interfaces import ICompound
|
||||||
from loops.util import _
|
from loops.util import _
|
||||||
|
|
||||||
|
|
||||||
|
class HtmlField(schema.Text):
|
||||||
|
|
||||||
|
__typeInfo__ = ('html',)
|
||||||
|
|
||||||
|
|
||||||
class IMicroArt(ICompound):
|
class IMicroArt(ICompound):
|
||||||
""" A short article with a few elements, for collecting
|
""" A short article with a few elements, for collecting
|
||||||
relevant information in a knowledge management environment.
|
relevant information in a knowledge management environment.
|
||||||
|
@ -34,6 +39,7 @@ class IMicroArt(ICompound):
|
||||||
|
|
||||||
# title = Ueberschrift, Thema
|
# title = Ueberschrift, Thema
|
||||||
|
|
||||||
|
#story = HtmlField( # Geschichte
|
||||||
story = schema.Text( # Geschichte
|
story = schema.Text( # Geschichte
|
||||||
title=_(u'Story'),
|
title=_(u'Story'),
|
||||||
description=_(u'The story, i.e. the main text of your '
|
description=_(u'The story, i.e. the main text of your '
|
||||||
|
@ -54,7 +60,7 @@ class IMicroArt(ICompound):
|
||||||
|
|
||||||
followUps = schema.Text( #Anschlussfragen
|
followUps = schema.Text( #Anschlussfragen
|
||||||
title=_(u'Follow-up Questions'),
|
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.'),
|
u'similar problems in the future.'),
|
||||||
required=False)
|
required=False)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<!-- ZPT macros for loops.compound.microart views -->
|
<!-- ZPT macros for loops.compound.microart views -->
|
||||||
|
<html i18n:domain="loops">
|
||||||
|
|
||||||
<div metal:define-macro="microart"
|
|
||||||
|
<div metal:define-macro="main"
|
||||||
tal:define="data item/data"
|
tal:define="data item/data"
|
||||||
class="microart">
|
class="microart">
|
||||||
<metal:block use-macro="view/concept_macros/concepttitle_only" />
|
<metal:block use-macro="view/concept_macros/concepttitle_only" />
|
||||||
|
@ -9,9 +11,17 @@
|
||||||
tal:condition="description">
|
tal:condition="description">
|
||||||
<span tal:content="structure description">Description</span>
|
<span tal:content="structure description">Description</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text"
|
<div class="text">
|
||||||
tal:content="structure item/render">Here comes the text...</div>
|
<div class="span-6 last"
|
||||||
<metal:resources use-macro="view/concept_macros/conceptchildren" />
|
tal:content="structure item/story" />
|
||||||
<metal:resources use-macro="view/concept_macros/conceptresources" />
|
<div class="span-2"
|
||||||
<metal:block use-macro="view/comment_macros/comments" />
|
tal:content="structure item/insight" />
|
||||||
|
<div class="span-2"
|
||||||
|
tal:content="structure item/consequences" />
|
||||||
|
<div class="span-2 last"
|
||||||
|
tal:content="structure item/followUps" /></div><br clear="both" />
|
||||||
|
<metal:block use-macro="view/comment_macros/comments" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</html>
|
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
||||||
|
|
||||||
"Project-Id-Version: $Id$\n"
|
"Project-Id-Version: $Id$\n"
|
||||||
"POT-Creation-Date: 2007-05-22 12:00 CET\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 <helmutm@cy55.de>\n"
|
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
||||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
|
@ -83,6 +83,8 @@ msgstr "Thema bearbeiten..."
|
||||||
msgid "Modify topic."
|
msgid "Modify topic."
|
||||||
msgstr "Thema ändern"
|
msgstr "Thema ändern"
|
||||||
|
|
||||||
|
# blog
|
||||||
|
|
||||||
msgid "Edit Blog Post..."
|
msgid "Edit Blog Post..."
|
||||||
msgstr "Eintrag bearbeiten..."
|
msgstr "Eintrag bearbeiten..."
|
||||||
|
|
||||||
|
@ -104,6 +106,34 @@ msgstr "Tagebucheintrag anlegen"
|
||||||
msgid "Export Blog"
|
msgid "Export Blog"
|
||||||
msgstr "Tagebuch exportieren"
|
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"
|
msgid "Glossary Item"
|
||||||
msgstr "Glossareintrag"
|
msgstr "Glossareintrag"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue