CCM: competence interface; further clean-up of default data definitions
This commit is contained in:
parent
4e50bd2c61
commit
9a333789da
14 changed files with 94 additions and 28 deletions
|
@ -27,7 +27,7 @@ configuration):
|
||||||
>>> concepts, resources, views = t.setup()
|
>>> concepts, resources, views = t.setup()
|
||||||
|
|
||||||
>>> len(concepts) + len(resources)
|
>>> len(concepts) + len(resources)
|
||||||
37
|
36
|
||||||
|
|
||||||
>>> loopsRoot = site['loops']
|
>>> loopsRoot = site['loops']
|
||||||
|
|
||||||
|
@ -47,11 +47,11 @@ Type- and text-based queries
|
||||||
>>> from loops.expert import query
|
>>> from loops.expert import query
|
||||||
>>> qu = query.Title('ty*')
|
>>> qu = query.Title('ty*')
|
||||||
>>> list(qu.apply())
|
>>> list(qu.apply())
|
||||||
[0, 2, 68]
|
[0, 2, 65]
|
||||||
|
|
||||||
>>> qu = query.Type('loops:*')
|
>>> qu = query.Type('loops:*')
|
||||||
>>> len(list(qu.apply()))
|
>>> len(list(qu.apply()))
|
||||||
37
|
36
|
||||||
|
|
||||||
>>> qu = query.Type('loops:concept:predicate')
|
>>> qu = query.Type('loops:concept:predicate')
|
||||||
>>> len(list(qu.apply()))
|
>>> len(list(qu.apply()))
|
||||||
|
|
|
@ -66,13 +66,13 @@ zcml in real life:
|
||||||
|
|
||||||
>>> t = searchView.typesForSearch()
|
>>> t = searchView.typesForSearch()
|
||||||
>>> len(t)
|
>>> len(t)
|
||||||
16
|
15
|
||||||
>>> t.getTermByToken('loops:resource:*').title
|
>>> t.getTermByToken('loops:resource:*').title
|
||||||
'Any Resource'
|
'Any Resource'
|
||||||
|
|
||||||
>>> t = searchView.conceptTypesForSearch()
|
>>> t = searchView.conceptTypesForSearch()
|
||||||
>>> len(t)
|
>>> len(t)
|
||||||
13
|
12
|
||||||
>>> t.getTermByToken('loops:concept:*').title
|
>>> t.getTermByToken('loops:concept:*').title
|
||||||
'Any Concept'
|
'Any Concept'
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ a controller attribute for the search view.
|
||||||
|
|
||||||
>>> searchView.submitReplacing('1.results', '1.search.form', pageView)
|
>>> searchView.submitReplacing('1.results', '1.search.form', pageView)
|
||||||
'submitReplacing("1.results", "1.search.form",
|
'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
|
Basic (text/title) search
|
||||||
-------------------------
|
-------------------------
|
||||||
|
@ -177,7 +177,7 @@ of the concepts' titles:
|
||||||
>>> request = TestRequest(form=form)
|
>>> request = TestRequest(form=form)
|
||||||
>>> view = Search(page, request)
|
>>> view = Search(page, request)
|
||||||
>>> view.listConcepts()
|
>>> 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
|
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')
|
>>> searchView.conceptsForType('loops:concept:customer')
|
||||||
[{'token': 'none', 'title': u'not selected'},
|
[{'token': 'none', 'title': u'not selected'},
|
||||||
{'token': '77', 'title': u'Customer 1'},
|
{'token': '74', 'title': u'Customer 1'},
|
||||||
{'token': '79', 'title': u'Customer 2'},
|
{'token': '76', 'title': u'Customer 2'},
|
||||||
{'token': '81', 'title': u'Customer 3'}]
|
{'token': '78', 'title': u'Customer 3'}]
|
||||||
|
|
||||||
Let's use this new search option for querying:
|
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))
|
>>> resultsView = SearchResults(page, TestRequest(form=form))
|
||||||
>>> results = list(resultsView.results)
|
>>> results = list(resultsView.results)
|
||||||
>>> results[0].title
|
>>> results[0].title
|
||||||
|
|
6
external/README.txt
vendored
6
external/README.txt
vendored
|
@ -17,7 +17,7 @@ Let's set up a loops site with basic and example concepts and resources.
|
||||||
>>> concepts, resources, views = t.setup()
|
>>> concepts, resources, views = t.setup()
|
||||||
>>> loopsRoot = site['loops']
|
>>> loopsRoot = site['loops']
|
||||||
>>> len(concepts), len(resources), len(views)
|
>>> len(concepts), len(resources), len(views)
|
||||||
(34, 3, 1)
|
(33, 3, 1)
|
||||||
|
|
||||||
|
|
||||||
Importing loops Objects
|
Importing loops Objects
|
||||||
|
@ -44,7 +44,7 @@ Creating the corresponding objects
|
||||||
>>> loader = Loader(loopsRoot)
|
>>> loader = Loader(loopsRoot)
|
||||||
>>> loader.load(elements)
|
>>> loader.load(elements)
|
||||||
>>> len(concepts), len(resources), len(views)
|
>>> len(concepts), len(resources), len(views)
|
||||||
(35, 3, 1)
|
(34, 3, 1)
|
||||||
|
|
||||||
>>> from loops.common import adapted
|
>>> from loops.common import adapted
|
||||||
>>> adMyquery = adapted(concepts['myquery'])
|
>>> adMyquery = adapted(concepts['myquery'])
|
||||||
|
@ -118,7 +118,7 @@ Extracting elements
|
||||||
>>> extractor = Extractor(loopsRoot, os.path.join(dataDirectory, 'export'))
|
>>> extractor = Extractor(loopsRoot, os.path.join(dataDirectory, 'export'))
|
||||||
>>> elements = list(extractor.extract())
|
>>> elements = list(extractor.extract())
|
||||||
>>> len(elements)
|
>>> len(elements)
|
||||||
67
|
65
|
||||||
|
|
||||||
Writing object information to the external storage
|
Writing object information to the external storage
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
type(u'competence', u'Kompetenz', viewName=u'',
|
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'',
|
type(u'person', u'Person', viewName=u'',
|
||||||
typeInterface=u'loops.knowledge.interfaces.IPerson',
|
typeInterface=u'loops.knowledge.interfaces.IPerson',
|
||||||
options=u'action.portlet:createQualification,editPerson')
|
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'system', u'issubtype', u'standard')
|
||||||
|
|
||||||
|
child(u'competence', u'competence', u'issubtype')
|
||||||
#child(u'competence', u'training', u'issubtype', usePredicate=u'provides')
|
#child(u'competence', u'training', u'issubtype', usePredicate=u'provides')
|
||||||
|
|
||||||
# records
|
# records
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
type(u'competence', u'Kompetenz', viewName=u'',
|
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'',
|
# type(u'person', u'Person', viewName=u'',
|
||||||
# typeInterface=u'loops.knowledge.interfaces.IPerson',
|
# typeInterface=u'loops.knowledge.interfaces.IPerson',
|
||||||
# options=u'action.portlet:editPerson')
|
# 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'system', u'issubtype', u'standard')
|
||||||
|
|
||||||
|
child(u'competence', u'competence', u'issubtype')
|
||||||
#child(u'competence', u'training', u'issubtype', usePredicate=u'provides')
|
#child(u'competence', u'training', u'issubtype', usePredicate=u'provides')
|
||||||
|
|
||||||
# records
|
# records
|
||||||
|
|
|
@ -25,4 +25,14 @@ Central part of CCM competence and certification management framework.
|
||||||
from zope.component import adapts
|
from zope.component import adapts
|
||||||
from zope.interface import implementer, implements
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
<configure
|
<configure
|
||||||
xmlns:zope="http://namespaces.zope.org/zope"
|
xmlns:zope="http://namespaces.zope.org/zope"
|
||||||
xmlns:browser="http://namespaces.zope.org/browser"
|
xmlns:browser="http://namespaces.zope.org/browser"
|
||||||
i18n_domain="loops">
|
i18n_domain="loops">
|
||||||
|
|
||||||
|
<zope:adapter
|
||||||
|
factory="loops.knowledge.qualification.base.Competence" />
|
||||||
|
|
||||||
<!-- views -->
|
<!-- views -->
|
||||||
|
|
||||||
|
|
|
@ -23,3 +23,22 @@ Interfaces for knowledge management and elearning with loops.
|
||||||
from zope.interface import Interface, Attribute
|
from zope.interface import Interface, Attribute
|
||||||
from zope import interface, component, schema
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from zope import component
|
||||||
from zope.interface.verify import verifyClass
|
from zope.interface.verify import verifyClass
|
||||||
from zope.testing.doctestunit import DocFileSuite
|
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.base import Questionnaire, Question, FeedbackItem
|
||||||
from loops.knowledge.survey.interfaces import IQuestionnaire, IQuestion, \
|
from loops.knowledge.survey.interfaces import IQuestionnaire, IQuestion, \
|
||||||
IFeedbackItem
|
IFeedbackItem
|
||||||
|
@ -21,6 +22,7 @@ def importData(loopsRoot):
|
||||||
baseImportData(loopsRoot, importPath, 'knowledge_de.dmp')
|
baseImportData(loopsRoot, importPath, 'knowledge_de.dmp')
|
||||||
|
|
||||||
def importSurvey(loopsRoot):
|
def importSurvey(loopsRoot):
|
||||||
|
component.provideAdapter(Competence)
|
||||||
component.provideAdapter(Questionnaire, provides=IQuestionnaire)
|
component.provideAdapter(Questionnaire, provides=IQuestionnaire)
|
||||||
component.provideAdapter(Question, provides=IQuestion)
|
component.provideAdapter(Question, provides=IQuestion)
|
||||||
component.provideAdapter(FeedbackItem, provides=IFeedbackItem)
|
component.provideAdapter(FeedbackItem, provides=IFeedbackItem)
|
||||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
||||||
|
|
||||||
"Project-Id-Version: 0.13.0\n"
|
"Project-Id-Version: 0.13.0\n"
|
||||||
"POT-Creation-Date: 2007-05-22 12:00 CET\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"
|
"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"
|
||||||
|
@ -170,6 +170,30 @@ msgstr "Glossareintrag anlegen..."
|
||||||
msgid "Create Glossary Item"
|
msgid "Create Glossary Item"
|
||||||
msgstr "Glossareintrag anlegen."
|
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..."
|
msgid "Create Person..."
|
||||||
msgstr "Person anlegen..."
|
msgstr "Person anlegen..."
|
||||||
|
|
||||||
|
@ -212,6 +236,8 @@ msgstr "Adresse bearbeiten..."
|
||||||
msgid "Modify address."
|
msgid "Modify address."
|
||||||
msgstr "Adresse bearbeiten."
|
msgstr "Adresse bearbeiten."
|
||||||
|
|
||||||
|
# general
|
||||||
|
|
||||||
msgid "Create Concept, Type = "
|
msgid "Create Concept, Type = "
|
||||||
msgstr "Begriff anlegen, Typ = "
|
msgstr "Begriff anlegen, Typ = "
|
||||||
|
|
||||||
|
@ -230,6 +256,8 @@ msgstr "Diese Ressource bearbeiten."
|
||||||
msgid "Edit Concept"
|
msgid "Edit Concept"
|
||||||
msgstr "Begriff bearbeiten"
|
msgstr "Begriff bearbeiten"
|
||||||
|
|
||||||
|
# events and tasks
|
||||||
|
|
||||||
msgid "Create Event..."
|
msgid "Create Event..."
|
||||||
msgstr "Termin anlegen..."
|
msgstr "Termin anlegen..."
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,7 @@ Send Email to Members
|
||||||
>>> form.subject
|
>>> form.subject
|
||||||
u"loops Notification from '$site'"
|
u"loops Notification from '$site'"
|
||||||
>>> form.mailBody
|
>>> 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
|
Show Presence of Other Users
|
||||||
|
|
|
@ -18,7 +18,7 @@ Let's set up a loops site with basic and example concepts and resources.
|
||||||
>>> concepts, resources, views = t.setup()
|
>>> concepts, resources, views = t.setup()
|
||||||
>>> loopsRoot = site['loops']
|
>>> loopsRoot = site['loops']
|
||||||
>>> len(concepts), len(resources), len(views)
|
>>> len(concepts), len(resources), len(views)
|
||||||
(34, 3, 1)
|
(33, 3, 1)
|
||||||
|
|
||||||
>>> from cybertools.tracking.btree import TrackingStorage
|
>>> from cybertools.tracking.btree import TrackingStorage
|
||||||
>>> from loops.system.job import JobRecord
|
>>> from loops.system.job import JobRecord
|
||||||
|
|
|
@ -35,7 +35,7 @@ ZCML setup):
|
||||||
Let's look what setup has provided us with:
|
Let's look what setup has provided us with:
|
||||||
|
|
||||||
>>> len(concepts)
|
>>> len(concepts)
|
||||||
23
|
22
|
||||||
|
|
||||||
Now let's add a few more concepts:
|
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())
|
>>> sorted(t['name'] for t in xrf.getConceptTypes())
|
||||||
[u'competence', u'customer', u'domain', u'file', u'note', u'person',
|
[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())
|
>>> sorted(t['name'] for t in xrf.getPredicates())
|
||||||
[u'depends', u'issubtype', u'knows', u'ownedby', u'provides', u'requires',
|
[u'depends', u'issubtype', u'knows', u'ownedby', u'provides', u'requires',
|
||||||
u'standard']
|
u'standard']
|
||||||
|
@ -96,7 +96,7 @@ All methods that retrieve one object also returns its children and parents:
|
||||||
u'hasType'
|
u'hasType'
|
||||||
>>> sorted(c['name'] for c in ch[0]['objects'])
|
>>> sorted(c['name'] for c in ch[0]['objects'])
|
||||||
[u'competence', u'customer', u'domain', u'file', u'note', u'person',
|
[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']
|
>>> pa = defaultPred['parents']
|
||||||
>>> len(pa)
|
>>> len(pa)
|
||||||
|
@ -115,7 +115,7 @@ We can also retrieve children and parents explicitely:
|
||||||
u'hasType'
|
u'hasType'
|
||||||
>>> sorted(c['name'] for c in ch[0]['objects'])
|
>>> sorted(c['name'] for c in ch[0]['objects'])
|
||||||
[u'competence', u'customer', u'domain', u'file', u'note', u'person',
|
[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')
|
>>> pa = xrf.getParents('5')
|
||||||
>>> len(pa)
|
>>> len(pa)
|
||||||
|
@ -174,14 +174,14 @@ Updating the concept map
|
||||||
|
|
||||||
>>> topicId = xrf.getObjectByName('topic')['id']
|
>>> topicId = xrf.getObjectByName('topic')['id']
|
||||||
>>> xrf.createConcept(topicId, u'zope2', u'Zope 2')
|
>>> 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'}
|
'name': u'zope2'}
|
||||||
|
|
||||||
The name of the concept is checked by a name chooser; if the corresponding
|
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.
|
parameter is empty, the name will be generated from the title.
|
||||||
|
|
||||||
>>> xrf.createConcept(topicId, u'', u'Python')
|
>>> 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'}
|
'name': u'python'}
|
||||||
|
|
||||||
If we try to deassign a ``hasType`` relation nothing will happen; a
|
If we try to deassign a ``hasType`` relation nothing will happen; a
|
||||||
|
|
Loading…
Add table
Reference in a new issue