reorganize knowledge package: put qualification (qualification and competence manager) in sub-package; create sub-package for surveys

This commit is contained in:
Helmut Merz 2013-02-08 13:09:57 +01:00
parent 6aab28a004
commit 3cc9cffd22
15 changed files with 315 additions and 80 deletions

View file

@ -171,9 +171,9 @@ Competence and Certification Management
======================================= =======================================
>>> from cybertools.stateful.interfaces import IStatesDefinition >>> from cybertools.stateful.interfaces import IStatesDefinition
>>> from loops.knowledge.qualification import qualificationStates >>> from loops.knowledge.qualification.base import qualificationStates
>>> from loops.knowledge.interfaces import IQualificationRecords >>> from loops.knowledge.qualification.interfaces import IQualificationRecords
>>> from loops.knowledge.qualification import QualificationRecords >>> from loops.knowledge.qualification.base import QualificationRecords
>>> component.provideUtility(qualificationStates, >>> component.provideUtility(qualificationStates,
... provides=IStatesDefinition, ... provides=IStatesDefinition,
... name='knowledge.qualification') ... name='knowledge.qualification')
@ -190,8 +190,8 @@ We first create a training that provides knowledge in Python specials.
Then we record the need for John to acquire this knowledge. Then we record the need for John to acquire this knowledge.
>>> from loops.knowledge.browser import CreateQualificationRecordForm >>> from loops.knowledge.qualification.browser import CreateQualificationRecordForm
>>> from loops.knowledge.browser import CreateQualificationRecord >>> from loops.knowledge.qualification.browser import CreateQualificationRecord
Glossaries Glossaries
@ -205,6 +205,12 @@ Glossary items are topic-like concepts that may be edited by end users.
>>> from loops.knowledge.glossary.browser import EditGlossaryItem >>> from loops.knowledge.glossary.browser import EditGlossaryItem
Survey
======
>>> from loops.knowledge.survey.base import Questionnaire
Fin de partie Fin de partie
============= =============

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de # Copyright (c) 2013 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
@ -30,10 +30,7 @@ from cybertools.typology.interfaces import IType
from loops.browser.action import DialogAction from loops.browser.action import DialogAction
from loops.browser.common import BaseView from loops.browser.common import BaseView
from loops.browser.concept import ConceptView from loops.browser.concept import ConceptView
from loops.expert.browser.report import ResultsConceptView
from loops.knowledge.interfaces import IPerson, ITask from loops.knowledge.interfaces import IPerson, ITask
from loops.knowledge.qualification import QualificationRecord
from loops.organize.work.browser import CreateWorkItemForm, CreateWorkItem
from loops.organize.party import getPersonForUser from loops.organize.party import getPersonForUser
from loops.util import _ from loops.util import _
@ -114,25 +111,3 @@ class Candidates(ConceptView):
return self.template.macros['requirement_candidates'] return self.template.macros['requirement_candidates']
# qualification stuff
class PersonQualificationView(ResultsConceptView):
pass
class CreateQualificationRecordForm(CreateWorkItemForm):
macros = knowledge_macros
recordManagerName = 'qualification'
trackFactory = QualificationRecord
@Lazy
def macro(self):
return self.macros['create_qualification']
class CreateQualificationRecord(CreateWorkItem):
pass

View file

@ -1,5 +1,3 @@
<!-- $Id$ -->
<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"
@ -66,22 +64,6 @@
interface="cybertools.knowledge.interfaces.IKnowledgeProvider" /> interface="cybertools.knowledge.interfaces.IKnowledgeProvider" />
</zope:class> </zope:class>
<!-- records -->
<zope:class class="loops.knowledge.qualification.QualificationRecord">
<require permission="zope.View"
interface="loops.knowledge.interfaces.IQualificationRecord" />
<require permission="zope.ManageContent"
set_schema="loops.knowledge.interfaces.IQualificationRecord" />
</zope:class>
<zope:adapter factory="loops.knowledge.qualification.QualificationRecords"
provides="loops.knowledge.interfaces.IQualificationRecords" />
<zope:utility factory="loops.knowledge.qualification.qualificationStates"
provides="cybertools.stateful.interfaces.IStatesDefinition"
name="knowledge.qualification" />
<!-- views --> <!-- views -->
<zope:adapter <zope:adapter
@ -100,19 +82,6 @@
factory="loops.knowledge.browser.Candidates" factory="loops.knowledge.browser.Candidates"
permission="zope.View" /> permission="zope.View" />
<browser:page
name="create_qualification.html"
for="loops.interfaces.INode"
class="loops.knowledge.browser.CreateQualificationRecordForm"
permission="zope.View" />
<zope:adapter
name="create_qualification"
for="loops.browser.node.NodeView
zope.publisher.interfaces.browser.IBrowserRequest"
factory="loops.knowledge.browser.CreateQualificationRecord"
permission="zope.View" />
<!-- other adapters --> <!-- other adapters -->
<zope:adapter factory="loops.knowledge.schema.PersonSchemaFactory" /> <zope:adapter factory="loops.knowledge.schema.PersonSchemaFactory" />
@ -120,5 +89,7 @@
<!-- sub-packages --> <!-- sub-packages -->
<include package=".glossary" /> <include package=".glossary" />
<include package=".qualification" />
<include package=".survey" />
</configure> </configure>

