work in progress: CCM competence and certification management: starting with forms and other views

This commit is contained in:
Helmut Merz 2012-05-20 12:03:36 +02:00
parent 0e56543900
commit a2f8410496
3 changed files with 71 additions and 10 deletions

View file

@ -23,10 +23,8 @@ ZCML setup):
We then import a loops .dmp file containing all necessary types and
predicates.
>>> import os
>>> from loops.setup import importData
>>> importPath = os.path.join(os.path.dirname(__file__), 'data')
>>> importData(loopsRoot, importPath, 'loops_knowledge_de.dmp')
>>> from loops.knowledge.tests import importData
>>> importData(loopsRoot)
We need some type concepts for controlling the meaning of the concepts objects,
these have already been created during setup and .dmp import:
@ -177,10 +175,24 @@ Competence and Certification Management
>>> from loops.knowledge.interfaces import IQualificationRecords
>>> from loops.knowledge.qualification import QualificationRecords
>>> component.provideUtility(qualificationStates,
... provides=IStatesDefinition)
... provides=IStatesDefinition,
... name='knowledge.qualification')
>>> component.provideAdapter(QualificationRecords,
... provides=IQualificationRecords)
>>> qurecs = loopsRoot.getRecordManager()['qualification']
We first create a training that provides knowledge in Python specials.
>>> trainingPySpecC = concepts['trpyspec'] = Concept(
... u'Python Specials Training')
>>> trainingPySpecC.assignParent(pySpecialsC)
Then we record the need for John to acquire this knowledge.
>>> from loops.knowledge.browser import CreateQualificationRecordForm
>>> from loops.knowledge.browser import CreateQualificationRecord
Glossaries
==========

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
# Copyright (c) 2012 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
@ -19,8 +19,6 @@
"""
Definition of view classes and other browser related stuff for the
loops.knowledge package.
$Id$
"""
from zope import interface, component
@ -32,11 +30,17 @@ from cybertools.typology.interfaces import IType
from loops.browser.action import DialogAction
from loops.browser.common import BaseView
from loops.browser.concept import ConceptView
from loops.expert.browser.report import ResultsConceptView
from loops.knowledge.interfaces import IPerson, ITask
from loops.organize.work.browser import CreateWorkItemForm, CreateWorkItem
from loops.organize.party import getPersonForUser
from loops.util import _
template = ViewPageTemplateFile('knowledge_macros.pt')
knowledge_macros = template.macros
actions.register('createTopic', 'portlet', DialogAction,
title=_(u'Create Topic...'),
description=_(u'Create a new topic.'),
@ -54,10 +58,19 @@ actions.register('editTopic', 'portlet', DialogAction,
dialogName='editTopic',
)
actions.register('createQualification', 'portlet', DialogAction,
title=_(u'Create Qualification Record...'),
description=_(u'Create a work item for this person.'),
viewName='create_qualification.html',
dialogName='createQualification',
prerequisites=['registerDojoDateWidget', 'registerDojoNumberWidget',
'registerDojoTextarea'],
)
class MyKnowledge(ConceptView):
template = ViewPageTemplateFile('knowledge_macros.pt')
template = template
@Lazy
def macro(self):
@ -90,9 +103,30 @@ class MyKnowledge(ConceptView):
class Candidates(ConceptView):
template = ViewPageTemplateFile('knowledge_macros.pt')
template = template
@Lazy
def macro(self):
return self.template.macros['requirement_candidates']
# qualification stuff
class PersonQualificationView(ResultsConceptView):
pass
class CreateQualificationRecordForm(CreateWorkItemForm):
macros = knowledge_macros
@Lazy
def macro(self):
return self.macros['create_qualification']
class CreateQualificationRecord(CreateWorkItem):
pass

View file

@ -57,4 +57,19 @@
</metal:candidates>
<!-- forms -->
<metal:block define-macro="create_qualification">
<form method="post" id="addQualification_form" class="dialog"
dojoType="dijit.form.Form">
<div class="buttons">
<input value="Save" type="submit"
i18n:attributes="value">
<input type="button" value="Cancel"
onClick="return closeDialog(false)"
i18n:attributes="value"></div>
</form>
</metal:block>
</html>