CCM: competence interface; further clean-up of default data definitions

This commit is contained in:
Helmut Merz 2013-02-26 10:51:48 +01:00
parent 4e50bd2c61
commit 9a333789da
14 changed files with 94 additions and 28 deletions

View file

@ -27,7 +27,7 @@ configuration):
>>> concepts, resources, views = t.setup()
>>> len(concepts) + len(resources)
37
36
>>> loopsRoot = site['loops']
@ -47,11 +47,11 @@ Type- and text-based queries
>>> from loops.expert import query
>>> qu = query.Title('ty*')
>>> list(qu.apply())
[0, 2, 68]
[0, 2, 65]
>>> qu = query.Type('loops:*')
>>> len(list(qu.apply()))
37
36
>>> qu = query.Type('loops:concept:predicate')
>>> len(list(qu.apply()))

View file

@ -66,13 +66,13 @@ zcml in real life:
>>> t = searchView.typesForSearch()
>>> len(t)
16
15
>>> t.getTermByToken('loops:resource:*').title
'Any Resource'
>>> t = searchView.conceptTypesForSearch()
>>> len(t)
13
12
>>> t.getTermByToken('loops:concept:*').title
'Any Concept'
@ -91,7 +91,7 @@ a controller attribute for the search view.
>>> searchView.submitReplacing('1.results', '1.search.form', pageView)
'submitReplacing("1.results", "1.search.form",
"http://127.0.0.1/loops/views/page/.target99/@@searchresults.html");...'
"http://127.0.0.1/loops/views/page/.target96/@@searchresults.html");...'
Basic (text/title) search
-------------------------
@ -177,7 +177,7 @@ of the concepts' titles:
>>> request = TestRequest(form=form)
>>> view = Search(page, request)
>>> view.listConcepts()
u"{identifier: 'id', items: [{label: 'Zope (Thema)', name: 'Zope', id: '104'}, {label: 'Zope 2 (Thema)', name: 'Zope 2', id: '106'}, {label: 'Zope 3 (Thema)', name: 'Zope 3', id: '108'}]}"
u"{identifier: 'id', items: [{label: 'Zope (Thema)', name: 'Zope', id: '101'}, {label: 'Zope 2 (Thema)', name: 'Zope 2', id: '103'}, {label: 'Zope 3 (Thema)', name: 'Zope 3', id: '105'}]}"
Preset Concept Types on Search Forms
------------------------------------
@ -219,13 +219,13 @@ and thus include the customer type in the preset search types.
>>> searchView.conceptsForType('loops:concept:customer')
[{'token': 'none', 'title': u'not selected'},
{'token': '77', 'title': u'Customer 1'},
{'token': '79', 'title': u'Customer 2'},
{'token': '81', 'title': u'Customer 3'}]
{'token': '74', 'title': u'Customer 1'},
{'token': '76', 'title': u'Customer 2'},
{'token': '78', 'title': u'Customer 3'}]
Let's use this new search option for querying:
>>> form = {'search.4.text_selected': u'77'}
>>> form = {'search.4.text_selected': u'74'}
>>> resultsView = SearchResults(page, TestRequest(form=form))
>>> results = list(resultsView.results)
>>> results[0].title

6
external/README.txt vendored
View file

@ -17,7 +17,7 @@ Let's set up a loops site with basic and example concepts and resources.
>>> concepts, resources, views = t.setup()
>>> loopsRoot = site['loops']
>>> len(concepts), len(resources), len(views)
(34, 3, 1)
(33, 3, 1)
Importing loops Objects
@ -44,7 +44,7 @@ Creating the corresponding objects
>>> loader = Loader(loopsRoot)
>>> loader.load(elements)
>>> len(concepts), len(resources), len(views)
(35, 3, 1)
(34, 3, 1)
>>> from loops.common import adapted
>>> adMyquery = adapted(concepts['myquery'])
@ -118,7 +118,7 @@ Extracting elements
>>> extractor = Extractor(loopsRoot, os.path.join(dataDirectory, 'export'))
>>> elements = list(extractor.extract())
>>> len(elements)
67
65
Writing object information to the external storage
--------------------------------------------------

View file

@ -1,5 +1,6 @@
type(u'competence', u'Kompetenz', viewName=u'',
typeInterface=u'', options=u'action.portlet:create_subtype,edit_concept')
typeInterface=u'loops.knowledge.qualification.interfaces.ICompetence',
options=u'action.portlet:create_subtype,edit_concept')
type(u'person', u'Person', viewName=u'',
typeInterface=u'loops.knowledge.interfaces.IPerson',
options=u'action.portlet:createQualification,editPerson')
@ -38,6 +39,7 @@ child(u'general', u'topic', u'standard')
child(u'system', u'issubtype', u'standard')
child(u'competence', u'competence', u'issubtype')
#child(u'competence', u'training', u'issubtype', usePredicate=u'provides')
# records

View file

@ -1,5 +1,6 @@
type(u'competence', u'Kompetenz', viewName=u'',
typeInterface=u'', options=u'action.portlet:create_subtype,edit_concept')
typeInterface=u'loops.knowledge.qualification.interfaces.ICompetence',
options=u'action.portlet:create_subtype,edit_concept')
# type(u'person', u'Person', viewName=u'',
# typeInterface=u'loops.knowledge.interfaces.IPerson',
# options=u'action.portlet:editPerson')
@ -38,6 +39,7 @@ child(u'general', u'requires', u'standard')
child(u'system', u'issubtype', u'standard')
child(u'competence', u'competence', u'issubtype')
#child(u'competence', u'training', u'issubtype', usePredicate=u'provides')
# records

View file

@ -25,4 +25,14 @@ Central part of CCM competence and certification management framework.
from zope.component import adapts
from zope.interface import implementer, implements
from loops.common import AdapterBase
from loops.knowledge.qualification.interfaces import ICompetence
class Competence(AdapterBase):
implements(ICompetence)
_contextAttributes = list(ICompetence)

View file

@ -3,6 +3,9 @@
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="loops">
<zope:adapter
factory="loops.knowledge.qualification.base.Competence" />
<!-- views -->
</configure>

View file

@ -23,3 +23,22 @@ Interfaces for knowledge management and elearning with loops.
from zope.interface import Interface, Attribute
from zope import interface, component, schema
from loops.interfaces import IConceptSchema
from loops.util import _
class ICompetence(IConceptSchema):
""" The competence of a person.
Maybe assigned to the person via a 'knows' relation or
work items of type 'checkup'.
"""
validityPeriod = schema.Int(
title=_(u'Validity Period (Months)'),
description=_(u'Number of months the competence remains valid. '
u'Zero means unlimited validity.'),
default=0,
required=False)

View file

@ -7,6 +7,7 @@ from zope import component
from zope.interface.verify import verifyClass
from zope.testing.doctestunit import DocFileSuite
from loops.knowledge.qualification.base import Competence
from loops.knowledge.survey.base import Questionnaire, Question, FeedbackItem
from loops.knowledge.survey.interfaces import IQuestionnaire, IQuestion, \
IFeedbackItem
@ -21,6 +22,7 @@ def importData(loopsRoot):
baseImportData(loopsRoot, importPath, 'knowledge_de.dmp')
def importSurvey(loopsRoot):
component.provideAdapter(Competence)
component.provideAdapter(Questionnaire, provides=IQuestionnaire)
component.provideAdapter(Question, provides=IQuestion)
component.provideAdapter(FeedbackItem, provides=IFeedbackItem)

