def __init__(self, uid, van): self.regels = [] with open(os.path.join(common.filepad, "newpw.html")) as fh: for x in fh: if "%s" in x: x = x.rstrip() if "stylesheet" in x: self.regels.append(x % common.httppad) elif "<script" in x: self.regels.extend(common.get_script()) elif 'action=' in x: self.regels.append(x % common.cgipad) elif 'id="tNaam"' in x: self.regels.append(x % uid) elif 'id="hVan"' in x: self.regels.append(x % van) elif 'input type="submit"' in x: self.regels.append(x % "doit('wu1','wu2','0')") else: if "<!-- kop -->" in x: self.regels.extend( common.printkop("Wachtwoord wijzigen")) #~ elif x[:-1] == "<body>" and editEntry: #~ hh = "window.location='#wijzigdeze'" #~ self.regels.append('<body onload="%s">' % hh) else: self.regels.append(x)
def __init__(self, kop, melding, login="******"): self.regels = [] with open(os.path.join(filepad, "next.html")) as f: for x in f: x = x.rstrip() if "%s" in x: if "stylesheet" in x: self.regels.append(x % httppad) elif "<!-- kop -->" in x: for y in printkop(kop): # gedefinieerd in school_globals self.regels.append(y) elif "<!-- data -->" in x: self.regels.append('<br /><div>%s</div>' % melding) elif x.startswith("input"): if login == "N": self.regels.append( '<input type="button" value="Terug" ' 'onclick="history.go(-1)"/>') else: hgoto = ("document.location='%sschool_login.py'" % cgipad) self.regels.append( '<input type="button" value="Login" ' 'onclick="%s"/>' % hgoto) else: self.regels.append(x)
def __init__(self, xslevel, u, s, edit_entry=False, sel_id="0"): self.regels = [] self.xslevel = xslevel self.toon_prog = "toon_leerlingen.py" self.wijzig_prog = "wijzig_leerling.py" with open(os.path.join(common.filepad, "leerlingen.html")) as fh: for x in fh: x = x.rstrip() if "%s" in x: if "stylesheet" in x: self.regels.append(x % common.httppad) elif "<script" in x: self.regels.extend(common.get_script()) elif 'action=' in x: if not edit_entry: self.regels.append(x % common.cgipad) elif 'input type="submit"' in x: self.regels.append(x % "doit_edit('tll1','tll2','0')") else: if x == "<body>" and edit_entry: self.regels.append('<body onload="%s">' % "window.location='#wijzigdeze'") elif x == "<!-- kop -->": self.regels.extend( common.printkop("Lijst leerlingen", u)) elif x == "<!-- contents -->": if edit_entry and sel_id == "0": self.wijzigregel("0", u, s) h = leerlingenlijst()[0].keys() #-- dit is het punt waarop de sortering kan worden aangepast ## h.sort() for y in sorted(h): if edit_entry: if y == sel_id: self.wijzigregel(y, u, s) else: self.toonregel(y, True) else: self.toonregel(y, False) elif edit_entry and x == "</form>": pass else: self.regels.append(x)
def __init__(self, xslevel, u, s, edit_entry=False, sel_id="0"): self.regels = [] self.xslevel = xslevel self.groepen = groependetailslijst()[0] self.leerkrachten = leerkrachtenlijst()[0] self.toon_prog = "toon_groepen.py" self.wijzig_prog = "wijzig_groep.py" with open(os.path.join(common.filepad, "groepen.html")) as fh: for x in fh.readlines(): x = x.rstrip() if "%s" in x: if "stylesheet" in x: self.regels.append(x % common.httppad) elif "<script" in x: self.regels.extend(common.get_script()) elif 'action=' in x: if not edit_entry: self.regels.append(x % common.cgipad) elif 'input type="submit"' in x: self.regels.append(x % "doit_edit('tgr1','tgr2','0')") else: if x == "<body>" and edit_entry: hh = "window.location='#wijzigdeze'" self.regels.append('<body onload="%s">' % hh) elif "<!-- kop -->" in x: self.regels.extend(common.printkop("Lijst groepen", u)) elif "<!-- contents -->" in x: if edit_entry and sel_id == "0": self.wijzigregel("0", u, s) h = self.groepen.keys() ## h.sort() for y in sorted(h): if edit_entry and y == sel_id: self.wijzigregel(y, u, s) else: self.toonregel(y, edit_entry) elif edit_entry and x == "</form>": pass else: self.regels.append(x)
def __init__(self, access_level, u, s, edit_entry=False, sel_id="0"): self.regels = [] self.access_level = access_level self.toon_prog = "toon_users.py" self.wijzig_prog = "wijzig_user.py" with open(os.path.join(common.filepad, "users.html")) as fh: for x in fh.readlines(): x = x.rstrip() if "%s" in x: if "stylesheet" in x: self.regels.append(x % common.httppad) elif "<script" in x: self.regels.extend(common.get_script()) elif 'action=' in x: if not edit_entry: self.regels.append(x % common.cgipad) elif 'input type="submit"' in x: self.regels.append(x % "doit_edit('tu1','tu2','0')") else: if x == "<body>" and edit_entry: hh = "window.location='#wijzigdeze'" self.regels.append('<body onload="%s">' % hh) elif x == "<!-- kop -->": self.regels.extend( common.printkop("Lijst gebruikers", u)) elif x == "<!-- contents -->": if edit_entry and sel_id == "0": x = ('', '', common.xtypes.keys()[1], common.btypes.keys()[1], snames[0]) self.wijzigregel("0", u, s) for y in userlijst(): if edit_entry and y[0] == sel_id: self.wijzigregel(y, u, s) else: self.toonregel(y, edit_entry) elif edit_entry and x == "</form>": pass else: self.regels.append(x)
def __init__(self, u, xslevel): self.regels = [] sZoek = "" abs = absentenlijst() ll = leerlingenlijst()[0] gr = groependetailslijst()[0] with open(os.path.join(common.filepad, "toon_klas.html")) as fh: for x in fh: x = x.rstrip() if "%s" in x: if "stylesheet" in x: self.regels.append(x % common.httppad) elif "<script" in x: self.regels.extend(common.get_script()) elif "action" in x: self.regels.append(x % common.cgipad) elif "hVan" in x: self.regels.append(x % 'toon_absent') elif 'chkAbs' in x: self.regels.append(x % 'checked="checked" disabled="disabled"') elif "option" in x: for g in groep: self.regels.append(x % (g, g)) elif "<!-- kop -->" in x: self.regels.extend(common.printkop("Lijst absente leerlingen ", u)) elif "<!-- contents -->" in x: aantabs = 0 for y, z in abs.items(): # absent, gegevens abstat = z[0] if abstat != "0": aantabs = aantabs + 1 absrdn = z[1] absdat = z[2] leerl = ll[y] llnm = leerl[0] llgr = gr[leerl[1]] lknm = llgr[2][0] self.regels.append(row) self.regels.append(coltext % str(llnm)) self.regels.append(coltext % lknm) if xslevel > 2: # wijzigen niet toegestaan self.regels.append(coltext % common.afwstat[int(abstat)]) else: self.regels.append(col) self.regels.append(wijzigform % (y, common.cgipad)) self.regels.append(herkomst % y) self.regels.append(target.format('w', y)) hh = "doit_sub('wla-{0}','wla1-{0}','wla2-{0}')".format( y) hh = ' onchange="%s"' % hh self.regels.append(select.format('selStat', hh)) for ix, z in enumerate(common.afwstat): hs = selected_text if str(ix) == abstat else '' self.regels.append(option % (hs, ix, z)) self.regels.append(endselect) self.regels.append(endform) self.regels.append(endcol) self.regels.append(coltext % absdat[:10]) if xslevel > 2: # wijzigen niet toegestaan self.regels.append(coltext % button_disabled) else: self.regels.append(col) self.regels.append(toonform % common.cgipad) self.regels.append(herkomst % y) self.regels.append(target.format('t', y)) hh = "doit('tla1-{0}','tla2-{0}')".format(y) self.regels.append(button % ('submit', 'Toon/Wijzig', hh)) self.regels.append(endform) self.regels.append(endcol) self.regels.append(endrow) if aantabs == 0: self.regels.append(niks_gevonden) else: self.regels.append(x)
def __init__(self, u, sel_id, meld, vandaan, selopt=""): self.regels = [] ll = Leerling(sel_id) #~ from datetime import date #~ dmy = date.today() dmy = today() with open(os.path.join(common.filepad, "toon_leerling.html")) as fh: for x in fh.readlines(): x = x.strip() if "%s" in x: if "stylesheet" in x: self.regels.append(x % common.httppad) elif "<script" in x: self.regels.extend(common.get_script()) elif "form action" in x: self.regels.append(x % common.cgipad) elif "Naam" in x: self.regels.append(x % ll.naam) elif "hTerug" in x: self.regels.append(x % vandaan) elif "option"in x: for ix, s in enumerate(common.afwstat): sh = "" if (selopt and ix == int(selopt)) or ix == int(ll.code): sh = selected_text self.regels.append(option % (sh, ix, s)) elif "textarea" in x: self.regels.append(x % ll.reden) elif "hId" in x: self.regels.append(x % sel_id) elif "colspan" in x: if meld != "": self.regels.append(x % meld) else: if "<!-- kop -->" in x: self.regels.extend(common.printkop("Details van leerling", u, vandaan)) elif "selDag" in x: self.regels.append(x) for i in range(1,32): y = selected_text if i == dmy.day else '' self.regels.append(option % (y, i, i)) elif "selMnd" in x: self.regels.append(x) for i in range(1,13): y = selected_text if i == dmy.month else '' self.regels.append(option % (y, i, i)) elif "selJaar" in x: self.regels.append(x) for i in range(dmy.year - 1, dmy.year + 2): y = selected_text if i == dmy.year else '' self.regels.append(option % (y, i, i)) elif "eindDag" in x: self.regels.append(x) self.regels.append(option % (selected_text, 0, '- -')) for i in range(1,32): self.regels.append(option % ('', i, i)) elif "eindMnd" in x: self.regels.append(x) self.regels.append(option % (selected_text, 0, '- -')) for i in range(1,13): self.regels.append(option % ('', i, i)) elif "eindJaar" in x: self.regels.append(x) self.regels.append(option % (selected_text, 0, '- - - -')) for i in range(dmy.year - 1, dmy.year + 2): self.regels.append(option % ('', i, i)) elif "<!-- AbsentHist -->" in x: self.regels.append(header) for x in absenties(sel_id): h1 = common.afwstat[int(x[1])] h2 = x[2] or " " self.regels.append('<tr><td>%s</td><td> </td><td>%s' '</td><td> </td><td>%s</td></tr>' % (x[0], h1, h2)) self.regels.append(endtable) else: self.regels.append(x)
def __init__(self, zoek, vandaan, u, s, xslevel, in_absenten): self.regels = [] self.lijst = zoek_leerlingen(zoek, vandaan, in_absenten) if len(self.lijst) == 1: self.regels.append( gotonext % ('fThis', common.cgipad, self.lijst[0][0], zoek, u, s)) return abs = absentenlijst() with open(os.path.join(common.filepad, "toon_klas.html")) as fh: for x in fh.readlines(): x = x.rstrip() if "hVan" in x: self.regels.append(x % vandaan) elif "%s" in x: if "stylesheet" in x: self.regels.append(x % common.httppad) elif "<script" in x: self.regels.extend(common.get_script()) elif "action" in x: self.regels.append(x % common.cgipad) elif 'chkAbs' in x: hlp = '' if in_absenten or vandaan == 'toon_absent': hlp += 'checked="checked"' if vandaan == 'toon_absent': hlp += 'disabled="disabled"' if hlp: self.regels.append(x % hlp) else: self.regels.append(x) elif "option" in x: for _id, naam in groepenlijst()[0]: self.regels.append(x % (_id, naam)) ## elif zoek != "" and '<input type="submit" value="Zoek"' in x: ## self.regels.append(disabled_button.format('Zoek')) elif "<!-- kop -->" in x: t = '' if zoek: t += 'naam(deel) ' if vandaan.startswith('toon_klas'): ## leerk_id = vandaan.split('_')[1] if in_absenten: if t: t += 'en ' t += "absent" t += " binnen groep van " + u # str(Leerkracht(leerk_id).naam) elif vandaan == 'toon_absent': t += " binnen absenten" self.regels.extend( common.printkop('Gezocht op: ' + t, u, vandaan)) elif "txtZoek" in x: if zoek: self.regels.append( x.replace("/>", ' value="%s"/>' % zoek)) else: self.regels.append(x) elif "<!-- contents -->" in x: for key, item, text, _, _ in self.lijst: self.regels.append(row) self.regels.append(coltext % item) self.regels.append(coltext % text) if key in abs: h = int(abs[key][0]) absdat = abs[key][2] hlp = absdat[:10] else: h = 0 absdat = hlp = " " if xslevel > 2: # wijzigen niet toegestaan self.regels.append(coltext % common.afwstat[h]) else: self.regels.append(col) self.regels.append(wijzigform % (key, common.cgipad)) self.regels.append(herkomst % (zoek, vandaan, key)) self.regels.append(target.format('w', key)) hh = "doit_sub('wla-{0}','wla1-{0}','wla2-{0}')".format( key) self.regels.append(select.format('selStat', hh)) for ix, z in enumerate(common.afwstat): hs = selected_text if ix == h else '' self.regels.append(option % (hs, ix, z)) self.regels.append(endselect) self.regels.append(' ' + endform) self.regels.append(endcol) self.regels.append(coltext % hlp) self.regels.append(col) self.regels.append(toonform % common.cgipad) self.regels.append(herkomst % (zoek, vandaan, key)) if xslevel > 2: # wijzigen niet toegestaan self.regels.append( disabled_button.format('Details')) else: self.regels.append(target.format('t', key)) hh = "doit('tla1-{0}','tla2-{0}')".format(key) self.regels.append( ' ' + button.format('submit', 'Details', hh)) self.regels.append(' ' + endform) self.regels.append(endcol) self.regels.append(endrow) if len(self.lijst) == 0: self.regels.append(no_result) else: self.regels.append(x)
def __init__(self, sel_id, u, xslevel): self.regels = [] klas, _, leerk = leerlingenlijst( leerkracht=sel_id) # of juist groep=sel_id? abs = absentenlijst() with open(os.path.join(common.filepad, "toon_klas.html")) as fh: for x in fh: x = x.rstrip() if "%s" in x: if "stylesheet" in x: self.regels.append(x % (common.httppad)) elif "<script" in x: self.regels.extend(common.get_script()) elif "action" in x: self.regels.append(x % common.cgipad) elif "hVan" in x: self.regels.append(x % ('toon_klas-' + str(sel_id))) elif 'chkAbs' in x: self.regels.append(x) elif "option" in x: for g in groep: self.regels.append(x % (g, g)) elif "<!-- kop -->" in x: self.regels.extend( common.printkop("Gezocht op: groep van %s" % u, u)) elif "<!-- contents -->" in x: lknm = leerk.naam.voornaam # voornaam van de leerkracht bij de gevraagde klas/groep for key, data in klas.items(): leerl = data[0] self.regels.append(row) self.regels.append(coltext % leerl) self.regels.append(coltext % lknm) if key in abs: h = int(abs[key][0]) absdat = abs[key][2] hh = absdat[:10] else: h = 0 absdat = hh = " " if xslevel > 2: # wijzigen niet toegestaan self.regels.append(coltext % common.afwstat[h]) else: self.regels.append(col) self.regels.append(form_wijzig % (key, common.cgipad)) self.regels.append( hidden_inputs.format(sel_id, key, "w")) hh = "doit_sub('wla-{0}','wla1-{0}','wla2-{0}')".format( key) self.regels.append(select % hh) for ix, z in enumerate(common.afwstat): hs = selected_text if ix == h else '' self.regels.append(optiontext % (hs, ix, z)) self.regels.append(endselect) self.regels.append(endform) self.regels.append(endcol) self.regels.append(coltext % absdat) if xslevel > 2: # wijzigen niet toegestaan self.regels.append(coltext % button_disabled) else: self.regels.append(col) self.regels.append(form_toon % common.cgipad) ## self.regels.append(vanregel % sel_id) self.regels.append( hidden_inputs.format(sel_id, key, "t")) hh = "doit('tla1-{0}','tla2-{0}')".format(key) self.regels.append(submit_button % hh) self.regels.append(endform) self.regels.append(endcol) self.regels.append(endrow) if len(klas) == 0: self.regels.append(notfound % lknm) else: self.regels.append(x)