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
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
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)
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
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
def getEvaluationBotton_Tick(item, formatter): """Action Buttons for Overview in Web-Browser """ evaluations = item.getParent() evalObj = evaluations.__parent__ fromURLq = URLQuote(formatter.request['PATH_INFO']).quote() urlExt = '/@@change_eval_yes?nextURL=%s&req_id=%s' % \ (fromURLq, item.requirement.getObjectId()) resource_path = getAdapter(formatter.request, name='pics')() ttid = u"evtick" + evalObj.getObjectId() view_url = absoluteURL(formatter.context, formatter.request) \ + urlExt if not item.value == 'Pass': view_html = u'<a href="%s">' % (view_url) + \ u'<img id="%s" alt="Info" src="%s/Tick.png" /></a>' % \ (ttid, resource_path) tooltip_text = _(u"change evaluation to <b>yes</b>") else: view_html = u'<img id="%s" alt="Details" src="%s/Tick_gr.png" />' % \ (ttid, resource_path) tooltip_text = _(u"changing evaluation to <b>yes</b> is not permitted") tooltip = u"<script type=\"text/javascript\">tt_%s = new YAHOO." \ u"widget.Tooltip('tt_%s', { autodismissdelay:'15000', " \ u"context:'%s', text:'%s' });</script>" \ % (ttid, ttid, ttid, tooltip_text) return view_html + tooltip
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
def getRequirementBotton_Cross(item, formatter): """Action Buttons for Overview in Web-Browser """ fromURLq = URLQuote(formatter.request['PATH_INFO']).quote() urlExt = '/@@change_eval_no?nextURL=%s&req_id=%s' % \ (fromURLq, item.getObjectId()) resource_path = getAdapter(formatter.request, name='pics')() ttid = u"cross" + formatter.context.getObjectId() view_url = absoluteURL(formatter.context, formatter.request) \ + urlExt if True: view_html = u'<a href="%s">' % (view_url) + \ u'<img id="%s" alt="Info" src="%s/Cross.png" /></a>' % \ (ttid, resource_path) tooltip_text = _(u'check requirement to <b>no</b>') else: view_html = u'<img id="%s" alt="Details" src="%s/Cross_gr.png" />' % \ (ttid, resource_path) tooltip_text = _(u'checking requirement to <b>no</b> is not permitted') tooltip = u"<script type=\"text/javascript\">tt_%s = new YAHOO." \ u"widget.Tooltip('tt_%s', { autodismissdelay:'15000', " \ u"context:'%s', text:'%s' });</script>" \ % (ttid, ttid, ttid, tooltip_text) return view_html + tooltip
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''
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
def objs(self): """List of Content objects an object will be: {'title': u'title', 'vendor': u'quoted vendor title', 'product': u'quoted product title', """ snmpd_utility = getUtility(IAdmUtilSnmpd) retList = [] if self.request.has_key('ictvendor'): if self.request.has_key('ictproduct'): for name in snmpd_utility.mrtg_data[self.request['ictvendor']]\ [self.request['ictproduct']].keys(): retList.append({'title': unicode(name), 'view': 'add_snmpvalue.html', 'vendor': URLQuote(self.request['ictvendor']).quote(), 'product': URLQuote(self.request['ictproduct']).quote(), 'template': URLQuote(name).quote()}) else: for name in snmpd_utility.mrtg_data[self.request['ictvendor']].keys(): retList.append({'title': unicode(name), 'view': 'add_snmps_by_vendor.html', 'vendor': URLQuote(self.request['ictvendor']).quote(), 'product': URLQuote(name).quote()}) else: for name in snmpd_utility.mrtg_data.keys(): retList.append({'title': unicode(name), 'view': 'add_snmps_by_vendor.html', 'vendor': URLQuote(name).quote()}) return retList
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
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
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
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