View file

@ -41,4 +41,4 @@ child(u'system', u'issubtype', u'standard')
child(u'competence', u'training', u'issubtype', usePredicate=u'provides') child(u'competence', u'training', u'issubtype', usePredicate=u'provides')
# records # records
records(u'qualification', u'loops.knowledge.qualification.QualificationRecord') records(u'qualification', u'loops.knowledge.qualification.base.QualificationRecord')

View file

@ -41,4 +41,4 @@ child(u'system', u'issubtype', u'standard')
child(u'competence', u'training', u'issubtype', usePredicate=u'provides') child(u'competence', u'training', u'issubtype', usePredicate=u'provides')
# records # records
records(u'qualification', u'loops.knowledge.qualification.QualificationRecord') records(u'qualification', u'loops.knowledge.qualification.base.QualificationRecord')

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de # Copyright (c) 2013 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
@ -22,18 +22,14 @@ 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 zope.i18nmessageid import MessageFactory
from zope.security.proxy import removeSecurityProxy
from cybertools.knowledge.interfaces import IKnowing, IRequirementProfile from cybertools.knowledge.interfaces import IKnowing, IRequirementProfile
from cybertools.knowledge.interfaces import IKnowledgeElement from cybertools.knowledge.interfaces import IKnowledgeElement
from cybertools.organize.interfaces import IWorkItem, IWorkItems
from loops.interfaces import IConceptSchema, ILoopsAdapter from loops.interfaces import IConceptSchema, ILoopsAdapter
from loops.organize.interfaces import IPerson as IBasePerson from loops.organize.interfaces import IPerson as IBasePerson
from loops.organize.interfaces import ITask as IBaseTask from loops.organize.interfaces import ITask as IBaseTask
from loops.schema.base import Relation, RelationSet from loops.schema.base import Relation, RelationSet
from loops.util import _
_ = MessageFactory('loops')
class IPerson(IBasePerson, IKnowing): class IPerson(IBasePerson, IKnowing):
@ -62,13 +58,3 @@ class ITopic(IConceptSchema, IKnowledgeElement, ILoopsAdapter):
""" Just a topic, some general classification concept. """ Just a topic, some general classification concept.
""" """
class IQualificationRecord(IWorkItem):
""" Records needs for qualification (acqusition of competence)
and corresponding participations in training events etc.
"""
class IQualificationRecords(IWorkItems):
""" Container for qualification records.
"""

View file

@ -0,0 +1 @@
'''package loops.knowledge.qualification'''

View file

@ -0,0 +1,103 @@
#
# Copyright (c) 2013 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
#
"""
Controlling qualification activities of persons.
Central part of CCM competence and certification management framework.
"""
from zope.component import adapts
from zope.interface import implementer, implements
from cybertools.stateful.base import Stateful
from cybertools.stateful.definition import StatesDefinition
from cybertools.stateful.definition import State, Transition
from cybertools.stateful.interfaces import IStatesDefinition
from cybertools.tracking.interfaces import ITrackingStorage
from loops.knowledge.qualification.interfaces import IQualificationRecord, \
IQualificationRecords
from loops.organize.work.base import WorkItem, WorkItems
@implementer(IStatesDefinition)
def qualificationStates():
return StatesDefinition('qualification',
State('new', 'new', ('assign',),
color='grey'),
State('open', 'open',
('register',
#'pass', 'fail',
'cancel', 'modify'),
color='red'),
State('registered', 'registered',
('register', 'pass', 'fail', 'unregister', 'cancel', 'modify'),
color='yellow'),
State('passed', 'passed',
('cancel', 'close', 'modify', 'open', 'expire'),
color='green'),
State('failed', 'failed',
('register', 'cancel', 'modify', 'open'),
color='green'),
State('expired', 'expired',
('register', 'cancel', 'modify', 'open'),
color='red'),
State('cancelled', 'cancelled', ('modify', 'open'),
color='grey'),
State('closed', 'closed', ('modify', 'open'),
color='lightblue'),
# not directly reachable states:
State('open_x', 'open', ('modify',), color='red'),
State('registered_x', 'registered', ('modify',), color='yellow'),
# transitions:
Transition('assign', 'assign', 'open'),
Transition('register', 'register', 'registered'),
Transition('pass', 'pass', 'passed'),
Transition('fail', 'fail', 'failed'),
Transition('unregister', 'unregister', 'open'),
Transition('cancel', 'cancel', 'cancelled'),
Transition('modify', 'modify', 'open'),
Transition('close', 'close', 'closed'),
Transition('open', 'open', 'open'),
#initialState='open')
initialState='new') # TODO: handle assignment to competence
class QualificationRecord(WorkItem):
implements(IQualificationRecord)
typeName = 'QualificationRecord'
typeInterface = IQualificationRecord
statesDefinition = 'knowledge.qualification'
def doAction(self, action, userName, **kw):
new = self.createNew(action, userName, **kw)
new.userName = self.userName
new.doTransition(action)
new.reindex()
return new
class QualificationRecords(WorkItems):
""" A tracking storage adapter managing qualification records.
"""
implements(IQualificationRecords)
adapts(ITrackingStorage)

