Beispiel #1
0
 def rendercont(updated):
     return ctx.tag[tags.h3["Global Changes"],
                    web.TabSwitcher([
                        ("Admin Password", 'adminpass'),
                        ("TUMS Updates", 'updatetums'),
                    ]),
                    tags.div(id="updatetums", _class="tabPane")[
                        tags.h3["Update TUMS"],
                        updated and "Update sent" or tags.a(
                            href="Update/")["Update all now"], ],
                    tags.div(id="adminpass", _class="tabPane")[
                        tags.h3["Change Administrator Password"],
                        tags.directive('form adminpassword')],
                    web.LoadTabSwitcher()]
Beispiel #2
0
    def render_messageQueue(self, ctx, data):
        if not (1 in self.avatarId.gids):
            return ctx.tag[""]

        tcont = []

        for k, v in self.enamel.tcsMaster.messageQueue.items():
            if v:
                tcont.append([tags.td[k], tags.td[repr(v)]])

        print tcont, "HERE!"

        return ctx.tag[tags.div(_class="tabBlock")[
            tags.div(_class="tabHeader")[tags.div(
                _class="tabText")["Message Queue"]],
            tags.div(
                _class="tabContent")[tags.table[[tags.tr[i] for i in tcont]]]]]
Beispiel #3
0
        def renderServers(servers):
            servers2 = {}
            for s in servers:
                if s[1] in self.enamel.tcsMaster.connectedNodes:
                    servers2[s[1]] = ('Online', s[1], s[4], s[0])
                elif s[1] in self.enamel.tcsMaster.knownNodes:
                    servers2[s[1]] = ('Online (No Direct)', s[1], s[4], s[0])
                else:
                    servers2[s[1]] = ('Offline', s[1], s[2], s[0])

            def getGraph(server, canonical):
                # Returns the right graph image or structure for this particular view mode
                if (len(self.arguments) < 1) or (self.arguments[0] == 'load'):
                    return tags.img(
                        src=
                        "/RRD?source=%s&type=load&timeframe=-7d&width=200&height=50&nog=yes"
                        % (server))

                if self.arguments[0] == 'latency':
                    return tags.img(
                        src=
                        "/RRD?source=%s&type=latency&timeframe=-7d&width=200&height=50&nog=yes"
                        % (canonical))
                if self.arguments[0] == 'internet':
                    return tags.img(
                        src=
                        "/RRD?source=%s&type=net&timeframe=-7d&width=200&height=50&nog=yes"
                        % (server))

                if self.arguments[0] == 'mailrate':
                    return tags.img(
                        src=
                        "/RRD?source=%s&type=exim&timeframe=-7d&width=200&height=50&nog=yes"
                        % (server))

            serversL = servers2.keys()
            serversL.sort()

            servers3 = []

            for i in serversL:
                servers3.append(servers2[i])

            return ctx.tag[
                tags.h3["Servers"], tags.br,
                tags.directive('form switchView'),
                self.dataTable(["Name", "Status", "Last IP", "Load", ""], [(
                    i[0] == "Online", i[1], i[0], i[2],
                    tags.div(_class="graphBlock")[getGraph(i[3], i[1])],
                    tags.a(href="/Servers/Manage/%s/" %
                           i[3])["Manage"]) for i in servers3],
                               sortable=True), ]
Beispiel #4
0
        def renderTime(deferreds):
            # Unpack results
            users, servers, domains = [i[1] for i in deferreds]

            userTable = []
            for row in users:
                print row
                userTable.append((row[1], ))

            serverTable = []
            for row in servers:
                serverTable.append((row[1], row[2]))

            domainTable = []
            for row in domains:
                domainTable.append((row[1], ""))

            return ctx.tag[
                PageBase.TabSwitcher(
                    (('Users', 'pUsers'), ('Servers', 'pServers'),
                     ('Domains', 'pDomains'))),
                tags.div(id='pUsers', _class="tabPane")[
                    tags.h3["Users"],
                    self.dataTable(["Username"], userTable), tags.br,
                    tags.h3["Add User"],
                    tags.directive('form addMembership')],
                tags.div(id='pServers', _class="tabPane")[
                    tags.h3["Servers"],
                    self.dataTable(["Server", "Hostname"], serverTable),
                    tags.br, tags.h3["Add Server"],
                    tags.directive('form addServerMembership')],
                tags.div(id='pDomains', _class="tabPane")[
                    tags.h3["Domains"],
                    self.dataTable(["Domain", ""], domainTable), tags.br,
                    tags.h3["Add Domain"],
                    tags.directive('form addDomainMembership')],
                PageBase.LoadTabSwitcher()]
Beispiel #5
0
        def renderTable(rows):
            orderTable = []

            for i in rows:
                if i[5] == "Vulani License":
                    descr = "Vulani License + %s support for %s" % (
                        i[6].capitalize(), i[3])
                else:
                    descr = ""
                orderTable.append([
                    i[10], i[3], i[5], descr, i[8].ctime(), i[9].ctime(), i[7]
                    or u"Pending",
                    tags.a(href="/Orders/EditOrder/%s/" % i[0])["Manage"]
                ])

            return ctx.tag[tags.div(_class="tabBlock")[
                tags.div(_class="tabHeader")[tags.div(
                    _class="tabText")["Pending Orders"]],
                tags.div(_class="tabContent")[self.dataTable([
                    "Requester", "Company", "Type", "Detail", "Created",
                    "Changed", "Status", ""
                ],
                                                             orderTable,
                                                             width="100%")]]]
Beispiel #6
0
        def retrOrder(row, userRow):
            print row

            email = userRow[4]

            descr = row[5]
            if row[5] == "Vulani License":
                if row[6] in ['standard', 'silver', 'gold', 'platinum']:
                    descr = "Vulani License + First month of %s support" % (
                        row[6].capitalize())
                else:
                    descr = "Standard Vulani License with no support"

            costMapper = {
                'gold': (3000, 700, "Gold support (recurring monthly)"),
                'platinum':
                (2000, 1000, "Platinum support (recurring monthly)")
            }

            costTup = costMapper.get(row[6].lower(), (5000, 0, None))

            costBase = costTup[0] + costTup[1]

            costRecur = costTup[1]

            transactionDate = datetime.now().strftime("%Y-%m-%d %H:%M")

            formDict = {
                "PAYGATE_ID": PayGateID,
                "REFERENCE": str(row[0]),
                "AMOUNT": str(costBase * 100),
                "CURRENCY": "ZAR",
                "RETURN_URL":
                "https://portal.vulani.net/Orders/PayGateReturn/",
                "TRANSACTION_DATE": transactionDate,
                "EMAIL": email,
            }

            sup = ""
            if costRecur:
                today = date.today()
                nextYear = date(today.year + 1, today.month, today.day)
                formDict["VERSION"] = "21"
                formDict["SUBS_START_DATE"] = today.strftime("%Y-%m-%d")
                formDict["SUBS_END_DATE"] = nextYear.strftime("%Y-%m-%d")
                formDict["PROCESS_NOW"] = "YES"
                formDict["PROCESS_NOW_AMOUNT"] = str(costBase * 100)
                formDict["AMOUNT"] = str(costRecur * 100)

                sup = tags.tr[tags.td["1 x %s" % costTup[2]],
                              tags.td["R%s.00" % costRecur]]

            formDict["CHECKSUM"] = genPayGateReqCHK(formDict)
            print formDict

            return ctx.tag[
                tags.table[tags.tr[tags.td["1 x Vulani license"],
                                   tags.td["R%s.00" % costTup[0]]], sup,
                           tags.tr[tags.td["Order Total"],
                                   tags.td["R%s.00" % costBase]]],
                tags.div(_class="billingNotice")
                ["Please note: Purchases will be billed and processed by THUSA BUSINESS SUPPORT (PTY) LTD"],
                PayGateLogoStuff,
                tags.form(
                    method="POST",
                    action="https://www.paygate.co.za/paywebv2/process.trans"
                )[
                    #tags.form(method="POST", action="https://www.vcs.co.za/vvonline/ccform.asp")[
                    [
                        tags.input(type="hidden", name=k, value=v)
                        for k, v in formDict.items()
                    ],
                    tags.input(type="submit", value="Pay by Credit Card")]]
Beispiel #7
0
 def render_content(self, ctx, data):
     return ctx.tag[
         tags.directive('form vlic'),
         tags.div(_class="billingNotice")
         ["Please note: Purchases will be billed and processed by THUSA BUSINESS SUPPORT (PTY) LTD"],
         PayGateLogoStuff]
Beispiel #8
0
import enamel, sha, md5

from datetime import datetime, date

from custom import Widgets
from twisted.internet import utils, defer

from nevow import inevow

from lib import PageBase, web

PayGateKey = "secret"
PayGateID = "10011013800"

PayGateLogoStuff = tags.div(_class="paygateLogos")[tags.p(
    style="margin-top:30px;")[tags.a(
        href="http://www.paygate.co.za", target="_blank")[tags.img(
            src="http://www.thusa.co.za/images/paygate.png", border="0")]]]


