diff --git a/browser/concept.py b/browser/concept.py index 2ffc5ea..01084b0 100644 --- a/browser/concept.py +++ b/browser/concept.py @@ -348,8 +348,8 @@ class ConceptView(BaseView): def isHidden(self, pr): if (getName(pr.second.conceptType) in - #IOptions(adapted(pr.predicate))('hide_parents_for', [])): - IOptions(pr.predicate)('hide_parents_for', [])): + IOptions(adapted(pr.predicate))('hide_parents_for', [])): + #IOptions(pr.predicate)('hide_parents_for', [])): return True hideRoles = None options = component.queryAdapter(adapted(pr.first), IOptions) diff --git a/browser/configure.zcml b/browser/configure.zcml index 3ebe833..ef0229b 100644 --- a/browser/configure.zcml +++ b/browser/configure.zcml @@ -29,7 +29,7 @@ diff --git a/browser/lobo/configure.zcml b/browser/lobo/configure.zcml index 0be24a7..e24df89 100644 --- a/browser/lobo/configure.zcml +++ b/browser/lobo/configure.zcml @@ -63,6 +63,14 @@ factory="loops.browser.lobo.standard.Header2" permission="zope.View" /> + + +
@@ -111,15 +112,13 @@ - + alt cell/title" /> - + alt cell/title" /> diff --git a/browser/lobo/standard.py b/browser/lobo/standard.py index fb847cd..aa3ac40 100644 --- a/browser/lobo/standard.py +++ b/browser/lobo/standard.py @@ -229,6 +229,13 @@ class Header2(BasePart): cssClass = ['span-4', 'span-2 last', 'clear'] +class Header3(BasePart): + + macroName = 'header' + imageSize = 'large' + cssClass = ['span-6 last', 'clear', 'clear'] + + # resource parts diff --git a/browser/skin/lobo/lobo.css b/browser/skin/lobo/lobo.css index fd323c7..de8850b 100644 --- a/browser/skin/lobo/lobo.css +++ b/browser/skin/lobo/lobo.css @@ -443,7 +443,7 @@ img.notselected { /* lobo layout-specific classes */ .legend { - margin-top: 1px; + margin-top: 5px; } /* comments */ diff --git a/compound/README.txt b/compound/README.txt index 4d0a049..06b6e2e 100644 --- a/compound/README.txt +++ b/compound/README.txt @@ -316,6 +316,17 @@ When we clear the `private` flag the post becomes visible again. 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 ============= diff --git a/compound/microart/__init__.py b/compound/microart/__init__.py new file mode 100644 index 0000000..4bc90fb --- /dev/null +++ b/compound/microart/__init__.py @@ -0,0 +1,4 @@ +""" +$Id$ +""" + diff --git a/compound/microart/base.py b/compound/microart/base.py new file mode 100644 index 0000000..3b568be --- /dev/null +++ b/compound/microart/base.py @@ -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) diff --git a/compound/microart/browser.py b/compound/microart/browser.py new file mode 100755 index 0000000..f35c83a --- /dev/null +++ b/compound/microart/browser.py @@ -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) + diff --git a/compound/microart/configure.zcml b/compound/microart/configure.zcml new file mode 100644 index 0000000..36e46c9 --- /dev/null +++ b/compound/microart/configure.zcml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + diff --git a/compound/microart/interfaces.py b/compound/microart/interfaces.py new file mode 100644 index 0000000..691bff7 --- /dev/null +++ b/compound/microart/interfaces.py @@ -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? diff --git a/compound/microart/schema.py b/compound/microart/schema.py new file mode 100644 index 0000000..b6d6dbf --- /dev/null +++ b/compound/microart/schema.py @@ -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 + diff --git a/compound/microart/view_macros.pt b/compound/microart/view_macros.pt new file mode 100755 index 0000000..ff15b1f --- /dev/null +++ b/compound/microart/view_macros.pt @@ -0,0 +1,17 @@ + + +
+ +
+ Description +
+
Here comes the text...
+ + + +
diff --git a/configure.zcml b/configure.zcml index 37c76c0..5ede487 100644 --- a/configure.zcml +++ b/configure.zcml @@ -475,6 +475,7 @@ + diff --git a/knowledge/knowledge.py b/knowledge/knowledge.py index c77223b..80b42ba 100644 --- a/knowledge/knowledge.py +++ b/knowledge/knowledge.py @@ -181,7 +181,7 @@ class Task(BaseTask, KnowledgeAdapterMixin): item['other'].append(k) result.append(item) 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)) diff --git a/locales/de/LC_MESSAGES/loops.mo b/locales/de/LC_MESSAGES/loops.mo index 5263c36..616b70a 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 1c787c2..8586a11 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-08-21 12:00 CET\n" +"PO-Revision-Date: 2011-10-31 12:00 CET\n" "Last-Translator: Helmut Merz \n" "Language-Team: loops developers \n" "MIME-Version: 1.0\n" @@ -114,13 +114,13 @@ msgid "Create Glossary Item..." msgstr "Glossareintrag anlegen..." msgid "Create Glossary Item" -msgstr "Glossareintrag anlegen" +msgstr "Glossareintrag anlegen." msgid "Create Person..." msgstr "Person anlegen..." msgid "Create a new person." -msgstr "Eine neue Person anlegen" +msgstr "Eine neue Person anlegen." msgid "Edit Person..." msgstr "Person bearbeiten..." @@ -132,25 +132,31 @@ msgid "Create Institution..." msgstr "Institution anlegen..." msgid "Create a new institution." -msgstr "Eine neue Institution anlegen" +msgstr "Eine neue Institution anlegen." msgid "Edit Institution..." msgstr "Institution bearbeiten..." 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..." msgstr "Adresse anlegen..." msgid "Create a new address." -msgstr "Eine neue Adresse anlegen" +msgstr "Eine neue Adresse anlegen." msgid "Edit Address..." msgstr "Adresse bearbeiten..." msgid "Modify address." -msgstr "Adresse bearbeiten" +msgstr "Adresse bearbeiten." msgid "Create Concept, Type = " msgstr "Begriff anlegen, Typ = " @@ -174,13 +180,13 @@ msgid "Create Event..." msgstr "Termin anlegen..." msgid "Create a new event" -msgstr "Einen neuen Termin anlegen" +msgstr "Einen neuen Termin anlegen." msgid "Create Task..." msgstr "Aufgabe anlegen..." msgid "Create a new task" -msgstr "Eine neue Aufgabe anlegen" +msgstr "Eine neue Aufgabe anlegen." msgid "Edit Task..." msgstr "Aufgabe bearbeiten..." @@ -188,6 +194,12 @@ msgstr "Aufgabe bearbeiten..." msgid "Modify task" msgstr "Aufgabe bearbeiten" +msgid "Create Project..." +msgstr "Project anlegen..." + +msgid "Create a new project." +msgstr "Eine neues Projekt anlegen." + msgid "Create Work Item..." msgstr "Aktivität anlegen..." diff --git a/organize/browser/party.py b/organize/browser/party.py index 5062013..6256d2a 100644 --- a/organize/browser/party.py +++ b/organize/browser/party.py @@ -19,8 +19,6 @@ """ Definition of view classes and other browser related stuff (e.g. actions) for loops.organize.party. - -$Id$ """ from email.MIMEText import MIMEText @@ -96,6 +94,16 @@ actions.register('editInstitution', 'portlet', DialogAction, 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, description=_(u'Send a link to this object by email.'), viewName='object_send_email.html', diff --git a/organize/browser/task.py b/organize/browser/task.py index 4427114..5f24eca 100644 --- a/organize/browser/task.py +++ b/organize/browser/task.py @@ -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 # 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. - -$Id$ """ from zope import interface, component @@ -51,6 +49,17 @@ actions.register('createTask', 'portlet', DialogAction, 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') diff --git a/tests/setup.py b/tests/setup.py index b23acf7..31522ba 100644 --- a/tests/setup.py +++ b/tests/setup.py @@ -58,7 +58,8 @@ from loops.browser.node import ViewPropertiesConfigurator from loops.common import NameChooser from loops.concept import Concept 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 IDocument, IFile, ITextDocument from loops.layout.base import LayoutNode @@ -143,6 +144,7 @@ class TestSite(object): component.provideAdapter(ConceptSecuritySetter) component.provideAdapter(ResourceSecuritySetter) component.provideAdapter(LoopsOptions) + component.provideAdapter(PredicateOptions) component.provideAdapter(QueryOptions) component.provideAdapter(TypeOptions) component.provideUtility(GlobalOptions())