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 getInstruments(self): bsc = getToolByName(self, 'bika_setup_catalog') items = [('', '')] + [ (o.UID, o.Title) for o in bsc(portal_type='Instrument', inactive_state='active') ] items.sort(lambda x, y: cmp(x[1].lower(), y[1].lower())) return DisplayList(list(items))
def SampleConditions(self, instance=None, allow_blank=False): instance = instance or self bsc = getToolByName(instance, 'bika_setup_catalog') items = [] for sm in bsc(portal_type='SampleCondition', inactive_state='active', sort_on='sortable_title'): items.append((sm.UID, sm.Title)) items = allow_blank and [['', '']] + list(items) or list(items) return DisplayList(items)
def getAnalysisServicesDisplayList(self): ''' Returns a Display List with the active Analysis Services available. The value is the keyword and the title is the text to be displayed. ''' bsc = getToolByName(self, 'bika_setup_catalog') items = [('', '')] + [(o.getObject().Keyword, o.Title) for o in bsc(portal_type='AnalysisService', inactive_state='active')] items.sort(lambda x, y: cmp(x[1].lower(), y[1].lower())) return DisplayList(list(items))
def _getCalculations(self): """ Returns a DisplayList with the available Calculations registered in Bika-Setup. Used to fill the Calculation ReferenceWidget. """ bsc = getToolByName(self, 'bika_setup_catalog') items = [(c.UID, c.Title) \ for c in bsc(portal_type='Calculation', inactive_state = 'active')] items.sort(lambda x, y: cmp(x[1], y[1])) items.insert(0, ('', t(_('None')))) return DisplayList(list(items))
def __call__(self, **kwargs): site = getSite() request = aq_get(site, 'REQUEST', None) catalog = getToolByName(site, self.catalog) if 'inactive_state' in catalog.indexes(): self.contentFilter['inactive_state'] = 'active' if 'cancellation_state' in catalog.indexes(): self.contentFilter['cancellation_state'] = 'active' self.contentFilter.update(**kwargs) objects = (b.getObject() for b in catalog(self.contentFilter)) items = [] for obj in objects: key = obj[self.key] key = callable(key) and key() or key value = obj[self.value] value = callable(value) and value() or value items.append((key, t(value))) return DisplayList(items)
def getInstruments(self): """ List of instruments Used in bika_listing.pt """ return DisplayList(self.instruments)
def getWorksheetTemplates(self): """ List of templates Used in bika_listing.pt """ return DisplayList(self.templates)