def genPayGateReqCHK(formDict):
    vars = [
        formDict["PAYGATE_ID"], formDict["REFERENCE"], formDict["AMOUNT"],
        formDict["CURRENCY"], formDict["RETURN_URL"],
        formDict["TRANSACTION_DATE"], formDict["EMAIL"]
    ]
    if "SUB_START_DATE" in formDict:
        vars.extend([
            formDict["SUB_START_DATE"],
            formDict["SUB_END_DATE"],
            formDict["SUB_FREQUENCY"],
            formDict["PROCESS_NOW"],
Beispiel #9
0
 def rollupBlock(self, title, content):
     return tags.div(_class="roundedBlock")[title, tags.div[content]]
Beispiel #10
0
        def renderForm(user):
            self.user = user
            domains = ['asd.co.za']
            username = self.user[3]
            domain = self.user[2]

            u_form = formal.Form(
                self.submitForm
            )[formal.Group('userSettings')[tags.div(_class="field")[
                tags.label[self.text.userFormLabelEmailAddress],
                tags.div(id="emailAd", _class="inputs")["%s@%s" %
                                                        (username, domain)]],
                                           formal.Field('uid',
                                                        formal.String(
                                                            required=True),
                                                        label=self.text.
                                                        userFormLabelUsername),
                                           formal.Field('givenName',
                                                        formal.String(
                                                            required=True),
                                                        label=self.text.
                                                        userFormLabelName),
                                           formal.Field('sn',
                                                        formal.String(),
                                                        label=self.text.
                                                        userFormLabelSurname),
                                           formal.Field('userPassword',
                                                        formal.String(),
                                                        formal.CheckedPassword,
                                                        label=self.text.
                                                        userFormLabelPass), ],
              formal.Group('mailSettings')
              [formal.Field('mailForwardingAddress0',
                            formal.String(),
                            label=self.text.userFormLabelForward),
               formal.
               Field('mailForwardingAddress1', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress2', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress3', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress4', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress5', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress6', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress7', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress8', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress9', formal.String(), label=""),
               tags.div(
                   _class="userLine")[tags.a(href="#", onclick="addForward();")
                                      [self.text.userFormLabelAddline]],
               formal.Field('mailAlternateAddress0',
                            formal.String(),
                            label=self.text.userFormLabelAlias),
               formal.Field('mailAlternateAddress1', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress2', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress3', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress4', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress5', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress6', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress7', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress8', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress9', formal.String(), label=""
                            ),
               tags.div(
                   _class="userLine")[tags.a(href="#", onclick="addAlias();")[
                       self.text.userFormLabelAddline]],
               formal.Field('vacen',
                            formal.Boolean(),
                            label=self.text.userFormLabelVacationActive,
                            description=self.text.userFormTextVacationNote),
               formal.Field('vacation',
                            formal.String(),
                            formal.TextArea,
                            label=self.text.userFormLabelVacation), ],
              formal.Group('userPermissions')
              [formal.Field('employeeType',
                            formal.Boolean(),
                            label=self.text.userFormLabelWeb),
               formal.Field('accountStatus',
                            formal.Boolean(),
                            label=self.text.userFormLabelEmail),
               formal.Field('tumsAdmin',
                            formal.Boolean(),
                            label=self.text.userFormLabelAdmin),
               formal.Field(
                   'tumsUser', formal.Sequence(formal.String()),
                   formal.widgetFactory(formal.CheckboxMultiChoice,
                                        [(i, i) for i in domains])),
               formal.Field('tumsReports',
                            formal.Boolean(),
                            label=self.text.userFormLabelReports),
               #      formal.Field('copyto', formal.String(), label = self.text.userFormLabelCopy,
               #          description = self.text.userFormTextCopy)
               ],
              #  formal.Group('userAccess')[
              #      formal.Field('vpnEnabled', formal.Boolean(), label = self.text.userFormLabelVPN,
              #          description = self.text.userFormTextVPN),
              #      formal.Field('ftpEnabled', formal.Boolean(), label = self.text.userFormLabelFTP,
              #          description = self.text.userFormTextFTP),
              #      formal.Field('ftpGlobal', formal.Boolean(), label = self.text.userFormLabelGlobalFTP,
              #          description = self.text.userFormTextGlobal)
              #  ]
              ]

            u_form.addAction(self.submitForm)

            u_form.data['userSettings.uid'] = self.user[3]
            u_form.data['userSettings.givenName'] = self.user[4]
            u_form.data['userSettings.sn'] = self.user[5]

            u_form.data['userPermissions.employeeType'] = "squid" in self.user[
                9]
            u_form.data['userPermissions.tumsUser'] = []
            u_form.data[
                'userPermissions.accountStatus'] = "active" in self.user[10]
            u_form.data[
                'userPermissions.tumsAdmin'] = "tumsAdmin" in self.user[9]
            u_form.data['userPermissions.tumsReports'] = "Repor" in self.user[
                9]

            u_form.data['mailSettings.vacen'] = self.user[20] == 1
            u_form.data['mailSettings.vacation'] = self.user[19]

            return u_form