예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
    def __call__(self):
        if getSecurityManager().checkPermission(AddPortalContent,
                                                self.context):
            self.show_select_row = True
            self.show_select_column = True

        return BikaListingView.__call__(self)
예제 #4
0
    def __call__(self):
        if getSecurityManager().checkPermission(AddPortalContent, self.context):
            self.show_select_row = True
            self.show_select_column = True
            self.context_actions = {_('Add'):
                                    {'url': 'createObject?type_name=Sample',
                                     'icon': '++resource++bika.lims.images/add.png'}}

        return BikaListingView.__call__(self)
예제 #5
0
    def __call__(self):
        self.catalog = 'bika_setup_catalog'
        self.contentFilter = {
            'portal_type': 'ManagedStorage',
            'review_state': 'occupied'
        }
        self.context_actions = {}
        self.title = self.context.Title()
        self.description = ""
        self.icon = self.portal_url + \
                    '/++resource++baobab.lims.images/storageunit_big.png'
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 25
        self.columns = {
            'Title': {
                'title': _('Title'),
                'index': 'sortable_title'
            },
            'Description': {
                'title': _('Description'),
                'toggle': False
            },
            'Type': {
                'title': _('Type')
            },
            'Temperature': {
                'title': _('Temperature'),
                'toggle': True
            },
            'Department': {
                'title': _('Department'),
                'toggle': True
            },
        }
        self.review_states = [{
            'id':
            'default',
            'title':
            _('All'),
            'contentFilter': {
                'inactive_state': 'active'
            },
            'transitions': [{
                'id': 'deactivate'
            }, {
                'id': 'liberate'
            }],
            'columns':
            ['Title', 'Type', 'Description', 'Temperature', 'Department']
        }]

        return BikaListingView.__call__(self)
예제 #6
0
 def __call__(self):
     mtool = getToolByName(self.context, 'portal_membership')
     addPortalMessage = self.context.plone_utils.addPortalMessage
     w_tool = getToolByName(self.context, 'portal_workflow')
     active_contacts = [
         c for c in self.context.objectValues('Contact')
         if w_tool.getInfoFor(c, 'inactive_state', '') == 'active'
     ]
     if isActive(self.context):
         if self.context.portal_type == "Client":
             if not active_contacts:
                 msg = _(
                     "Client contact required before request may be submitted"
                 )
                 addPortalMessage(msg)
             else:
                 if mtool.checkPermission(AddProject, self.context):
                     self.context_actions[_('Add')] = {
                         'url': 'createObject?type_name=Project',
                         'icon': '++resource++bika.lims.images/add.png'
                     }
     if mtool.checkPermission(ManageProjects, self.context):
         self.review_states[0]['transitions'].append({'id': 'deactivate'})
         self.review_states.append({
             'id':
             'inactive',
             'title':
             _('Dormant'),
             'contentFilter': {
                 'inactive_state': 'inactive'
             },
             'transitions': [
                 {
                     'id': 'activate'
                 },
             ],
             'columns': ['Title', 'getClient', 'getStudyType']
         })
         self.review_states.append({
             'id':
             'all',
             'title':
             _('All'),
             'contentFilter': {},
             'transitions': [{
                 'id': 'empty'
             }],
             'columns': ['Title', 'getClient', 'getStudyType']
         })
         stat = self.request.get("%s_review_state" % self.form_id,
                                 'default')
         self.show_select_column = stat != 'all'
     return BikaListingView.__call__(self)
예제 #7
0
    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.getId() 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.getId()})
            self.context.plone_utils.addPortalMessage(
                self.context.translate(message), 'info')

        # Printing workflow enabled?
        # If not, remove the Column
        self.printwfenabled = self.context.bika_setup.getPrintingWorkflowEnabled(
        )
        printed_colname = 'DatePrinted'
        if not self.printwfenabled and printed_colname in self.columns:
            # Remove "Printed" columns
            del self.columns[printed_colname]
            tmprvs = []
            for rs in self.review_states:
                tmprs = rs
                tmprs['columns'] = [
                    c for c in rs.get('columns', []) if c != printed_colname
                ]
                tmprvs.append(tmprs)
            self.review_states = tmprvs

        template = BikaListingView.__call__(self)
        return template
