Programming in almost language

This is the site where you may share your knowledge and experience to eachother..

  • Categories

  • LinkedIn

  • Tweet Me

  • My footsteps

How to use ATVocabulary Manger

Posted by Praveen Kumar on July 4, 2008

ATVocabularyManager is a product for letting site managers define vocabularies for fields through-the-web or by import from XML files. ArchGenXML can generate the necessary code to use this product.

ATVM manages dynamic vocabularies. It installs a tool, where a site Manager can add, change and delete vocabularies. These vocabularies can then be used anywhere on the site.

You can download ATVocabularyManager from the Plone.org products area: http://plone.org/products/atvocabularymanager

This product is based on Archetypes and made to work with Archetypes as well as with other Products. It is intended use is within Archetypes Fields. Using it as a vocabulary provider for CMFMetadata worked out fine too.

Once you download the product, you need to install it first from site setp or add/remove products.

Now we start with practical.

Objective- here we are going to create a profile one is CategoryList and ProfileDescription where CategoryList may have director/producer/banner category and we create another one named movie where we have fields banner,director and producer which will dynamically populated from profile where we introduce new banner/director/producer..i hope you would have got the idea what we are going to do

After installing successfully

now you have to use a managed vocabulary simply add the term to the file profile.py

vocabulary = NamedVocabulary("""categorylist""")

profile.py

__author__ = “””unknown <unknown>”””
__docformat__ = ‘plaintext’

from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import *
from Products.ATVocabularyManager.namedvocabulary import NamedVocabulary
from Products.starmovie.config import *
schema = Schema((
StringField(
name=‘categorylist’,
widget=SelectionWidget(
label=“Movie Category List”,
label_msgid=‘starmovie_label_categorylist’,
i18n_domain=‘starmovie’,
),
vocabulary=NamedVocabulary(“””categorylist”””)
),

StringField(
name=‘profileDescription’,
widget=TextAreaWidget(
label=“Profile Description”,
label_msgid=‘starmovie_label_profileDescription’,
i18n_domain=‘starmovie’,
)
),
),
)
profile_schema = BaseSchema.copy() + \
schema.copy()
class profile(BaseContent):
“””
“””

security = ClassSecurityInfo()
__implements__ = (getattr(BaseContent,’__implements__’,()),)
archetype_name = ‘profile’
meta_type = ‘profile’
portal_type = ‘profile’
allowed_content_types = []
filter_content_types = 0
global_allow = 1
immediate_view = ‘base_view’
default_view = ‘base_view’
suppl_views = ()
typeDescription = “profile”
typeDescMsgId = ‘description_edit_profile’
_at_rename_after_creation = True
schema = profile_schema
# Methods
registerType(profile, PROJECTNAME)
# end of class profile

ArchGenXML

ArchGenXML fully supports ATVocabularyManager,

Now we are going to create movie

movie.py

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: