Example #1
0
    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')),
        ))
Example #2
0
 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))
Example #3
0
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)
Example #4
0
 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))
Example #5
0
 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))
Example #6
0
    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)
Example #7
0
 def getInstruments(self):
     """ List of instruments
         Used in bika_listing.pt
     """
     return DisplayList(self.instruments)
Example #8
0
 def getWorksheetTemplates(self):
     """ List of templates
         Used in bika_listing.pt
     """
     return DisplayList(self.templates)