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