Don’t required the logged in Sone to match, a local Sone is enough.
[Sone.git] / src / main / resources / templates / imageBrowser.html
1 <%include include/head.html>
2
3         <div class="page-id hidden">image-browser</div>
4
5         <%if albumRequested>
6
7                 <%ifnull album>
8
9                         <p><%= Page.ImageBrowser.Album.Error.NotFound.Text|l10n|html></p>
10
11                 <%elseifnull album.title>
12
13                         <p><%= Page.ImageBrowser.Album.Error.NotFound.Text|l10n|html></p>
14
15                 <%else>
16
17                         <%if album.sone.local>
18                                 <script language="javascript">
19                                         $(function() {
20                                                 getTranslation("WebInterface.DefaultText.UploadImage.Title", function(text) {
21                                                         $("#upload-image :input[name='title']").each(function() {
22                                                                 registerInputTextareaSwap(this, text, "title", false, true);
23                                                         });
24                                                 });
25                                                 getTranslation("WebInterface.DefaultText.UploadImage.Description", function(text) {
26                                                         $("#upload-image :input[name='description']").each(function() {
27                                                                 registerInputTextareaSwap(this, text, "description", true, false);
28                                                         });
29                                                 });
30                                                 $("#upload-image label").hide();
31                                                 getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
32                                                         $("#create-album input[name='name']").each(function() {
33                                                                 registerInputTextareaSwap(this, text, "name", false, true);
34                                                         });
35                                                 });
36                                                 getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
37                                                         $("#create-album input[name='description']").each(function() {
38                                                                 registerInputTextareaSwap(this, text, "description", true, true);
39                                                         });
40                                                 });
41                                                 $("#create-album label").hide();
42                                                 getTranslation("WebInterface.DefaultText.EditAlbum.Title", function(text) {
43                                                         $("#edit-album input[name='title']").each(function() {
44                                                                 registerInputTextareaSwap(this, text, "title", false, true);
45                                                         });
46                                                 });
47                                                 getTranslation("WebInterface.DefaultText.EditAlbum.Description", function(text) {
48                                                         $("#edit-album :input[name='description']").each(function() {
49                                                                 registerInputTextareaSwap(this, text, "description", true, false);
50                                                         });
51                                                 });
52                                                 $("#edit-album label").hide();
53                                         });
54                                 </script>
55                         <%/if>
56
57                         <h1><%= Page.ImageBrowser.Album.Title|l10n|replace needle='{album}' replacementKey=album.title|html></h1>
58
59                         <div class="backlinks">
60                                 <%foreach album.backlinks backlink backlinks>
61                                         <div class="backlink">
62                                                 <a href="<% backlink.target|html>"><% backlink.name|html></a>
63                                         </div>
64                                         <%if ! backlinks.last>
65                                                 <div class="separator">&gt;</div>
66                                         <%/if>
67                                 <%/foreach>
68                         </div>
69
70                         <%foreach album.albums album>
71                                 <div class="album image">
72                                         <a href="imageBrowser.html?album=<% album.id|html>">
73                                                 <%ifnull album.image>
74                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
75                                                 <%else><!-- TODO -->
76                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
77                                                 <%/if>
78                                         </a>
79                                 </div>
80                         <%/foreach>
81
82                         <%foreach album.images image>
83                                 <div class="image">
84                                         <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=200 max-height=150></a>
85                                 </div>
86                         <%/foreach>
87
88                         <div id="description">
89                                 <% album.description|html>
90                         </div>
91
92                         <%if album.sone.local>
93                                 <%include include/uploadImage.html>
94                                 <%include include/createAlbum.html>
95
96                                 <h2><%= Page.ImageBrowser.Album.Edit.Title|l10n|html></h2>
97
98                                 <form id="edit-album" action="editAlbum.html" method="post">
99                                         <input type="hidden" name="formPassword" value="<%formPassword|html>" />
100                                         <input type="hidden" name="album" value="<%album.id|html>" />
101
102                                         <div>
103                                                 <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
104                                                 <input type="text" name="title" value="<%album.title|html>" />
105                                         </div>
106                                         <div>
107                                                 <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
108                                                 <textarea name="description"><%album.description|html></textarea>
109                                         </div>
110                                         <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
111                                 </form>
112
113                                 <%if album.empty>
114                                         <form id="delete-album" action="deleteAlbum.html" method="get">
115                                                 <input type="hidden" name="album" value="<%album.id|html>" />
116                                                 <button type="submit"><%= Page.ImageBrowser.Album.Button.Delete|l10n|html></button>
117                                         </form>
118                                 <%/if>
119
120                         <%/if>
121
122                 <%/if>
123
124         <%elseif imageRequested>
125
126                 <h1><%image.title|html></h1>
127
128                 <div class="backlinks">
129                         <%foreach image.album.backlinks backlink backlinks>
130                                 <div class="backlink">
131                                         <a href="<% backlink.target|html>"><% backlink.name|html></a>
132                                 </div>
133                                 <%if ! backlinks.last>
134                                         <div class="separator">&gt;</div>
135                                 <%/if>
136                         <%/foreach>
137                 </div>
138
139                 <%ifnull image>
140
141                 <%else>
142
143                         <%if image.sone.local>
144                                 <script language="javascript">
145                                         $(function() {
146                                                 getTranslation("WebInterface.DefaultText.EditImage.Title", function(text) {
147                                                         $("#edit-image input[name='title']").each(function() {
148                                                                 registerInputTextareaSwap(this, text, "title", false, true);
149                                                         });
150                                                 });
151                                                 getTranslation("WebInterface.DefaultText.EditImage.Description", function(text) {
152                                                         $("#edit-image :input[name='description']").each(function() {
153                                                                 registerInputTextareaSwap(this, text, "description", true, false);
154                                                         });
155                                                 });
156                                                 $("#edit-image label").hide();
157                                         });
158                                 </script>
159                         <%/if>
160
161                         <div class="single-image">
162                                 <%ifnull !image.key>
163                                         <a href="/<%image.key|html>"><% image|image-link max-width=640 max-height=480></a>
164                                 <%else>
165                                         <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=640 max-height=480></a>
166                                 <%/if>
167                         </div>
168
169                         <p class="parsed"><%image.description|parse sone=image.sone></p>
170
171                         <%if image.sone.local>
172
173                                 <h2><%= Page.ImageBrowser.Image.Edit.Title|l10n|html></h2>
174
175                                 <form id="edit-image" action="editImage.html" method="post">
176                                         <input type="hidden" name="formPassword" value="<%formPassword|html>" />
177                                         <input type="hidden" name="image" value="<%image.id|html>" />
178
179                                         <div>
180                                                 <label for="title"><%= Page.ImageBrowser.Image.Title.Label|l10n|html></label>
181                                                 <input type="text" name="title" value="<%image.title|html>" />
182                                         </div>
183                                         <div>
184                                                 <label for="description"><%= Page.ImageBrowser.Image.Description.Label|l10n|html></label>
185                                                 <textarea name="description"><%image.description|html></textarea>
186                                         </div>
187                                         <div>
188                                                 <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
189                                         </div>
190                                 </form>
191
192                                 <h2><%= Page.ImageBrowser.Image.Delete.Title|l10n|html></h2>
193
194                                 <form id="delete-image" action="deleteImage.html" method="get">
195                                         <input type="hidden" name="image" value="<%image.id|html>" />
196                                         <button type="submit"><%= Page.ImageBrowser.Image.Button.Delete|l10n|html></button>
197                                 </form>
198
199                         <%/if>
200
201                 <%/if>
202
203         <%elseif soneRequested>
204
205                 <%if sone.local>
206                         <script language="javascript">
207                                 $(function() {
208                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
209                                                 $("#create-album input[name='name']").each(function() {
210                                                         registerInputTextareaSwap(this, text, "name", false, true);
211                                                 });
212                                         });
213                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
214                                                 $("#create-album input[name='description']").each(function() {
215                                                         registerInputTextareaSwap(this, text, "description", true, true);
216                                                 });
217                                         });
218                                         $("#create-album label").hide();
219                                 });
220                         </script>
221                 <%/if>
222
223                 <%ifnull sone>
224
225                         <p><%= Page.ImageBrowser.Sone.Error.NotFound.Text|l10n|html></p>
226
227                 <%else>
228
229                         <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle='{sone}' replacementKey=sone.niceName|html></h1>
230
231                         <%foreach sone.albums album>
232                                 <div class="album image">
233                                         <a href="imageBrowser.html?album=<% album.id|html>">
234                                                 <%ifnull album.image>
235                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
236                                                 <%else><!-- TODO -->
237                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
238                                                 <%/if>
239                                         </a>
240                                 </div>
241                         <%/foreach>
242
243                         <%if sone.local>
244                                 <%include include/createAlbum.html>
245                         <%/if>
246
247                 <%/if>
248
249         <%/if>
250
251 <%include include/tail.html>