diff --git a/mo/web/org_contest.py b/mo/web/org_contest.py index fdebce5c5e6dd8e9629a809fa11ceeddcc9b2876..1d72081dedca35c262c95e284a454ca2cadc074e 100644 --- a/mo/web/org_contest.py +++ b/mo/web/org_contest.py @@ -25,7 +25,7 @@ from mo.util_format import inflect_number, inflect_by_number from mo.web import app import mo.web.util from mo.web.util import MODecimalField, PagerForm -from mo.web.table import CellCheckbox, Table, Row, Column, cell_pion_link, cell_place_link, cell_email_link +from mo.web.table import CellCheckbox, Table, Row, Column, cell_pion_link, cell_place_link, cell_email_link, cell_email_link_flags, CellMarkup import wtforms.validators as validators from wtforms.widgets.html5 import NumberInput @@ -551,16 +551,13 @@ def make_contestant_table(query: Query, round: db.Round, add_checkbox: bool = Fa html_attr = { 'class': 'state-' + pion.state.name } - if u.is_test: - html_attr['class'] += ' testuser' - html_attr['title'] = 'Testovací uživatel' rows.append(Row( keys={ 'sort_key': u.sort_key(), 'user_id': u.user_id, 'first_name': cell_pion_link(u, pion.contest_id, u.first_name), 'last_name': cell_pion_link(u, pion.contest_id, u.last_name), - 'email': cell_email_link(u), + 'email': cell_email_link_flags(u), 'school': pant.school_place.name, 'school_code': cell_place_link(pant.school_place, pant.school_place.get_code()), 'grade': pant.grade, diff --git a/mo/web/table.py b/mo/web/table.py index 4b4a15776665271741238ce4ae4a294764a51e2e..72cbbcd14fdf0c7c501ccdb610dcbc6d52ec3543 100644 --- a/mo/web/table.py +++ b/mo/web/table.py @@ -11,6 +11,7 @@ import werkzeug.exceptions from mo.csv import FileFormat import mo.db as db from mo.web import app +from mo.web.util import user_html_flags @dataclass @@ -200,6 +201,9 @@ class Table: def cell_email_link(user: db.User) -> CellLink: return CellLink(user.email, 'mailto:' + urllib.parse.quote(user.email, safe='@')) +def cell_email_link_flags(user: db.User) -> CellLink: + return CellLink(user.email, 'mailto:' + urllib.parse.quote(user.email, safe='@'), html_suffix=user_html_flags(user)) + def cell_user_link(user: db.User, text: str) -> CellLink: return CellLink(text, url_for('org_user', id=user.user_id)) diff --git a/mo/web/templates/org_contest_solutions.html b/mo/web/templates/org_contest_solutions.html index 7bda4f7c3466e544f126108be2883da21fed8a1c..7df83f66e70e2cf897b4b8c8fd0e841f129dbb05 100644 --- a/mo/web/templates/org_contest_solutions.html +++ b/mo/web/templates/org_contest_solutions.html @@ -61,7 +61,7 @@ konkrétní úlohu. Symbol <span class="icon">🗐</span> značí, že existuje </thead> {% for pion in pions %} {% set u = pion.user %} - <tr class="state-{{ pion.state.name }}{% if u.is_test %} testuser{% endif %}" {% if u.is_test %}title="Testovací uživatel"{% endif %}> + <tr class="state-{{ pion.state.name }}> <th>{{ u|pion_link(contest.contest_id) }} <td>{{ pion.state.friendly_name() }} {% set sum_points = [] %} diff --git a/mo/web/templates/org_contest_user.html b/mo/web/templates/org_contest_user.html index c6e8e4708b63e80fed734f3da89a82db61b0e151..d37540fb4adf55594f1b70a185cfd2171da08811 100644 --- a/mo/web/templates/org_contest_user.html +++ b/mo/web/templates/org_contest_user.html @@ -32,7 +32,7 @@ </thead> <tr><td>Jméno:<td>{{ user.first_name }} <tr><td>Příjmení:<td>{{ user.last_name }} - <tr><td>E-mail:<td>{{ user.email|mailto }} + <tr><td>E-mail:<td>{{ user.email|mailto }}{{ user|user_flags }} <tr><td>Škola:<td><a href='{{ url_for('org_place', id=pant.school) }}'>{{ pant.school_place.name }}</a> <tr><td>Třída:<td>{{ pant.grade }} <tr><td>Rok narození:<td>{{ pant.birth_year }} diff --git a/mo/web/templates/org_orgs.html b/mo/web/templates/org_orgs.html index 52d30633852c2aae12252ec7e3e1667c8b00de6a..dbd6cc7e52c2f7550237dd434fd46e35a19e1605 100644 --- a/mo/web/templates/org_orgs.html +++ b/mo/web/templates/org_orgs.html @@ -51,7 +51,7 @@ {% for user in users %} <tr> <td>{{ user.first_name }}</td><td>{{ user.last_name }}</td> - <td>{{ user.email|mailto }}{% if user.password_hash == None %}<span class="user-inactive" title='Účet dosud nebyl aktivován'> *</span>{% endif %}</td> + <td>{{ user.email|mailto }}{{ user|user_flags }}</td> <td>{% if user.is_admin %}správce{% elif user.roles|count == 0 %}<i>žádná role</i>{% else %} <ul> {% for role in user.roles %} diff --git a/mo/web/templates/org_submit_list.html b/mo/web/templates/org_submit_list.html index de2b4e61978bcfa29e4a95b554faf75390612d1d..ff445d3ee105f6eeae8c395321ade119702729ed 100644 --- a/mo/web/templates/org_submit_list.html +++ b/mo/web/templates/org_submit_list.html @@ -9,7 +9,7 @@ {% set site_id = sc.site.place_id if sc.site else None %} <table class="data"> - <tr><th>Účastník<td>{{ sc.user|pion_link(sc.contest.contest_id) }} + <tr><th>Účastník<td>{{ sc.user|pion_link(sc.contest.contest_id) }}{{ sc.user|user_flags }} <tr><th>Úloha<td><a href='{{ url_for('org_contest_task', contest_id=sc.contest.contest_id, site_id=site_id, task_id=sc.task.task_id) }}'>{{ sc.task.code }} {{ sc.task.name }}</a> {% if solution %} <tr><th>Body<td> diff --git a/mo/web/templates/org_users.html b/mo/web/templates/org_users.html index df46553b9fd9b0e76fca60cbba515cf236c8c9bf..e1b2b2f6e54997fd51082177402df64b0d4fb752 100644 --- a/mo/web/templates/org_users.html +++ b/mo/web/templates/org_users.html @@ -73,9 +73,9 @@ </tr> </thead> {% for user in users %} - <tr{% if user.is_test %} class="testuser" title="Testovací uživatel"{% endif %}> + <tr> <td>{{ user.first_name }}</td><td>{{ user.last_name }}</td> - <td>{{ user.email|mailto }}{% if user.password_hash == None %}<span class="user-inactive" title='Účet dosud nebyl aktivován'> *</span>{% endif %}</td> + <td>{{ user.email|mailto }}{{ user|user_flags }}</td> <td>{% if user.participants|count == 0 %}<i>v žádném ročníku</i>{% else %} <ul> {% for participant in user.participants %} diff --git a/mo/web/templates/parts/org_solution_table.html b/mo/web/templates/parts/org_solution_table.html index 6223a92c5a84f2968b5c654c19302788949d248d..c8a85be235225cd49e2808b69129e8d1d39e77c4 100644 --- a/mo/web/templates/parts/org_solution_table.html +++ b/mo/web/templates/parts/org_solution_table.html @@ -35,14 +35,14 @@ finální (ve výchozím stavu poslední nahrané).{% elif sc.allow_upload_solut {% set u = for_user or obj.user %} {% set task = for_task or obj %} {% if for_task %} - <tr class="state-{{ obj.state.name }}{% if u.is_test %} testuser{% endif %}" {% if u.is_test %}title="Testovací uživatel"{% endif %}> + <tr class="state-{{ obj.state.name }}"> {% else %} <tr> {% endif %} <td>{% if for_user %} <a href='{{ url_for('org_contest_task', contest_id=ct_id, task_id=task.task_id) }}'>{{ task.code }} {{ task.name }}</a> {% else %} - {{ u|pion_link(contest.contest_id) }}</a> + {{ u|pion_link(contest.contest_id) }}{{ u|user_flags }}</a> {% endif %} {% if for_task %}<td>{{ obj.state.friendly_name() }}{% endif %} {% if sol %}