def processForm(self, REQUEST, RESPONSE): if self.form.has_key('gruppeid'): gruppeid = self.form.get('gruppeid') gruppe = Gruppe(gruppeid) titel = 'Auszug vom %(day)d.%(month)d.%(year)d.' % today() + \ ' - %s -' % gruppe['gn'] + '\n\n\n' else: fallid = self.form.get('fallid') fall = Fall(int(fallid)) akte = Akte(fall['akte_id']) faelle = akte['faelle'] faelle.sort('bgy','bgm','bgd') titel = 'Auszug vom %(day)d.%(month)d.%(year)d.' % today() + ' - %s -' % fall['fn'] + '\n\n\n' art = self.form.get('art') out = '' # Aktendokumente if self.form.has_key('fallid'): for f in faelle: if art == 'bnotiz': dokl = DokumentList(where = 'fall_id = %s and art = %s and mtyp = %s and mit_id = %s' % (f['id'], cc('dokart', 'bnotiz'), cc('mimetyp', 'txt'), self.mitarbeiter['id']), order = 'vy,vm,vd') elif art=='anotiz': adokl = DokumentList(where = 'fall_id = %s and mtyp = %s' % (f['id'], cc('mimetyp', 'txt')), order = 'vy,vm,vd') dokl = [] for d in adokl: if d['art'] != cc('dokart', 'bnotiz'): dokl.append(d) out = out + mk_text(dokl, get_akte_path(akte['id'])) # Gruppendokumente elif gruppeid and art == 'bnotiz': dokl = GruppendokumentList(where = 'gruppe_id = %s and art = %s and mtyp = %s and mit_id = %s'% (gruppe['id'], cc('dokart', 'bnotiz'), cc('mimetyp', 'txt'), self.mitarbeiter['id']), order = 'vy,vm,vd') out = mk_text(dokl, get_gruppe_path(gruppe['id'])) elif gruppeid and art=='anotiz': adokl = GruppendokumentList(where = 'gruppe_id = %s and mtyp = %s' % (gruppe['id'], cc('mimetyp', 'txt')), order = 'vy,vm,vd') dokl = [] for d in adokl: if d['art'] != cc('dokart', 'bnotiz'): dokl.append(d) out = mk_text(dokl, get_gruppe_path(gruppe['id'])) # Plain-Text-Ausgabe fuer den Browser. Alternativ: print_pdf.py if out is None or out == '': out = 'Kein Ascii-Text vorhanden' else: out = titel + out # Datei uebertragen if RESPONSE: RESPONSE.setHeader('content-type', '%s' % 'text/plain') RESPONSE.setHeader('filename', 'zusammenfassung.txt') RESPONSE.setBody(out) else: return "Fehler beim Anzeigen des Dokumentes"
tx = canv.beginText(left_margin, top_margin - 0.5*inch) for f in faelle: if art == 'bnotiz': dokl = DokumentList(where = 'fall_id = %s and art = %s and mtyp = %s \ and mit_id = %s'% (f['id'], cc('dokart', 'bnotiz'), cc('mimetyp', 'txt'), self.mitarbeiter['id']), order = 'vy,vm,vd') elif art == 'anotiz': aktendokl = DokumentList(where = 'fall_id = %s and mtyp = %s' % (f['id'], cc('mimetyp', 'txt')), order = 'vy,vm,vd') dokl = [] for d in aktendokl: if d['art'] != cc('dokart', 'bnotiz'): dokl.append(d) for b in dokl: try: data = open('%s/%s' % (akte_path, b['fname']), 'r').readlines() except Exception, e: meldung = {'titel':'Fehler', 'legende':'Fehlerbeschreibung', 'zeile1': str(e), 'zeile2':'Versuchen Sie es bitte erneut.'} return (meldung_t %meldung) zeilen = string.split(mk_columns(d['betr'],70),'\n') tx.textLine("%(vd)s.%(vm)s.%(vy)s: %(art__name)s." %b ) tx.textLine('Betr.: %s' % zeilen[0]) for z in zeilen[1:]: tx.textLine(" %s" % z)