View file

@ -0,0 +1,53 @@
#
# Copyright (c) 2013 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
#
"""
Definition of view classes and other browser related stuff for the
loops.knowledge package.
"""
from zope import interface, component
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
from loops.expert.browser.report import ResultsConceptView
from loops.knowledge.browser import template, knowledge_macros
from loops.knowledge.qualification.base import QualificationRecord
from loops.organize.work.browser import CreateWorkItemForm, CreateWorkItem
class PersonQualificationView(ResultsConceptView):
pass
class CreateQualificationRecordForm(CreateWorkItemForm):
macros = knowledge_macros
recordManagerName = 'qualification'
trackFactory = QualificationRecord
@Lazy
def macro(self):
return self.macros['create_qualification']
class CreateQualificationRecord(CreateWorkItem):
pass

View file

@ -0,0 +1,39 @@
<configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="loops">
<!-- records -->
<zope:class class="loops.knowledge.qualification.base.QualificationRecord">
<require permission="zope.View"
interface="loops.knowledge.qualification.interfaces.IQualificationRecord" />
<require permission="zope.ManageContent"
set_schema="loops.knowledge.qualification.interfaces.IQualificationRecord" />
</zope:class>
<zope:adapter
factory="loops.knowledge.qualification.base.QualificationRecords"
provides="loops.knowledge.qualification.interfaces.IQualificationRecords" />
<zope:utility
factory="loops.knowledge.qualification.base.qualificationStates"
provides="cybertools.stateful.interfaces.IStatesDefinition"
name="knowledge.qualification" />
<!-- views -->
<browser:page
name="create_qualification.html"
for="loops.interfaces.INode"
class="loops.knowledge.qualification.browser.CreateQualificationRecordForm"
permission="zope.View" />
<zope:adapter
name="create_qualification"
for="loops.browser.node.NodeView
zope.publisher.interfaces.browser.IBrowserRequest"
factory="loops.knowledge.qualification.browser.CreateQualificationRecord"
permission="zope.View" />
</configure>

View file

@ -0,0 +1,37 @@
#
# Copyright (c) 2013 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
#
"""
Interfaces for knowledge management and elearning with loops.
"""
from zope.interface import Interface, Attribute
from zope import interface, component, schema
from cybertools.organize.interfaces import IWorkItem, IWorkItems
class IQualificationRecord(IWorkItem):
""" Records needs for qualification (acqusition of competence)
and corresponding participations in training events etc.
"""
class IQualificationRecords(IWorkItems):
""" Container for qualification records.
"""

View file

@ -0,0 +1 @@
'''package loops.knowledge.survey'''

33
knowledge/survey/base.py Normal file
View file

@ -0,0 +1,33 @@
#
# Copyright (c) 2013 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
#
"""
Surveys used in knowledge management.
"""
from zope.component import adapts
from zope.interface import implementer, implements
from cybertools.knowledge.survey.questionnaire import Questionnaire \
as BaseQuestionnaire
class Questionnaire(BaseQuestionnaire):
pass

View file

@ -0,0 +1,6 @@
<configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="loops">
</configure>

View file

@ -0,0 +1,24 @@
#
# Copyright (c) 2013 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
#
"""
Interfaces for surveys used in knowledge management.
"""
from zope.interface import Interface, Attribute
from zope import interface, component, schema