work in progress: qualification overview

This commit is contained in:
Helmut Merz 2014-04-25 13:28:19 +02:00
parent 2a532dba86
commit fab93d8ceb
12 changed files with 102 additions and 26 deletions

View file

@ -27,7 +27,7 @@ configuration):
>>> concepts, resources, views = t.setup() >>> concepts, resources, views = t.setup()
>>> len(concepts) + len(resources) >>> len(concepts) + len(resources)
36 38
>>> 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, 65] [0, 2, 69]
>>> qu = query.Type('loops:*') >>> qu = query.Type('loops:*')
>>> len(list(qu.apply())) >>> len(list(qu.apply()))
36 38
>>> qu = query.Type('loops:concept:predicate') >>> qu = query.Type('loops:concept:predicate')
>>> len(list(qu.apply())) >>> len(list(qu.apply()))

View file

@ -66,13 +66,13 @@ zcml in real life:
>>> t = searchView.typesForSearch() >>> t = searchView.typesForSearch()
>>> len(t) >>> len(t)
15 16
>>> t.getTermByToken('loops:resource:*').title >>> t.getTermByToken('loops:resource:*').title
'Any Resource' 'Any Resource'
>>> t = searchView.conceptTypesForSearch() >>> t = searchView.conceptTypesForSearch()
>>> len(t) >>> len(t)
12 13
>>> 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/.target96/@@searchresults.html");...' "http://127.0.0.1/loops/views/page/.target100/@@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: '101'}, {label: 'Zope 2 (Thema)', name: 'Zope 2', id: '103'}, {label: 'Zope 3 (Thema)', name: 'Zope 3', id: '105'}]}" u"{identifier: 'id', items: [{label: 'Zope (Thema)', name: 'Zope', id: '105'}, {label: 'Zope 2 (Thema)', name: 'Zope 2', id: '107'}, {label: 'Zope 3 (Thema)', name: 'Zope 3', id: '109'}]}"
Preset Concept Types on Search Forms Preset Concept Types on Search Forms
------------------------------------ ------------------------------------
@ -219,9 +219,9 @@ 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': '74', 'title': u'Customer 1'}, {'token': '78', 'title': u'Customer 1'},
{'token': '76', 'title': u'Customer 2'}, {'token': '80', 'title': u'Customer 2'},
{'token': '78', 'title': u'Customer 3'}] {'token': '82', 'title': u'Customer 3'}]
Let's use this new search option for querying: Let's use this new search option for querying:

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() >>> concepts, resources, views = t.setup()
>>> loopsRoot = site['loops'] >>> loopsRoot = site['loops']
>>> len(concepts), len(resources), len(views) >>> len(concepts), len(resources), len(views)
(33, 3, 1) (35, 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)
(34, 3, 1) (36, 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)
65 67
Writing object information to the external storage Writing object information to the external storage
-------------------------------------------------- --------------------------------------------------

View file

