Update of /cvsroot/archetypes/ATVocabularyManager
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24619
Modified Files:
NamedVocabulary.py README.txt VocabularyTool.py config.py
Log Message:
added tree-like (hierachical) vocabularys
Index: config.py
===================================================================
RCS file: /cvsroot/archetypes/ATVocabularyManager/config.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- config.py 26 May 2004 22:59:02 -0000 1.2
+++ config.py 18 Jun 2004 09:03:13 -0000 1.3
@@ -1,10 +1,15 @@
# package configuration
+PROJECTNAME = "ATVocabularyManager"
+SKINS_DIR = 'skins'
+
+GLOBALS = globals()
+
TOOL_NAME="atvocabulary_manager"
DEFAULT_VOCABULARY_CONTAINER='SimpleVocabulary'
-## LinguaPlone addon?
+# LinguaPlone addon?
try:
from Products.LinguaPlone.public import registerType
except ImportError:
Index: VocabularyTool.py
===================================================================
RCS file: /cvsroot/archetypes/ATVocabularyManager/VocabularyTool.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- VocabularyTool.py 26 May 2004 22:59:02 -0000 1.3
+++ VocabularyTool.py 18 Jun 2004 09:03:13 -0000 1.4
@@ -56,7 +56,7 @@
'''
security = ClassSecurityInfo()
portal_type = meta_type = 'VocabularyTool'
- archetype_name = 'VocabularyTool'
+ archetype_name = 'Vocabulary Tool'
schema=BaseFolderSchema + Schema((
# a tool doesnt need an idwidget and title for edit
Index: NamedVocabulary.py
===================================================================
RCS file: /cvsroot/archetypes/ATVocabularyManager/NamedVocabulary.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- NamedVocabulary.py 15 May 2004 12:41:08 -0000 1.1.1.1
+++ NamedVocabulary.py 18 Jun 2004 09:03:12 -0000 1.2
@@ -44,12 +44,42 @@
The instance of the content class is given as parameter.
"""
+ vocab = self.getVocabulary(instance)
+ return vocab.getDisplayList(instance)
+
+ def getVocabularyDict(self, instance):
+ """ returns the vocabulary as a dictionary with a string key and a
+ string value. If it is not a flat vocabulary, the value is a
+ tuple with a string and a sub-dictionary with the same format
+ (or None if its a leave).
+
+ The instance of the content is given as parameter.
+ """
+ vocab = self.getVocabulary(instance)
+ return vocab.getVocabularyDict(instance)
+
+ def isFlat(self):
+ """ indicates if it is a flat or hierachical vocabulary """
+
+ vocab = self.getVocabulary(instance)
+ return vocab.isFlat()
+
+ def showLeafsOnly(self):
+ """ indicates if only leaves or also nots should be shown
+ """
+
+ vocab = self.getVocabulary(instance)
+ return vocab.showLeafsOnly(instance)
+
+
+ def getVocabulary(self, instance):
+ """ return the vocabulary by name from atvocabularymanager
+ """
vt = getToolByName(instance,TOOL_NAME)
vocab = vt.getVocabularyByName(self.vocab_name)
-
assert(IVocabulary.isImplementedBy(vocab))
-
- return vocab.getDisplayList(instance)
+ return vocab
+
# end of class NamedVocabulary
Index: README.txt
===================================================================
RCS file: /cvsroot/archetypes/ATVocabularyManager/README.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- README.txt 23 May 2004 14:29:44 -0000 1.2
+++ README.txt 18 Jun 2004 09:03:13 -0000 1.3
@@ -25,7 +25,8 @@
Dependencies:
* Archetypes 1.3 CVS (since minor but relevantchanges to Field.py's
- vocabulary handling where integrated, this is since 2004-05-14)
+ vocabulary handling where and its IVocabulary interface are integrated, i
+ this is since 2004-06-18)
Todo
-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
|