-
-html_head = """
-<style>
-tr:nth-child(even) {
- background-color: #f2f2f2;
-}
-tr:nth-child(odd) {
- background-color: #ffffff;
-}
-th, td { border: 1px solid black; text-align: left; vertical_align: top; }
-td details { display: inline }
-td.input { width: 100%; }
-td.checkbox { width: 1.5em; }
-th.checkbox { width: 1.5em; }
-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{% if date %}?date={{date}}{% endif %}">choose tasks</a>
-<a href="{{db.prefix}}/day?{% if date %}date={{date}}&{% endif %}hide_unchosen=1">do tasks</a>
-| <a href="{{db.prefix}}/calendar?t_and=calendar">calendar</a>
-<hr />
-"""
-form_footer = '\n</form>'
-
-form_header_tmpl = """
-<form action="{{action|e}}" method="POST">
-"""
-calendar_tmpl = """
-<table>
-{% for date, day in days.items() | sort(reverse=True) %}
-<tr><td colspan=3><a href="{{db.prefix}}/day?date={{date}}&hide_unchosen=1">{{ date }}</a> {{ day.weekday }} ({{ 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 }}">{{ todo.title }}</a></td><td>{{ todo.comment|e }}</td></tr>
-{% endif %}
-{% endfor %}
-{% endfor %}
-</table>
-"""
-todo_tmpl = """
-<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=5 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>
-</table>
-<input type="submit" value="update" />
-"""
-task_tmpl = """
-<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=5 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 class="input"><input name="tags" type="text" value="{{ task.tags_joined|e }}" ><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" />
-"""
-# archived_days_tmpl = """
-# <table>
-# {% for date, day in days.items() | sort(reverse=True) %}
-# {% if day.archived %}
-# <tr><td>{{ date }} {{ day.weekday }} ({{ day.todos_sum|round(2) }}) {{ day.comment|e }} <input type="submit" name="edit_{{date}}" value="edit" /></td></tr>
-# {% for task, todo in day.todos.items() | sort(attribute='1.title', reverse=True) %}
-# <tr><td>{{ todo.title }}</td><td>{% if todo.done %}✓{% endif %}</td><td>{{ todo.weight }}</td></tr>
-# {% endfor %}
-# {% endif %}
-# {% endfor %}
-# </table>
-# """
-day_tmpl = """
-<input type="submit" value="OK">
-hide unchosen: <input name="hide_unchosen" type="checkbox" {% if db.hide_unchosen %}checked{% endif %} /><br />
-mandatory tags: {% for t_tag in db.t_tags | sort %}
-<input name="t_filter_and" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_and %} checked {% endif %} >{{ t_tag }}
-{% endfor %}
-<br />
-forbidden tags: {% for t_tag in db.t_tags | sort %}
-<input name="t_filter_not" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_not %} checked {% endif %} >{{ t_tag }}
-{% endfor %}
-</p>
-
-<p>
-<input type="hidden" name="original_selected_date" value="{{ db.selected_date }}" />
-<a href="{{db.prefix}}/day?date={{prev_date}}{% if db.hide_unchosen %}&hide_unchosen=1{% endif %}">prev</a> <a href="{{db.prefix}}/day?date={{next_date}}{% if db.hide_unchosen %}&hide_unchosen=1{% endif %}">next</a> date: <input name="new_selected_date" value="{{ db.selected_date }}" size=8 /> {{ db.selected_day.todos_sum|round(2) }} ({{ db.selected_day.todos_sum2|round(2)}}) comment: <input name="comment" value="{{ db.selected_day.comment|e }}">
-</p>
-
-<table>
-<tr><th>task</th><th class="checkbox">choose?</th><th class="checkbox">done?</th><th>weight</th><th>comment</th></tr>
-{% for uuid, t in db.tasks.items() | sort(attribute='1.title', reverse=True) %}
-{% if t.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?date={{ db.selected_date }}&t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</details></td>
-<td><input name="choose" type="checkbox" value="{{ uuid }}" {% if uuid in db.selected_day.todos.keys() %}checked{% endif %} ></td>
-<td class="checkbox"><input name="done" type="checkbox" value="{{ uuid }}" {% if uuid in db.selected_day.todos.keys() and db.selected_day.todos[uuid].done %}checked{% endif %} ></td>
-<td class="checkbox"><input name="day_weight" type="number" step=0.1 size=5 value="{% if uuid in db.selected_day.todos.keys() and db.selected_day.todos[uuid].day_weight %}{{ db.selected_day.todos[uuid].day_weight }}{% endif %}" placeholder={{ t.current_default_weight }} ></td>
-<td type="input"><input name="todo_comment" type="text" value="{% if uuid in db.selected_day.todos.keys() %}{{ db.selected_day.todos[uuid].comment|e }}{% endif %}" ></td>
-</tr>
-{% endif %}
-{% endfor %}
-</table>
-<input type="submit" value="OK">
-"""
-tasks_tmpl = """
-<p>
-<input type="submit" value="OK"> mandatory tags: {% for t_tag in db.t_tags | sort %}
-<input name="t_filter_and" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_and %} checked {% endif %} >{{ t_tag }}
-{% endfor %}
-<br />
-forbidden tags: {% for t_tag in db.t_tags | sort %}
-<input name="t_filter_not" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_not %} checked {% endif %} >{{ t_tag }}
-{% endfor %}
-</p>
-<table>
-<tr><th>default<br />weight</th><th>task</th><th>tags</th></tr>
-{% for uuid, t in db.tasks.items() | sort(attribute='1.title', reverse=True) %}
-{% if t.visible %}
-<tr>
-<td>{{ 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>
-"""
-# selected_day_tmpl = """
-# <p>
-# hide unchosen: <input name="hide_unchosen" type="checkbox" {% if db.hide_unchosen %}checked{% endif %} /><br />
-# mandatory tags: {% for t_tag in db.t_tags | sort %}
-# <input name="t_filter_and" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_and %} checked {% endif %} >{{ t_tag }}
-# {% endfor %}
-# <br />
-# forbidden tags: {% for t_tag in db.t_tags | sort %}
-# <input name="t_filter_not" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_not %} checked {% endif %} >{{ t_tag }}
-# {% endfor %}
-# </p>
-#
-# <p>
-# <input type="hidden" name="original_selected_date" value="{{ db.selected_date }}" />
-# date: <input name="new_selected_date" value="{{ db.selected_date }}" size=8 /> {{ db.selected_day.todos_sum|round(2) }} ({{ db.selected_day.todos_sum2|round(2)}}) comment: <input name="comment" value="{{ db.selected_day.comment|e }}">
-# </p>
-#
-# <table>
-# <tr><th>default<br />weight</th><th>title</th><th>tags</th><th>choose?</th><th>done?</th><th>day<br />weight</th></tr>
-# {% for uuid, t in db.tasks.items() | sort(attribute='1.title', reverse=True) %}
-# {% if t.visible %}
-# <input name="t_uuid" value="{{ uuid }}" type="hidden" >
-# <tr>
-# <td><input name="t_default_weight" value="{{ t.default_weight }}" type="number" step=0.1 size=5 required/></td>
-# <td><input name="t_title" value="{{ t.title|e }}"/></td>
-# <td><input name="t_tags" value="{{ t.tags_joined|e }}" >
-# <td><input name="choose" type="checkbox" value="{{ uuid }}" {% if uuid in db.selected_day.todos.keys() %}checked{% endif %} ></td>
-# <td><input name="done" type="checkbox" value="{{ uuid }}" {% if uuid in db.selected_day.todos.keys() and db.selected_day.todos[uuid].done %}checked{% endif %} ></td>
-# <td colspan=2><input name="day_weight" type="number" step=0.1 size=5 value="{% if uuid in db.selected_day.todos.keys() and db.selected_day.todos[uuid].day_weight %}{{ db.selected_day.todos[uuid].day_weight }}{% endif %}" ></td>
-# </tr>
-# {% endif %}
-# {% endfor %}
-# </table>
-# <input type="submit" value="OK">
-# """