Merge branch 'master' into bbmaster

This commit is contained in:
Helmut Merz 2011-11-08 13:38:55 +01:00
commit 3b6a5d0830
21 changed files with 357 additions and 25 deletions

View file

@ -348,8 +348,8 @@ class ConceptView(BaseView):
def isHidden(self, pr): def isHidden(self, pr):
if (getName(pr.second.conceptType) in if (getName(pr.second.conceptType) in
#IOptions(adapted(pr.predicate))('hide_parents_for', [])): IOptions(adapted(pr.predicate))('hide_parents_for', [])):
IOptions(pr.predicate)('hide_parents_for', [])): #IOptions(pr.predicate)('hide_parents_for', [])):
return True return True
hideRoles = None hideRoles = None
options = component.queryAdapter(adapted(pr.first), IOptions) options = component.queryAdapter(adapted(pr.first), IOptions)

View file

@ -29,7 +29,7 @@
<page for="loops.interfaces.INode" <page for="loops.interfaces.INode"
name="contents.html" name="contents.html"
template="contents.pt" template="contents.pt"
class="cybertools.container.ordered.ContainerView" class="cybertools.container.ordered.OrderedContainerView"
permission="loops.ManageSite" /> permission="loops.ManageSite" />
<!-- login/logout --> <!-- login/logout -->

View file

@ -63,6 +63,14 @@
factory="loops.browser.lobo.standard.Header2" factory="loops.browser.lobo.standard.Header2"
permission="zope.View" /> permission="zope.View" />
<zope:adapter
name="lobo_h3"
for="loops.interfaces.IConcept
loops.browser.skin.Lobo"
provides="zope.interface.Interface"
factory="loops.browser.lobo.standard.Header3"
permission="zope.View" />
<zope:adapter <zope:adapter
name="lobo_cell" name="lobo_cell"
for="loops.interfaces.IConceptSchema for="loops.interfaces.IConceptSchema

View file

@ -60,7 +60,8 @@
</a></span> </a></span>
</div> </div>
</tal:image> </tal:image>
<div tal:attributes="class python:part.cssClass[1]"> <div tal:condition="cell/renderedTextDescription"
tal:attributes="class python:part.cssClass[1]">
<span tal:content="structure cell/renderedTextDescription" /> <span tal:content="structure cell/renderedTextDescription" />
</div> </div>
<tal:break condition="python:part.showImage and cell.img"> <tal:break condition="python:part.showImage and cell.img">
@ -111,15 +112,13 @@
<img tal:condition="showImageLink|python:False" <img tal:condition="showImageLink|python:False"
tal:attributes="src cell/img/src; tal:attributes="src cell/img/src;
class cell/img/cssClass; class cell/img/cssClass;
alt cell/title" /> alt cell/title" /></a>
</a>
<a tal:condition="not:showImageLink|python:False" <a tal:condition="not:showImageLink|python:False"
tal:attributes="href cell/targetUrl; tal:attributes="href cell/targetUrl;
title cell/title"> title cell/title">
<img tal:attributes="src cell/img/src; <img tal:attributes="src cell/img/src;
class cell/img/cssClass; class cell/img/cssClass;
alt cell/title" /> alt cell/title" /></a>
</a>
</tal:img> </tal:img>
</metal:image> </metal:image>

View file

@ -229,6 +229,13 @@ class Header2(BasePart):
cssClass = ['span-4', 'span-2 last', 'clear'] cssClass = ['span-4', 'span-2 last', 'clear']
class Header3(BasePart):
macroName = 'header'
imageSize = 'large'
cssClass = ['span-6 last', 'clear', 'clear']
# resource parts # resource parts

View file

@ -443,7 +443,7 @@ img.notselected {
/* lobo layout-specific classes */ /* lobo layout-specific classes */
.legend { .legend {
margin-top: 1px; margin-top: 5px;
} }
/* comments */ /* comments */

View file

@ -316,6 +316,17 @@ When we clear the `private` flag the post becomes visible again.
True True
Micro Articles
==============
>>> from loops.compound.microart.base import MicroArt
>>> from loops.compound.microart.interfaces import IMicroArt
>>> component.provideAdapter(BlogPost, provides=IMicroArt)
>>> tMicroArt = addAndConfigureObject(concepts, Concept, 'microart',
... title=u'MicroArt', conceptType=tType)
Fin de partie Fin de partie
============= =============

View file

@ -0,0 +1,4 @@
"""
$Id$
"""

73
compound/microart/base.py Normal file
View file

@ -0,0 +1,73 @@
#
# Copyright (c) 2011 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Micro articles (MicroArt).
"""
from zope.cachedescriptors.property import Lazy
from zope.dublincore.interfaces import IZopeDublinCore
from zope.interface import implements
from zope.event import notify
from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
from zope import schema
from zope.traversing.api import getName
from loops.common import adapted
from loops.compound.base import Compound
from loops.compound.microart.interfaces import IMicroArt
from loops.resource import Resource
from loops.setup import addAndConfigureObject
from loops.type import TypeInterfaceSourceList
TypeInterfaceSourceList.typeInterfaces += (IMicroArt,)
class MicroArt(Compound):
implements(IMicroArt)
_adapterAttributes = Compound._adapterAttributes + ('text',)
_noexportAttributes = ('text',)
_textIndexAttributes = ('text',)
defaultTextContentType = 'text/restructured'
textContentType = defaultTextContentType
def getText(self):
res = self.getParts()
if len(res) > 0:
return adapted(res[0]).data
return u''
def setText(self, value):
res = self.getParts()
if len(res) > 0:
res = adapted(res[0])
else:
tTextDocument = self.conceptManager['textdocument']
name = getName(self.context) + '_text'
res = addAndConfigureObject(self.resourceManager, Resource, name,
title=self.title, contentType=self.defaultTextContentType,
resourceType=tTextDocument)
#notify(ObjectCreatedEvent(res))
self.add(res, position=0)
res = adapted(res)
res.data = value
notify(ObjectModifiedEvent(res.context))
text = property(getText, setText)

52
compound/microart/browser.py Executable file
View file

@ -0,0 +1,52 @@
#
# Copyright (c) 2011 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
View classes for micro articles (MicroArt).
"""
import itertools
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.common import adapted
from loops import util
from loops.util import _
view_macros = ViewPageTemplateFile('view_macros.pt')
class MicroArtView(ConceptView):
@Lazy
def macro(self):
return view_macros.macros['microart']
def render(self):
return self.renderText(self.data['text'], self.adapted.textContentType)
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)

View file

@ -0,0 +1,29 @@
<configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="zope">
<zope:adapter
factory="loops.compound.microart.base.MicroArt"
provides="loops.compound.microart.interfaces.IMicroArt"
trusted="True" />
<zope:class class="loops.compound.microart.base.MicroArt">
<require permission="zope.View"
interface="loops.compound.microart.interfaces.IMicroArt" />
<require permission="zope.View"
attributes="context" />
<require permission="zope.ManageContent"
set_schema="loops.compound.microart.interfaces.IMicroArt" />
</zope:class>
<!-- views -->
<zope:adapter
name="microart.html"
for="loops.interfaces.IConcept
zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.interface.Interface"
factory="loops.compound.microart.browser.MicroArtView"
permission="zope.View" />
</configure>

View file

@ -0,0 +1,63 @@
#
# Copyright (c) 2011 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Micro articles (MicroArt / MikroArtikel in German).
"""
from zope.interface import Interface, Attribute
from zope import interface, component, schema
from loops.compound.interfaces import ICompound
from loops.util import _
class IMicroArt(ICompound):
""" A short article with a few elements, for collecting
relevant information in a knowledge management environment.
"""
# title = Ueberschrift, Thema
story = schema.Text( # Geschichte
title=_(u'Story'),
description=_(u'The story, i.e. the main text of your '
u'micro article. Who did what? What happend?'),
required=True)
insight = schema.Text( # Einsicht
title=_(u'Insight'),
description=_(u'What can we learn from the story? What '
u'has gone wrong? What was good?'),
required=True)
consequences = schema.Text( #(Schluss-) Folgerungen
title=_(u'Consequences'),
description=_(u'What we will do next time in a similar '
u'situation?'),
required=True)
followUps = schema.Text( #Anschlussfragen
title=_(u'Follow-up Questions'),
description=_(u'Question for helping to solve or avoid '
u'similar problems in the future.'),
required=False)
# ideas, questions:
# could follow-up questions be associated to links to follow-up micro articles?
# re-use story for other MAs, e.g. insight and consequences drawn by others?

View file

@ -0,0 +1,37 @@
#
# Copyright (c) 2011 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Specialized schema factories
"""
from zope.component import adapts
from cybertools.composer.schema.factory import SchemaFactory
from loops.compound.microart.interfaces import IMicroArt
class MicroArtSchemaFactory(SchemaFactory):
adapts(IMicroArt)
def __call__(self, interface, **kw):
schema = super(MicroArtSchemaFactory, self).__call__(interface, **kw)
schema.fields.text.height = 10
return schema

View file

@ -0,0 +1,17 @@
<!-- ZPT macros for loops.compound.microart views -->
<div metal:define-macro="microart"
tal:define="data item/data"
class="microart">
<metal:block use-macro="view/concept_macros/concepttitle_only" />
<div class="description"
tal:define="description description|item/renderedDescription"
tal:condition="description">
<span tal:content="structure description">Description</span>
</div>
<div class="text"
tal:content="structure item/render">Here comes the text...</div>
<metal:resources use-macro="view/concept_macros/conceptchildren" />
<metal:resources use-macro="view/concept_macros/conceptresources" />
<metal:block use-macro="view/comment_macros/comments" />
</div>

View file

@ -475,6 +475,7 @@
<include package=".browser" /> <include package=".browser" />
<include package=".classifier" /> <include package=".classifier" />
<include package=".compound.blog" /> <include package=".compound.blog" />
<include package=".compound.microart" />
<include package=".config" /> <include package=".config" />
<include package=".constraint" /> <include package=".constraint" />
<include package=".expert" /> <include package=".expert" />

View file

@ -181,7 +181,7 @@ class Task(BaseTask, KnowledgeAdapterMixin):
item['other'].append(k) item['other'].append(k)
result.append(item) result.append(item)
for item in result: for item in result:
item['fit'] /= len(reqs) item['fit'] = round(item['fit'] / len(reqs), 2)
return sorted(result, key=lambda x: (-x['fit'], x['person'].title)) return sorted(result, key=lambda x: (-x['fit'], x['person'].title))

Binary file not shown.

View file

@ -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-08-21 12:00 CET\n" "PO-Revision-Date: 2011-10-31 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"
@ -114,13 +114,13 @@ msgid "Create Glossary Item..."
msgstr "Glossareintrag anlegen..." msgstr "Glossareintrag anlegen..."
msgid "Create Glossary Item" msgid "Create Glossary Item"
msgstr "Glossareintrag anlegen" msgstr "Glossareintrag anlegen."
msgid "Create Person..." msgid "Create Person..."
msgstr "Person anlegen..." msgstr "Person anlegen..."
msgid "Create a new person." msgid "Create a new person."
msgstr "Eine neue Person anlegen" msgstr "Eine neue Person anlegen."
msgid "Edit Person..." msgid "Edit Person..."
msgstr "Person bearbeiten..." msgstr "Person bearbeiten..."
@ -132,25 +132,31 @@ msgid "Create Institution..."
msgstr "Institution anlegen..." msgstr "Institution anlegen..."
msgid "Create a new institution." msgid "Create a new institution."
msgstr "Eine neue Institution anlegen" msgstr "Eine neue Institution anlegen."
msgid "Edit Institution..." msgid "Edit Institution..."
msgstr "Institution bearbeiten..." msgstr "Institution bearbeiten..."
msgid "Modify institution." msgid "Modify institution."
msgstr "Institution bearbeiten" msgstr "Institution bearbeiten."
msgid "Create Orgunit..."
msgstr "Organisationseinheit anlegen..."
msgid "Create a new organizational unit."
msgstr "Eine neue Organisationseinheit anlegen."
msgid "Create Address..." msgid "Create Address..."
msgstr "Adresse anlegen..." msgstr "Adresse anlegen..."
msgid "Create a new address." msgid "Create a new address."
msgstr "Eine neue Adresse anlegen" msgstr "Eine neue Adresse anlegen."
msgid "Edit Address..." msgid "Edit Address..."
msgstr "Adresse bearbeiten..." msgstr "Adresse bearbeiten..."
msgid "Modify address." msgid "Modify address."
msgstr "Adresse bearbeiten" msgstr "Adresse bearbeiten."
msgid "Create Concept, Type = " msgid "Create Concept, Type = "
msgstr "Begriff anlegen, Typ = " msgstr "Begriff anlegen, Typ = "
@ -174,13 +180,13 @@ msgid "Create Event..."
msgstr "Termin anlegen..." msgstr "Termin anlegen..."
msgid "Create a new event" msgid "Create a new event"
msgstr "Einen neuen Termin anlegen" msgstr "Einen neuen Termin anlegen."
msgid "Create Task..." msgid "Create Task..."
msgstr "Aufgabe anlegen..." msgstr "Aufgabe anlegen..."
msgid "Create a new task" msgid "Create a new task"
msgstr "Eine neue Aufgabe anlegen" msgstr "Eine neue Aufgabe anlegen."
msgid "Edit Task..." msgid "Edit Task..."
msgstr "Aufgabe bearbeiten..." msgstr "Aufgabe bearbeiten..."
@ -188,6 +194,12 @@ msgstr "Aufgabe bearbeiten..."
msgid "Modify task" msgid "Modify task"
msgstr "Aufgabe bearbeiten" msgstr "Aufgabe bearbeiten"
msgid "Create Project..."
msgstr "Project anlegen..."
msgid "Create a new project."
msgstr "Eine neues Projekt anlegen."
msgid "Create Work Item..." msgid "Create Work Item..."
msgstr "Aktivität anlegen..." msgstr "Aktivität anlegen..."

View file

@ -19,8 +19,6 @@
""" """
Definition of view classes and other browser related stuff (e.g. actions) for Definition of view classes and other browser related stuff (e.g. actions) for
loops.organize.party. loops.organize.party.
$Id$
""" """
from email.MIMEText import MIMEText from email.MIMEText import MIMEText
@ -96,6 +94,16 @@ actions.register('editInstitution', 'portlet', DialogAction,
dialogName='editInstitution', dialogName='editInstitution',
) )
actions.register('createOrgUnit', 'portlet', DialogAction,
title=_(u'Create Orgunit...'),
description=_(u'Create a new organizational unit.'),
viewName='create_concept.html',
dialogName='createOrgUnit',
typeToken='.loops/concepts/orgunit',
fixedType=True,
innerForm='inner_concept_form.html',
)
actions.register('send_email', 'object', DialogAction, actions.register('send_email', 'object', DialogAction,
description=_(u'Send a link to this object by email.'), description=_(u'Send a link to this object by email.'),
viewName='object_send_email.html', viewName='object_send_email.html',

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de # Copyright (c) 2011 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -18,8 +18,6 @@
""" """
Definition of view classes and other browser related stuff for tasks. Definition of view classes and other browser related stuff for tasks.
$Id$
""" """
from zope import interface, component from zope import interface, component
@ -51,6 +49,17 @@ actions.register('createTask', 'portlet', DialogAction,
prerequisites=['registerDojoDateWidget'], prerequisites=['registerDojoDateWidget'],
) )
actions.register('createProject', 'portlet', DialogAction,
title=_(u'Create Project...'),
description=_(u'Create a new project.'),
viewName='create_concept.html',
dialogName='createProject',
typeToken='.loops/concepts/project',
fixedType=True,
innerForm='inner_concept_form.html',
prerequisites=['registerDojoDateWidget'],
)
organize_macros = ViewPageTemplateFile('view_macros.pt') organize_macros = ViewPageTemplateFile('view_macros.pt')

View file

@ -58,7 +58,8 @@ from loops.browser.node import ViewPropertiesConfigurator
from loops.common import NameChooser from loops.common import NameChooser
from loops.concept import Concept from loops.concept import Concept
from loops.concept import IndexAttributes as ConceptIndexAttributes from loops.concept import IndexAttributes as ConceptIndexAttributes
from loops.config.base import GlobalOptions, LoopsOptions, QueryOptions, TypeOptions from loops.config.base import GlobalOptions, LoopsOptions
from loops.config.base import QueryOptions, PredicateOptions, TypeOptions
from loops.interfaces import ILoopsObject, IIndexAttributes from loops.interfaces import ILoopsObject, IIndexAttributes
from loops.interfaces import IDocument, IFile, ITextDocument from loops.interfaces import IDocument, IFile, ITextDocument
from loops.layout.base import LayoutNode from loops.layout.base import LayoutNode
@ -143,6 +144,7 @@ class TestSite(object):
component.provideAdapter(ConceptSecuritySetter) component.provideAdapter(ConceptSecuritySetter)
component.provideAdapter(ResourceSecuritySetter) component.provideAdapter(ResourceSecuritySetter)
component.provideAdapter(LoopsOptions) component.provideAdapter(LoopsOptions)
component.provideAdapter(PredicateOptions)
component.provideAdapter(QueryOptions) component.provideAdapter(QueryOptions)
component.provideAdapter(TypeOptions) component.provideAdapter(TypeOptions)
component.provideUtility(GlobalOptions()) component.provideUtility(GlobalOptions())