Binary file not shown.

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: 0.13.0\n"
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
"PO-Revision-Date: 2013-01-16 12:00 CET\n"
"PO-Revision-Date: 2013-02-26 12:00 CET\n"
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
"Language-Team: loops developers <helmutm@cy55.de>\n"
"MIME-Version: 1.0\n"
@ -170,6 +170,30 @@ msgstr "Glossareintrag anlegen..."
msgid "Create Glossary Item"
msgstr "Glossareintrag anlegen."
# survey / questionnaire
msgid "Answer Range"
msgstr "Abstufung Bewertungen"
msgid "Number of items (answer options) to select from."
msgstr "Anzahl der Abstufungen, aus denen bei der Antwort gewählt werden kann."
msgid "Negativ"
msgstr "Negativbewertung"
msgid "Value inversion: High selection means low value."
msgstr "Invertierung der Bewertung: Hohe gewählte Stufe bedeutet niedriger Wert."
# competence (qualification)
msgid "Validity Period (Months)"
msgstr "Gültigkeitszeitraum (Monate)"
msgid "Number of months the competence remains valid. Zero means unlimited validity."
msgstr "Anzahl der Monate, die diese Kompetenz gültig bleibt. Null bedeutet unbegrenzte Gültigkeit"
# organize
msgid "Create Person..."
msgstr "Person anlegen..."
@ -212,6 +236,8 @@ msgstr "Adresse bearbeiten..."
msgid "Modify address."
msgstr "Adresse bearbeiten."
# general
msgid "Create Concept, Type = "
msgstr "Begriff anlegen, Typ = "
@ -230,6 +256,8 @@ msgstr "Diese Ressource bearbeiten."
msgid "Edit Concept"
msgstr "Begriff bearbeiten"
# events and tasks
msgid "Create Event..."
msgstr "Termin anlegen..."

View file

@ -410,7 +410,7 @@ Send Email to Members
>>> form.subject
u"loops Notification from '$site'"
>>> form.mailBody
u'\n\nEvent #1\nhttp://127.0.0.1/loops/views/menu/.116\n\n'
u'\n\nEvent #1\nhttp://127.0.0.1/loops/views/menu/.113\n\n'
Show Presence of Other Users

View file

@ -18,7 +18,7 @@ Let's set up a loops site with basic and example concepts and resources.
>>> concepts, resources, views = t.setup()
>>> loopsRoot = site['loops']
>>> len(concepts), len(resources), len(views)
(34, 3, 1)
(33, 3, 1)
>>> from cybertools.tracking.btree import TrackingStorage
>>> from loops.system.job import JobRecord

View file

@ -35,7 +35,7 @@ ZCML setup):
Let's look what setup has provided us with:
>>> len(concepts)
23
22
Now let's add a few more concepts:
@ -73,7 +73,7 @@ applied in an explicit assignment.
>>> sorted(t['name'] for t in xrf.getConceptTypes())
[u'competence', u'customer', u'domain', u'file', u'note', u'person',
u'predicate', u'task', u'textdocument', u'topic', u'training', u'type']
u'predicate', u'task', u'textdocument', u'topic', u'type']
>>> sorted(t['name'] for t in xrf.getPredicates())
[u'depends', u'issubtype', u'knows', u'ownedby', u'provides', u'requires',
u'standard']
@ -96,7 +96,7 @@ All methods that retrieve one object also returns its children and parents:
u'hasType'
>>> sorted(c['name'] for c in ch[0]['objects'])
[u'competence', u'customer', u'domain', u'file', u'note', u'person',
u'predicate', u'task', u'textdocument', u'topic', u'training', u'type']
u'predicate', u'task', u'textdocument', u'topic', u'type']
>>> pa = defaultPred['parents']
>>> len(pa)
@ -115,7 +115,7 @@ We can also retrieve children and parents explicitely:
u'hasType'
>>> sorted(c['name'] for c in ch[0]['objects'])
[u'competence', u'customer', u'domain', u'file', u'note', u'person',
u'predicate', u'task', u'textdocument', u'topic', u'training', u'type']
u'predicate', u'task', u'textdocument', u'topic', u'type']
>>> pa = xrf.getParents('5')
>>> len(pa)
@ -174,14 +174,14 @@ Updating the concept map
>>> topicId = xrf.getObjectByName('topic')['id']
>>> xrf.createConcept(topicId, u'zope2', u'Zope 2')
{'description': u'', 'title': u'Zope 2', 'type': '36', 'id': '75',
{'description': u'', 'title': u'Zope 2', 'type': '36', 'id': '72',
'name': u'zope2'}
The name of the concept is checked by a name chooser; if the corresponding
parameter is empty, the name will be generated from the title.
>>> xrf.createConcept(topicId, u'', u'Python')
{'description': u'', 'title': u'Python', 'type': '36', 'id': '77',
{'description': u'', 'title': u'Python', 'type': '36', 'id': '74',
'name': u'python'}
If we try to deassign a ``hasType`` relation nothing will happen; a