# Path: Catalog.py
# class Catalog(IMainModule):
#     CATALOG_NONE = 0
#     CATALOG_DEVINFO = 1
#     CATALOG_SETTINGS = 2
#     CATALOG_APPS = 3
#     CATALOG_NETWORKING = 4
#     CATALOG_LOGS = 5
#     CATALOG_TIMELINE = 6
#     CATALOG_COMMS = 7
#     
#     name = "Catalogs"
#     internal_name = "catalog"
#     
#     catalogs_info = {
#         CATALOG_NONE : { "name":"Uncategorised", "display":False },
#         CATALOG_DEVINFO : {"name": "Device Info", "display": True, 
#                         "url": "/devinfo", "icon": "fa-info" },
#         CATALOG_SETTINGS : { "name": "Device Settings", "display": False, 
#                             "url": "/devsettings", "icon": "fa-gear" },
#         CATALOG_APPS : { "name": "Apps", "display": True, "url": "/apps", 
#                         "icon": "fa-archive" },
#         CATALOG_NETWORKING : { "name": "Networking", "display": True, 
#                               "url": "/devnet", "icon": "fa-globe" },
#         CATALOG_LOGS : { "name": "Device Logs", "display": True, 
#                         "url": "/logs", "icon": "fa-file" },
#         CATALOG_TIMELINE : { "name": "Timeline", "display": False, 
#                             "url": "/timeline", "icon": "fa-clock-o" },
#         CATALOG_COMMS : { "name": "Communications", "display":True, 
#                          "url": "/comms", "icon":"fa-comments-o" }
#     }
#     
#     def __init__(self, lookup, case, settings):
#         '@type lookup: mako.lookup.TemplateLookup'
#         self.lookup = lookup
#         self.case = case
#         self.settings = settings
#         return
#     
#     
#     def set_templatelookup(self, lookup):
#         '@type lookup: mako.lookup.TemplateLookup'
#         self.lookup = lookup
#         
#     def get_menuentry_list(self, store, case_id):
#         menu = []
#         for cat_id, catalog in self.catalogs_info.iteritems():
#             if catalog['display'] == False: continue
#             store_catalog = store.get_misccatalog(cat_id)
#             if len(store_catalog.sections) != 0:
#                 entry = MenuEntry(catalog['name'], "#", catalog['icon'] )
#                 for section in store_catalog.sections.values():
#                     child = MenuEntry( section.section_label, catalog['url'] + 
#                                        '/' + str(case_id) + '/' +
#                                        section.section_name )
#                     entry.content.append(child)
#             else:
#                 entry = MenuEntry(catalog['name'], 
#                                   catalog['url']+'/'+str(case_id),
#                                   catalog['icon'])
#             menu.append(entry)
#         return menu
# 
#     def get_catalog_table_html(self,catalog,section_name):
#         tmpl = self.lookup.get_template("catalog_table.html")
#         for name,section in catalog.sections.iteritems():
#             if( name.replace(' ', '') == section_name ):
#                 return tmpl.render_unicode(section=section)
#         tmpl = self.lookup.get_template("error.html")
#         return tmpl.render_unicode(error="Catalog not found")
#     
#     @cherrypy.expose
#     def apps(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(Catalog.CATALOG_APPS)
#         return self.get_catalog_table_html(cat,section_name)
#     
#     @cherrypy.expose
#     def devinfo(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(
#                                                         Catalog.CATALOG_DEVINFO)
#         return self.get_catalog_table_html(cat, section_name)
#     
#     @cherrypy.expose
#     def logs(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(Catalog.CATALOG_LOGS)
#         return self.get_catalog_table_html(cat, section_name)
#     
#     @cherrypy.expose
#     def devnet(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(
#                                                     Catalog.CATALOG_NETWORKING)
#         return self.get_catalog_table_html(cat, section_name)
#         
#     @cherrypy.expose
#     def comms(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(
#                                                         Catalog.CATALOG_COMMS)
#         return self.get_catalog_table_html(cat, section_name)


import cherrypy, os
import Widgets
from Catalog import Catalog
from mako.lookup import TemplateLookup
        if lock != None:
            ok = True
            lock_type = None
            pin = lock.find_item_by_name("password_hash")
            pattern = lock.find_item_by_name("gesture_hash")
            if pin != None and len(pin.item_value) != 0:
                lock_type = "PIN"
            elif pattern != None and len(pattern.item_value) != 0:
                lock_type = "Pattern"
            
            widget.add_item(["Lock Type", lock_type])
            if lock_type == "PIN":
                pquality = lock.find_item_by_name("lockscreen.password_type")
                if pquality != None:
                    widget.add_item(["Password Quality", pquality.item_value])
            
            owner_info = lock.find_item_by_name("lock_screen_owner_info")
            if owner_info != None:
                widget.add_item(["Lock Screen Message", owner_info.item_value])
        
        """
        Handle WiFi info
        """
        wifi_nets = store.query_catalog( Catalog.CATALOG_NETWORKING, 
                                    "wifi_info.connected_numbers" )
        if wifi_nets != None:
            ok = True
            widget.add_item(["# Connected Wifi Networks", 
                             len(wifi_nets.subsection_items)])
        

