コード例 #1
0
def main():
    form = cgi.FieldStorage()
    form_ok = False
    u = s = ''
    for k in form.keys():
        if k.startswith('wgr1'):
            u = form[k].value
        elif k.startswith('wgr2'):
            s = form[k].value
    xslevel, meld = shared.check_session(u, s)
    if not meld:
        id = form.getfirst("hId", '')
        nm = form.getfirst("tnaam", '')
        jr = form.getfirst("selJR", '')
        lk = form.getfirst("selLK", '')
        if not id or not nm or not jr or not lk:
            meld = "Alle rubrieken moeten worden ingevuld"
    print("Content-Type: text/html")  # HTML is following
    if meld:
        l = shared.MeldFout("Er is iets misgegaan", meld)
        print()
        for x in l.regels:
            print(x)
        return
    ln = wijzig_groep(id, nm, jr, lk)
    if ln.ok:
        # doorlinken naar selectiescherm
        print('Location: http://school.pythoneer.nl/cgi-bin/toon_groepen.py?'
              'tgr1=%s&tgr2=%s' % (u, s))
        print()
    else:
        print()
        print("Wijzigen is niet gelukt")
コード例 #2
0
def main():
    form = cgi.FieldStorage()
    u = form.getfirst("wu1", '')
    s = form.getfirst("wu2", '')
    xslevel, meld = shared.check_session(u, s)
    if not meld:
        uid = form.getfirst("tNaam", '')
        doe = form.getfirst("hPw", '')
        oldpw = form.getfirst("tPwO", '')
        newpw = form.getfirst("tPw", '')
        van = form.getfirst("hVan", '')
        if uid == '' or van == '':
            meld = ("Geen userid (%s) of scherm (%s) opgegeven" % (uid,van))
    if not meld:
        if doe == "J":
            p = VraagPassword(uid, van)
        elif newpw != '':
            p = wijzig_passw(uid, oldpw, newpw)
            if not p.ok:
                meld = "het opgegeven (oude) wachtwoord is onjuist"
            ## else:
                ## meld = 'uw wachtwoord is gewijzigd'
        else:
            utype = form.getfirst("sType", '')
            blok = form.getfirst("sBlok", '')
            start = form.getfirst("sStart", '')
            met = form.getfirst("tMet", '')
            nieuw = True if doe == '0' else False
            ok, meld = wijzig_user(uid, nieuw, utype, blok, start, met)
            if nieuw and not ok:
                meld = "opgegeven usernaam komt al voor"
            elif not nieuw and not ok:
                meld = "opgegeven user niet gevonden"
            ## elif not ok:
                ## meld = "toevoegen/wijzigen is niet gelukt"
    print("Content-Type: text/html")     # HTML is following
    if meld:
        l = shared.MeldFout("Er is iets misgegaan", meld)
        print()
        for x in l.regels:
            print(x)
    else:
        if doe == "J":
            print()
            for x in p.regels:
                print(x)
        else:
            # doorlinken naar selectiescherm
            # hier moet nog userid en sessionid aan doorgegeven worden
            # van = toon_users: tu1 en tu2
            # andere mogelijkheid: nog niet aanwezig (login pagina?)
            if van == 'toon_users':
                print('Location: http://school.pythoneer.nl/cgi-bin/%s.py?'
                    'tu1=%s&tu2=%s' % (van, u, s))
            print()
コード例 #3
0
def main():
    form = cgi.FieldStorage()
    form_ok = False
    u = form.getfirst("tb1", '')
    s = form.getfirst("tb2", '')
    xslevel, meld = shared.check_session(u, s)
    if meld:
        l = shared.MeldFout("Er is iets misgegaan", meld)
    else:
        l = Start(u, xslevel)
    print("Content-Type: text/html\n")  # HTML is following
    for x in l.regels:
        print(x)
コード例 #4
0
def main():
    form = cgi.FieldStorage()
    form_ok = False
    ## shared.showkeys(form)
    ## return
    u = s = ''
    for k in form.keys():
        if k.startswith('wla1'):
            u = form.getvalue(k)
        elif k.startswith('wla2'):
            s = form.getvalue(k)
    xslevel, meld = shared.check_session(u, s)
    if meld:
        h = shared.MeldFout("Er is iets misgegaan", meld)
    else:
        sel_id = form.getfirst("hId", "0")
        newstat = form.getfirst("selStat", "")
        reden = form.getfirst("txtReden", "")
        komtvan = form.getfirst("hVan", "")
        kwamvan = form.getfirst("hTerug", "")
        if newstat == "2" and reden == "":
            meld = "Geef een reden op"
            h = toon_llabs_main(u, sel_id, meld, komtvan, newstat)
        else:
            newdag = form.getfirst("selDag", "")
            newmnd = form.getfirst("selMnd", "")
            newjaar = form.getfirst("selJaar", "")
            if len(newdag) == 1:
                newdag = "0" + newdag
            if len(newmnd) == 1:
                newmnd = "0" + newmnd
            newdat = newjaar + newmnd + newdag
            enddag = form.getfirst("eindDag", "")
            endmnd = form.getfirst("eindMnd", "")
            endjaar = form.getfirst("eindJaar", "")
            if enddag == '0' or endmnd == '0' or endjaar == '0':
                enddat = ''
            else:
                if len(enddag) == 1:
                    enddag = "0" + enddag
                if len(endmnd) == 1:
                    endmnd = "0" + endmnd
                enddat = endjaar + endmnd + enddag

            h = WijzigAbsentie(sel_id, newstat, reden, komtvan, u, s, kwamvan,
                               newdat, enddat)
    print("Content-Type: text/html\n")  # HTML is following
    for x in h.regels:
        print(x)
コード例 #5
0
def main():
    form = cgi.FieldStorage()
    form_ok = 0
    u = form.getfirst("tu1", '')
    s = form.getfirst("tu2", '')
    xslevel, meld = shared.check_session(u, s)
    if meld:
        l = shared.MeldFout("Er is iets misgegaan", meld)
    else:
        sel_id = form.getfirst("edit", '')
        edit_entry = True if sel_id else False
        l = ToonUser(xslevel, u, s, edit_entry, sel_id)
    print("Content-Type: text/html\n")  # HTML is following
    for x in l.regels:
        print(x)
コード例 #6
0
def main():
    form = cgi.FieldStorage()
    form_ok = False
    u = form.getfirst("ta1", '')
    s = form.getfirst("ta2", '')
    xslevel, meld = shared.check_session(u, s)
    if meld:
        l = shared.MeldFout("Er is iets misgegaan", meld)
    else:
        l = ToonAbsenten(u, xslevel)
        #~ m = ('gebruiker %s heeft toegangsniveau %s' % (u,xslevel))
        #~ l = meld_fout("Er is iets misgegaan",m)
    print("Content-Type: text/html\n")     # HTML is following
    for x in l.regels:
      print(x)
コード例 #7
0
ファイル: toon_klas.py プロジェクト: albertvisser/absentie
def main():
    form = cgi.FieldStorage()
    form_ok = False
    u = form.getfirst("tk1", '')
    s = form.getfirst("tk2", '')
    xslevel, meld = shared.check_session(u, s)
    if not meld:
        sel_id = form.getfirst("selKlas", '')
        if sel_id:
            h = ToonKlas(sel_id, u, xslevel)
        else:
            meld = "Geen klas-id opgegeven"
    if meld:
        h = shared.MeldFout("Er is iets misgegaan", meld)
    print("Content-Type: text/html\n")     # HTML is following
    for x in h.regels:
      print(x)
