|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# |
| 3 | +# This file is part of SENAITE.AST. |
| 4 | +# |
| 5 | +# SENAITE.AST is free software: you can redistribute it and/or modify it under |
| 6 | +# the terms of the GNU General Public License as published by the Free |
| 7 | +# Software Foundation, version 2. |
| 8 | +# |
| 9 | +# This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 12 | +# details. |
| 13 | +# |
| 14 | +# You should have received a copy of the GNU General Public License along with |
| 15 | +# this program; if not, write to the Free Software Foundation, Inc., 51 |
| 16 | +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 17 | +# |
| 18 | +# Copyright 2020-2025 by it's authors. |
| 19 | +# Some rights reserved, see README and LICENSE. |
| 20 | + |
| 21 | +from senaite.app.listing.interfaces import IListingView |
| 22 | +from senaite.app.listing.interfaces import IListingViewAdapter |
| 23 | +from senaite.ast.config import IDENTIFICATION_KEY |
| 24 | +from zope.component import adapter |
| 25 | +from zope.interface import implementer |
| 26 | + |
| 27 | +@implementer(IListingViewAdapter) |
| 28 | +@adapter(IListingView) |
| 29 | +class AnalysesViewAdapter(object): |
| 30 | + """Adapter for analyses listing |
| 31 | + """ |
| 32 | + |
| 33 | + def __init__(self, listing, context): |
| 34 | + self.listing = listing |
| 35 | + self.context = context |
| 36 | + |
| 37 | + def folder_item(self, obj, item, index): |
| 38 | + keyword = obj.getKeyword |
| 39 | + if keyword == IDENTIFICATION_KEY: |
| 40 | + # reload the current view on analysis submit to make the section |
| 41 | + # for the selection of AST panels to become visible and properly |
| 42 | + # populated with panels that include at least one of the selected |
| 43 | + # microorganisms |
| 44 | + item["reload"] = ["submit"] |
| 45 | + |
| 46 | + def before_render(self): |
| 47 | + pass |
0 commit comments