def getServicesPage(self, uriToHandler):
        output = ""

        uriList = uriToHandler.keys()

        uriList.sort()

        autoList = []

        if "/" in uriList:
            uriList.remove("/")
            autoList.append("/")
        if "/services" in uriList:
            uriList.remove("/services")
            autoList.append("/services")
        if "/default.css" in uriList:
            uriList.remove("/default.css")
            autoList.append("/default.css")
        if "/favicon.ico" in uriList:
            uriList.remove("/favicon.ico")
            autoList.append("/favicon.ico")

        output += LandingPageHTML.getURITable(title="Application",uriList=uriList,uriToHandler=uriToHandler)

        output += LandingPageHTML.getURITable(title="Admin",uriList=autoList,uriToHandler=uriToHandler)

        return output
Пример #2
0
    def getServicesPage(self, uriToHandler):
        output = ""

        uriList = uriToHandler.keys()

        uriList.sort()

        autoList = []

        if "/" in uriList:
            uriList.remove("/")
            autoList.append("/")
        if "/services" in uriList:
            uriList.remove("/services")
            autoList.append("/services")
        if "/default.css" in uriList:
            uriList.remove("/default.css")
            autoList.append("/default.css")
        if "/favicon.ico" in uriList:
            uriList.remove("/favicon.ico")
            autoList.append("/favicon.ico")

        output += LandingPageHTML.getURITable(title="Application",
                                              uriList=uriList,
                                              uriToHandler=uriToHandler)

        output += LandingPageHTML.getURITable(title="Admin",
                                              uriList=autoList,
                                              uriToHandler=uriToHandler)

        return output
Пример #3
0
    def getHeader(self, activeTab="Main", headTag=None, bodyTag=None):
        if headTag is None:
            headTag = ET.Element('head')
        if bodyTag is None:
            bodyTag = ET.Element('body')

        # make sure each component has elements to make formatting consistent
        headTag.append(ET.Comment(''))
        bodyTag.append(ET.Comment(''))

        fileStr = StringIO()
        ET.ElementTree(headTag).write(fileStr, encoding='utf-8')
        headTagStr = unicodeUtf8(fileStr.getvalue())
        # remove the tag closer
        # </head>
        headTagStr = headTagStr[:headTagStr.rindex('<')]

        # fill in the prefab body tag content
        titleStr = LandingPageHTML.title
        landing = ET.Element('body')
        LandingPageHTML.addBodyHeaderAndContent(landing, titleStr,
                                                self.getMenuTags(activeTab))

        fileStr = StringIO()
        ET.ElementTree(landing).write(fileStr, encoding='utf-8')
        landingStr = unicodeUtf8(fileStr.getvalue())
        # remove <body>
        landingStr = landingStr[landingStr.index('>') + 1:]
        # remove tag closers
        for i in xrange(3):
            # </body>
            # contents </div>
            # </center>
            landingStr = landingStr[:landingStr.rindex('<')]

        fileStr = StringIO()
        ET.ElementTree(bodyTag).write(fileStr, encoding='utf-8')
        bodyTagStr = unicodeUtf8(fileStr.getvalue())
        # extract <body>
        bodyStr = bodyTagStr[bodyTagStr.index('>') + 1:]
        bodyTagStr = bodyTagStr[:bodyTagStr.index('>') + 1]

        bodyStr = bodyTagStr + '\n' + landingStr + '\n' + bodyStr

        s = self.headerTemplate % {
            'titlestring': titleStr,
            'headTag': headTagStr,
            'bodyTag': bodyStr,
        }
        return s
    def getHeader(self, activeTab = "Main", headTag=None, bodyTag=None):
        if headTag is None:
            headTag = ET.Element('head')
        if bodyTag is None:
            bodyTag = ET.Element('body')

        # make sure each component has elements to make formatting consistent
        headTag.append(ET.Comment(''))
        bodyTag.append(ET.Comment(''))

        fileStr = StringIO()
        ET.ElementTree(headTag).write(fileStr, encoding='utf-8')
        headTagStr = unicodeUtf8(fileStr.getvalue())
        # remove the tag closer
        # </head>
        headTagStr = headTagStr[:headTagStr.rindex('<')]

        # fill in the prefab body tag content
        titleStr = LandingPageHTML.title
        landing = ET.Element('body')
        LandingPageHTML.addBodyHeaderAndContent(landing, titleStr, self.getMenuTags(activeTab))

        fileStr = StringIO()
        ET.ElementTree(landing).write(fileStr, encoding='utf-8')
        landingStr = unicodeUtf8(fileStr.getvalue())
        # remove <body>
        landingStr = landingStr[landingStr.index('>')+1:]
        # remove tag closers
        for i in xrange(3):
            # </body>
            # contents </div>
            # </center>
            landingStr = landingStr[:landingStr.rindex('<')]

        fileStr = StringIO()
        ET.ElementTree(bodyTag).write(fileStr, encoding='utf-8')
        bodyTagStr = unicodeUtf8(fileStr.getvalue())
        # extract <body>
        bodyStr = bodyTagStr[bodyTagStr.index('>')+1:]
        bodyTagStr = bodyTagStr[:bodyTagStr.index('>')+1]

        bodyStr = bodyTagStr + '\n' + landingStr + '\n' + bodyStr

        s = self.headerTemplate % {'titlestring': titleStr,
                                   'headTag' : headTagStr,
                                   'bodyTag': bodyStr,
                                   }
        return s
 def getMenuTags(self, activeTab):
     return LandingPageHTML.getTabTags(self.menu, activeTab)
 def getQuickStatsTable(self):
     return LandingPageHTML.getQuickStatsTable(self.quickStats)
Пример #7
0
 def getMenuTags(self, activeTab):
     return LandingPageHTML.getTabTags(self.menu, activeTab)
Пример #8
0
 def getQuickStatsTable(self):
     return LandingPageHTML.getQuickStatsTable(self.quickStats)