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