-
-html_head = """
-<style>
-body { font-family: monospace; }
-table.alternating tr:nth-child(even) {
- background-color: #f2f2f2;
-}
-table.alternating tr:nth-child(odd) {
- background-color: #ffffff;
-}
-th, td { text-align: left; vertical_align: top; border-bottom: 1px dotted black; }
-td details { display: inline }
-td.input { width: 100%; }
-td.number { text-align: right; }
-td.checkbox { width: 0.1em; height: 0.1em; padding: 0em; text-align: center; }
-tr.week_row td { height: 0.1em; border: 0px; background-color: black; }
-tr.day_row td { background-color: #f2f2f2 }
-input { font-family: monospace; padding: 0em; margin: 0em; }
-input[type="number"] { font-family: monospace; text-align: right; }
-input[type="text"] { width: 100%; box-sizing: border-box; }
-</style>
-<body>
-tasks: <a href="{{db.prefix}}/tasks">list</a> <a href="{{db.prefix}}/add_task">add</a> | day:
-<a href="{{db.prefix}}/day?hide_unchosen=0&hide_done=0">choose tasks</a>
-<a href="{{db.prefix}}/day?hide_unchosen=1&hide_done=1">do tasks</a>
-| <a href="{{db.prefix}}/calendar">calendar</a>
-| <a href="{{db.prefix}}/unset_cookie">unset cookie</a>
-<hr />
-"""
-form_footer = '\n</form>'
-form_header_tmpl = """
-<form action="{{action|e}}" method="POST">
-"""
-calendar_tmpl = """
-<p>
-from: <input name="start" {% if start_date %}value="{{ start_date }}"{% endif %} placeholder="{{ today }}" />
-to: <input name="end" {% if end_date %}value="{{ end_date }}"{% endif %} placeholder="2030-12-31" />
-<input type="submit" value="OK" />
-</p>
-<table>
-{% for date, day in days.items() | sort() %}
-{% if day.weekday == "Mo" %}<tr class="week_row"><td colspan=3></td></tr>{% endif %}
-<tr class="day_row"><td colspan=3><a href="{{db.prefix}}/day?selected_date={{date}}&hide_unchosen=1">{{ day.weekday }} {{ date }}</a> |{{ '%04.1f' % day.todos_sum|round(2) }}| {{ day.comment|e }}</td></tr>
-{% for task, todo in day.todos.items() | sort(attribute='1.title', reverse=True) %}
-{% if todo.visible %}
-<tr><td class="checkbox">{% if todo.done %}✓{% else %} {% endif %}</td><td><a href="{{db.prefix}}/todo?task={{ todo.task.id_ }}&date={{ date }}">{%if "cancelled" in todo.tags%}<s>{% endif %}{% if "deadline" in todo.tags %}DEADLINE: {% endif %}{{ todo.title|e }}{%if "cancelled" in todo.tags%}</s>{% endif %}</a></td><td>{{ todo.comment|e }}</td></tr>
-{% endif %}
-{% endfor %}
-{% endfor %}
-</table>
-"""
-todo_tmpl = """
-<h3>todo</h3>
-<input type="hidden" name="task_uuid" value="{{ todo.task.id_ }}" />
-<input type="hidden" name="date" value="{{ todo.day.date }}" />
-<table>
-<tr><th>task</th><td><a href="{{db.prefix}}/task?id={{ todo.task.id_ }}">{{ todo.task.title|e }}</a></td></tr>
-<tr><th>default weight</th><td>{{ todo.default_weight }}</td></tr>
-<tr><th>day</th><td>{{ todo.day.date }}</td></tr>
-<tr><th>day weight</th><td class="input"><input type="number" name="day_weight" step=0.1 size=8 value="{{ todo.day_weight }}" /></td></tr>
-<tr><th>comment</th><td class="input"><input type="text" name="comment" value="{{todo.comment|e}}" /></td></tr>
-<tr><th>done</th><td class="input"><input type="checkbox" name="done" {% if todo.done %}checked{% endif %}/></td></tr>
-<tr><th>day tags</th>
-<td>
-{% for tag in db.t_tags | sort %}
-{% if tag in todo.task.tags %} ✓{% else %}<input type="checkbox" name="day_tag_{{tag|e}}"{% if tag in todo.day_tags %} checked{% endif %}/>{% endif %} {{ tag }}<br />
-{% endfor %}
-add: <input name="day_tags_joined" type="text" value="" >
-</td>
-</tr>
-</table>
-<input type="submit" value="update" />
-"""
-task_tmpl = """
-<h3>task</h3>
-<input type="hidden" name="id" value="{{ task.id_ }}" />
-<table>
-<tr><th>title</th><td class="input"><input name="title" type="text" value="{{ task.title|e }}" /><details><summary>history</summary><ul>{% for k,v in task.title_history.items() | sort(attribute='0', reverse=True) %}<li>{{ k }}: {{ v|e }}{% endfor %}</ul></details></td></tr>
-<tr><th>default weight</th><td class="input"><input type="number" name="default_weight" value="{{ task.default_weight }}" step=0.1 size=8 required /><details><summary>history</summary><ul>{% for k,v in task.default_weight_history.items() | sort(attribute='0', reverse=True) %}<li>{{ k }}: {{ v|e }}{% endfor %}</ul></details></td></tr>
-<tr><th>tags</th>
-<td>
-{% for tag in db.t_tags | sort %}
-<input type="checkbox" name="tag_{{tag|e}}"{% if tag in task.tags %} checked{% endif %}/> {{ tag }}<br />
-{% endfor %}
-add: <input name="tags_joined" type="text" value="" ><br />
-<details><summary>history</summary><ul>{% for k,v in task.tags_history.items() | sort(attribute='0', reverse=True) %}<li>{{ k }}: {{ v|e }}{% endfor %}</ul></details>
-</td></tr>
-</table>
-<input type="submit" value="update" />
-"""
-day_tmpl = """
-<p>
-<input name="hide_unchosen" type="checkbox" {% if db.hide_unchosen %}checked{% endif %} /> hide unchosen <input name="hide_done" type="checkbox" {% if db.hide_done %}checked{% endif %} /> hide done |
-<a href="{{db.prefix}}/day?selected_date={{prev_date}}">prev</a> <a href="{{db.prefix}}/day?selected_date={{next_date}}">next</a> |
-<input type="hidden" name="original_selected_date" value="{{ db.selected_date }}" />
-date: <input name="new_selected_date" value="{{ db.selected_date }}" size=10 /> |
-{{ db.selected_day.todos_sum|round(2) }} ({{ db.selected_day.todos_sum2|round(2)}}) |
-comment: <input name="day_comment" value="{{ db.selected_day.comment|e }}">
-</p>
-
-<table class="alternating">
-<tr><th>task</th><th class="checkbox">choose?</th><th class="checkbox">done?</th><th>weight</th><th>edit?</th><th>day tags</th><th>comment</th></tr>
-{% for uuid, t in db.tasks.items() | sort(attribute='1.title') %}
-{% if t.visible and (uuid not in db.selected_day.todos.keys() or db.selected_day.todos[uuid].visible) %}
-<tr>
-<input name="t_uuid" value="{{ uuid }}" type="hidden" >
-<td><details><summary>] <a href="{{db.prefix}}/task?id={{ uuid }}" />{{ t.current_title|e }}</a></summary>tags: {% for tag in t.tags | sort %}<a href="{{db.prefix}}/day?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</details></td>
-{% if uuid in db.selected_day.todos.keys() %}
-<td class="checkbox"><input name="choose" type="checkbox" value="{{ uuid }}" checked></td>
-<td class="checkbox"><input name="done" type="checkbox" value="{{ uuid }}" {% if db.selected_day.todos[uuid].done %}checked{% endif %}></td>
-<td class="checkbox"><input name="day_weight" type="number" step=0.1 size=8 value="{% if db.selected_day.todos[uuid].day_weight is not none %}{{ db.selected_day.todos[uuid].day_weight }}{% endif %}" placeholder={{ t.current_default_weight }} ></td>
-<td><a href="{{db.prefix}}/todo?task={{uuid}}&date={{ db.selected_date }}">edit</a></td>
-<td>{% for tag in db.selected_day.todos[uuid].day_tags | sort %}<a href="{{db.prefix}}/tags?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</td>
-<td>{{ db.selected_day.todos[uuid].comment|e }}</td>
-{% else %}
-<td class="checkbox"><input name="choose" type="checkbox" value="{{ uuid }}"</td>
-<td class="checkbox"><input name="done" type="checkbox" value="{{ uuid }}"></td>
-<td class="checkbox"><input name="day_weight" type="number" step=0.1 size=8 placeholder={{ t.current_default_weight }} ></td>
-<td></td>
-<td></td>
-<td></td>
-{% endif %}
-</tr>
-{% endif %}
-{% endfor %}
-</table>
-<input type="submit" value="OK">
-"""
-tag_filters_tmpl = """
-<p style="float: left; margin-right: 1em;">
-<input type="submit" value="OK">
-</p>
-<p>
-mandatory tags:
-{% for and_filter in db.t_filter_and %}
-<select name="t_and">
-<option></option>
-{% for tag in db.t_tags | sort %}
-<option value="{{tag|e}}" {% if and_filter == tag %}selected{% endif %}>{{tag|e}}</option>
-{% endfor %}
-</select>
-{% endfor %}
-<select name="t_and">
-<option></option>
-{% for tag in db.t_tags | sort %}
-<option value="{{tag|e}}">{{tag|e}}</option>
-{% endfor %}
-</select>
-<br />
-forbidden tags:
-{% for not_filter in db.t_filter_not %}
-<select name="t_not">
-<option></option>
-{% for tag in db.t_tags | sort %}
-<option value="{{tag|e}}" {% if not_filter == tag %}selected{% endif %}>{{tag|e}}</option>
-{% endfor %}
-</select>
-{% endfor %}
-<select name="t_not">
-<option></option>
-{% for tag in db.t_tags | sort %}
-<option value="{{tag|e}}">{{tag|e}}</option>
-{% endfor %}
-</select>
-</p>
-"""
-tasks_tmpl = """
-<table class="alternating">
-<tr><th>default<br />weight</th><th>task</th><th>tags</th></tr>
-{% for uuid, t in db.tasks.items() | sort(attribute='1.title') %}
-{% if t.visible %}
-<tr>
-<td class="number">{{ t.default_weight }}</a></td>
-<td><a href="{{db.prefix}}/task?id={{ uuid }}" />{{ t.title|e }}</a></td>
-<td>{% for tag in t.tags | sort %}<a href="{{db.prefix}}/tags?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</td>
-{% endif %}
-{% endfor %}
-</table>
-"""