diff options
Diffstat (limited to 'templates/index.html')
| -rw-r--r-- | templates/index.html | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..cf4e616 --- /dev/null +++ b/templates/index.html | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | <html> | ||
| 2 | <title>AVON</title> | ||
| 3 | <head> | ||
| 4 | <style> | ||
| 5 | td { vertical-align: top; } | ||
| 6 | tr.color_1 { background: #ccc; } | ||
| 7 | table { border: none; } | ||
| 8 | </style> | ||
| 9 | </head> | ||
| 10 | <body> | ||
| 11 | <form action="/" METHOD="POST"> | ||
| 12 | {%- for field in range(1,5) -%} | ||
| 13 | <div class="search_entry"> | ||
| 14 | <select name="search_{{ field }}_column"> | ||
| 15 | {% set column_search = request.form.get('search_'+(field|string)+'_string', '') %} | ||
| 16 | {% if column_search | length %} | ||
| 17 | {% set column_val = request.form.get('search_'+(field|string)+'_column') %} | ||
| 18 | {% set operator_val = request.form.get('search_'+(field|string)+'_operator') %} | ||
| 19 | {% set any_val = request.form.get('search_'+(field|string)+'_any') %} | ||
| 20 | {% else %} | ||
| 21 | {% set column_val = ['nachname', 'vorname', 'ort', 'rufnummer'][field-1] %} | ||
| 22 | {% set operator_val = ['equals', 'contains', 'equals', 'contains'][field-1] %} | ||
| 23 | {% set any_val = ['', '', 'on', ''][field-1] %} | ||
| 24 | {% endif %} | ||
| 25 | {%- for column in [ ['vorname', 'Vorname'], ['nachname', 'Nachname'], ['zip', 'PLZ'], ['ort', 'Ort'], ['vorwahl', 'Vorwahl'], ['rufnummer', 'Rufnummer'], ['strasse', 'Straße'], ['hausnummer', 'Hausnummer'], ['zusaetze', 'Zusatz'], ['verweise', 'Verweise / Branche'], ['email', 'E-Mail'], ['web', 'Webseite'] ] -%} | ||
| 26 | <option value="{{ column[0] }}" {%- if column_val== column[0] -%}selected="selected"{%- endif -%}>{{ column[1] }}</option> | ||
| 27 | {%- endfor -%} | ||
| 28 | </select> | ||
| 29 | <select name="search_{{ field }}_operator"> | ||
| 30 | {%- for operator in [ [ 'equals', 'equals'], ['beginswith', 'begins with'], ['contains', 'contains' ], ['equalsnot', 'equals not'], ['containsnot', 'contains not'] ] -%} | ||
| 31 | <option value="{{ operator[0] }}" {%- if operator_val == operator[0] -%}selected="selected"{%- endif -%}>{{ operator[1] }}</option> | ||
| 32 | {%- endfor -%} | ||
| 33 | </select> | ||
| 34 | <input type="checkbox" name="search_{{ field }}_any" {%- if any_val == 'on' -%}checked="{%- endif -%}">any</input> | ||
| 35 | <input type="text" name="search_{{ field }}_string" value="{{ request.form.get('search_'+(field|string)+'_string', '') }}"> | ||
| 36 | </div> | ||
| 37 | {%- endfor -%} | ||
| 38 | <input type="submit" value="Search"> | ||
| 39 | </form> | ||
| 40 | {% if rows | length > 0 -%}<h3>Found {{ rows | length }} matches.</h3>{% endif %} | ||
| 41 | {% set color = { 'value': 0 } %} | ||
| 42 | <table> | ||
| 43 | <thead><td>flags</td><td>zip</td></thead> | ||
| 44 | {%- for row in rows -%} | ||
| 45 | {% set span = row[3:16] | reject("none") | map('length') | max %} | ||
| 46 | {% for r in range (span) %} | ||
| 47 | {% if ( r == 0 ) and ( color.update({ 'value': 1 - color.value }) ) %} {% endif %} | ||
| 48 | <tr class="color_{{ color.value }}"> | ||
| 49 | {%- if r == 0 -%} | ||
| 50 | <td rowspan="{{span}}">{{ convert.bits_to_years(row[0]|int) }} : {{ convert.bits_to_years(row[1]|int) }} : {{ convert.bits_to_years(row[2]|int) }}</td> | ||
| 51 | {%- endif -%} | ||
| 52 | {%- for c in range(3, 16) -%} | ||
| 53 | <td>{{ row[c][r] or '' }}</td> | ||
| 54 | {%- endfor -%} | ||
| 55 | </tr> | ||
| 56 | {%- endfor -%} | ||
| 57 | {%- endfor -%} | ||
| 58 | </table> | ||
| 59 | </body> | ||
| 60 | </html> | ||
