| @@ 36-95 (lines=60) @@ | ||
| 33 | from zope.interface.declarations import implements |
|
| 34 | ||
| 35 | ||
| 36 | class SubGroupsView(BikaListingView): |
|
| 37 | ||
| 38 | def __init__(self, context, request): |
|
| 39 | super(SubGroupsView, self).__init__(context, request) |
|
| 40 | self.catalog = 'bika_setup_catalog' |
|
| 41 | self.contentFilter = {'portal_type': 'SubGroup', |
|
| 42 | 'sort_on': 'sortable_title'} |
|
| 43 | self.context_actions = { |
|
| 44 | _('Add'): { |
|
| 45 | 'url': 'createObject?type_name=SubGroup', |
|
| 46 | 'permission': AddSubGroup, |
|
| 47 | 'icon': '++resource++bika.lims.images/add.png' |
|
| 48 | } |
|
| 49 | } |
|
| 50 | self.icon = self.portal_url + \ |
|
| 51 | "/++resource++bika.lims.images/batch_big.png" |
|
| 52 | self.title = self.context.translate(_("Sub-groups")) |
|
| 53 | self.description = "" |
|
| 54 | ||
| 55 | self.show_select_row = False |
|
| 56 | self.show_select_column = True |
|
| 57 | self.pagesize = 25 |
|
| 58 | ||
| 59 | self.columns = { |
|
| 60 | 'Title': {'title': _('Sub-group'), |
|
| 61 | 'index': 'sortable_title'}, |
|
| 62 | 'Description': {'title': _('Description'), |
|
| 63 | 'index': 'description', |
|
| 64 | 'toggle': True}, |
|
| 65 | 'SortKey': {'title': _('Sort Key')}, |
|
| 66 | } |
|
| 67 | ||
| 68 | self.review_states = [ |
|
| 69 | {'id': 'default', |
|
| 70 | 'title': _('Active'), |
|
| 71 | 'contentFilter': {'is_active': True}, |
|
| 72 | 'transitions': [{'id': 'deactivate'}, ], |
|
| 73 | 'columns': ['Title', 'Description', 'SortKey']}, |
|
| 74 | {'id': 'inactive', |
|
| 75 | 'title': _('Inactive'), |
|
| 76 | 'contentFilter': {'is_active': False}, |
|
| 77 | 'transitions': [{'id': 'activate'}, ], |
|
| 78 | 'columns': ['Title', 'Description', 'SortKey']}, |
|
| 79 | {'id': 'all', |
|
| 80 | 'title': _('All'), |
|
| 81 | 'contentFilter': {}, |
|
| 82 | 'columns': ['Title', 'Description', 'SortKey']}, |
|
| 83 | ] |
|
| 84 | ||
| 85 | def before_render(self): |
|
| 86 | """Before template render hook |
|
| 87 | """ |
|
| 88 | # Don't allow any context actions |
|
| 89 | self.request.set("disable_border", 1) |
|
| 90 | ||
| 91 | def folderitem(self, obj, item, index): |
|
| 92 | obj = api.get_object(obj) |
|
| 93 | item["Description"] = obj.Description() |
|
| 94 | item["replace"]["Title"] = get_link(item["url"], item["Title"]) |
|
| 95 | return item |
|
| 96 | ||
| 97 | ||
| 98 | schema = ATFolderSchema.copy() |
|
| @@ 36-94 (lines=59) @@ | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | class InstrumentLocationsView(BikaListingView): |
|
| 37 | """Displays all available instrument locations in a table |
|
| 38 | """ |
|
| 39 | ||
| 40 | def __init__(self, context, request): |
|
| 41 | super(InstrumentLocationsView, self).__init__(context, request) |
|
| 42 | ||
| 43 | self.contentFilter = {'portal_type': 'InstrumentLocation', |
|
| 44 | 'sort_on': 'sortable_title'} |
|
| 45 | ||
| 46 | self.context_actions = {_('Add'): |
|
| 47 | {'url': 'createObject?type_name=InstrumentLocation', |
|
| 48 | 'permission': AddInstrumentLocation, |
|
| 49 | 'icon': '++resource++bika.lims.images/add.png'}} |
|
| 50 | ||
| 51 | self.title = self.context.translate(_("Instrument Locations")) |
|
| 52 | self.icon = "++resource++bika.lims.images/instrumenttype_big.png" |
|
| 53 | self.description = "" |
|
| 54 | ||
| 55 | self.show_select_row = False |
|
| 56 | self.show_select_column = True |
|
| 57 | self.pagesize = 25 |
|
| 58 | ||
| 59 | self.columns = { |
|
| 60 | 'Title': {'title': _('Title'), |
|
| 61 | 'index': 'sortable_title'}, |
|
| 62 | 'Description': {'title': _('Description'), |
|
| 63 | 'index': 'description', |
|
| 64 | 'toggle': True}, |
|
| 65 | } |
|
| 66 | ||
| 67 | self.review_states = [ |
|
| 68 | {'id': 'default', |
|
| 69 | 'title': _('Active'), |
|
| 70 | 'contentFilter': {'is_active': True}, |
|
| 71 | 'transitions': [{'id': 'deactivate'}, ], |
|
| 72 | 'columns': ['Title', 'Description']}, |
|
| 73 | {'id': 'inactive', |
|
| 74 | 'title': _('Inactive'), |
|
| 75 | 'contentFilter': {'is_active': False}, |
|
| 76 | 'transitions': [{'id': 'activate'}, ], |
|
| 77 | 'columns': ['Title', 'Description']}, |
|
| 78 | {'id': 'all', |
|
| 79 | 'title': _('All'), |
|
| 80 | 'contentFilter': {}, |
|
| 81 | 'columns': ['Title', 'Description']}, |
|
| 82 | ] |
|
| 83 | ||
| 84 | def before_render(self): |
|
| 85 | """Before template render hook |
|
| 86 | """ |
|
| 87 | # Don't allow any context actions |
|
| 88 | self.request.set("disable_border", 1) |
|
| 89 | ||
| 90 | def folderitem(self, obj, item, index): |
|
| 91 | obj = api.get_object(obj) |
|
| 92 | item["Description"] = obj.Description() |
|
| 93 | item["replace"]["title"] = get_link(item["url"], item["Title"]) |
|
| 94 | return item |
|
| 95 | ||
| 96 | ||
| 97 | schema = ATFolderSchema.copy() |
|
| @@ 34-91 (lines=58) @@ | ||
| 31 | from zope.interface.declarations import implements |
|
| 32 | ||
| 33 | ||
| 34 | class PreservationsView(BikaListingView): |
|
| 35 | ||
| 36 | def __init__(self, context, request): |
|
| 37 | super(PreservationsView, self).__init__(context, request) |
|
| 38 | self.catalog = 'bika_setup_catalog' |
|
| 39 | self.contentFilter = {'portal_type': 'Preservation', |
|
| 40 | 'sort_on': 'sortable_title'} |
|
| 41 | self.context_actions = {_('Add'): |
|
| 42 | {'url': 'createObject?type_name=Preservation', |
|
| 43 | 'permission': AddPreservation, |
|
| 44 | 'icon': '++resource++bika.lims.images/add.png'}} |
|
| 45 | self.title = self.context.translate(_("Preservations")) |
|
| 46 | self.icon = self.portal_url + "/++resource++bika.lims.images/preservation_big.png" |
|
| 47 | self.description = "" |
|
| 48 | ||
| 49 | self.show_select_row = False |
|
| 50 | self.show_select_column = True |
|
| 51 | self.pagesize = 25 |
|
| 52 | ||
| 53 | self.columns = { |
|
| 54 | 'Title': {'title': _('Preservation'), |
|
| 55 | 'index':'sortable_title'}, |
|
| 56 | 'Description': {'title': _('Description'), |
|
| 57 | 'index': 'description', |
|
| 58 | 'toggle': True}, |
|
| 59 | } |
|
| 60 | ||
| 61 | self.review_states = [ |
|
| 62 | {'id':'default', |
|
| 63 | 'title': _('Active'), |
|
| 64 | 'contentFilter': {'is_active': True}, |
|
| 65 | 'transitions': [{'id':'deactivate'}, ], |
|
| 66 | 'columns': ['Title', |
|
| 67 | 'Description']}, |
|
| 68 | {'id':'inactive', |
|
| 69 | 'title': _('Inactive'), |
|
| 70 | 'contentFilter': {'is_active': False}, |
|
| 71 | 'transitions': [{'id':'activate'}, ], |
|
| 72 | 'columns': ['Title', |
|
| 73 | 'Description']}, |
|
| 74 | {'id':'all', |
|
| 75 | 'title': _('All'), |
|
| 76 | 'contentFilter':{}, |
|
| 77 | 'columns': ['Title', |
|
| 78 | 'Description']}, |
|
| 79 | ] |
|
| 80 | ||
| 81 | def before_render(self): |
|
| 82 | """Before template render hook |
|
| 83 | """ |
|
| 84 | # Don't allow any context actions |
|
| 85 | self.request.set("disable_border", 1) |
|
| 86 | ||
| 87 | def folderitem(self, obj, item, index): |
|
| 88 | obj = api.get_object(obj) |
|
| 89 | item["Description"] = obj.Description() |
|
| 90 | item["replace"]["Title"] = get_link(item["url"], item["Title"]) |
|
| 91 | return item |
|
| 92 | ||
| 93 | ||
| 94 | schema = ATFolderSchema.copy() |
|
| @@ 34-91 (lines=58) @@ | ||
| 31 | from zope.interface.declarations import implements |
|
| 32 | ||
| 33 | ||
| 34 | class ContainerTypesView(BikaListingView): |
|
| 35 | ||
| 36 | def __init__(self, context, request): |
|
| 37 | super(ContainerTypesView, self).__init__(context, request) |
|
| 38 | self.catalog = 'bika_setup_catalog' |
|
| 39 | self.contentFilter = {'portal_type': 'ContainerType', |
|
| 40 | 'sort_on': 'sortable_title'} |
|
| 41 | self.context_actions = {_('Add'): |
|
| 42 | {'url': 'createObject?type_name=ContainerType', |
|
| 43 | 'permission': AddContainerType, |
|
| 44 | 'icon': '++resource++bika.lims.images/add.png'}} |
|
| 45 | self.title = self.context.translate(_("Container Types")) |
|
| 46 | self.icon = self.portal_url + "/++resource++bika.lims.images/container_big.png" |
|
| 47 | self.description = "" |
|
| 48 | ||
| 49 | self.show_select_row = False |
|
| 50 | self.show_select_column = True |
|
| 51 | self.pagesize = 25 |
|
| 52 | ||
| 53 | self.columns = { |
|
| 54 | 'Title': {'title': _('Container Type'), |
|
| 55 | 'index':'sortable_title'}, |
|
| 56 | 'Description': {'title': _('Description'), |
|
| 57 | 'index': 'description', |
|
| 58 | 'toggle': True}, |
|
| 59 | } |
|
| 60 | ||
| 61 | self.review_states = [ |
|
| 62 | {'id':'default', |
|
| 63 | 'title': _('Active'), |
|
| 64 | 'contentFilter': {'is_active': True}, |
|
| 65 | 'transitions': [{'id':'deactivate'}, ], |
|
| 66 | 'columns': ['Title', |
|
| 67 | 'Description']}, |
|
| 68 | {'id':'inactive', |
|
| 69 | 'title': _('Inactive'), |
|
| 70 | 'contentFilter': {'is_active': False}, |
|
| 71 | 'transitions': [{'id':'activate'}, ], |
|
| 72 | 'columns': ['Title', |
|
| 73 | 'Description']}, |
|
| 74 | {'id':'all', |
|
| 75 | 'title': _('All'), |
|
| 76 | 'contentFilter':{}, |
|
| 77 | 'columns': ['Title', |
|
| 78 | 'Description']}, |
|
| 79 | ] |
|
| 80 | ||
| 81 | def before_render(self): |
|
| 82 | """Before template render hook |
|
| 83 | """ |
|
| 84 | # Don't allow any context actions |
|
| 85 | self.request.set("disable_border", 1) |
|
| 86 | ||
| 87 | def folderitem(self, obj, item, index): |
|
| 88 | obj = api.get_object(obj) |
|
| 89 | item["Description"] = obj.Description() |
|
| 90 | item["replace"]["Title"] = get_link(item["url"], item["Title"]) |
|
| 91 | return item |
|
| 92 | ||
| 93 | ||
| 94 | schema = ATFolderSchema.copy() |
|
| @@ 34-88 (lines=55) @@ | ||
| 31 | from zope.interface.declarations import implements |
|
| 32 | ||
| 33 | ||
| 34 | class InstrumentTypesView(BikaListingView): |
|
| 35 | ||
| 36 | def __init__(self, context, request): |
|
| 37 | super(InstrumentTypesView, self).__init__(context, request) |
|
| 38 | self.catalog = 'bika_setup_catalog' |
|
| 39 | self.contentFilter = {'portal_type': 'InstrumentType', |
|
| 40 | 'sort_on': 'sortable_title'} |
|
| 41 | self.context_actions = {_('Add'): |
|
| 42 | {'url': 'createObject?type_name=InstrumentType', |
|
| 43 | 'permission': AddInstrumentType, |
|
| 44 | 'icon': '++resource++bika.lims.images/add.png'}} |
|
| 45 | self.title = self.context.translate(_("Instrument Types")) |
|
| 46 | self.icon = "++resource++bika.lims.images/instrumenttype_big.png" |
|
| 47 | self.description = "" |
|
| 48 | ||
| 49 | self.show_select_row = False |
|
| 50 | self.show_select_column = True |
|
| 51 | self.pagesize = 25 |
|
| 52 | ||
| 53 | self.columns = { |
|
| 54 | 'Title': {'title': _('Title'), |
|
| 55 | 'index': 'sortable_title'}, |
|
| 56 | 'Description': {'title': _('Description'), |
|
| 57 | 'index': 'description', |
|
| 58 | 'toggle': True}, |
|
| 59 | } |
|
| 60 | ||
| 61 | self.review_states = [ |
|
| 62 | {'id':'default', |
|
| 63 | 'title': _('Active'), |
|
| 64 | 'contentFilter': {'is_active': True}, |
|
| 65 | 'transitions': [{'id':'deactivate'}, ], |
|
| 66 | 'columns': ['Title', 'Description']}, |
|
| 67 | {'id':'inactive', |
|
| 68 | 'title': _('Inactive'), |
|
| 69 | 'contentFilter': {'is_active': False}, |
|
| 70 | 'transitions': [{'id':'activate'}, ], |
|
| 71 | 'columns': ['Title', 'Description']}, |
|
| 72 | {'id':'all', |
|
| 73 | 'title': _('All'), |
|
| 74 | 'contentFilter':{}, |
|
| 75 | 'columns': ['Title', 'Description']}, |
|
| 76 | ] |
|
| 77 | ||
| 78 | def before_render(self): |
|
| 79 | """Before template render hook |
|
| 80 | """ |
|
| 81 | # Don't allow any context actions |
|
| 82 | self.request.set("disable_border", 1) |
|
| 83 | ||
| 84 | def folderitem(self, obj, item, index): |
|
| 85 | obj = api.get_object(obj) |
|
| 86 | item["Description"] = obj.Description() |
|
| 87 | item["replace"]["Title"] = get_link(item["url"], item["Title"]) |
|
| 88 | return item |
|
| 89 | ||
| 90 | ||
| 91 | schema = ATFolderSchema.copy() |
|
| @@ 34-88 (lines=55) @@ | ||
| 31 | from zope.interface.declarations import implements |
|
| 32 | ||
| 33 | ||
| 34 | class ManufacturersView(BikaListingView): |
|
| 35 | ||
| 36 | def __init__(self, context, request): |
|
| 37 | super(ManufacturersView, self).__init__(context, request) |
|
| 38 | self.catalog = 'bika_setup_catalog' |
|
| 39 | self.contentFilter = {'portal_type': 'Manufacturer', |
|
| 40 | 'sort_on': 'sortable_title'} |
|
| 41 | self.context_actions = {_('Add'): |
|
| 42 | {'url': 'createObject?type_name=Manufacturer', |
|
| 43 | 'permission': AddManufacturer, |
|
| 44 | 'icon': '++resource++bika.lims.images/add.png'}} |
|
| 45 | self.title = self.context.translate(_("Manufacturers")) |
|
| 46 | self.icon = "++resource++bika.lims.images/manufacturer_big.png" |
|
| 47 | self.description = "" |
|
| 48 | ||
| 49 | self.show_select_row = False |
|
| 50 | self.show_select_column = True |
|
| 51 | self.pagesize = 25 |
|
| 52 | ||
| 53 | self.columns = { |
|
| 54 | 'Title': {'title': _('Title'), |
|
| 55 | 'index': 'sortable_title'}, |
|
| 56 | 'Description': {'title': _('Description'), |
|
| 57 | 'index': 'description', |
|
| 58 | 'toggle': True}, |
|
| 59 | } |
|
| 60 | ||
| 61 | self.review_states = [ |
|
| 62 | {'id':'default', |
|
| 63 | 'title': _('Active'), |
|
| 64 | 'contentFilter': {'is_active': True}, |
|
| 65 | 'transitions': [{'id':'deactivate'}, ], |
|
| 66 | 'columns': ['Title', 'Description']}, |
|
| 67 | {'id':'inactive', |
|
| 68 | 'title': _('Inactive'), |
|
| 69 | 'contentFilter': {'is_active': False}, |
|
| 70 | 'transitions': [{'id':'activate'}, ], |
|
| 71 | 'columns': ['Title', 'Description']}, |
|
| 72 | {'id':'all', |
|
| 73 | 'title': _('All'), |
|
| 74 | 'contentFilter':{}, |
|
| 75 | 'columns': ['Title', 'Description']}, |
|
| 76 | ] |
|
| 77 | ||
| 78 | def before_render(self): |
|
| 79 | """Before template render hook |
|
| 80 | """ |
|
| 81 | # Don't allow any context actions |
|
| 82 | self.request.set("disable_border", 1) |
|
| 83 | ||
| 84 | def folderitem(self, obj, item, index): |
|
| 85 | obj = api.get_object(obj) |
|
| 86 | item["Description"] = obj.Description() |
|
| 87 | item["replace"]["Title"] = get_link(item["url"], item["Title"]) |
|
| 88 | return item |
|
| 89 | ||
| 90 | ||
| 91 | schema = ATFolderSchema.copy() |
|