def create_logout(): meta = { "clear_screen": False, "links": { "#": "00000" }, "publisher_color": 7 } data_cept = bytearray() data_cept.extend(Cept.parallel_mode()) data_cept.extend(Cept.clear_screen()) data_cept.extend(Cept.set_cursor(2, 1)) data_cept.extend(Cept.set_screen_bg_color(12)) data_cept.extend(Cept.set_fg_color(7)) data_cept.extend(Login_UI.btx_logo()) data_cept.extend(Cept.set_left_g3()) data_cept.extend(Cept.set_fg_color(15)) data_cept.extend(Cept.repeat("Q", 40)) data_cept.extend(Cept.set_fg_color(7)) data_cept.extend(Cept.set_left_g0()) data_cept.extend(Cept.set_cursor(19, 8)) data_cept.extend(Cept.from_str("Vielen Dank für Ihren Anruf!")) data_cept.extend(b'\r\n') data_cept.extend(b'\r\n') data_cept.extend(Cept.set_left_g3()) data_cept.extend(Cept.set_fg_color(15)) data_cept.extend(Cept.repeat("Q", 40)) return (meta, data_cept)
def create_page(pageid): ret = None # generated pages if pageid.startswith("00000") or pageid == "9a": # login ret = Login_UI.create_page(User.user(), pageid) basedir = PATH_DATA + "00000/" if not ret and (pageid.startswith("71") or pageid.startswith("78")): # historic page overview ret = Historic_UI.create_page(User.user(), pageid) basedir = PATH_DATA + "8/" if not ret and pageid.startswith("7"): # user management ret = User_UI.create_page(User.user(), pageid) basedir = PATH_DATA + "7/" if not ret and pageid.startswith("8"): # messaging ret = Messaging_UI.create_page(User.user(), pageid) basedir = PATH_DATA + "8/" if not ret and pageid.startswith("55"): # wikipedia basedir = PATH_DATA + "55/" ret = MediaWiki_UI.create_page(pageid, basedir) if not ret and pageid.startswith("35"): # Congress Wiki basedir = PATH_DATA + "55/" ret = MediaWiki_UI.create_page(pageid, basedir) if not ret and pageid.startswith("45"): # c64 wiki basedir = PATH_DATA + "45/" ret = MediaWiki_UI.create_page(pageid, basedir) if not ret and pageid.startswith("666"): # images ret = Image_UI.create_page(pageid) basedir = PATH_DATA + "55/" if not ret and pageid.startswith("6502"): # RSS basedir = PATH_DATA + "55/" ret = RSS_UI.create_page(pageid, basedir) if ret: (meta, data_cept) = ret else: basedir = None data_cept = None for dir in [ "", "hist/10/", "hist/11/" ]: for i in reversed(range(0, len(pageid))): testdir = PATH_DATA + dir + pageid[:i+1] if os.path.isdir(testdir): filename = pageid[i+1:] sys.stderr.write("filename: '" + filename + "'\n") basedir = testdir + "/" break if basedir: filename_meta = basedir + filename + ".meta" filename_cept = basedir + filename + ".cept" filename_cm = basedir + filename + ".cm" if os.path.isfile(filename_meta): with open(filename_meta) as f: meta = json.load(f) if os.path.isfile(filename_cept): with open(filename_cept, mode='rb') as f: data_cept = f.read() elif os.path.isfile(filename_cm): data_cept = CM.read(filename_cm) break if data_cept is None: return None try: with open(basedir + "a.glob") as f: glob = json.load(f) meta.update(glob) # combine dicts, glob overrides meta except: pass cept_1 = bytearray() cept_1.extend(Cept.hide_cursor()) if meta.get("clear_screen", False): cept_1.extend(Cept.serial_limited_mode()) cept_1.extend(Cept.clear_screen()) last_filename_include = "" sys.stderr.write("Clear Screen\n"); cept_1.extend(create_preamble(basedir, meta)) cept_2 = bytearray() if meta.get("cls2", False): cept_2.extend(Cept.serial_limited_mode()) cept_2.extend(Cept.clear_screen()) last_filename_include = "" # header if the data is actually there, if not ignore this try: hf = headerfooter(pageid, meta["publisher_name"], meta["publisher_color"]) cept_2.extend(hf) except: pass if meta.get("parallel_mode", False): cept_2.extend(Cept.parallel_mode()) # payload cept_2.extend(data_cept) cept_2.extend(Cept.serial_limited_mode()) # footer if it exists try: cept_2.extend(hf) except: pass cept_2.extend(Cept.sequence_end_of_page()) inputs = meta.get("inputs") return (cept_1, cept_2, meta["links"], inputs, meta.get("autoplay", False))
def create_login(): meta = { "clear_screen": False, "links": { }, "publisher_color": 7, "inputs": { "fields": [ { "name": "user_id", "hint": "Teilnehmernummer oder # eingeben", "line": 18, "column": 26, "height": 1, "width": 10, "bgcolor": 12, "fgcolor": 3 }, { "name": "ext", "hint": "Mitbenutzer oder # eingeben", "line": 18, "column": 37, "height": 1, "width": 1, "bgcolor": 12, "fgcolor": 3, "type": "number", "cursor_home": True, "default": "1" }, { "name": "password", "hint": "Nächstes Feld mit #; Leer für Gast", "line": 20, "column": 26, "height": 1, "width": 14, "bgcolor": 12, "fgcolor": 3, "type": "password", "validate": "call:Login_UI.callback_login" } ], "confirm": False, "target": "page:000001a", "no_navigation": True } } data_cept = bytearray() data_cept.extend(Cept.parallel_mode()) data_cept.extend(Cept.clear_screen()) data_cept.extend(Cept.set_cursor(2, 1)) data_cept.extend(Cept.set_screen_bg_color(12)) data_cept.extend(Cept.set_fg_color(7)) data_cept.extend(Login_UI.btx_logo()) data_cept.extend(Cept.set_left_g3()) data_cept.extend(Cept.set_fg_color(15)) data_cept.extend(Cept.repeat("Q", 40)) data_cept.extend(Cept.set_fg_color(7)) data_cept.extend(Cept.set_left_g0()) data_cept.extend(Cept.set_cursor(18, 8)) data_cept.extend(Cept.from_str("Teilnehmer")) data_cept.extend(Cept.set_cursor(18, 25)) data_cept.extend(b":") data_cept.extend(Cept.set_cursor(18, 36)) data_cept.extend(Cept.set_fg_color(3)) data_cept.extend(b'-') data_cept.extend(Cept.set_fg_color(7)) data_cept.extend(Cept.set_cursor(20, 8)) data_cept.extend(Cept.from_str("persönl. Kennwort:")) data_cept.extend(b'\r\n') data_cept.extend(Cept.set_left_g3()) data_cept.extend(Cept.set_fg_color(15)) data_cept.extend(Cept.repeat("Q", 40)) return (meta, data_cept)
def create_start(user): links = { "#": "0" } if user.messaging.has_new_messages(): links["8"] = "88" if user.user_id == "0": links["7"] = "77" meta = { "include": "a", "clear_screen": True, "links": links, "publisher_color": 7 } t = datetime.datetime.now() current_date = t.strftime("%d.%m.%Y %H:%M") if user.stats.last_login is not None: t = datetime.datetime.fromtimestamp(user.stats.last_login) last_date = t.strftime("%d.%m.%Y") last_time = t.strftime("%H:%M") else: last_date = "--.--.----" last_time = "--:--" user_name = "" if user.salutation: user_name += user.salutation + "\n" if user.first_name: user_name += user.first_name + "\n" if user.last_name: user_name += user.last_name + "\n" notifications = Login_UI.notifications(user) data_cept = bytearray() data_cept.extend(Cept.clear_screen()) data_cept.extend(Cept.cursor_home()) data_cept.extend(b'\n') data_cept.extend(Cept.set_palette(1)) data_cept.extend(Cept.set_screen_bg_color_simple(4)) data_cept.extend(Cept.load_g0_g0()) data_cept.extend(Cept.set_left_g0()) data_cept.extend(Cept.parallel_mode()) data_cept.extend(Cept.set_palette(0)) data_cept.extend(Cept.code_9e()) data_cept.extend(Cept.set_fg_color_simple(7)) data_cept.extend(Cept.load_g0_drcs()) data_cept.extend(Cept.set_left_g0()) data_cept.extend(b'!"#\r\n$%&') data_cept.extend(Cept.cursor_up()) data_cept.extend(Cept.cursor_right()) data_cept.extend(Cept.load_g0_g0()) data_cept.extend(Cept.set_left_g0()) data_cept.extend(b'\n') data_cept.extend(Cept.double_height()) data_cept.extend(Cept.from_str("Bildschirmtext")) data_cept.extend(b'\r\n') data_cept.extend(Cept.set_line_bg_color_simple(4)) data_cept.extend(b'\n') data_cept.extend(Cept.set_line_bg_color_simple(4)) data_cept.extend(Cept.set_palette(1)) data_cept.extend(Cept.double_height()) data_cept.extend(b'\r') data_cept.extend(Cept.from_str("Deutsche Bundespost")) data_cept.extend(b'\n\r') data_cept.extend(Cept.set_palette(0)) data_cept.extend(Cept.normal_size()) data_cept.extend(Cept.code_9e()) data_cept.extend(b'\r\n') data_cept.extend(Cept.set_fg_color_simple(3)) data_cept.extend(Cept.from_str(current_date)) data_cept.extend(Cept.set_fg_color_simple(7)) data_cept.extend(b'\r\n\n') data_cept.extend(Cept.from_str("Guten Tag")) data_cept.extend(b'\r\n') data_cept.extend(Cept.from_str(user_name)) data_cept.extend(b'\r\n') data_cept.extend(Cept.set_fg_color_simple(3)) data_cept.extend(Cept.from_str(notifications)) data_cept.extend(Cept.set_fg_color_simple(7)) data_cept.extend(Cept.set_cursor(19, 1)) data_cept.extend(Cept.from_str("Sie benutzten Bildschirmtext zuletzt")) data_cept.extend(b'\r\n') data_cept.extend(Cept.from_str("am ")) data_cept.extend(Cept.set_fg_color_simple(3)) data_cept.extend(Cept.from_str(last_date)) data_cept.extend(Cept.set_fg_color_simple(7)) data_cept.extend(Cept.from_str(" bis ")) data_cept.extend(Cept.set_fg_color_simple(3)) data_cept.extend(Cept.from_str(last_time)) data_cept.extend(Cept.set_fg_color_simple(7)) data_cept.extend(b'\r\n\r\n\r\n') data_cept.extend(Cept.set_line_bg_color_simple(4)) data_cept.extend(Cept.from_str("Weiter mit # oder *Seitennummer#")) return (meta, data_cept)