Esempio n. 1
0
 def get_page(self):
     """
     Returns the page this Menu belongs To
     """
     if self._page is None or self._page.get_id() != self._page_id:
         self._page = Page.get_page(self._page_id)
     return self._page
Esempio n. 2
0
    def getMenusOfSite(self,params):
        page_id = int(params[0])

        page = Page.get_page(page_id)
        menus = page.get_menus()
        ret = []
        for menu in menus:
            ret.append({
                    'id':menu.get_id(),
                    'name':menu.get_name()
                })
        return ret
Esempio n. 3
0
    def uninstall(self):
        """
        Uninstalls this template
        """
        db = Database()

        for bin_id in self._binaries:
            bin = Binary.get_by_id(bin_id)
            bin.delete()
        stmnt = "DELETE FROM TEMPLATE_BINARIES ;"
        db.query(stmnt, commit=True)
        
        #Destroy Pages
        Page.delete_all_pages()

        #Set Page ID-Generator to 1
        db.set_seq_to('SIT_GEN',1)

        stmnt = "DELETE FROM TEMPLATE_INFO ;"
        db.query(stmnt, commit=True)

        PokeManager.add_activity(ActivityType.TEMPLATE)
Esempio n. 4
0
 def getSite(self, params):
     page_id = int(params[0])
     
     page = Page.get_page(page_id)
     spaces = page.get_space_names()
     boxes = page.get_box_info()
     ret = {
         'id':page.get_id(),
         'name':page.get_name(),
         'description':page.get_description(),
         'spaces':spaces,
         'boxes':boxes
     }
     return ret
Esempio n. 5
0
 def retrieveSites(self, params):
     pages = Page.get_pages()
     ret = []
     for page in pages:
         spaces = page.get_space_names()
         boxes = page.get_box_info()
         ret.append({
                 'id':page.get_id(),
                 'name':page.get_name(),
                 'description':page.get_description(),
                 'spaces':spaces,
                 'boxes':boxes
             })
     return ret
Esempio n. 6
0
        #uninstall old template
        if cls.is_template_installed():
            old_template = cls.get_current_template()
            old_template.uninstall()

        new_template = Template()
        new_template.set_name(manifest['name'])
        new_template.set_description(manifest['description'])
        new_template.set_author(manifest['author'])

        #create pages
        for page in pagedata:
            Page.create(page['name'],
                                page['internal_name'],
                                page['desc'],
                                page['html_body'],
                                page['html_head'],
                                page['css'],
                                page['minimap'])    

        #put binary into database
        for bin_filename in os.listdir(temp_installpath+"/static"):
            binary=None
            try:
                bin_file = open(temp_installpath+"/static/"+bin_filename,"rb")
                bin_data = bin_file.read()
                bin_file.close()
                # TODO: Find more generic way to determine mimetype
                if bin_filename.endswith(".png"):
                    binary = Binary.create("image/png", bin_data)
                if bin_filename.endswith(".jpeg") or bin_filename.endswith(".jpg"):
Esempio n. 7
0
    def createMenuForSite(self, params):
        page_id = int(params[0])

        page = Page.get_page(page_id)

        Menu.create_menu(page)