def update(self): """ Update viewlet """ info = IObjectArchivator(self.context) rv = NamedVocabulary('eea.workflow.reasons') vocab = rv.getVocabularyDict(self.context) archive_info = dict(initiator=info.initiator, archive_date=info.archive_date, reason=vocab.get(info.reason, "Other"), custom_message=info.custom_message) self.info = archive_info
def archive(self, context, initiator=None, reason=None, custom_message=None): """Archive the object""" now = DateTime() alsoProvides(context, IObjectArchived) context.setExpirationDate(now) self.archive_date = now self.initiator = initiator self.custom_message = custom_message self.reason = reason wftool = getToolByName(context, 'portal_workflow') mtool = getToolByName(context, 'portal_membership') state = wftool.getInfoFor(context, 'review_state') actor = mtool.getAuthenticatedMember().getId() rv = NamedVocabulary('eea.workflow.reasons') vocab = rv.getVocabularyDict(context) reason = vocab.get('reason', "Other") if custom_message: reason += u" (%s)" % custom_message comments = (u"Archived by %(actor)s on %(date)s by request " u"from %(initiator)s with reason: %(reason)s" % { 'actor': actor, 'initiator': initiator, 'reason': reason, 'date': now.ISO8601(), }) for wfname in context.workflow_history.keys(): history = context.workflow_history[wfname] history += ({ 'action': 'Archive', 'review_state': state, 'actor': actor, 'comments': comments, 'time': now, }, ) context.workflow_history[wfname] = history context.workflow_history._p_changed = True context.reindexObject()
def update(self): """ Update viewlet """ info = IObjectArchivator(self.context) rv = NamedVocabulary('eea.workflow.reasons') vocab = rv.getVocabularyDict(self.context) archive_info = dict(initiator=info.initiator, archive_date=info.archive_date, reason=vocab.get(info.reason, "Other"), custom_message=info.custom_message) self.info = archive_info
def info(self): """ Info used in view """ info = IObjectArchivator(self.context) rv = NamedVocabulary('eea.workflow.reasons') vocab = rv.getVocabularyDict(self.context) archive_info = dict(initiator=info.initiator, archive_date=info.archive_date, reason=vocab.get(info.reason, "Other"), custom_message=info.custom_message) return archive_info
class EventSchemaExtender(object): """ Schema extender """ layer = IEniSeisContentLayer fields = ( CountriesField( name='countries', schemata='default', multiValued=1, vocabulary=NamedVocabulary('european_countries'), widget=public.MultiSelectionWidget(label=_(u"Countries"), description=_(u"Countries"))), ExtendedStringField( name='event_level', widget=public.SelectionWidget( label="Event Level", description=(u"Select Regional Level for events that belong " u"to both East and South")), default="National Level", required=True, vocabulary=["National Level", "Regional Level", "Other"], ), ) def __init__(self, context): self.context = context def getFields(self): """ Returns fields """ return self.fields
def archive(self, context, initiator=None, reason=None, custom_message=None): """Archive the object""" now = DateTime() alsoProvides(context, IObjectArchived) context.setExpirationDate(now) self.archive_date = now self.initiator = initiator self.custom_message = custom_message self.reason = reason wftool = getToolByName(context, 'portal_workflow') mtool = getToolByName(context, 'portal_membership') state = wftool.getInfoFor(context, 'review_state') actor = mtool.getAuthenticatedMember().getId() rv = NamedVocabulary('eea.workflow.reasons') vocab = rv.getVocabularyDict(context) reason = vocab.get('reason', "Other") if custom_message: reason += u" (%s)" % custom_message comments = (u"Archived by %(actor)s on %(date)s by request " u"from %(initiator)s with reason: %(reason)s" % { 'actor':actor, 'initiator':initiator, 'reason':reason, 'date':now.ISO8601(), }) for wfname in context.workflow_history.keys(): history = context.workflow_history[wfname] history += ({ 'action':'Archive', 'review_state':state, 'actor':actor, 'comments':comments, 'time':now, },) context.workflow_history[wfname] = history context.workflow_history._p_changed = True context.reindexObject()
def __call__(self): rv = NamedVocabulary('eea.workflow.reasons') #TODO: rename to eea.workflow.archive_reasons reasons = rv.getVocabularyDict(self.context) return reasons
from Products.CMFPlone import PloneMessageFactory as _ from Products.LinguaPlone.public import (Schema, LinesField, InAndOutWidget, registerType) from Products.EEAContentTypes.config import PROJECTNAME from Products.EEAContentTypes.content.ExternalHighlight import ExternalHighlight from Products.EEAContentTypes.content.ExternalHighlight import schema as \ ExtHighlightSchema from Products.EEAContentTypes.content.Highlight import Highlight from Products.EEAContentTypes.content.interfaces import IArticle from zope.interface import implements from eea.themecentre.interfaces import IThemeTagging schema = Schema((LinesField( 'publication_groups', schemata='categorization', vocabulary=NamedVocabulary("publications_groups"), languageIndependent=True, index="KeywordIndex:brains", widget=InAndOutWidget( label=_(u'Publication groups'), description=_(u'Fill in publication groups'), i18n_domain='eea', ), ), ), ) Article_schema = getattr(Highlight, 'schema', Schema(())).copy() + \ schema.copy() fields2Move2DefaultSchemata = [ 'management_plan', 'image', 'imageLink', 'imageCaption', 'imageNote' ]
def test_namedvocab(self): from Products.ATVocabularyManager.namedvocabulary import NamedVocabulary nv = NamedVocabulary('name-accuracy') d = nv.getVocabularyDict(self.portal) self.assertEquals(d, {'accurate': 'accurate', 'false': 'false', 'inaccurate': 'inaccurate'})
widget=StringWidget( label="Office Location (from LDAP)", label_msgid='UWOshCommitteeOnCommittees_label_officeNumberLDAP', i18n_domain='UWOshCommitteeOnCommittees', ), default_method="getDefaultOfficeNumberLDAP"), StringField( name='officeBuilding', widget=SelectionWidget( label="Office Building", visible=0, label_msgid='UWOshCommitteeOnCommittees_label_officeBuilding', i18n_domain='UWOshCommitteeOnCommittees', ), enforceVocabulary=1, vocabulary=NamedVocabulary("""UWOshBuildings"""), default_method="getDefaultBuilding"), StringField(name='officeRoom', widget=StringWidget( label="Office Room", visible=0, label_msgid='UWOshCommitteeOnCommittees_label_officeRoom', i18n_domain='UWOshCommitteeOnCommittees', ), default_method="getDefaultRoom"), StringField( name='officeMailbox', widget=StringWidget( label="Office Mailbox (optional)", label_msgid='UWOshCommitteeOnCommittees_label_officeMailbox', i18n_domain='UWOshCommitteeOnCommittees',
StringField( name='dpsir', widget=SelectionWidget( label="Position in DPSIR framework", description=("The work of the EEA is built around a conceptual " "framework known as the DPSIR assessment framework. " "DPSIR stands for ‘driving forces, pressures, " "states, impacts and responses’. DPSIR builds on " "the existing OECD model and offers a basis for " "analysing the interrelated factors that impact on " "the environment."), label_msgid='indicators_label_dpsir', i18n_domain='indicators', ), schemata="Classification", vocabulary=NamedVocabulary("indicator_dpsir"), required_for_published=True, ), StringField( name='typology', widget=SelectionWidget( label="Typology", description=("Typology is a categorisation based on a simple " "set of questions: what is happening (A) is " "this relevant (B) can we make progress in " "improving the way we do things (C), are the " "undertaken policy measures effective (Type D) " "and does this contribute to our overall " "welfare (E)?, led to a first typology of " "indicators. The typology was used to " "demonstrate that (in"),
macro='scale_widget', label='Scale of the dataset', label_msgid='dataservice_label_scale', description=("Gives a rough value of accuracy for the GIS " "dataset. Example: 1:1000"), description_msgid='dataservice_help_scale', i18n_domain='eea', size=20, ) ), StringField( name='referenceSystem', languageIndependent=True, required=False, vocabulary=NamedVocabulary(REFERENCE_DICTIONARY_ID), widget=SelectionWidget( macro="reference_widget", label="Coordinate reference system", description=("Coordinate reference system used for the GIS " "dataset. Example: Lambert Azimutal"), label_msgid="dataservice_label_system", description_msgid="dataservice_help_system", i18n_domain="eea", ), ), LinesField( schemata="categorization", name='reportingObligations',
default_output_type="text/x-html-safe", ), StringField( name='category_of_use', widget=SelectionWidget( label="Category of use", visible={ 'view': 'hidden', 'edit': 'hidden' }, label_msgid='indicators_label_category_of_use', i18n_domain='indicators', description=" ", ), required=False, vocabulary=NamedVocabulary("indicator_category_of_use"), ), TextField( name='description', widget=RichWidget( label="Description", label_msgid='indicators_label_description', i18n_domain='indicators', description=" ", ), default_content_type="text/html", searchable=True, required=False, allowable_content_types=( 'text/plain', 'text/structured',
# Keep updated label and description in # geographic_bounding_box_widget.pt too. label="Bounding Box", description=("Coordinates of the four (West, East, North, South) " "foremost corners of the dataset"), label_msgid='eea_geographic_bounding_box', i18n_domain='eea', ) ), LinesField( name='geographicCoverage', languageIndependent=True, required=False, multiValued=1, default=[], vocabulary=NamedVocabulary(COUNTRIES_DICTIONARY_ID), schemata='metadata', widget=MultiSelectionWidget( macro="countries_widget", helper_js=("countries_widget.js",), helper_css=("countries_widget.css",), size=15, label="Coverage", description=("Countries that are covered by the resource"), label_msgid='dataservice_label_geographic', description_msgid='dataservice_help_geographic', i18n_domain='eea', ) ), StringField( name='coordinateReferenceSystem',
def __call__(self): rv = NamedVocabulary('eea.workflow.reasons') reasons = rv.getVocabularyDict(self.context) return reasons
def __call__(self, context): voc = NamedVocabulary("publications_groups") items = voc.getDisplayList(context).items() return SimpleVocabulary([SimpleTerm(key, key, value) for key, value in items])
def __call__(self, context): voc = NamedVocabulary("report_publishers") items = voc.getDisplayList(context).items() return SimpleVocabulary([SimpleTerm(value, key, value) for key, value in items])
def __call__(self, context): voc = NamedVocabulary('report_types') items = [SimpleTerm('N/A', 'N/A', 'N/A'), ] items.extend([SimpleTerm(value, key, value) for key, value in voc.getDisplayList(context).items()]) return SimpleVocabulary(items)
def get_named_vocab(self, name): vocab = NamedVocabulary(name) vocab = vocab.getVocabulary(self.context) vocab = dict(vocab.getDisplayList(self.context).items()) return vocab
required=False, primary=True, validators=(('checkFileMaxSize', V_REQUIRED), ), widget=FileWidget( description=("Select the file to be added by " "clicking the 'Browse' button."), description_msgid="help_file", label="File", label_msgid="label_file", i18n_domain="plone", show_content_type=False, )), StringField( name='category', default='edse', vocabulary=NamedVocabulary(CATEGORIES_DICTIONARY_ID), widget=SelectionWidget( format="select", # possible values: flex, select, radio label="Category", description="Category description.", label_msgid='dataservice_label_category', description_msgid='dataservice_help_category', i18n_domain='eea', )), StringField(name='shortId', widget=StringWidget( label="Short ID", visible=-1, description="Short ID description.", label_msgid='dataservice_label_shortid', description_msgid='dataservice_help_shortid',
def archive(self, context, initiator=None, reason=None, custom_message=None, archive_date=None): """Archive the object :param context: given object that should be archived :param initiator: the user id or name which commissioned the archival :param reason: reason id for which the object was archived :param custom_message: Custom message explaining why the object was archived :param archive_date: DateTime object which sets the expiration date of the object """ initiator = safe_unicode(initiator) reason = safe_unicode(reason) custom_message = safe_unicode(custom_message) wftool = getToolByName(context, 'portal_workflow') has_workflow = wftool.getChainFor(context) if not has_workflow: # NOP return date = archive_date and archive_date or DateTime() alsoProvides(context, IObjectArchived) context.setExpirationDate(date) # refactor this setting from here, without these assignments to self # the test for is_archived fails self.archive_date = date self.initiator = initiator self.custom_message = custom_message self.reason = reason state = wftool.getInfoFor(context, 'review_state') mtool = getToolByName(context, 'portal_membership') actor = mtool.getAuthenticatedMember().getId() rv = NamedVocabulary('eea.workflow.reasons') vocab = rv.getVocabularyDict(context) reason = vocab.get(reason, "Other") if custom_message: reason += u" (%s)" % custom_message comments = (u"Archived by %(actor)s on %(date)s by request " u"from %(initiator)s with reason: %(reason)s" % { 'actor': actor, 'initiator': initiator, 'reason': reason, 'date': date.ISO8601() }) for wfname in context.workflow_history.keys(): history = context.workflow_history[wfname] history += ({ 'action': 'Archive', 'review_state': state, 'actor': actor, 'comments': comments, 'time': date, }, ) context.workflow_history[wfname] = history context.workflow_history._p_changed = True context.reindexObject() notify(Purge(context))
name='policy_question', searchable=True, widget=StringField._properties['widget']( label="Policy Question", label_msgid='indicators_label_policy_question', i18n_domain='indicators', ), ), StringField( name='dpsir', widget=SelectionWidget( label="DPSIR", label_msgid='indicators_label_dpsir', i18n_domain='indicators', ), vocabulary=NamedVocabulary("indicator_dpsir"), ), DateTimeField( name='assessment_date', widget=DateTimeField._properties['widget']( label="Assessment date", description="Date when the assessment analysis was made. " "This does not necesserly coincide with the " "underline data time coverage which can be older.", label_msgid='indicators_label_assessment_date', i18n_domain='indicators', ), ), StringField( name='source_code', searchable=True,
import interfaces from Products.Communities.interfaces.ontology import IOntology from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin from Products.ATContentTypes.content.document import ATDocumentSchema from Products.Communities.config import * ##code-section module-header #fill in your manual code here from Products.AddRemoveWidget import AddRemoveWidget from Products.ATVocabularyManager.namedvocabulary import NamedVocabulary ##/code-section module-header schema = Schema((LinesField( name='keywords', vocabulary=NamedVocabulary("""GlobalCommunityKeywords"""), widget=AddRemoveWidget( label=u"Keywords", description=u"Keywords.", ), searchable=1, ), ), ) ##code-section after-local-schema #fill in your manual code here ##/code-section after-local-schema Ontology_schema = BaseSchema.copy() + \ schema.copy() ##code-section after-schema #fill in your manual code here ##/code-section after-schema
vocabulary="getWSCourseNumberNameFaculty", schemata="default", searchable=True, write_permission='UWOshSuccess: edit student fields'), LinesField( name='testAccommodationsRequested', widget=MultiSelectionWidget( format='checkbox', label="Accommodations Requested", label_msgid='UWOshSuccess_label_testAccommodationsRequested', i18n_domain='UWOshSuccess', ), required=True, schemata="default", default='', vocabulary=NamedVocabulary("""UWOshSuccessAccommodations"""), searchable=True, enforceVocabulary=True, write_permission='UWOshSuccess: edit student fields'), TextField(name='studentComments', widget=TextAreaWidget( label="Student Comments", label_msgid='UWOshSuccess_label_studentComments', i18n_domain='UWOshSuccess', ), schemata="default", searchable=True, write_permission='UWOshSuccess: edit student fields'), # Faculty fields StringField(name='facultyHeader',
def get_named_vocab(self, name): vocab = NamedVocabulary(name) vocab = vocab.getVocabulary(self.context) vocab = dict(vocab.getDisplayList(self.context).items()) return vocab
widget=SelectionWidget( label='The commented article', label_msgid='label_comment_to_field', description= 'If this Article was submitted as a comment to an existing publication you can select it here to create a connection between the two.', description_msgid='help_comment_to_field'), searchable=1, multiValued=0, vocabulary="getPublishedArticles"), StringField( 'journal_section', widget=SelectionWidget( required=1, label='Section', description='Welcher Sektion läßt sich der Artikel zuordnen?'), vocabulary=NamedVocabulary("journal-sections"), default='no-section', searchable=1, schemata='Bibliographic Data'), StringField( 'subject_areas', widget=MultiSelectionWidget( required=0, label='Subject areas', description='Select one ore more appropiate subject areas.'), vocabulary=NamedVocabulary("subject-areas"), searchable=1, schemata='Bibliographic Data'), StringField('JournalTitle', required=0, widget=StringWidget(
def __call__(self): rv = NamedVocabulary('eea.workflow.reasons' ) #TODO: rename to eea.workflow.archive_reasons reasons = rv.getVocabularyDict(self.context) return reasons
def archive(self, context, initiator=None, reason=None, custom_message=None, archive_date=None): """Archive the object :param context: given object that should be archived :param initiator: the user id or name which commissioned the archival :param reason: reason id for which the object was archived :param custom_message: Custom message explaining why the object was archived :param archive_date: DateTime object which sets the expiration date of the object """ initiator = safe_unicode(initiator) reason = safe_unicode(reason) custom_message = safe_unicode(custom_message) wftool = getToolByName(context, 'portal_workflow') has_workflow = wftool.getChainFor(context) if not has_workflow: # NOP return date = archive_date and archive_date or DateTime() alsoProvides(context, IObjectArchived) context.setExpirationDate(date) # refactor this setting from here, without these assignments to self # the test for is_archived fails self.archive_date = date self.initiator = initiator self.custom_message = custom_message self.reason = reason state = wftool.getInfoFor(context, 'review_state') mtool = getToolByName(context, 'portal_membership') actor = mtool.getAuthenticatedMember().getId() rv = NamedVocabulary('eea.workflow.reasons') vocab = rv.getVocabularyDict(context) reason = vocab.get(reason, "Other") if custom_message: reason += u" (%s)" % custom_message comments = (u"Archived by %(actor)s on %(date)s by request " u"from %(initiator)s with reason: %(reason)s" % { 'actor': actor, 'initiator': initiator, 'reason': reason, 'date': date.ISO8601() }) for wfname in context.workflow_history.keys(): history = context.workflow_history[wfname] history += ({ 'action': 'Archive', 'review_state': state, 'actor': actor, 'comments': comments, 'time': date, },) context.workflow_history[wfname] = history context.workflow_history._p_changed = True context.reindexObject() notify(Purge(context))