Ejemplo n.º 1
0
 def manage_editProductClass(self,
                             name="",
                             productKeys=(),
                             isOS=False,
                             partNumber="",
                             description="",
                             REQUEST=None):
     """
     Edit a ProductClass from a web page.
     """
     redirect = self.rename(name)
     productKeys = [l.strip() for l in productKeys.split('\n')]
     if productKeys != self.productKeys:
         self.unindex_object()
         self.productKeys = productKeys
     self.partNumber = partNumber
     self.description = description
     self.isOS = isOS
     self.name = name
     self.index_object()
     if REQUEST:
         from Products.ZenUtils.Time import SaveMessage
         messaging.IMessageSender(self).sendToBrowser(
             'Product Class Saved', SaveMessage())
         return self.callZenScreen(REQUEST, redirect)
Ejemplo n.º 2
0
 def manage_editManufacturer(self,
                             id='',
                             title='',
                             url='',
                             supportNumber='',
                             address1='',
                             address2='',
                             city='',
                             state='',
                             zip='',
                             country='',
                             regexes=[],
                             REQUEST=None):
     """
     Edit a Manufacturer from a web page.
     """
     redirect = self.rename(id)
     self.title = title
     self.url = url
     self.supportNumber = supportNumber
     self.address1 = address1
     self.address2 = address2
     self.city = city
     self.state = state
     self.zip = zip
     self.country = country
     self.regexes = regexes
     if REQUEST:
         from Products.ZenUtils.Time import SaveMessage
         messaging.IMessageSender(self).sendToBrowser(
             'Saved', SaveMessage())
         return self.callZenScreen(REQUEST, redirect)
 def manage_editOSProcessClass(self,
                               name="",
                               zMonitor=True, 
                               zAlertOnRestart=False,
                               zFailSeverity=3,
                               regex="",
                               description="",
                               ignoreParametersWhenModeling=False,
                               ignoreParameters=False,
                               REQUEST=None):
                              
     """
     Edit a ProductClass from a web page.
     """
     from Products.ZenUtils.Utils import unused
     unused(zAlertOnRestart, zFailSeverity, zMonitor)
     # Left in name, added title for consistency
     self.title = name
     self.name = name
     id = self.prepId(name)
     redirect = self.rename(id)
     self.regex = regex        
     self.description = description
     self.ignoreParametersWhenModeling = ignoreParametersWhenModeling
     self.ignoreParameters = ignoreParameters
     if REQUEST:
         from Products.ZenUtils.Time import SaveMessage
         messaging.IMessageSender(self).sendToBrowser(
             'Product Class Saved',
             SaveMessage()
         )
         return self.callZenScreen(REQUEST, redirect)
Ejemplo n.º 4
0
    def zmanage_editProperties(self, REQUEST=None, redirect=False, audit=True):
        """
        Edit a ZenModel object and return its proper page template.
        Object will be reindexed if nessesary.

        @permission: ZEN_MANAGE_DMD
        """
        self.manage_changeProperties(**REQUEST.form)
        index_object = getattr(self, 'index_object', lambda self: None)
        index_object()
        if REQUEST:
            from Products.ZenUtils.Time import SaveMessage
            messaging.IMessageSender(self).sendToBrowser(
                'Properties Saved',
                SaveMessage()
            )

            if audit:
                auditType = getDisplayType(self)
                auditKind = 'Setting' if auditType == 'DataRoot' else auditType
                auditFn(['UI', auditKind, 'Edit'],
                        data_=REQUEST.form,
                        skipFields_=('redirect',
                                'zenScreenName',
                                'zmanage_editProperties'),
                        maskFields_=('smtpPass'))
            return self.callZenScreen(REQUEST, redirect=redirect)
Ejemplo n.º 5
0
 def manage_editServiceClass(self,
                             name="",
                             monitor=False,
                             serviceKeys="",
                             port=0,
                             description="",
                             REQUEST=None):
     """
     Edit a ProductClass from a web page.
     """
     self.name = name
     id = self.prepId(name)
     if self.zMonitor != monitor:
         self.setZenProperty("zMonitor", monitor)
         self._indexInstances()
     redirect = self.rename(id)
     serviceKeys = [l.strip() for l in serviceKeys.split('\n')]
     if serviceKeys != self.serviceKeys:
         self.unindex_object()
         self.serviceKeys = serviceKeys
         self.index_object()
     self.port = port
     self.description = description
     if REQUEST:
         from Products.ZenUtils.Time import SaveMessage
         messaging.IMessageSender(self).sendToBrowser(
             'Service Class Saved', SaveMessage())
         return self.callZenScreen(REQUEST, redirect)
Ejemplo n.º 6
0
    def manage_editMSMQQueue(self, messagesInQueueThreshold=None, monitor=None,
        REQUEST=None):
        """
        Edit this MSMQQueue from the web.
        """
        if messagesInQueueThreshold is not None:
            self.messagesInQueueThreshold = messagesInQueueThreshold

        if monitor is not None:
            self.monitor = monitor

        self.index_object()

        if REQUEST:
            IMessageSender(self).sendToBrowser('Saved', SaveMessage())
            return self.callZenScreen(REQUEST)
Ejemplo n.º 7
0
    def manage_editEventClassInst(self,
                                  name='',
                                  eventClassKey='',
                                  regex='',
                                  rule='',
                                  example='',
                                  transform='',
                                  explanation='',
                                  resolution='',
                                  REQUEST=None):
        """Edit an EventClassInst from a web page."""

        #save arguments for audit logging
        values = locals()

        oldValues = {
            'name': getDisplayName(self),
            'eventClassKey': self.eventClassKey,
            'regex': self.regex,
            'rule': self.rule,
            'example': self.example,
            'transform': self.transform,
            'explanation': self.explanation,
            'resolution': self.resolution,
        }

        redirect = self.rename(name)
        if eventClassKey and self.eventClassKey != eventClassKey:
            self.unindex_object()
            self.sequence = self.eventClass().nextSequenceNumber(eventClassKey)
            self.eventClassKey = eventClassKey
            self.index_object()
        self.regex = regex
        self.rule = rule
        self.example = example
        self.transform = transform
        self.explanation = explanation
        self.resolution = resolution
        if REQUEST:
            audit('UI.EventClassMapping.Edit',
                  self,
                  data_=values,
                  oldData_=oldValues,
                  skipFields_=['self', 'REQUEST'])
            messaging.IMessageSender(self).sendToBrowser(
                'Saved', SaveMessage())
            return self.callZenScreen(REQUEST, redirect)
 def edit_portlet_perms(self, REQUEST=None):
     """
     Update the portlet permissions
     """
     for portlet in REQUEST.form:
         if not portlet.endswith('_permission'): continue
         portname = portlet.split('_')[0]
         p = self.find(id=portname)
         p.permission = REQUEST.form[portlet]
     if REQUEST:
         from Products.ZenUtils.Time import SaveMessage
         messaging.IMessageSender(self).sendToBrowser(
             'Permissions Saved',
             SaveMessage()
         )
         REQUEST['RESPONSE'].redirect('/zport/dmd/editPortletPerms')
     audit('UI.Portlet.Edit', data_=REQUEST.form)