예제 #8
0
    def __call__(self):
        # Printing workflow enabled?
        # If not, remove the Column
        self.printwfenabled = self.context.bika_setup.getPrintingWorkflowEnabled()
        printed_colname = 'DatePrinted'
        if not self.printwfenabled and printed_colname in self.columns:
            # Remove "Printed" columns
            del self.columns[printed_colname]
            tmprvs = []
            for rs in self.review_states:
                tmprs = rs
                tmprs['columns'] = [c for c in rs.get('columns', []) if
                                    c != printed_colname]
                tmprvs.append(tmprs)
            self.review_states = tmprvs

        template = BikaListingView.__call__(self)
        return template
예제 #9
0
    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.getId() 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.getId()})
            self.context.plone_utils.addPortalMessage(
                self.context.translate(message), 'info')

        # Printing workflow enabled?
        # If not, remove the Column
        self.printwfenabled = self.context.bika_setup.getPrintingWorkflowEnabled()
        printed_colname = 'DatePrinted'
        if not self.printwfenabled and printed_colname in self.columns:
            # Remove "Printed" columns
            del self.columns[printed_colname]
            tmprvs = []
            for rs in self.review_states:
                tmprs = rs
                tmprs['columns'] = [c for c in rs.get('columns', []) if
                                    c != printed_colname]
                tmprvs.append(tmprs)
            self.review_states = tmprvs

        template = BikaListingView.__call__(self)
        return template
예제 #10
0
 def __call__(self):
     if getSecurityManager().checkPermission(AddProject, self.context):
         self.show_select_row = True
         self.show_select_column = True
     return BikaListingView.__call__(self)
예제 #11
0
 def __call__(self):
     # self.catalog = 'bika_setup_catalog'
     path = '/'.join(self.context.getPhysicalPath())
     self.contentFilter = {
         'path': {
             'query': path,
             'depth': 1,
             'level': 0
         },
         'sort_on': 'sortable_title'
     }
     self.context_actions = {}
     self.title = self.context.Title()
     self.description = ""
     self.icon = self.portal_url + \
                 '/++resource++baobab.lims.images/storageunit_big.png'
     self.show_sort_column = False
     self.show_select_row = False
     self.show_select_column = True
     self.pagesize = 25
     self.columns = {
         'Title': {
             'title': _('Title'),
             'index': 'sortable_title'
         },
         'Description': {
             'title': _('Description'),
             'toggle': False
         },
         'Type': {
             'title': _('Type')
         },
         'Temperature': {
             'title': _('Temperature'),
             'toggle': True
         },
         'Department': {
             'title': _('Department'),
             'toggle': True
         },
     }
     self.review_states = [{
         'id':
         'default',
         'title':
         _('All'),
         'contentFilter': {},
         'columns':
         ['Title', 'Type', 'Description', 'Temperature', 'Department']
     }, {
         'id':
         'units',
         'title':
         _('Storage Units'),
         'contentFilter': {
             'inactive_state': 'active',
             'portal_type': 'StorageUnit'
         },
         'transitions': [{
             'id': 'deactivate'
         }],
         'columns':
         ['Title', 'Type', 'Description', 'Temperature', 'Department']
     }, {
         'id':
         'managed',
         'title':
         _('Managed Storages'),
         'contentFilter': {
             'inactive_state': 'active',
             'portal_type': 'ManagedStorage'
         },
         'transitions': [{
             'id': 'deactivate'
         }, {
             'id': 'occupy'
         }],
         'columns':
         ['Title', 'Type', 'Description', 'Temperature', 'Department']
     }, {
         'id':
         'unmanaged',
         'title':
         _('Unmanaged Storages'),
         'contentFilter': {
             'inactive_state': 'active',
             'review_state': 'available',
             'portal_type': 'UnmanagedStorage'
         },
         'transitions': [{
             'id': 'deactivate'
         }, {
             'id': 'occupy'
         }],
         'columns':
         ['Title', 'Type', 'Description', 'Temperature', 'Department']
     }, {
         'id':
         'occupied',
         'title':
         _('Occupied'),
         'contentFilter': {
             'inactive_state': 'active',
             'portal_type': 'UnmanagedStorage',
             'review_state': 'occupied'
         },
         'transitions': [{
             'id': 'deactivate'
         }, {
             'id': 'liberate'
         }],
         'columns':
         ['Title', 'Type', 'Description', 'Temperature', 'Department']
     }, {
         'id':
         'occupied_boxes',
         'title':
         _('Occupied Boxes'),
         'contentFilter': {
             'inactive_state': 'active',
             'portal_type': 'ManagedStorage',
             'review_state': 'occupied'
         },
         'transitions': [{
             'id': 'deactivate'
         }, {
             'id': 'liberate'
         }],
         'columns':
         ['Title', 'Type', 'Description', 'Temperature', 'Department']
     }]
     return BikaListingView.__call__(self)