@ -4,6 +4,8 @@ type(u'competence', u'Kompetenz', viewName=u'',
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')
type(u'report', u'Report', viewName=u'',
typeInterface='loops.expert.report.IReport')
type(u'task', u'Aufgabe', viewName=u'', type(u'task', u'Aufgabe', viewName=u'',
typeInterface=u'loops.knowledge.interfaces.ITask', typeInterface=u'loops.knowledge.interfaces.ITask',
options=u'action.portlet:createTask,editTask') options=u'action.portlet:createTask,editTask')
@ -26,6 +28,10 @@ concept(u'requires', u'requires', u'predicate')
concept(u'issubtype', u'is Subtype', u'predicate', options=u'hide_children', concept(u'issubtype', u'is Subtype', u'predicate', options=u'hide_children',
predicateInterface='loops.interfaces.IIsSubtype') predicateInterface='loops.interfaces.IIsSubtype')
# reports
concept(u'qualification_overview', u'Qualification Overview', u'report',
reportType=u'qualification_overview')
# structure # structure
child(u'general', u'competence', u'standard') child(u'general', u'competence', u'standard')
child(u'general', u'depends', u'standard') child(u'general', u'depends', u'standard')

View file

@ -26,6 +26,10 @@ concept(u'requires', u'requires', u'predicate')
concept(u'issubtype', u'is Subtype', u'predicate', options=u'hide_children', concept(u'issubtype', u'is Subtype', u'predicate', options=u'hide_children',
predicateInterface='loops.interfaces.IIsSubtype') predicateInterface='loops.interfaces.IIsSubtype')
# reports
concept(u'qualification_overview', u'Qualification Overview', u'report',
reportType=u'qualification_overview')
# structure # structure
child(u'general', u'competence', u'standard') child(u'general', u'competence', u'standard')
child(u'general', u'depends', u'standard') child(u'general', u'depends', u'standard')

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de # Copyright (c) 2014 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
@ -18,7 +18,7 @@
""" """
Definition of view classes and other browser related stuff for the Definition of view classes and other browser related stuff for the
loops.knowledge package. loops.knowledge.qualification package.
""" """
from zope import interface, component from zope import interface, component
@ -27,10 +27,9 @@ from zope.cachedescriptors.property import Lazy
from loops.expert.browser.report import ResultsConceptView from loops.expert.browser.report import ResultsConceptView
from loops.knowledge.browser import template, knowledge_macros from loops.knowledge.browser import template, knowledge_macros
from loops.knowledge.qualification.base import QualificationRecord
class PersonQualificationView(ResultsConceptView): class Qualifications(ResultsConceptView):
pass reportName = 'qualification_overview'

View file

@ -15,4 +15,26 @@
<!-- views --> <!-- views -->
<zope:adapter
name="qualifications.html"
for="loops.interfaces.IConcept
zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.interface.Interface"
factory="loops.knowledge.qualification.browser.Qualifications"
permission="zope.View" />
<!-- reports -->
<zope:adapter
name="qualification_overview"
factory="loops.knowledge.qualification.report.QualificationOverview"
provides="loops.expert.report.IReportInstance"
trusted="True" />
<zope:class class="loops.knowledge.qualification.report.QualificationOverview">
<require permission="zope.View"
interface="loops.expert.report.IReportInstance" />
<require permission="zope.ManageContent"
set_schema="loops.expert.report.IReportInstance" />
</zope:class>
</configure> </configure>

View file

@ -0,0 +1,43 @@
#
# Copyright (c) 2014 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
#
"""
Qualification management report definitions.
"""
from cybertools.util.jeep import Jeep
from loops.expert.report import ReportInstance
from loops.organize.work.report import WorkRow
from loops.organize.work.report import deadline, day, task, party, state
from loops.organize.work.report import workTitle, workDescription
class QualificationOverview(ReportInstance):
type = "qualification_overview"
label = u'Qualification Overview'
rowFactory = WorkRow
fields = Jeep((day, deadline, party, task, workTitle, state))
taskTypeNames = ('folder','query', 'competence',)
defaultOutputFields = fields
def getTasks(self, parts):
return []

View file

@ -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.expert.report import IReport, Report
from loops.knowledge.qualification.base import Competence 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, \
@ -19,6 +20,7 @@ importPath = os.path.join(os.path.dirname(__file__), 'data')
def importData(loopsRoot): def importData(loopsRoot):
component.provideAdapter(Report, provides=IReport)
baseImportData(loopsRoot, importPath, 'knowledge_de.dmp') baseImportData(loopsRoot, importPath, 'knowledge_de.dmp')
def importSurvey(loopsRoot): def importSurvey(loopsRoot):

View file

@ -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/.113\n\n' u'\n\nEvent #1\nhttp://127.0.0.1/loops/views/menu/.117\n\n'
Show Presence of Other Users 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() >>> concepts, resources, views = t.setup()
>>> loopsRoot = site['loops'] >>> loopsRoot = site['loops']
>>> len(concepts), len(resources), len(views) >>> len(concepts), len(resources), len(views)
(33, 3, 1) (35, 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

View file

@ -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)
22 24
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'type'] u'predicate', u'report', 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'type'] u'predicate', u'report', 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'type'] u'predicate', u'report', 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': '72', {'description': u'', 'title': u'Zope 2', 'type': '38', 'id': '76',
'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': '74', {'description': u'', 'title': u'Python', 'type': '38', 'id': '78',
'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