コード例 #8
0
def main():
    form = cgi.FieldStorage()
    form_ok = False
    u = s = ''
    for k in form.keys():
        if k.startswith('wll1'):
            u = form[k].value
        elif k.startswith('wll2'):
            s = form[k].value
    xslevel, meld = shared.check_session(u, s)
    if not meld:
        sel_id = form.getfirst("hId", '')
        vn = form["tvnaam"].value
        vv = form["ttus"].value
        an = form["tanaam"].value
        dd = form["tdag"].value
        mm = form["tmaand"].value
        jr = form["tjaar"].value
        gesl = form["selgesl"].value
        aut = form["selaut"].value
        grp = form["selgrp"].value
        if not sel_id or not vn or not an or not jr \
                or not gesl or not aut or not grp:
            meld = "Alle rubrieken moeten worden ingevuld"
    print("Content-Type: text/html")  # HTML is following
    if meld:
        h = shared.MeldFout("Er is iets misgegaan", meld)
        print()
        for x in h.regels:
            print(x)
        return
    naam = (vn, vv, an)
    datum = (dd, mm, jr)
    ok = wijzig_leerling(sel_id, naam, datum, gesl, aut, grp)
    if ok:
        # doorlinken naar selectiescherm
        print(
            'Location: http://school.pythoneer.nl/cgi-bin/toon_leerlingen.py?'
            'tll1=%s&tll2=%s' % (u, s))
        print()
    else:
        print()
        print("Wijzigen is niet gelukt")
コード例 #9
0
ファイル: sel_leerling.py プロジェクト: albertvisser/absentie
def main():
    form = cgi.FieldStorage()
    form_ok = 0
    zoek = ""
    u = form.getfirst("sl1", '')
    s = form.getfirst("sl2", '')
    xslevel, meld = shared.check_session(u, s)
    if not meld:
        zoek = form.getfirst("txtZoek", None)
        absent = form.getfirst('chkAbs', False)
        if zoek is not None or absent:
            vandaan = form.getfirst("hVan", "start")
            h = SelectLeerling(zoek, vandaan, u, s, xslevel, absent)
        else:
            meld = "Geen zoekstring opgegeven"
    if meld:
        h = shared.MeldFout("Er is iets misgegaan", meld)
    print("Content-Type: text/html\n")     # HTML is following
    for x in h.regels:
        print(x)
コード例 #10
0
def main():
    form = cgi.FieldStorage()
    form_ok = False
    u = s = ''
    for k in form.keys():
        if k.startswith('tla1'):
            u = form.getfirst(k, '')
        elif k.startswith('tla2'):
            s = form.getfirst(k, '')
    xslevel, meld = shared.check_session(u, s)
    if meld:
        h = shared.MeldFout("Er is iets misgegaan", meld)
    else:
        vandaan = form.getfirst("hVan", 'start')
        sel_id = form.getfirst("hId", 0)
        meld = form.getfirst("txtMeld", "")
        h = ToonAbsentie(u, sel_id, meld, vandaan)
    print("Content-Type: text/html\n")  # HTML is following
    for x in h.regels:
        print(x)
コード例 #11
0
def main():
    form = cgi.FieldStorage()
    form_ok = False
    # op basis van de inhoud van de velden tk1 en tk2 de login checken
    # aan de login database
    u = s = ''
    for k in form.keys():
        if k.startswith('wlk1'):
            u = form[k].value
        elif k.startswith('wlk2'):
            s = form[k].value
    xslevel, meld = shared.check_session(u, s)
    if not meld:
        sel_id = form.getfirst("hId", '')
        vn = form.getfirst("tvnaam", '')
        vv = form.getfirst("ttus", '')
        an = form.getfirst("tanaam", '')
        if not sel_id or not vn or not an:
            meld = "Alle rubrieken moeten worden ingevuld"
    print("Content-Type: text/html")  # HTML is following
    if meld:
        h = shared.MeldFout("Er is iets misgegaan", meld)
        print()
        for x in h.regels:
            print(x)
        return
    ok = wijzig_leerkracht(sel_id, vn, vv, an)
    if ok:
        # doorlinken naar selectiescherm
        print(
            'Location: http://school.pythoneer.nl/cgi-bin/toon_leerkrachten.py?'
            'tlk1=%s&tlk2=%s' % (u, s))
        print()
    else:
        print()
        print("Wijzigen is niet gelukt")