# Path: Catalog.py
# class Catalog(IMainModule):
#     CATALOG_NONE = 0
#     CATALOG_DEVINFO = 1
#     CATALOG_SETTINGS = 2
#     CATALOG_APPS = 3
#     CATALOG_NETWORKING = 4
#     CATALOG_LOGS = 5
#     CATALOG_TIMELINE = 6
#     CATALOG_COMMS = 7
#     
#     name = "Catalogs"
#     internal_name = "catalog"
#     
#     catalogs_info = {
#         CATALOG_NONE : { "name":"Uncategorised", "display":False },
#         CATALOG_DEVINFO : {"name": "Device Info", "display": True, 
#                         "url": "/devinfo", "icon": "fa-info" },
#         CATALOG_SETTINGS : { "name": "Device Settings", "display": False, 
#                             "url": "/devsettings", "icon": "fa-gear" },
#         CATALOG_APPS : { "name": "Apps", "display": True, "url": "/apps", 
#                         "icon": "fa-archive" },
#         CATALOG_NETWORKING : { "name": "Networking", "display": True, 
#                               "url": "/devnet", "icon": "fa-globe" },
#         CATALOG_LOGS : { "name": "Device Logs", "display": True, 
#                         "url": "/logs", "icon": "fa-file" },
#         CATALOG_TIMELINE : { "name": "Timeline", "display": False, 
#                             "url": "/timeline", "icon": "fa-clock-o" },
#         CATALOG_COMMS : { "name": "Communications", "display":True, 
#                          "url": "/comms", "icon":"fa-comments-o" }
#     }
#     
#     def __init__(self, lookup, case, settings):
#         '@type lookup: mako.lookup.TemplateLookup'
#         self.lookup = lookup
#         self.case = case
#         self.settings = settings
#         return
#     
#     
#     def set_templatelookup(self, lookup):
#         '@type lookup: mako.lookup.TemplateLookup'
#         self.lookup = lookup
#         
#     def get_menuentry_list(self, store, case_id):
#         menu = []
#         for cat_id, catalog in self.catalogs_info.iteritems():
#             if catalog['display'] == False: continue
#             store_catalog = store.get_misccatalog(cat_id)
#             if len(store_catalog.sections) != 0:
#                 entry = MenuEntry(catalog['name'], "#", catalog['icon'] )
#                 for section in store_catalog.sections.values():
#                     child = MenuEntry( section.section_label, catalog['url'] + 
#                                        '/' + str(case_id) + '/' +
#                                        section.section_name )
#                     entry.content.append(child)
#             else:
#                 entry = MenuEntry(catalog['name'], 
#                                   catalog['url']+'/'+str(case_id),
#                                   catalog['icon'])
#             menu.append(entry)
#         return menu
# 
#     def get_catalog_table_html(self,catalog,section_name):
#         tmpl = self.lookup.get_template("catalog_table.html")
#         for name,section in catalog.sections.iteritems():
#             if( name.replace(' ', '') == section_name ):
#                 return tmpl.render_unicode(section=section)
#         tmpl = self.lookup.get_template("error.html")
#         return tmpl.render_unicode(error="Catalog not found")
#     
#     @cherrypy.expose
#     def apps(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(Catalog.CATALOG_APPS)
#         return self.get_catalog_table_html(cat,section_name)
#     
#     @cherrypy.expose
#     def devinfo(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(
#                                                         Catalog.CATALOG_DEVINFO)
#         return self.get_catalog_table_html(cat, section_name)
#     
#     @cherrypy.expose
#     def logs(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(Catalog.CATALOG_LOGS)
#         return self.get_catalog_table_html(cat, section_name)
#     
#     @cherrypy.expose
#     def devnet(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(
#                                                     Catalog.CATALOG_NETWORKING)
#         return self.get_catalog_table_html(cat, section_name)
#         
#     @cherrypy.expose
#     def comms(self, case_id, section_name):
#         cat = self.case.get_store(case_id).get_misccatalog(
#                                                         Catalog.CATALOG_COMMS)
#         return self.get_catalog_table_html(cat, section_name)


# Path: Dashboard.py
import cherrypy, os
import Widgets
from Catalog import Catalog
from mako.lookup import TemplateLookup

        if lock != None:
            ok = True
            lock_type = None
            pin = lock.find_item_by_name("password_hash")
            pattern = lock.find_item_by_name("gesture_hash")
            if pin != None and len(pin.item_value) != 0:
                lock_type = "PIN"
            elif pattern != None and len(pattern.item_value) != 0:
                lock_type = "Pattern"
            
            widget.add_item(["Lock Type", lock_type])
            if lock_type == "PIN":
                pquality = lock.find_item_by_name("lockscreen.password_type")
                if pquality != None:
                    widget.add_item(["Password Quality", pquality.item_value])
            
            owner_info = lock.find_item_by_name("lock_screen_owner_info")
            if owner_info != None:
                widget.add_item(["Lock Screen Message", owner_info.item_value])
        
        """
        Handle WiFi info
        """
        wifi_nets = store.query_catalog( Catalog.CATALOG_NETWORKING, 
                                    "wifi_info.connected_numbers" )
        if wifi_nets != None:
            ok = True
            widget.add_item(["# Connected Wifi Networks", 
                             len(wifi_nets.subsection_items)])
        

        wifi_tether = store.query_catalog( Catalog.CATALOG_NETWORKING, 