~speakman/ppvalbok/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{% extends "base.html" %}

{% block title %}Redigera vallokal {{ station.name }}{% endblock%}
{% block script %}
<style type="text/css">
	div.message {
	color: red;
	font-weight: bold;
	text-align: center;
	font-size: 12pt;
	}

	fieldset {
	font-size: 8pt;
	}

	input {
	font-size: 8pt;
	}

	td {
	vertical-align: top;
	}

	ul img {
	vertical-align: middle;
	border: 0;
	}
	
	fieldset {
	border: 1px solid silver;
	margin: 10px;
	padding: 15px;
	}

	table.main {
	margin: 0 auto;
	}
</style>
{% endblock %}

{% block content %}
<h1>Redigera vallokal: {{ station.name }}</h1>
<hr/>
{% if message %}
<div class="message">{{ message }}</div>
{% endif %}
<table class="main">
	<tr>
		<td>
			<form method="post" action="">
				<fieldset>
					<legend>Lokaluppgifter</legend>
					<table>
						{{ form.as_table }}
						<tr><td><br /></td></tr>
						<tr>
							<th>
								<label>Samdistribueras med:</label>
							</th>
							<td style="max-width: 230px">
								{% if station.data.distributor %}
								<em>
									Denna vallokal har en distributör inbokad. För att sätta 
									samdistribuering, avboka först distributören eller
									sätt andra lokaler att samdistribuera med denna.
								</em>
								{% else %}
								<select name="distributed_with">
									<option value="0"> (ingen samdistribution) </option>
									{% for station in all_stations %}
									<option value="{{ station.id }}"{% ifequal distributed_with station.id %} selected="selected"{% endifequal %}>
										{{ station.name }}
									</option>
									{% endfor %}
								</select>
								{% endif %}
							</td>
						</tr>	
						<tr><td><br /></td></tr>
						<tr>
							<td></td>
							<td>
								<input type="hidden" name="action" value="change_data" />
								<input type="submit" value="Spara" />
							</td>
						</tr>
					</table>
				</fieldset>
			</form>
			
		</td>
		<td>
			<fieldset>
				<legend>Valdistrikt <a href="http://sv.wikipedia.org/wiki/Valdistrikt" target="_blank" title="Om valdistrikt...">?</a></legend>
				<p>
					Antal röstberättigade i lokalen: {{ station.voters }}
				</p>
				<h4>Distrikt som ingår i vallokalen:</h4>
				<ul style="list-style: none;">
					{% for district in districts %}
					<li>
						<a href="?action=remove_district&district={{ district.id }}">
							<img src="{{ MEDIA_URL }}images/list-remove.png" />
						</a>
						{{ district.name }} ({{ district.voters }})
					</li>
					{% endfor %}
				</ul>
				<h4>Distrikt tillgängliga i kommunen:</h4>
				{% if free_districts %}
				<ul style="list-style: none;">
					{% for district in free_districts %}
					<li>
						<a href="?action=add_district&district={{ district.id }}">
							<img src="{{ MEDIA_URL}}images/list-add.png" 
							     alt="Lägg till {{ district.name }} till vallokalen" 
							     title="Lägg till {{ district.name }} till vallokalen" />
						</a>
						{{ district.name }} ({{ district.voters }})
					</li>
					{% endfor %}
				</ul>
				{% else %}
				<blockquote><em>Inga obundna distrikt tillgängliga.</em></blockquote>
				{% endif %}
			</fieldset>
			<fieldset>
				<legend>Ta bort vallokalen</legend>
				{% if not station.data.distributor and not station.data.first_watch and not station.data.second_watch and not station.data.third_watch and not districts %}
				<form name="openlocation">
					<input type="hidden" name="href" value="{% url votingstation-edit station.municipality.slug station.slug %}?action=delete" />
					<input type="button" onclick="if (confirm('Är du säker?')) { location.href=document.openlocation.href.value;}" value="Ta bort vallokalen" />
				</form>
				{% else %}
				{% if districts %}
				Den här lokalen har distrikt kopplat till sig.<br /> Du kan inte ta bort en lokal med distrikt.
				{% else %}
				Den här lokalen innehåller bokningar. Du kan<br />inte ta bort en lokal med bokningar.
				{% endif %}
				{% endif %}
			</fieldset>
		</td>
	</tr>
</table>
<div style="clear: both;"></div>
<a href="{% url region station.region.shortname %}">&lt;&lt; Tillbaka till region {{ station.region.name }}</a>
{% endblock %}