Example #1
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     try:
         objId = getUtility(IIntIds).getId(self.context)
     except:
         objId = 1000
     retList = []
     if appsetup.getConfigContext().hasFeature('devmode') and \
        checkPermission('org.ict_ok.components.host.Edit', self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%sshutdownHost" % objId
         tmpDict['title'] = _(u"shutdown host")
         tmpDict['href'] = u"%s/@@shutdownHost.html?nextURL=%s" % \
                (zapi.getPath( self.context),
                 quoter.quote())
         retList.append(tmpDict)
         tmpDict = {}
         tmpDict['oid'] = u"c%senterMaintenanceMode" % objId
         tmpDict['title'] = _(u"enter maintenance mode")
         tmpDict['href'] = u"%s/@@enterMaintenanceMode.html?nextURL=%s" % \
                (zapi.getPath( self.context),
                 quoter.quote())
         retList.append(tmpDict)
     return SuperHostDetails.actions(self) + retList
Example #2
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     try:
         objId = getUtility(IIntIds).getId(self.context)
     except:
         objId = 1000
     retList = []
     if appsetup.getConfigContext().hasFeature('devmode') and \
        checkPermission('org.ict_ok.components.host.Edit', self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%strigger_online" % objId
         tmpDict['title'] = _(u"Trigger online")
         tmpDict['href'] = u"%s/@@trigger_online?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         retList.append(tmpDict)
         tmpDict = {}
         tmpDict['oid'] = u"c%strigger_offline" % objId
         tmpDict['title'] = _(u"Trigger offline")
         tmpDict['href'] = u"%s/@@trigger_offline?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         retList.append(tmpDict)
         tmpDict = {}
         tmpDict['oid'] = u"c%strigger_not1" % objId
         tmpDict['title'] = _(u"Trigger notification1")
         tmpDict['href'] = u"%s/@@trigger_not1?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         retList.append(tmpDict)
     return retList
Example #3
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     try:
         objId = getUtility(IIntIds).getId(self.context)
     except KeyError:
         objId = 1000
     retList = []
     adapSize = ISized(self.context)
     if checkPermission('org.ict_ok.admin_utils.supervisor.ReindexDB',
                        self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%sreindex_db" % objId
         tmpDict['title'] = _(u"reindex database")
         tmpDict['href'] = u"%s/@@reindex_db?nextURL=%s" % \
                (zapi.getPath( self.context),
                 quoter.quote())
         tmpDict['tooltip'] = _(u"will reindex the catalogs of all "\
                                u"tables in database")
         retList.append(tmpDict)
     if checkPermission('org.ict_ok.admin_utils.supervisor.PackDB',
                        self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%spack_db" % objId
         tmpDict['title'] = _(u"pack database")
         tmpDict['href'] = u"%s/@@pack_db?nextURL=%s" % \
                (zapi.getPath( self.context),
                 quoter.quote())
         tmpDict['tooltip'] = _(u"will pack the database and delete "\
                                u"all backups")
         retList.append(tmpDict)
     return retList
Example #4
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     try:
         objId = getUtility(IIntIds).getId(self.context)
     except:
         objId = 1000
     retList = []
     if appsetup.getConfigContext().hasFeature('devmode') and \
        checkPermission('org.ict_ok.components.host.Edit', self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%spoweroff" % objId
         tmpDict['title'] = _(u"Power off")
         tmpDict['href'] = u"%s/@@poweroff.html?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         retList.append(tmpDict)
         tmpDict = {}
         tmpDict['oid'] = u"c%spoweron" % objId
         tmpDict['title'] = _(u"Power on")
         tmpDict['href'] = u"%s/@@poweron.html?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         retList.append(tmpDict)
     return SuperHostDetails.actions(self) + retList
Example #5
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     try:
         objId = self.context.objectID
     except KeyError:
         objId = 1000
     retList = []
     adapSize = ISized(self.context)
     if checkPermission('org.ict_ok.admin_utils.supervisor.ReindexDB',
                        self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%sreindex_db" % objId
         tmpDict['title'] = _(u"reindex database")
         tmpDict['href'] = u"%s/@@reindex_db?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         tmpDict['tooltip'] = _(u"will reindex the catalogs of all "\
                                u"tables in database")
         retList.append(tmpDict)
     if checkPermission('org.ict_ok.admin_utils.supervisor.RemoveIndices',
                        self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%sremove_indices" % objId
         tmpDict['title'] = _(u"Remove indices")
         tmpDict['href'] = u"%s/@@remove_indices?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         tmpDict['tooltip'] = _(u"will remove all indices of all "\
                                u"tables in database")
         retList.append(tmpDict)
     if checkPermission('org.ict_ok.admin_utils.supervisor.CreateIndices',
                        self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%screate_indices" % objId
         tmpDict['title'] = _(u"Create indices")
         tmpDict['href'] = u"%s/@@create_indices?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         tmpDict['tooltip'] = _(u"will create all indices in database")
         retList.append(tmpDict)
     if not self.isInIctSite() and \
         checkPermission('org.ict_ok.admin_utils.supervisor.PackDB',
                         self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%spack_db" % objId
         tmpDict['title'] = _(u"pack database")
         tmpDict['href'] = u"%s/@@pack_db?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         tmpDict['tooltip'] = _(u"will pack the database and delete "\
                                u"all backups")
         retList.append(tmpDict)
     return retList
Example #6
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     retList = []
     if checkPermission('org.ict_ok.admin_utils.notifier.Edit',
                        self.context):
         quoter = URLQuote(self.request.getURL())
         if self.context.enableConnector:
             tmpDict = {}
             #tmpDict['oid'] = u"c%s" % objId
             tmpDict['oid'] = u"c000stop_connector"
             tmpDict['title'] = _(u"stop jabber-connector")
             tmpDict['href'] = u"%s/@@stop_connector?nextURL=%s" % \
                    (zapi.getPath(self.context),
                     quoter.quote())
             tmpDict['tooltip'] = _(u"stops the jabber-connector (as user:%s)"\
                                    % self.request.principal.title)
             retList.append(tmpDict)
             tmpDict = {}
             tmpDict['oid'] = u"c000get_isup"
             tmpDict['title'] = _(u"is jabber-connector up")
             tmpDict['href'] = u"%s/@@get_isup?nextURL=%s" % \
                    (zapi.getPath(self.context),
                     quoter.quote())
             tmpDict['tooltip'] = _(
                 u"ask the jabber-connector for watchdog")
             retList.append(tmpDict)
             tmpDict = {}
             tmpDict['oid'] = u"c000send_test"
             tmpDict['title'] = _(u"send test message")
             tmpDict['href'] = u"%s/@@send_test?nextURL=%s" % \
                    (zapi.getPath(self.context),
                     quoter.quote())
             tmpDict['tooltip'] = _(u"send test message to im-server")
             retList.append(tmpDict)
         else:
             tmpDict = {}
             #tmpDict['oid'] = u"c%s" % objId
             tmpDict['oid'] = u"c000start_connector"
             tmpDict['title'] = _(u"start jabber-connector")
             tmpDict['href'] = u"%s/@@start_connector?nextURL=%s" % \
                    (zapi.getPath(self.context),
                     quoter.quote())
             tmpDict['tooltip'] = _(u"starts the jabber-connector (as user:%s)"\
                                    % self.request.principal.title)
             retList.append(tmpDict)
     #tmpDict = {}
     #tmpDict['oid'] = u"a12345"
     #tmpDict['title'] = u"ich bin ein Titel"
     #tmpDict['href'] = u"http://www.essen.de"
     #tmpDict['tooltip'] = u"ich bin der \"aa\" 'bb' dazugehörige Tooltip Essen"
     #retList.append(tmpDict)
     return retList
Example #7
0
 def fsearchLink(self, text, arg_key=None):
     if arg_key:
         key = arg_key
     else:
         key = u'%s' % (text)
     quoter = URLQuote(key)
     return u'<a href="/@@fsearch?key=%s">%s</a>' % (quoter.quote(), text)
Example #8
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     try:
         objId = getUtility(IIntIds).getId(self.context)
     except:
         objId = 1000
     retList = []
     if appsetup.getConfigContext().hasFeature('devmode') and \
        checkPermission('org.ict_ok.components.host.Edit', self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%strigger_online" % objId
         tmpDict['title'] = _(u"Trigger online")
         tmpDict['href'] = u"%s/@@trigger_online?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         retList.append(tmpDict)
         tmpDict = {}
         tmpDict['oid'] = u"c%strigger_offline" % objId
         tmpDict['title'] = _(u"Trigger offline")
         tmpDict['href'] = u"%s/@@trigger_offline?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         retList.append(tmpDict)
         tmpDict = {}
         tmpDict['oid'] = u"c%strigger_not1" % objId
         tmpDict['title'] = _(u"Trigger notification1")
         tmpDict['href'] = u"%s/@@trigger_not1?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         retList.append(tmpDict)
     adapSize = ISized(self.context)
     if checkPermission('org.ict_ok.components.interface.Add', self.context) and \
        (adapSize.sizeForSorting()[1] < 1):
         tmpDict = {}
         tmpDict['oid'] = u"c%sstart_snmp_if_scanner" % objId
         tmpDict['title'] = _(u"start snmp interface scanner")
         tmpDict['href'] = u"%s/@@start_snmp_if_scanner.html" % \
                zapi.absoluteURL(self.context, self.request)
         tmpDict['tooltip'] = _(u"starts the interface scanner with snmp scan (as user:%s)"\
                                % self.request.principal.title)
         retList.append(tmpDict)
     return retList
Example #9
0
def fsearch_user_formatter(value, item, formatter):
    if hasattr(item, 'user'):
        username = vocabValue('AllLdapUser', item.user, formatter.request)
    else:
        return u''
    if username:
        quoter = URLQuote(item.user)
        return u'<a href="/@@fsearch?key=%s">%s</a>' % (quoter.quote(), username)
    else:
        return u''
Example #10
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     try:
         objId = getUtility(IIntIds).getId(self.context)
     except KeyError:
         objId = 1000
     retList = []
     if checkPermission('org.ict_ok.admin_utils.event.Send', self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%ssend_event" % objId
         tmpDict['title'] = _(u"send it")
         tmpDict['href'] = u"%s/@@send_event.html?nextURL=%s" % \
                (zapi.getPath( self.context),
                 quoter.quote())
         tmpDict['tooltip'] = _(
             u"sends an the event to the list of receivers")
         retList.append(tmpDict)
     return retList
Example #11
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     try:
         objId = getUtility(IIntIds).getId(self.context)
     except KeyError:
         objId = 1000
     retList = []
     if checkPermission('org.ict_ok.admin_utils.notifier.Send',
                        self.context):
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%snotifier_send" % objId
         tmpDict['title'] = _(u"send test")
         tmpDict['href'] = u"%s/@@send_test?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         tmpDict['tooltip'] = _(u"will send a test message "\
                                u"by the selected notifier")
         retList.append(tmpDict)
     return retList
Example #12
0
 def actions(self):
     """
     gives us the action dict of the object
     """
     try:
         objId = getUtility(IIntIds).getId(self.context)
     except KeyError:
         objId = 1000
     retList = []
     if True:
     #if checkPermission('org.ict_ok.admin_utils.generators.nagios.View',
                        #self.context) and\
        #zapi.queryMultiAdapter((self.context, self.request),
                               #name='shutdown.html') is not None:
         quoter = URLQuote(self.request.getURL())
         tmpDict = {}
         tmpDict['oid'] = u"c%sgenerate" % objId
         tmpDict['title'] = _(u"generate")
         tmpDict['href'] = u"%s/@@generate.html?nextURL=%s" % \
                (zapi.absoluteURL(self.context, self.request),
                 quoter.quote())
         tmpDict['tooltip'] = _(u"generate nagios cfg")
         retList.append(tmpDict)
     return retList
 def  test_quote_cast_needed(self):
     q = URLQuote(TestObject())
     self.assertEqual(u'www.google.de', q.quote())
     self.assertEqual(u'www.google.de', q.unquote())
     self.assertEqual(u'www.google.de', q.quote_plus())
     self.assertEqual(u'www.google.de', q.unquote_plus())
 def test_quote_simple(self):
     q = URLQuote(u"www.google.de")
     self.assertEqual(u'www.google.de', q.quote())
     self.assertEqual(u'www.google.de', q.unquote())
     self.assertEqual(u'www.google.de', q.quote_plus())
     self.assertEqual(u'www.google.de', q.unquote_plus())