瀏覽代碼

Displaying more bases. Added Prev/Next msg view.

We also display sorry, since links won't persist
after Sunday's message packing/renumbering.

Prev/Next buttons so you can skip through the
messages quicker.
root 4 年之前
父節點
當前提交
eea0ebf75a
共有 3 個文件被更改,包括 29 次插入3 次删除
  1. 16 2
      messages.py
  2. 7 1
      templates/list.html
  3. 6 0
      templates/message.html

+ 16 - 2
messages.py

@@ -30,8 +30,11 @@ bases = {
     "FSXNET-General": "msgs/fsx_gen",
     "FSXNET-BBS": "msgs/fsx_bbs",
     "FSXNET-BOT": "msgs/fsx_bot",
+    "FSXNET-Encryption": "msgs/fsx_cry",
+    "FSXNET-Ham Radio": "msgs/fsx_ham",
     "FSXNET-Magicka": "msgs/fsx_mag",
-    "HappyNet-General": "msgs/hpy_gen",
+    "FSXNET-Mystic": "msgs/fsx_mys",
+    # "HappyNet-General": "msgs/hpy_gen",
 }
 
 # bases = {"FSX_BOT": "fsx_bot"}
@@ -152,7 +155,7 @@ def display_message(area, msgno):
             "missing-area.html", base_path=base_path, title="Missing Area"
         )
 
-    # message = jammin.read_message(bases[area], msgno)
+# message = jammin.read_message(bases[area], msgno)
     message = get_message(bases[area], msgno)
 
     if not message:
@@ -163,6 +166,15 @@ def display_message(area, msgno):
             title="Missing Message",
         )
 
+    messages = get_messages(bases[area])
+    total = len(messages)
+    prevmsg = None
+    nextmsg = None
+    if (msgno > 1):
+        prevmsg = msgno - 1
+    if (msgno < total):
+        nextmsg = msgno + 1
+
     if "text" in message:
         if "\x1b" in message["text"]:
             # Ok, the message contains ANSI CODES -- Convert
@@ -178,6 +190,8 @@ def display_message(area, msgno):
         message=message,
         area=area,
         msgnumber=msgno,
+        prevmsg=prevmsg,
+        nextmsg=nextmsg,
         base_path=base_path,
         title="Message {0}".format(msgno),
     )

+ 7 - 1
templates/list.html

@@ -7,5 +7,11 @@
 {% block content %}
 {% for base in bases.keys() %}
 <div><a href="{{ url_for('display_messages', area=base) }}">{{ base }}</a></div>
+<div>&nbsp;</div>
 {% endfor %}
-{% endblock %}
+
+<p>Sorry, there's a "bug" in how the messages are on the BBS.
+Every Sunday messages are packed, and the message counter gets reset to 1.
+This results in links to messages breaking after Sunday's packing.</p>
+<p>Sorry.</p>
+{% endblock %}

+ 6 - 0
templates/message.html

@@ -8,6 +8,12 @@
 {% block content %}
 
 <div class="small-12 medium-12 large-12 cell">
+<div class="grid-x padding-x">
+    <div class="small-2 medium-2 large-2 cell">{% if prevmsg is not none %}
+    <a class="button" href="{{ url_for('display_message', area=area, msgno=prevmsg) }}">Previous</a>{% endif %}</div>
+    <div class="small-2 medium-2 large-2 cell">{% if nextmsg is not none %}
+    <a class="button" href="{{ url_for('display_message', area=area, msgno=nextmsg) }}">Next</a>{% endif %}</div>
+</div>
 
 <div class="grid-x padding-x">
     <div class="small-2 medium-2 large-2 cell">Message #:</div>