]> git.decadent.org.uk Git - memories.git/blob - templates/photo/view
0216bdaeacb01c6fa3da2392829796043034c962
[memories.git] / templates / photo / view
1 [% INCLUDE header %]
2 [% SET tab = request.params.active || "comment" %]
3 [% SET url = base _ "/photo/view/" _ photo.id; %]
4 <table width="100%">
5     <tr valign="top">
6     <td width="70%">
7     [% IF prev %]
8         <small><a href="[%base%]/photo/view/[%prev.id%]">&lt;&lt; [% prev %]</a></small>
9     [% END %]
10 <h1>[% photo.title %]</h1>
11     [% IF next %]
12         <small><a href="[%base%]/photo/view/[%next.id%]"> [% next %] &gt;&gt;</a></small>
13     [% END %]
14 [% IF request.user == photo.uploader %]
15     <p><a href="[%base%]/photo/delete/[%photo.id%]">Delete this
16     photo</a></p>
17     <form action="[%base%]/photo/do_edit/[%photo.id%]">
18         <input name="title" value="[%photo.title |html%]">
19         <input type="submit" name="Rename" value="Rename">
20     </form>
21 [% END %]
22 </td>
23 <td align="right">
24 [% IF photo.albums %]
25 In albums:
26 [% FOR album = photo.albums; %]
27 <a href="[%base%]/album/view/[%album.id%]">[%album.name%]</a> ([%album.photos.size%])
28 [% ";" UNLESS album == photo.albums.last %]
29 [% END %]
30 <br>
31 [% END %]
32 <small>
33 <i>Photo shot on [% photo.shot.ymd %] </i> <br>
34 Uploaded by <a href="[%base%]/user/view/[%photo.uploader.id%]"> [%
35 photo.uploader %] </a>
36 </small> <br>
37 [% photo.hit_count %] view[%IF photo.hit_count > 1%]s[%END%]
38 </td>
39 </tr>
40 </table>
41
42 <div class="tagbrowse smaller">
43 [% SET tagset = {}; FOR tag = photo.tags;
44     SET name = tag.name; tagset.$name = tag.taggings.size;
45   END;
46   SET sorted = tagset.nsort.reverse;
47 %]
48 [% SET counter = 0;
49   FOR tag = sorted;
50     counter = counter + 1;
51     IF tagset.$tag > 1; 
52         "<a href=\""; base;"/tag/view/";tag | html | uri;"\">";
53         tag;
54         "</a>&nbsp;(";
55         tagset.$tag; ")";
56     ELSE; 
57         tag; 
58         IF counter > 20; "..."; LAST; END;
59     END;
60     ", " UNLESS tag == sorted.last;
61 END %]
62 </div>
63
64 [% PROCESS sized %]
65
66 [% IF photo.description OR photo.copyright OR photo.license %]
67 <div class="photodesc"> 
68     [% photo.description | html %] 
69     [% IF photo.copyright %] <div class="photorights"> [% photo.copyright | html %] </div> [% END %]
70     [% IF photo.license %] <div class="photolicense"> [% photo.license | html %] </div> [% END %]
71 </div>
72 [% END %]
73
74 <script>
75 function select_tab(name) {
76     document.getElementsByClassName("active").each(function (x) { x.removeClassName("active")});
77     new Ajax.Updater("content","[%base%]/photo/"+name+"/[%photo.id%]",
78       { method: "get", evalScripts: true }
79     )
80     $(name).addClassName("active");
81 }
82 </script>
83 [% MACRO do_tab(tabname, label) BLOCK; %]
84 <li>
85     <a [% IF tab == tabname %] class="active" [% END %] id="[%tabname%]" href="javascript:select_tab('[%tabname%]')">
86     [%label%]</a>
87 </li>
88 [% END %]
89
90 <ul id="tabmenu">
91     [%do_tab("comment", "Comments") %]
92     [%do_tab("exif", "Photo info") %]
93     [%do_tab("tagedit", "Edit tags") %]
94     [%do_tab("similar", "Similar photos") %]
95 </ul>
96 <div id="content">
97 [% INCLUDE comment %]
98 </div>
99 [%
100 INCLUDE footer;
101 %]