コード例 #1
0
 def __init__(self, context, request):
     ARV.__init__(self, context, request)
     self.catalog = "bika_catalog"
     path = '/'.join(self.context.getPhysicalPath())
     self.contentFilter = {
         'portal_type': 'AnalysisRequest',
         'sort_on': 'created',
         'sort_order': 'reverse',
         'cancellation_state': 'active',
     }
     hide_actions_and_columns(self)
コード例 #2
0
 def folderitem(self, obj, item, index):
     # Call the folderitem method from the base class
     item = _ARV.folderitem(self, obj, item, index)
     # In sampling rounds, analysis request list will be listed per Sample
     # Partition/Container Obtaining analysis requests
     # TODO-performance: don't get the full object
     obj = obj.getObject()
     # Getting the sampling round template uid
     srTemplateUID = obj.getSamplingRound(
     ).sr_template if obj.getSamplingRound().sr_template else ''
     # Getting the sampling round object
     catalog = getToolByName(self.context, 'uid_catalog')
     srTemplateObj = catalog(UID=srTemplateUID)[0].getObject() if catalog(
         UID=srTemplateUID) else None
     # Getting the partitions and creating a row per partition
     partitions = obj.getPartitions()
     for part in partitions:
         item['partition'] = part.id
         if part.getContainer():
             img_url = '<img src="' + self.portal_url + '/++resource++bika.lims.images/ok.png"/>'
             item['securitySealIntact'] = part.getContainer(
             ).getSecuritySealIntact()
             item['replace']['securitySealIntact'] = img_url \
                 if part.getContainer().getSecuritySealIntact() else ' '
         else:
             item['securitySealIntact'] = ' '
         item['replace']['partition'] = "<a href='%s'>%s</a>" % (
             part.absolute_url(), item['partition'])
         item[
             'samplingRoundTemplate'] = srTemplateObj.title if srTemplateObj else ''
         if srTemplateObj:
             item['replace']['samplingRoundTemplate'] = \
                 "<a href='%s'>%s</a>" % (srTemplateObj.absolute_url, item['samplingRoundTemplate'])
     return item
コード例 #3
0
 def folderitems(self, full_objects=True):
     # In sampling rounds, analysis request list will be listed per Sample Partition/Container
     # Obtaining analysis requests
     items = _ARV.folderitems(self, full_objects)
     new_items = []
     for x in range(len(items)):
         if 'obj' not in items[x]:
             new_items.append(items[x])
             continue
         obj = items[x]['obj']
         # Getting the sampling round template uid
         srTemplateUID = obj.getSamplingRound(
         ).sr_template if obj.getSamplingRound().sr_template else ''
         # Getting the sampling round object
         catalog = getToolByName(self.context, 'uid_catalog')
         srTemplateObj = catalog(
             UID=srTemplateUID)[0].getObject() if catalog(
                 UID=srTemplateUID) else None
         # Getting the partitions and creating a row per partition
         partitions = obj.getPartitions()
         for part in partitions:
             item = items[x].copy()
             # We ave to make a copy of 'replace' because it's a reference to a dict object
             item['replace'] = items[x]['replace'].copy()
             item['partition'] = part.id
             if part.getContainer():
                 img_url = '<img src="' + self.portal_url + '/++resource++bika.lims.images/ok.png"/>'
                 item['securitySealIntact'] = part.getContainer(
                 ).getSecuritySealIntact()
                 item['replace']['securitySealIntact'] = img_url \
                     if part.getContainer().getSecuritySealIntact() else ' '
             else:
                 item['securitySealIntact'] = ' '
             item['replace']['partition'] = "<a href='%s'>%s</a>" % (
                 part.absolute_url(), item['partition'])
             item[
                 'samplingRoundTemplate'] = srTemplateObj.title if srTemplateObj else ''
             if srTemplateObj:
                 item['replace']['samplingRoundTemplate'] = \
                     "<a href='%s'>%s</a>" % (srTemplateObj.absolute_url, item['samplingRoundTemplate'])
             new_items.append(item)
     return new_items
コード例 #4
0
 def folderitem(self, obj, item, index):
     # Call the folderitem method from the base class
     item = _ARV.folderitem(self, obj, item, index)
     # In sampling rounds, analysis request list will be listed per Sample
     # Partition/Container Obtaining analysis requests
     # TODO-performance: don't get the full object
     obj = obj.getObject()
     # Getting the sampling round template uid
     srTemplateUID = obj.getSamplingRound().sr_template if obj.getSamplingRound().sr_template else ''
     # Getting the sampling round object
     catalog = getToolByName(self.context, 'uid_catalog')
     srTemplateObj = catalog(UID=srTemplateUID)[0].getObject() if catalog(UID=srTemplateUID) else None
     item['samplingRoundTemplate'] = ''
     if srTemplateObj:
         item['samplingRoundTemplate'] = srTemplateObj.title
         item['replace']['samplingRoundTemplate'] = \
             "<a href='%s'>%s</a>" % (
             srTemplateObj.absolute_url, item['samplingRoundTemplate'])
     item['securitySealIntact'] = ''
     return item
コード例 #5
0
 def folderitems(self, full_objects=True):
     # In sampling rounds, analysis request list will be listed per Sample Partition/Container
     # Obtaining analysis requests
     items = _ARV.folderitems(self, full_objects)
     new_items = []
     for x in range(len(items)):
         if 'obj' not in items[x]:
             new_items.append(items[x])
             continue
         obj = items[x]['obj']
         # Getting the sampling round template uid
         srTemplateUID = obj.getSamplingRound().sr_template if obj.getSamplingRound().sr_template else ''
         # Getting the sampling round object
         catalog = getToolByName(self.context, 'uid_catalog')
         srTemplateObj = catalog(UID=srTemplateUID)[0].getObject() if catalog(UID=srTemplateUID) else None
         # Getting the partitions and creating a row per partition
         partitions = obj.getPartitions()
         for part in partitions:
             item = items[x].copy()
             # We ave to make a copy of 'replace' because it's a reference to a dict object
             item['replace'] = items[x]['replace'].copy()
             item['partition'] = part.id
             if part.getContainer():
                 img_url = '<img src="'+self.portal_url+'/++resource++bika.lims.images/ok.png"/>'
                 item['securitySealIntact'] = part.getContainer().getSecuritySealIntact()
                 item['replace']['securitySealIntact'] = img_url \
                     if part.getContainer().getSecuritySealIntact() else ' '
             else:
                 item['securitySealIntact'] = ' '
             item['replace']['partition'] = "<a href='%s'>%s</a>" % (part.absolute_url(), item['partition'])
             item['samplingRoundTemplate'] = srTemplateObj.title if srTemplateObj else ''
             if srTemplateObj:
                 item['replace']['samplingRoundTemplate'] = \
                     "<a href='%s'>%s</a>" % (srTemplateObj.absolute_url, item['samplingRoundTemplate'])
             new_items.append(item)
     return new_items
コード例 #6
0
 def folderitem(self, obj, item, index):
     item = BaseView.folderitem(self, obj, item, index)
     return folder_listing_item(self, obj, item, index)
コード例 #7
0
 def __call__(self):
     return ARV.__call__(self)