Move admin forms to their appropriate places.
[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 class="backlink"><%= 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                         <p id="description"><% album.description|html></p>
71
72                         <%if album.sone.local>
73                                 <h2><%= Page.ImageBrowser.Album.Edit.Title|l10n|html></h2>
74
75                                 <form id="edit-album" action="editAlbum.html" method="post">
76                                         <input type="hidden" name="formPassword" value="<%formPassword|html>" />
77                                         <input type="hidden" name="album" value="<%album.id|html>" />
78
79                                         <div>
80                                                 <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
81                                                 <input type="text" name="title" value="<%album.title|html>" />
82                                         </div>
83                                         <div>
84                                                 <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
85                                                 <textarea name="description"><%album.description|html></textarea>
86                                         </div>
87                                         <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
88                                 </form>
89                         <%/if>
90
91                         <%foreach album.albums album>
92                                 <%first><h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2><%/first>
93                                 <%if loop.count|mod divisor=3><div class="image-row"><%/if>
94                                 <div class="album image">
95                                         <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
96                                                 <%ifnull album.albumImage>
97                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
98                                                 <%else><!-- TODO -->
99                                                         <% album.albumImage|image-link max-width=200 max-height=150 title==album.title>
100                                                 <%/if>
101                                                 <br/>
102                                                 <% album.title|html>
103                                         </a>
104                                 </div>
105                                 <%= false|store key=endRow>
106                                 <%if loop.count|mod divisor=3 offset=1><%= true|store key=endRow><%/if>
107                                 <%last><%= true|store key=endRow><%/last>
108                                 <%if endRow></div><%/if>
109                         <%/foreach>
110
111                         <%if album.sone.local>
112                                 <%include include/createAlbum.html>
113                         <%/if>
114
115                         <%foreach album.images image>
116                                 <%first><h2><%= Page.ImageBrowser.Header.Images|l10n|html></h2><%/first>
117                                 <%if loop.count|mod divisor=3><div class="image-row"><%/if>
118                                 <div class="image">
119                                         <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=200 max-height=150></a>
120                                 </div>
121                                 <%= false|store key=endRow>
122                                 <%if loop.count|mod divisor=3 offset=1><%= true|store key=endRow><%/if>
123                                 <%last><%= true|store key=endRow><%/last>
124                                 <%if endRow></div><%/if>
125                         <%/foreach>
126
127                         <%if album.sone.local>
128                                 <%include include/uploadImage.html>
129
130                                 <%if album.empty>
131                                         <form id="delete-album" action="deleteAlbum.html" method="get">
132                                                 <input type="hidden" name="album" value="<%album.id|html>" />
133                                                 <button type="submit"><%= Page.ImageBrowser.Album.Button.Delete|l10n|html></button>
134                                         </form>
135                                 <%/if>
136
137                         <%/if>
138
139                 <%/if>
140
141         <%elseif imageRequested>
142
143                 <h1 class="backlink"><%image.title|html></h1>
144
145                 <div class="backlinks">
146                         <%foreach image.album.backlinks backlink backlinks>
147                                 <div class="backlink">
148                                         <a href="<% backlink.target|html>"><% backlink.name|html></a>
149                                 </div>
150                                 <%if ! backlinks.last>
151                                         <div class="separator">&gt;</div>
152                                 <%/if>
153                         <%/foreach>
154                 </div>
155
156                 <%ifnull image>
157
158                 <%else>
159
160                         <%if image.sone.local>
161                                 <script language="javascript">
162                                         $(function() {
163                                                 getTranslation("WebInterface.DefaultText.EditImage.Title", function(text) {
164                                                         $("#edit-image input[name='title']").each(function() {
165                                                                 registerInputTextareaSwap(this, text, "title", false, true);
166                                                         });
167                                                 });
168                                                 getTranslation("WebInterface.DefaultText.EditImage.Description", function(text) {
169                                                         $("#edit-image :input[name='description']").each(function() {
170                                                                 registerInputTextareaSwap(this, text, "description", true, false);
171                                                         });
172                                                 });
173                                                 $("#edit-image label").hide();
174                                         });
175                                 </script>
176                         <%/if>
177
178                         <div class="single-image">
179                                 <%ifnull !image.key>
180                                         <a href="/<%image.key|html>"><% image|image-link max-width=640 max-height=480></a>
181                                 <%else>
182                                         <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=640 max-height=480></a>
183                                 <%/if>
184                         </div>
185
186                         <p class="parsed"><%image.description|parse sone=image.sone></p>
187
188                         <%if image.sone.local>
189
190                                 <h2><%= Page.ImageBrowser.Image.Edit.Title|l10n|html></h2>
191
192                                 <form id="edit-image" action="editImage.html" method="post">
193                                         <input type="hidden" name="formPassword" value="<%formPassword|html>" />
194                                         <input type="hidden" name="image" value="<%image.id|html>" />
195
196                                         <div>
197                                                 <label for="title"><%= Page.ImageBrowser.Image.Title.Label|l10n|html></label>
198                                                 <input type="text" name="title" value="<%image.title|html>" />
199                                         </div>
200                                         <div>
201                                                 <label for="description"><%= Page.ImageBrowser.Image.Description.Label|l10n|html></label>
202                                                 <textarea name="description"><%image.description|html></textarea>
203                                         </div>
204                                         <div>
205                                                 <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
206                                         </div>
207                                 </form>
208
209                                 <h2><%= Page.ImageBrowser.Image.Delete.Title|l10n|html></h2>
210
211                                 <form id="delete-image" action="deleteImage.html" method="get">
212                                         <input type="hidden" name="image" value="<%image.id|html>" />
213                                         <button type="submit"><%= Page.ImageBrowser.Image.Button.Delete|l10n|html></button>
214                                 </form>
215
216                         <%/if>
217
218                 <%/if>
219
220         <%elseif soneRequested>
221
222                 <%if sone.local>
223                         <script language="javascript">
224                                 $(function() {
225                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
226                                                 $("#create-album input[name='name']").each(function() {
227                                                         registerInputTextareaSwap(this, text, "name", false, true);
228                                                 });
229                                         });
230                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
231                                                 $("#create-album input[name='description']").each(function() {
232                                                         registerInputTextareaSwap(this, text, "description", true, true);
233                                                 });
234                                         });
235                                         $("#create-album label").hide();
236                                 });
237                         </script>
238                 <%/if>
239
240                 <%ifnull sone>
241
242                         <p><%= Page.ImageBrowser.Sone.Error.NotFound.Text|l10n|html></p>
243
244                 <%else>
245
246                         <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle='{sone}' replacementKey=sone.niceName|html></h1>
247
248                         <%foreach sone.albums album>
249                                 <%if loop.count|mod divisor=3><div class="image-row"><%/if>
250                                 <div class="album image">
251                                         <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
252                                                 <%ifnull album.albumImage>
253                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
254                                                 <%else><!-- TODO -->
255                                                         <% album.albumImage|image-link max-width=200 max-height=150 title==album.title>
256                                                 <%/if>
257                                                 <br/>
258                                                 <% album.title|html>
259                                         </a>
260                                 </div>
261                                 <%= false|store key=endRow>
262                                 <%if loop.count|mod divisor=3 offset=1><%= true|store key=endRow><%/if>
263                                 <%last><%= true|store key=endRow><%/last>
264                                 <%if endRow></div><%/if>
265                         <%/foreach>
266
267                         <%if sone.local>
268                                 <%include include/createAlbum.html>
269                         <%/if>
270
271                 <%/if>
272
273         <%/if>
274
275 <%include include/tail.html>