def listMetaDataFields(self, exclude=True): """Return a list of metadata fields from catalog. """ #tool = getToolByName(self, ATCT_TOOLNAME) #original_list = tool.getMetadataDisplay(exclude) return DisplayList(( ('getAnalysisCategory', _p('Analysis Category')), ('getAnalysisService', _p('Analysis Service')), ('getAnalysts', _('Analyst')), ('getClientOrderNumber', _('Client Order')), ('getClientReference', _('Client Reference')), ('getClientSampleID', _('Client Sample ID')), ('getClientTitle', _('Client')), ('getContactTitle', _('Contact')), ('Creator', _p('Creator')), ('created', _('Date Created')), ('getDatePublished', _('Date Published')), ('getDateReceived', _('Date Received')), ('getDateSampled', _('Date Sampled')), ('getProfilesTitle', _('Analysis Profiles')), ('getRequestID', _('Request ID')), ('getSampleID', _('Sample ID')), ('getSamplePointTitle', _('Sample Point')), ('getSampleTypeTitle', _('Sample Type')), ('review_state', _p('Review state')), ))
def __init__(self, context, request): super(StorageLocationsView, self).__init__(context, request) self.catalog = 'bika_setup_catalog' self.contentFilter = {'portal_type': 'StorageLocation', 'sort_on': 'sortable_title'} self.context_actions = {_('Add'): {'url': 'createObject?type_name=StorageLocation', 'icon': '++resource++bika.lims.images/add.png'}} self.title = self.context.translate(_("Storage Locations")) self.icon = self.portal_url + "/++resource++bika.lims.images/storagelocation_big.png" self.description = "" self.show_sort_column = False self.show_select_row = False self.show_select_column = True self.pagesize = 25 self.columns = { 'Title': {'title': _('Storage Location'), 'index':'sortable_title'}, 'Description': {'title': _('Description'), 'index': 'description', 'toggle': True}, 'SiteTitle': {'title': _p('Site Title'), 'toggle': True}, 'SiteCode': {'title': _p('Site Code'), 'toggle': True}, 'LocationTitle': {'title': _p('Location Title'), 'toggle': True}, 'LocationCode': {'title': _p('Location Code'), 'toggle': True}, 'ShelfTitle': {'title': _p('Shelf Title'), 'toggle': True}, 'ShelfCode': {'title': _p('Shelf Code'), 'toggle': True}, 'Owner': {'title': _p('Owner'), 'toggle': True}, } self.review_states = [ {'id':'default', 'title': _('Active'), 'contentFilter': {'inactive_state': 'active'}, 'transitions': [{'id':'deactivate'}, ], 'columns': ['Title', 'Description', 'Owner', 'SiteTitle', 'SiteCode', 'LocationTitle', 'LocationCode', 'ShelfTitle', 'ShelfCode']}, {'id':'inactive', 'title': _('Dormant'), 'contentFilter': {'inactive_state': 'inactive'}, 'transitions': [{'id':'activate'}, ], 'columns': ['Title', 'Description', 'Owner', 'SiteTitle', 'SiteCodeShelfCode' ]}, {'id':'all', 'title': _('All'), 'contentFilter':{}, 'columns': ['Title', 'Description', 'Owner', 'SiteTitle', 'SiteCodeShelfCode' ]}, ]
def __call__(self): self.errors = {} if 'header_table_submitted' in self.request: schema = self.context.Schema() fields = schema.fields() form = self.request.form for field in fields: fieldname = field.getName() if fieldname in form: if fieldname + "_uid" in form: # references (process_form would normally do *_uid trick) field.getMutator(self.context)(form[fieldname + "_uid"]) else: # other fields field.getMutator(self.context)(form[fieldname]) message = _p("Changes saved.") self.context.plone_utils.addPortalMessage(message, 'info') return self.template()