def folderitem(self, obj, item, index): """Service triggered each time an item is iterated in folderitems. The use of this service prevents the extra-loops in child objects. :obj: the instance of the class to be foldered :item: dict containing the properties of the object to be used by the template :index: current index of the item """ layout = obj.getLayout title = api.get_title(obj) url = api.get_url(obj) item["CreationDate"] = self.ulocalized_time(obj.created) if len(obj.getAnalysesUIDs) == 0: item["table_row_class"] = "state-empty-worksheet" title_link = "{}/{}".format(url, "add_analyses") if len(layout) > 0: title_link = "{}/{}".format(url, "manage_results") item["Title"] = title item["replace"]["Title"] = get_link(title_link, value=title) pos_parent = {} for slot in layout: # compensate for bad data caused by a stupid bug. if type(slot["position"]) in (list, tuple): slot["position"] = slot["position"][0] if slot["position"] == "new": continue if slot["position"] in pos_parent: continue pos_parent[slot["position"]] =\ self.rc.lookupObject(slot.get("container_uid")) # Total QC Analyses item["NumQCAnalyses"] = str(obj.getNumberOfQCAnalyses) # Total Routine Analyses item["NumRegularAnalyses"] = str(obj.getNumberOfRegularAnalyses) # Total Number of Samples item["NumRegularSamples"] = str(obj.getNumberOfRegularSamples) # Progress progress_perc = obj.getProgressPercentage item["replace"]["Progress"] = get_progress_bar_html(progress_perc) review_state = item["review_state"] if self.can_reassign and review_state == "open": item["Analyst"] = obj.getAnalyst item["allow_edit"] = ["Analyst"] item["required"] = ["Analyst"] item["choices"] = {"Analyst": self.analyst_choices} else: fullname = user_fullname(self.context, obj.getAnalyst) item["Analyst"] = fullname return item
def folderitem(self, obj, item, index): """ :obj: is a worksheet brain. """ # Additional info from Worksheet to be added in the item generated by # default by bikalisting. # Call the folderitem method from the base class item = BikaListingView.folderitem(self, obj, item, index) item['CreationDate'] = self.ulocalized_time(obj.created) if len(obj.getAnalysesUIDs) == 0: item['table_row_class'] = 'state-empty-worksheet' layout = obj.getLayout item['Title'] = obj.Title turl = "manage_results" if len(layout) > 0 else "add_analyses" item['replace']['Title'] = "<a href='%s/%s'>%s</a>" % \ (item['url'], turl, item['Title']) pos_parent = {} for slot in layout: # compensate for bad data caused by a stupid bug. if type(slot['position']) in (list, tuple): slot['position'] = slot['position'][0] if slot['position'] == 'new': continue if slot['position'] in pos_parent: continue pos_parent[slot['position']] =\ self.rc.lookupObject(slot.get('container_uid')) # Total QC Analyses item['NumQCAnalyses'] = str(obj.getNumberOfQCAnalyses) # Total Routine Analyses item['NumRegularAnalyses'] = str(obj.getNumberOfRegularAnalyses) # Total Number of Samples item['NumRegularSamples'] = str(obj.getNumberOfRegularSamples) if item['review_state'] == 'open' \ and self.allow_edit \ and not self.restrict_results \ and self.can_manage: item['Analyst'] = obj.getAnalyst item['allow_edit'] = [ 'Analyst', ] item['required'] = [ 'Analyst', ] item['choices'] = {'Analyst': self.analyst_choices} self.can_reassign = True else: item['Analyst'] = user_fullname(self.context, obj.getAnalyst) return item
def folderitem(self, obj, item, index): """ :obj: is a worksheet brain. """ # Additional info from Worksheet to be added in the item generated by # default by bikalisting. # Call the folderitem method from the base class item = BikaListingView.folderitem(self, obj, item, index) item['CreationDate'] = self.ulocalized_time(obj.created) if len(obj.getAnalysesUIDs) == 0: item['table_row_class'] = 'state-empty-worksheet' layout = obj.getLayout item['Title'] = obj.Title turl = "manage_results" if len(layout) > 0 else "add_analyses" item['replace']['Title'] = "<a href='%s/%s'>%s</a>" % \ (item['url'], turl, item['Title']) pos_parent = {} for slot in layout: # compensate for bad data caused by a stupid bug. if type(slot['position']) in (list, tuple): slot['position'] = slot['position'][0] if slot['position'] == 'new': continue if slot['position'] in pos_parent: continue pos_parent[slot['position']] =\ self.rc.lookupObject(slot.get('container_uid')) # Total QC Analyses item['NumQCAnalyses'] = str(obj.getNumberOfQCAnalyses) # Total Routine Analyses item['NumRegularAnalyses'] = str(obj.getNumberOfRegularAnalyses) # Total Number of Samples item['NumRegularSamples'] = str(obj.getNumberOfRegularSamples) if item['review_state'] == 'open' \ and self.allow_edit \ and not self.restrict_results \ and self.can_manage: item['Analyst'] = obj.getAnalyst item['allow_edit'] = ['Analyst', ] item['required'] = ['Analyst', ] item['choices'] = {'Analyst': self.analyst_choices} self.can_reassign = True else: item['Analyst'] = user_fullname(self.context, obj.getAnalyst) return item
def folderitem(self, obj, item, index): """Service triggered each time an item is iterated in folderitems. The use of this service prevents the extra-loops in child objects. :obj: the instance of the class to be foldered :item: dict containing the properties of the object to be used by the template :index: current index of the item """ title = api.get_title(obj) url = api.get_url(obj) item["CreationDate"] = self.ulocalized_time(obj.created) title_link = "{}/{}".format(url, "add_analyses") if len(obj.getAnalysesUIDs) > 0: title_link = "{}/{}".format(url, "manage_results") item["Title"] = title item["replace"]["Title"] = get_link(title_link, value=title) # Total QC Analyses item["getNumberOfQCAnalyses"] = str(obj.getNumberOfQCAnalyses) # Total Routine Analyses item["getNumberOfRegularAnalyses"] = str( obj.getNumberOfRegularAnalyses) # Total Number of Samples item["getNumberOfRegularSamples"] = str(obj.getNumberOfRegularSamples) # Progress progress = obj.getProgressPercentage progress_bar_html = get_progress_bar_html(progress) item["replace"]["getProgressPercentage"] = progress_bar_html review_state = item["review_state"] if self.can_reassign and review_state == "open": item["Analyst"] = obj.getAnalyst item["allow_edit"] = ["Analyst"] item["required"] = ["Analyst"] item["choices"] = {"Analyst": self.analyst_choices} else: fullname = user_fullname(self.context, obj.getAnalyst) item["Analyst"] = fullname return item
def getCreatorFullName(self): return user_fullname(self, self.Creator())