| @@ 36-124 (lines=89) @@ | ||
| 33 | """Controlpanel Listing for Analysis Profiles |
|
| 34 | """ |
|
| 35 | ||
| 36 | def __init__(self, context, request): |
|
| 37 | super(AnalysisProfilesView, self).__init__(context, request) |
|
| 38 | ||
| 39 | self.catalog = SETUP_CATALOG |
|
| 40 | self.show_select_column = True |
|
| 41 | ||
| 42 | self.contentFilter = { |
|
| 43 | "portal_type": "AnalysisProfile", |
|
| 44 | "sort_on": "sortable_title", |
|
| 45 | "sort_order": "ascending", |
|
| 46 | # restrict the search to the current folder only |
|
| 47 | "path": { |
|
| 48 | "query": api.get_path(context), |
|
| 49 | "level": 0, |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | self.context_actions = { |
|
| 54 | _(u"listing_analysisprofiles_action_add", default=u"Add"): { |
|
| 55 | "url": "++add++AnalysisProfile", |
|
| 56 | "permission": AddAnalysisProfile, |
|
| 57 | "icon": "senaite_theme/icon/plus" |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| 61 | self.title = translate(_( |
|
| 62 | u"listing_analysisprofiles_title", |
|
| 63 | default=u"Analysis Profiles") |
|
| 64 | ) |
|
| 65 | self.icon = api.get_icon("AnalysisProfiles", html_tag=False) |
|
| 66 | ||
| 67 | self.columns = collections.OrderedDict(( |
|
| 68 | ("Title", { |
|
| 69 | "title": _( |
|
| 70 | u"listing_analysisprofiles_column_title", |
|
| 71 | default=u"Profile" |
|
| 72 | ), |
|
| 73 | "index": "sortable_title", |
|
| 74 | }), |
|
| 75 | ("Description", { |
|
| 76 | "title": _( |
|
| 77 | u"listing_analysisprofiles_column_description", |
|
| 78 | default=u"Description" |
|
| 79 | ), |
|
| 80 | "toggle": True, |
|
| 81 | }), |
|
| 82 | ("ProfileKey", { |
|
| 83 | "title": _( |
|
| 84 | u"listing_analysisprofiles_column_profilekey", |
|
| 85 | default=u"Profile Key" |
|
| 86 | ), |
|
| 87 | "sortable": False, |
|
| 88 | "toggle": True, |
|
| 89 | }), |
|
| 90 | ("SampleTypes", { |
|
| 91 | "title": _( |
|
| 92 | u"listing_analysisprofiles_column_sampletypes", |
|
| 93 | default=u"Sample Types", |
|
| 94 | ), |
|
| 95 | "index": "sampletype_title", |
|
| 96 | "sortable": True, |
|
| 97 | }), |
|
| 98 | )) |
|
| 99 | ||
| 100 | self.review_states = [ |
|
| 101 | { |
|
| 102 | "id": "default", |
|
| 103 | "title": _( |
|
| 104 | u"listing_analysisprofiles_state_active", |
|
| 105 | default=u"Active" |
|
| 106 | ), |
|
| 107 | "contentFilter": {"is_active": True}, |
|
| 108 | "columns": self.columns.keys(), |
|
| 109 | }, { |
|
| 110 | "id": "inactive", |
|
| 111 | "title": _( |
|
| 112 | u"listing_analysisprofiles_state_inactive", |
|
| 113 | default=u"Inactive" |
|
| 114 | ), |
|
| 115 | "contentFilter": {'is_active': False}, |
|
| 116 | "columns": self.columns.keys(), |
|
| 117 | }, { |
|
| 118 | "id": "all", |
|
| 119 | "title": _( |
|
| 120 | u"listing_analysisprofiles_state_all", |
|
| 121 | default=u"All" |
|
| 122 | ), |
|
| 123 | "contentFilter": {}, |
|
| 124 | "columns": self.columns.keys(), |
|
| 125 | }, |
|
| 126 | ] |
|
| 127 | ||
| @@ 34-114 (lines=81) @@ | ||
| 31 | ||
| 32 | class SubGroupsView(ListingView): |
|
| 33 | ||
| 34 | def __init__(self, context, request): |
|
| 35 | super(SubGroupsView, self).__init__(context, request) |
|
| 36 | ||
| 37 | self.catalog = SETUP_CATALOG |
|
| 38 | self.show_select_column = True |
|
| 39 | ||
| 40 | self.contentFilter = { |
|
| 41 | "portal_type": "SubGroup", |
|
| 42 | "sort_on": "sortable_title", |
|
| 43 | "sort_order": "ascending", |
|
| 44 | "path": { |
|
| 45 | "query": api.get_path(self.context), |
|
| 46 | "depth": 1, |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| 50 | self.context_actions = { |
|
| 51 | _("listing_subgroup_action_add", default="Add"): { |
|
| 52 | "url": "++add++SubGroup", |
|
| 53 | "permission": AddSubGroup, |
|
| 54 | "icon": "senaite_theme/icon/plus" |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | self.title = translate(_( |
|
| 59 | "listing_subgroups_title", |
|
| 60 | default="Sub-Groups") |
|
| 61 | ) |
|
| 62 | self.description = "" |
|
| 63 | self.icon = api.get_icon("SubGroups", html_tag=False) |
|
| 64 | ||
| 65 | self.columns = collections.OrderedDict(( |
|
| 66 | ("Title", { |
|
| 67 | "title": _( |
|
| 68 | "listing_subgroups_column_title", |
|
| 69 | default="Title" |
|
| 70 | ), |
|
| 71 | "index": "sortable_title"}), |
|
| 72 | ("Description", { |
|
| 73 | "title": _( |
|
| 74 | "listing_subgroups_column_description", |
|
| 75 | default="Description" |
|
| 76 | ), |
|
| 77 | "toggle": True, |
|
| 78 | }), |
|
| 79 | ("SortKey", { |
|
| 80 | "title": _( |
|
| 81 | "listing_subgroups_column_sortkey", |
|
| 82 | default="Sort Key" |
|
| 83 | ), |
|
| 84 | "toggle": True, |
|
| 85 | }), |
|
| 86 | )) |
|
| 87 | ||
| 88 | self.review_states = [ |
|
| 89 | { |
|
| 90 | "id": "default", |
|
| 91 | "title": _( |
|
| 92 | "listing_subgroups_state_active", |
|
| 93 | default="Active" |
|
| 94 | ), |
|
| 95 | "contentFilter": {"is_active": True}, |
|
| 96 | "transitions": [{"id": "deactivate"}, ], |
|
| 97 | "columns": self.columns.keys(), |
|
| 98 | }, { |
|
| 99 | "id": "inactive", |
|
| 100 | "title": _( |
|
| 101 | "listing_subgroups_state_inactive", |
|
| 102 | default="Inactive" |
|
| 103 | ), |
|
| 104 | "contentFilter": {'is_active': False}, |
|
| 105 | "transitions": [{"id": "activate"}, ], |
|
| 106 | "columns": self.columns.keys(), |
|
| 107 | }, { |
|
| 108 | "id": "all", |
|
| 109 | "title": _( |
|
| 110 | "listing_subgroups_state_all", |
|
| 111 | default="All" |
|
| 112 | ), |
|
| 113 | "contentFilter": {}, |
|
| 114 | "columns": self.columns.keys(), |
|
| 115 | }, |
|
| 116 | ] |
|
| 117 | ||