From a2f8410496e887fe6db38ef901e4084359d8d382 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 20 May 2012 12:03:36 +0200 Subject: [PATCH] work in progress: CCM competence and certification management: starting with forms and other views --- knowledge/README.txt | 22 ++++++++++++++---- knowledge/browser.py | 44 +++++++++++++++++++++++++++++++---- knowledge/knowledge_macros.pt | 15 ++++++++++++ 3 files changed, 71 insertions(+), 10 deletions(-) diff --git a/knowledge/README.txt b/knowledge/README.txt index 10a7953..994b7ae 100644 --- a/knowledge/README.txt +++ b/knowledge/README.txt @@ -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 ========== diff --git a/knowledge/browser.py b/knowledge/browser.py index 53b7634..ff9781e 100644 --- a/knowledge/browser.py +++ b/knowledge/browser.py @@ -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 + diff --git a/knowledge/knowledge_macros.pt b/knowledge/knowledge_macros.pt index 1a8f660..5d12f77 100644 --- a/knowledge/knowledge_macros.pt +++ b/knowledge/knowledge_macros.pt @@ -57,4 +57,19 @@ + + + +
+
+ +
+
+
+ +