Skip to content
Snippets Groups Projects
Commit 9ca5b98d authored by Roang's avatar Roang
Browse files

Merge branch 'feature/archive_mode' into 'develop'

archive mode

See merge request !972
parents 74a39e75 3781a690
Branches
Tags
No related merge requests found
...@@ -52,6 +52,7 @@ env = environ.FileAwareEnv( ...@@ -52,6 +52,7 @@ env = environ.FileAwareEnv(
PRETIX_SECRET=(str, None), PRETIX_SECRET=(str, None),
METRICS_SERVER_IPS=(list, ['*']), METRICS_SERVER_IPS=(list, ['*']),
TIMEZONE=(str, 'Europe/Berlin'), TIMEZONE=(str, 'Europe/Berlin'),
ARCHIVE_MODE=(bool, False),
BIGBLUEBUTTON=(bool, False), BIGBLUEBUTTON=(bool, False),
BIGBLUEBUTTON_API_URL=(str, None), BIGBLUEBUTTON_API_URL=(str, None),
BIGBLUEBUTTON_API_TOKEN=(str, None), BIGBLUEBUTTON_API_TOKEN=(str, None),
...@@ -577,6 +578,9 @@ SELECTED_CONFERENCE_ID = env('SELECTED_CONFERENCE_ID') ...@@ -577,6 +578,9 @@ SELECTED_CONFERENCE_ID = env('SELECTED_CONFERENCE_ID')
# PlainUI Configuration # PlainUI Configuration
# ---------------------------------- # ----------------------------------
# archive mode disables user login etc.
ARCHIVE_MODE = env('ARCHIVE_MODE')
# Absolute url to use when dereferring links. Replaces `{quoted_target}` with the urlquoted target url # Absolute url to use when dereferring links. Replaces `{quoted_target}` with the urlquoted target url
# If you modify this on a non-empty database you should run `manage.py rerender_markdown` to update cashed markdown that contains old urls. # If you modify this on a non-empty database you should run `manage.py rerender_markdown` to update cashed markdown that contains old urls.
PLAINUI_DEREFERER_URL = env('PLAINUI_DEREFERER_URL') PLAINUI_DEREFERER_URL = env('PLAINUI_DEREFERER_URL')
......
import re import re
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.conf import settings
from typing import Any from typing import Any
from jinja2 import Environment, pass_context from jinja2 import Environment, pass_context
...@@ -275,6 +276,7 @@ def environment(**options): ...@@ -275,6 +276,7 @@ def environment(**options):
env = MyEnvironment(**{'extensions': ['jinja2.ext.i18n', 'jinja2.ext.debug'], **options}) env = MyEnvironment(**{'extensions': ['jinja2.ext.i18n', 'jinja2.ext.debug'], **options})
env.globals.update( env.globals.update(
{ {
'archive_mode': settings.ARCHIVE_MODE,
'browser_type': browser_type, 'browser_type': browser_type,
'build_report_url': build_report_url, 'build_report_url': build_report_url,
'css_scope': css_scope, 'css_scope': css_scope,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
{{ wikiMacro.card('_intro_badges', class="hub-col-remaining") }} {{ wikiMacro.card('_intro_badges', class="hub-col-remaining") }}
<div class="hub-card hub-col-325px"> <div class="hub-card hub-col-325px">
<h2 class="hub-section-title">{{ _("Redeem badge") }}</h2> <h2 class="hub-section-title">{{ _("Redeem badge") }}</h2>
{% if not archive_mode %}
<form <form
method="POST" method="POST"
action="{{ url("plainui:manage_badges") }}{%- if request.GET.next -%}?next={{ request.GET.next }}{%- endif -%}" action="{{ url("plainui:manage_badges") }}{%- if request.GET.next -%}?next={{ request.GET.next }}{%- endif -%}"
...@@ -36,6 +37,9 @@ ...@@ -36,6 +37,9 @@
{{ _("Manage badges") }} {{ _("Manage badges") }}
</a> </a>
</div> </div>
{% else %}
{{ _('archivemode_notavailable') }}
{% endif %}
</div> </div>
</div> </div>
...@@ -65,10 +69,12 @@ ...@@ -65,10 +69,12 @@
) }} ) }}
{% endfor %} {% endfor %}
{% if not archive_mode %}
<div class="hub-tag-divider"></div> <div class="hub-tag-divider"></div>
{{ tagbox.filter(_("yours"), 'owned', 'true') }} {{ tagbox.filter(_("yours"), 'owned', 'true') }}
{{ tagbox.filter(_("missing"), 'owned', 'false') }} {{ tagbox.filter(_("missing"), 'owned', 'false') }}
{% endif %}
</div> </div>
<div class="hub-card"> <div class="hub-card">
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
{% block content %} {% block content %}
{% if private %}{{ navMacro.top_nav(_("My Bulletin Board")) }}{%else%}{{ navMacro.top_nav(_("Bulletin Board")) }}{%endif%} {% if private %}{{ navMacro.top_nav(_("My Bulletin Board")) }}{%else%}{{ navMacro.top_nav(_("Bulletin Board")) }}{%endif%}
{% if not archive_mode %}
<div class="my-3"> <div class="my-3">
<ul class="mb-0 list-unstyled d-flex justify-content-center"> <ul class="mb-0 list-unstyled d-flex justify-content-center">
{% if current_user and not private %} {% if current_user and not private %}
...@@ -81,4 +82,7 @@ ...@@ -81,4 +82,7 @@
{%- endif %} {%- endif %}
</ul> </ul>
</div> </div>
{% else %}{# archive mode #}
{{ _('archivemode_notavailable') }}
{% endif %}
{% endblock %} {% endblock %}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#} #}
{% macro fav(fav_id, fav_type, fav_is, color="transparent", next=request.get_full_path() ) -%} {% macro fav(fav_id, fav_type, fav_is, color="transparent", next=request.get_full_path() ) -%}
{% if not archive_mode %}
<form action="{{ url('plainui:modify_favorites') }}" class="d-inline-block" method="POST"> <form action="{{ url('plainui:modify_favorites') }}" class="d-inline-block" method="POST">
{{ csrf_input }} {{ csrf_input }}
<input type="hidden" name="next" value="{{ next ~ '#fav_' ~ fav_id}}"> <input type="hidden" name="next" value="{{ next ~ '#fav_' ~ fav_id}}">
...@@ -29,9 +30,11 @@ ...@@ -29,9 +30,11 @@
</button> </button>
{% endif -%} {% endif -%}
</form> </form>
{% endif %}
{%- endmacro %} {%- endmacro %}
{% macro schedule(sch_id, sch_is, color="transparent", next=request.get_full_path() ) -%} {% macro schedule(sch_id, sch_is, color="transparent", next=request.get_full_path() ) -%}
{% if not archive_mode %}
<form action="{{ url('plainui:modify_personal_calendar') }}" class="d-inline-block" method="POST"> <form action="{{ url('plainui:modify_personal_calendar') }}" class="d-inline-block" method="POST">
{{ csrf_input }} {{ csrf_input }}
<input type="hidden" name="next" value="{{ next ~ '#sch_' ~ sch_id }}"> <input type="hidden" name="next" value="{{ next ~ '#sch_' ~ sch_id }}">
...@@ -53,6 +56,7 @@ ...@@ -53,6 +56,7 @@
</button> </button>
{% endif -%} {% endif -%}
</form> </form>
{% endif %}
{%- endmacro %} {%- endmacro %}
{% macro share(view_name, title=_("share this "), color="transparent") -%} {% macro share(view_name, title=_("share this "), color="transparent") -%}
...@@ -74,18 +78,22 @@ ...@@ -74,18 +78,22 @@
{%- endmacro %} {%- endmacro %}
# #
{% macro report(report_url=none, kind=none, next=none, lookup_key=none, title=_("report this url"), color="transparent" ) -%} {% macro report(report_url=none, kind=none, next=none, lookup_key=none, title=_("report this url"), color="transparent" ) -%}
{% if not archive_mode %}
<a href="{{ build_report_url(request, reported_url=report_url, kind=kind, next_url=next, lookup_key=lookup_key) }}" class="me-2 btn-icon-big btn btn-{{ color }}" title="{{ title }}"> <a href="{{ build_report_url(request, reported_url=report_url, kind=kind, next_url=next, lookup_key=lookup_key) }}" class="me-2 btn-icon-big btn btn-{{ color }}" title="{{ title }}">
<svg width="1.25rem" height="1.25rem" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500" style="enable-background:new 0 0 500 500" fill="currentColor"> <svg width="1.25rem" height="1.25rem" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500" style="enable-background:new 0 0 500 500" fill="currentColor">
<style>.st0{display:none}.st1{display:inline}.st2{fill:none;stroke:#000;stroke-width:18;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10}</style> <style>.st0{display:none}.st1{display:inline}.st2{fill:none;stroke:#000;stroke-width:18;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10}</style>
<g><path d="M248.37 310.4c-9.86 0-16.38 1.9-19.56 5.7-3.19 3.8-4.78 10.01-4.78 18.63 0 8.83 1.59 15.1 4.78 18.79 3.18 3.7 9.7 5.54 19.56 5.54 9.85 0 16.32-1.85 19.4-5.54 3.08-3.7 4.62-9.96 4.62-18.79 0-8.62-1.53-14.83-4.62-18.63-3.08-3.8-9.55-5.7-19.4-5.7zM224.96 160.55c-1.23 1.34-1.85 2.93-1.85 4.78l10.78 126.29h29.57l10.47-126.29c0-1.85-.56-3.44-1.69-4.78-1.13-1.33-3.74-2-7.85-2h-32.03c-3.71 0-6.17.67-7.4 2z"/><path d="M448.65 237.65 262.3 51.3a16.992 16.992 0 0 0-24.04 0L51.9 237.65c-6.64 6.64-6.64 17.4 0 24.04l186.35 186.35a16.992 16.992 0 0 0 24.04 0l186.35-186.35c6.65-6.64 6.65-17.4.01-24.04zM250.27 411.98 87.96 249.67 250.28 87.36l162.31 162.31-162.32 162.31z"/></g> <g><path d="M248.37 310.4c-9.86 0-16.38 1.9-19.56 5.7-3.19 3.8-4.78 10.01-4.78 18.63 0 8.83 1.59 15.1 4.78 18.79 3.18 3.7 9.7 5.54 19.56 5.54 9.85 0 16.32-1.85 19.4-5.54 3.08-3.7 4.62-9.96 4.62-18.79 0-8.62-1.53-14.83-4.62-18.63-3.08-3.8-9.55-5.7-19.4-5.7zM224.96 160.55c-1.23 1.34-1.85 2.93-1.85 4.78l10.78 126.29h29.57l10.47-126.29c0-1.85-.56-3.44-1.69-4.78-1.13-1.33-3.74-2-7.85-2h-32.03c-3.71 0-6.17.67-7.4 2z"/><path d="M448.65 237.65 262.3 51.3a16.992 16.992 0 0 0-24.04 0L51.9 237.65c-6.64 6.64-6.64 17.4 0 24.04l186.35 186.35a16.992 16.992 0 0 0 24.04 0l186.35-186.35c6.65-6.64 6.65-17.4.01-24.04zM250.27 411.98 87.96 249.67 250.28 87.36l162.31 162.31-162.32 162.31z"/></g>
</svg> </svg>
</a> </a>
{% endif %}
{%- endmacro %} {%- endmacro %}
{% macro edit(edit, title=_("edit this"), color="transparent" ) -%} {% macro edit(edit, title=_("edit this"), color="transparent" ) -%}
{% if not archive_mode %}
<a href="{{ edit }}" class="me-2 btn-icon-big btn btn-{{ color }}" title="{{ title }}"> <a href="{{ edit }}" class="me-2 btn-icon-big btn btn-{{ color }}" title="{{ title }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5L13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175l-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/> <path fill-rule="evenodd" d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5L13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175l-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/>
</svg> </svg>
</a> </a>
{% endif %}
{%- endmacro %} {%- endmacro %}
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
{%- endmacro %} {%- endmacro %}
{% macro dms() %} {% macro dms() %}
{% if not archive_mode %}
{% set chat_url = url('plainui:personal_message') %} {% set chat_url = url('plainui:personal_message') %}
{% set num_unread = num_of_unread_messages(request) -%} {% set num_unread = num_of_unread_messages(request) -%}
<a <a
...@@ -32,6 +33,7 @@ ...@@ -32,6 +33,7 @@
</span> </span>
{% endif %} {% endif %}
</a> </a>
{% endif %}
{% endmacro %} {% endmacro %}
{% macro usermenu() %} {% macro usermenu() %}
...@@ -40,7 +42,14 @@ ...@@ -40,7 +42,14 @@
<i class="bi bi-person-circle hub-top-nav__button-icon"> </i> <i class="bi bi-person-circle hub-top-nav__button-icon"> </i>
</a> </a>
<ul class="dropdown-menu dropdown-menu-start" aria-labelledby="navbarDropdown"> <ul class="dropdown-menu dropdown-menu-start" aria-labelledby="navbarDropdown">
{% if request.user.is_authenticated %} {% if archive_mode %}
<li><a class="dropdown-item disabled text-decoration-line-through"
disabled="disabled"
href="#"
title="{{ _("archivemode_loginlink_hint") }}">
Login</a>
</li>
{% elif request.user.is_authenticated %}
<li> <li>
{% set num_of_pending_badges = num_of_pending_badges(request) -%} {% set num_of_pending_badges = num_of_pending_badges(request) -%}
<a <a
...@@ -87,6 +96,7 @@ ...@@ -87,6 +96,7 @@
{% endmacro %} {% endmacro %}
{% macro createmenu() %} {% macro createmenu() %}
{% if not archive_mode %}
<div class="dropdown"> <div class="dropdown">
<button <button
class="hub-top-nav__button dropdown-toggle me-2" class="hub-top-nav__button dropdown-toggle me-2"
...@@ -117,6 +127,7 @@ ...@@ -117,6 +127,7 @@
</li> </li>
</ul> </ul>
</div> </div>
{% endif %}
{% endmacro %} {% endmacro %}
{# {#
...@@ -126,10 +137,12 @@ ...@@ -126,10 +137,12 @@
{% macro top_nav(title, has_breadcrumbs=False) %} {% macro top_nav(title, has_breadcrumbs=False) %}
<div class="hub-top-nav {% if has_breadcrumbs %}hub-top-nav--breadcrumbs{% endif %}"> <div class="hub-top-nav {% if has_breadcrumbs %}hub-top-nav--breadcrumbs{% endif %}">
<h1 class="hub-head-page">{{ title }}</h1> <h1 class="hub-head-page">{{ title }}</h1>
{% if not archive_mode %}
<form method="POST" action="{{ url('plainui:search') }}" role="search"> <form method="POST" action="{{ url('plainui:search') }}" role="search">
{{ csrf_input }} {{ csrf_input }}
<input class="form-control" name="q" type="text" placeholder="{{ _("search") }}" value="{% if search_query is defined %}{{ search_query }}{% endif %}"> <input class="form-control" name="q" type="text" placeholder="{{ _("search") }}" value="{% if search_query is defined %}{{ search_query }}{% endif %}">
</form> </form>
{% endif %}
<div class="hub-top-nav__buttons"> <div class="hub-top-nav__buttons">
{{ dms() }} {{ dms() }}
{{ createmenu() }} {{ createmenu() }}
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
</figure> </figure>
<div class="mw-320 mx-auto"> <div class="mw-320 mx-auto">
<h2>{{ _("Login") }}</h2> <h2>{{ _("Login") }}</h2>
{% if not archive_mode %}
<form method="POST" id="login" class="hub-landing__form"> <form method="POST" id="login" class="hub-landing__form">
<!--<h1 class="text-center bg-secondary p-2 text-dark h3 m-0">{{ _("login") }}</h1>--> <!--<h1 class="text-center bg-secondary p-2 text-dark h3 m-0">{{ _("login") }}</h1>-->
<div class=""> <div class="">
...@@ -46,6 +47,9 @@ ...@@ -46,6 +47,9 @@
</div> </div>
</div> </div>
</form> </form>
{% else %}
<p class="mb-2 text-white">{{ _("archivemode_nologin") }}</p>
{% endif %}
</div> </div>
<hr class="hub-spacer"> <hr class="hub-spacer">
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
{% endif %} {% endif %}
</div> </div>
{% if voc_stream %} {% if voc_stream and not archive_mode %}
<div class="hub-card"> <div class="hub-card">
<h2 class="hub-section-title mb-0">{{ _("Currently Streaming") }}</h2> <h2 class="hub-section-title mb-0">{{ _("Currently Streaming") }}</h2>
{{ integrations.vocPlayer(vocStream=voc_stream) }} {{ integrations.vocPlayer(vocStream=voc_stream) }}
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<p>{{ _("Registration Info Text") }}</p> <p>{{ _("Registration Info Text") }}</p>
{% if not archive_mode %}
<form <form
method="POST" method="POST"
id="registration" id="registration"
...@@ -35,6 +36,9 @@ ...@@ -35,6 +36,9 @@
</ul> </ul>
</div> </div>
</form> </form>
{% else %}
<p class="mb-2 text-white">{{ _("archivemode_nologin") }}</p>
{% endif %}
<hr class="hub-spacer"> <hr class="hub-spacer">
</article> </article>
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
{{ navMacro.top_nav(_("Wiki page")) }} {{ navMacro.top_nav(_("Wiki page")) }}
{% if not archive_mode %}
<div class="row"> <div class="row">
<div class="col m-2 d-flex justify-content-start"> <div class="col m-2 d-flex justify-content-start">
<a href="{{ url('plainui:static_page_global_history') }}" class="btn btn-dark me-2">{{ _("Global History") }}</a> <a href="{{ url('plainui:static_page_global_history') }}" class="btn btn-dark me-2">{{ _("Global History") }}</a>
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
<a href="{{ url('plainui:static_page_history', page_slug=page_slug) }}" class="btn btn-dark">{{ _("History") }}</a> <a href="{{ url('plainui:static_page_history', page_slug=page_slug) }}" class="btn btn-dark">{{ _("History") }}</a>
</div> </div>
</div> </div>
{% endif %}
<div class="hub-card"> <div class="hub-card">
<h2 class="hub-section-title">{{ page.title }}</h2> <h2 class="hub-section-title">{{ page.title }}</h2>
......
...@@ -147,6 +147,9 @@ msgstr "Einlösen" ...@@ -147,6 +147,9 @@ msgstr "Einlösen"
msgid "Manage badges" msgid "Manage badges"
msgstr "Badge-Verwaltung" msgstr "Badge-Verwaltung"
msgid "archivemode_notavailable"
msgstr "Diese Funktion steht nicht mehr zur Verfügung, da die Webseite archiviert wurde."
msgid "all" msgid "all"
msgstr "alle" msgstr "alle"
...@@ -322,6 +325,9 @@ msgstr "Kapazität" ...@@ -322,6 +325,9 @@ msgstr "Kapazität"
msgid "chat" msgid "chat"
msgstr "DNs" msgstr "DNs"
msgid "archivemode_loginlink_hint"
msgstr "nicht verfügbar, Seite ist archiviert"
msgid "profile" msgid "profile"
msgstr "Profil" msgstr "Profil"
...@@ -449,6 +455,9 @@ msgstr "Neu hier?" ...@@ -449,6 +455,9 @@ msgstr "Neu hier?"
msgid "sign up (new account)" msgid "sign up (new account)"
msgstr "Account anlegen" msgstr "Account anlegen"
msgid "archivemode_nologin"
msgstr "Diese Webseite wurde archiviert, ein Login ist nicht mehr möglich."
msgid "Profile" msgid "Profile"
msgstr "Profil" msgstr "Profil"
......
...@@ -132,6 +132,9 @@ msgstr "" ...@@ -132,6 +132,9 @@ msgstr ""
msgid "assembly badges" msgid "assembly badges"
msgstr "" msgstr ""
msgid "archivemode_notavailable"
msgstr "This function is not available any more as this website has been archived."
msgid "all" msgid "all"
msgstr "" msgstr ""
...@@ -301,6 +304,9 @@ msgstr "" ...@@ -301,6 +304,9 @@ msgstr ""
msgid "chat" msgid "chat"
msgstr "DMs" msgstr "DMs"
msgid "archivemode_loginlink_hint"
msgstr "not available, page has been archived"
msgid "profile" msgid "profile"
msgstr "" msgstr ""
...@@ -428,6 +434,9 @@ msgstr "New here?" ...@@ -428,6 +434,9 @@ msgstr "New here?"
msgid "sign up (new account)" msgid "sign up (new account)"
msgstr "Sign up" msgstr "Sign up"
msgid "archivemode_nologin"
msgstr "This website has been archived, logging in is not possible any more."
msgid "Profile" msgid "Profile"
msgstr "" msgstr ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment