""" These are the standard themes that come with Pyflag. """ import pyflag.conf config=pyflag.conf.ConfObject() import pyflag.FlagFramework as FlagFramework import pyflag.Registry as Registry import pyflag.Theme as Theme class BlueTheme(Theme.BasicTheme): """ This class encapsulates the theme elements. The results from this class really depend on the UI used - for example the HTMLUI will expect HTML to come back from here. """ hilight_bar = '''
%s %s
Forensics and Log Analysis GUI
''' def navbar(self,query=None,next=None,previous=None,pageno=None): """ Returns the HTML for the navigation bar. """ if query==None: query=FlagFramework.query_type(()) if not query.has_key('family'): query['family']='' if next: #Make a link q=query.clone() q.FillQueryTarget(next) next = '' % (str(q)) else: next = '' if previous<0: previous = '' else: q=query.clone() q.FillQueryTarget(previous) previous = '' % (str(q)) bar = {'family': Theme.propegate(query,FlagFramework.query_type()),'back': previous,'case': query['case'],'pageno': pageno,'next': next,'reset': str(query)+'&reset=1','stop': str(query)+'&stop=1'} toolbar = '''
%(back)s%(case)s - page %(pageno)s%(next)s
''' % bar return toolbar def render(self, query=FlagFramework.query_type(()), meta='',data='',next=None,previous=None,pageno=None,ui=None,title="FLAG - Forensic Log Analysis GUI. %s" % config.VERSION): if not ui.toolbar_ui: toolbar_str='  ' else: toolbar_str=ui.toolbar_ui.__str__() toolbar=self.navbar(query=query , next=next , previous=previous , pageno=pageno) return " ".join((self.header % title,self.banner,meta,''' \n''',self.hilight_bar % (toolbar_str,toolbar), data ,self.hilight_bar % (toolbar_str,toolbar),self.footer)) def menu(self,flag,query, result): """ Draws the menu for the current family. @arg flag: A Flag object containing the appropriate dispatcher @arg query: The user query """ family = query['family'] module_list = Registry.REPORTS.get_families() Theme.order_families(module_list) result=flag.ui() result.result='''
table corner
Main Menu
table corner
 

''' for k in module_list: link = flag.ui() link.link(k,family=k) result.result+='''  %s
\n''' % (link,) if family==k: report_list = Registry.REPORTS.family[family] for r in report_list: if r.hidden: continue link = flag.ui() link.link(r.name,target=Theme.propegate(query,FlagFramework.query_type()),tooltip=r.__doc__,report=r.name) result.result+="     · %s
\n" % link result.result+="
" result.result+='''

 
table corner
 
table corner
''' return result default=None