| @@ 41-106 (lines=66) @@ | ||
| 38 | ||
| 39 | class ContainersView(BikaListingView): |
|
| 40 | ||
| 41 | def __init__(self, context, request): |
|
| 42 | super(ContainersView, self).__init__(context, request) |
|
| 43 | ||
| 44 | self.catalog = "senaite_catalog_setup" |
|
| 45 | ||
| 46 | self.contentFilter = { |
|
| 47 | "portal_type": "Container", |
|
| 48 | "sort_on": "sortable_title", |
|
| 49 | } |
|
| 50 | ||
| 51 | self.context_actions = { |
|
| 52 | _("Add"): { |
|
| 53 | "url": "createObject?type_name=Container", |
|
| 54 | "permission": AddContainer, |
|
| 55 | "icon": "++resource++bika.lims.images/add.png"} |
|
| 56 | } |
|
| 57 | ||
| 58 | self.title = self.context.translate(_("Containers")) |
|
| 59 | self.icon = "{}/{}".format( |
|
| 60 | self.portal_url, |
|
| 61 | "/++resource++bika.lims.images/container_big.png" |
|
| 62 | ) |
|
| 63 | ||
| 64 | self.description = "" |
|
| 65 | ||
| 66 | self.show_select_row = False |
|
| 67 | self.show_select_column = True |
|
| 68 | self.pagesize = 25 |
|
| 69 | ||
| 70 | self.columns = collections.OrderedDict(( |
|
| 71 | ("Title", { |
|
| 72 | "title": _("Container"), |
|
| 73 | "index": "sortable_title"}), |
|
| 74 | ("Description", { |
|
| 75 | "title": _("Description"), |
|
| 76 | "index": "description", |
|
| 77 | "toggle": True}), |
|
| 78 | ("ContainerType", { |
|
| 79 | "title": _("Container Type"), |
|
| 80 | "toggle": True}), |
|
| 81 | ("Capacity", { |
|
| 82 | "title": _("Capacity"), |
|
| 83 | "toggle": True}), |
|
| 84 | ("Pre-preserved", { |
|
| 85 | "title": _("Pre-preserved"), |
|
| 86 | "toggle": True}), |
|
| 87 | )) |
|
| 88 | ||
| 89 | self.review_states = [ |
|
| 90 | { |
|
| 91 | "id": "default", |
|
| 92 | "title": _("Active"), |
|
| 93 | "contentFilter": {"is_active": True}, |
|
| 94 | "transitions": [{"id": "deactivate"}, ], |
|
| 95 | "columns": self.columns.keys(), |
|
| 96 | }, { |
|
| 97 | "id": "inactive", |
|
| 98 | "title": _("Inactive"), |
|
| 99 | "contentFilter": {'is_active': False}, |
|
| 100 | "transitions": [{"id": "activate"}, ], |
|
| 101 | "columns": self.columns.keys(), |
|
| 102 | }, { |
|
| 103 | "id": "all", |
|
| 104 | "title": _("All"), |
|
| 105 | "contentFilter": {}, |
|
| 106 | "columns": self.columns.keys(), |
|
| 107 | }, |
|
| 108 | ] |
|
| 109 | ||
| @@ 39-95 (lines=57) @@ | ||
| 36 | """ |
|
| 37 | implements(IContacts) |
|
| 38 | ||
| 39 | def __init__(self, context, request): |
|
| 40 | super(ClientContactsView, self).__init__(context, request) |
|
| 41 | self.catalog = CONTACT_CATALOG |
|
| 42 | self.contentFilter = { |
|
| 43 | "portal_type": "Contact", |
|
| 44 | "sort_on": "sortable_title", |
|
| 45 | "path": { |
|
| 46 | "query": "/".join(context.getPhysicalPath()), |
|
| 47 | "level": 0 |
|
| 48 | } |
|
| 49 | } |
|
| 50 | self.context_actions = { |
|
| 51 | _("Add"): |
|
| 52 | {"url": "++add++Contact", |
|
| 53 | "permission": "Add portal content", |
|
| 54 | "icon": "++resource++bika.lims.images/add.png"}} |
|
| 55 | ||
| 56 | self.show_select_row = False |
|
| 57 | self.show_select_column = True |
|
| 58 | self.pagesize = 50 |
|
| 59 | self.form_id = "contacts" |
|
| 60 | ||
| 61 | self.icon = self.portal_url + \ |
|
| 62 | "/++resource++bika.lims.images/client_contact_big.png" |
|
| 63 | self.title = self.context.translate(_("Contacts")) |
|
| 64 | self.description = "" |
|
| 65 | ||
| 66 | self.columns = OrderedDict(( |
|
| 67 | ("getFullname", { |
|
| 68 | "title": _("Full Name"), |
|
| 69 | "index": "getFullname", |
|
| 70 | "sortable": True, }), |
|
| 71 | ("Username", { |
|
| 72 | "title": _("User Name"), }), |
|
| 73 | ("getEmailAddress", { |
|
| 74 | "title": _("Email Address"), }), |
|
| 75 | ("getBusinessPhone", { |
|
| 76 | "title": _("Business Phone"), }), |
|
| 77 | ("getMobilePhone", { |
|
| 78 | "title": _("MobilePhone"), }), |
|
| 79 | )) |
|
| 80 | ||
| 81 | self.review_states = [ |
|
| 82 | {"id": "default", |
|
| 83 | "title": _("Active"), |
|
| 84 | "contentFilter": {"is_active": True}, |
|
| 85 | "transitions": [{"id": "deactivate"}, ], |
|
| 86 | "columns": self.columns.keys()}, |
|
| 87 | {"id": "inactive", |
|
| 88 | "title": _("Inactive"), |
|
| 89 | "contentFilter": {"is_active": False}, |
|
| 90 | "transitions": [{"id": "activate"}, ], |
|
| 91 | "columns": self.columns.keys()}, |
|
| 92 | {"id": "all", |
|
| 93 | "title": _("All"), |
|
| 94 | "contentFilter": {}, |
|
| 95 | "columns": self.columns.keys()}, |
|
| 96 | ] |
|
| 97 | ||
| 98 | def folderitem(self, obj, item, index): |
|