本文整理汇总了Python中lims.browser.bika_listing.BikaListingView类的典型用法代码示例。如果您正苦于以下问题:Python BikaListingView类的具体用法?Python BikaListingView怎么用?Python BikaListingView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BikaListingView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, context, request, field):
BikaListingView.__init__(self, context, request)
self.selected = [o.UID() for o in getattr(field, field.accessor)()]
self.context_actions = {}
self.catalog = "bika_setup_catalog"
self.contentFilter = {'review_state': 'impossible_state'}
self.base_url = self.context.absolute_url()
self.view_url = self.base_url
self.show_categories = True
self.show_sort_column = False
self.show_select_row = False
self.show_select_all_checkbox = False
self.show_select_column = True
self.pagesize = 999999
self.form_id = 'serviceswidget'
self.columns = {
'Service': {'title': _('Service')},
'Keyword': {'title': _('Keyword'),
'index': 'getKeyword'},
'Method': {'title': _('Method')},
'Calculation': {'title': _('Calculation')},
}
self.review_states = [
{'id':'default',
'title': _('All'),
'contentFilter':{},
'transitions': [],
'columns':['Service',
'Keyword',
'Method',
'Calculation', ]
},
]
示例2: __init__
def __init__(self, context, request):
BikaListingView.__init__(self, context, request)
self.show_sort_column = False
self.show_select_row = False
self.show_select_column = False
self.show_workflow_action_buttons = False
self.pagesize = 999999
self.icon = self.portal_url + "/++resource++bika.lims.images/%s_big.png" % \
context.portal_type.lower()
self.title = to_utf8(self.context.Title()) + " " + t(_("Log"))
self.description = ""
self.columns = {
'Version': {'title': _('Version'), 'sortable': False},
'Date': {'title': _('Date'), 'sortable': False},
'User': {'title': _('User'), 'sortable': False},
'Action': {'title': _('Action'), 'sortable': False},
'Description': {'title': _('Description'), 'sortable': False},
}
self.review_states = [
{'id': 'default',
'title': 'All',
'contentFilter': {},
'columns': ['Version',
'Date',
'User',
'Action',
'Description']},
]
示例3: folderitems
def folderitems(self):
items = BikaListingView.folderitems(self)
for x in range(len(items)):
if not items[x].has_key('obj'): continue
obj = items[x]['obj']
itype = obj.getInstrumentType()
items[x]['Type'] = itype.Title() if itype else ''
ibrand = obj.getManufacturer()
items[x]['Brand'] = ibrand.Title() if ibrand else ''
items[x]['Model'] = obj.getModel()
data = obj.getCertificateExpireDate()
if data == '':
items[x]['ExpiryDate'] = "No date avaliable"
else:
items[x]['ExpiryDate'] = data.asdatetime().strftime(self.date_format_short)
if obj.isOutOfDate():
items[x]['WeeksToExpire'] = "Out of date"
else:
date = int(str(obj.getWeeksToExpire()).split(',')[0].split(' ')[0])
weeks,days = divmod(date,7)
items[x]['WeeksToExpire'] = str(weeks)+" weeks"+" "+str(days)+" days"
if obj.getMethod():
items[x]['Method'] = obj.getMethod().Title()
items[x]['replace']['Method'] = "<a href='%s'>%s</a>" % \
(obj.getMethod().absolute_url(), items[x]['Method'])
else:
items[x]['Method'] = ''
items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \
(items[x]['url'], items[x]['Title'])
return items
示例4: folderitems
def folderitems(self):
mtool = getToolByName(self.context, "portal_membership")
if mtool.checkPermission(ManageBika, self.context):
del self.review_states[0]["transitions"]
self.show_select_column = True
self.review_states.append(
{
"id": "active",
"title": _("Active"),
"contentFilter": {"inactive_state": "active"},
"transitions": [{"id": "deactivate"}],
"columns": ["Title", "Description"],
}
)
self.review_states.append(
{
"id": "inactive",
"title": _("Dormant"),
"contentFilter": {"inactive_state": "inactive"},
"transitions": [{"id": "activate"}],
"columns": ["Title", "Description"],
}
)
items = BikaListingView.folderitems(self)
for x in range(len(items)):
if "obj" in items[x]:
items[x]["replace"]["Title"] = "<a href='%s'>%s</a>" % (items[x]["url"], items[x]["Title"])
return items
示例5: __call__
def __call__(self):
ar = self.context
workflow = getToolByName(ar, 'portal_workflow')
# If is a retracted AR, show the link to child AR and show a warn msg
if workflow.getInfoFor(ar, 'review_state') == 'invalid':
childar = hasattr(ar, 'getChildAnalysisRequest') \
and ar.getChildAnalysisRequest() or None
childid = childar and childar.getRequestID() or None
message = _('This Analysis Request has been withdrawn and is '
'shown for trace-ability purposes only. Retest: '
'${retest_child_id}.',
mapping={'retest_child_id': safe_unicode(childid) or ''})
self.context.plone_utils.addPortalMessage(
self.context.translate(message), 'warning')
# If is an AR automatically generated due to a Retraction, show it's
# parent AR information
if hasattr(ar, 'getParentAnalysisRequest') \
and ar.getParentAnalysisRequest():
par = ar.getParentAnalysisRequest()
message = _('This Analysis Request has been '
'generated automatically due to '
'the retraction of the Analysis '
'Request ${retracted_request_id}.',
mapping={'retracted_request_id': par.getRequestID()})
self.context.plone_utils.addPortalMessage(
self.context.translate(message), 'info')
template = BikaListingView.__call__(self)
return template
示例6: folderitems
def folderitems(self):
mtool = getToolByName(self.context, 'portal_membership')
if mtool.checkPermission(ManageBika, self.context):
del self.review_states[0]['transitions']
self.show_select_column = True
self.review_states.append(
{'id':'active',
'title': _('Active'),
'contentFilter': {'inactive_state': 'active'},
'transitions': [{'id':'deactivate'}, ],
'columns': ['Title', 'Description']})
self.review_states.append(
{'id':'inactive',
'title': _('Dormant'),
'contentFilter': {'inactive_state': 'inactive'},
'transitions': [{'id':'activate'}, ],
'columns': ['Title', 'Description']})
items = BikaListingView.folderitems(self)
for x in range(len(items)):
if not items[x].has_key('obj'): continue
items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \
(items[x]['url'], items[x]['Title'])
return items
示例7: folderitems
def folderitems(self):
items = BikaListingView.folderitems(self)
props = self.context.portal_properties.site_properties
for x in range(len(items)):
if 'obj' not in items[x]:
continue
obj = items[x]['obj']
obj_url = obj.absolute_url()
file = obj.getReportFile()
icon = file.getBestIcon()
items[x]['Client'] = ''
client = obj.getClient()
if client:
items[x]['replace']['Client'] = "<a href='%s'>%s</a>" % \
(client.absolute_url(),
client.Title())
items[x]['FileSize'] = '%sKb' % (file.get_size() / 1024)
items[x]['Created'] = self.ulocalized_time(obj.created())
items[x]['By'] = self.user_fullname(obj.Creator())
items[x]['replace']['Title'] = \
"<a href='%s/at_download/ReportFile'>%s</a>" % \
(obj_url, items[x]['Title'])
return items
示例8: folderitems
def folderitems(self):
items = BikaListingView.folderitems(self)
for item in items:
if not item.has_key('obj'): continue
obj = item['obj']
title_link = "<a href='%s'>%s</a>" % (item['url'], item['title'])
item['replace']['Title'] = title_link
return items
示例9: folderitems
def folderitems(self):
items = BikaListingView.folderitems(self)
for x in range(len(items)):
if not items[x].has_key('obj'): continue
items[x]['replace']['getFullname'] = "<a href='%s'>%s</a>" % \
(items[x]['url'], items[x]['obj'].getFullname())
return items
示例10: folderitems
def folderitems(self):
items = BikaListingView.folderitems(self)
for x in range(len(items)):
if not items[x].has_key('obj'): continue
obj = items[x]['obj']
items[x]['Description'] = obj.Description()
items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \
(items[x]['url'], items[x]['Title'])
return items
示例11: folderitems
def folderitems(self):
items = BikaListingView.folderitems(self)
for x in range(len(items)):
if not items[x].has_key('obj'): continue
obj = items[x]['obj']
items[x]['Title'] = obj.Title()
items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \
(items[x]['url'], items[x]['title'])
items[x]['ProfileKey'] = obj.getProfileKey()
return items
示例12: folderitems
def folderitems(self):
items = BikaListingView.folderitems(self)
for x in range(len(items)):
if 'obj' not in items[x]:
continue
items[x]['replace']['title'] = \
"<a href='%s'>%s</a>" % (items[x]['url'], items[x]['title'])
return items
示例13: isItemAllowed
def isItemAllowed(self, obj):
# Only show "my" worksheets
# this cannot be setup in contentFilter,
# because AuthenticatedMember is not available in __init__
if self.selected_state == 'mine' or self.restrict_results == True:
analyst = obj.getAnalyst().strip()
if analyst != _c(self.member.getId()):
return False
return BikaListingView.isItemAllowed(self, obj)
示例14: folderitems
def folderitems(self):
items = BikaListingView.folderitems(self)
for x in range(len(items)):
if not items[x].has_key('obj'): continue
obj = items[x]['obj']
items[x]['Title'] = obj.Title()
items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \
(items[x]['url'], items[x]['Title'])
st = obj.getSampleType()
items[x]['SampleType'] = obj.getSampleType().Title() \
if obj.getSampleType() else ""
return items
示例15: folderitems
def folderitems(self):
items = BikaListingView.folderitems(self)
for x in range(len(items)):
if 'obj' not in items[x]:
continue
items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \
(items[x]['url'], items[x]['Title'])
items[x]['getEffectiveDate'] = self.ulocalized_time(items[x]['obj'].getEffectiveDate())
items[x]['getExpirationDate'] = self.ulocalized_time(items[x]['obj'].getExpirationDate())
return items