Wiki source code of Photo Album Class Sheet

Last modified by Administrator on 2007/04/12 09:36

Show last authors
1 #set($obj = $doc.getObject("XWiki.PhotoAlbumClass", 0))
2 #if(!$obj)
3 ## String type is more specific than Object type. We should avoid ambiguous method call
4 ## see http://java.sun.com/docs/books/jls/clarifications-2-2nd-ed.html (JLS 15.12.2.2)
5 #set($obj = "")
6 #end
7
8 <br />
9 1 $doc.display("title", $obj)
10
11 $doc.display("description", $obj)
12
13 #if($context.action != "inline")
14
15 #set($diapo = $request.get("diapo"))
16 #if(!$diapo)
17 #set($diapo="all")
18 #end
19
20 #if($diapo=="all")
21
22 #macro(photosAlbum2 $height)
23 #set($current = 0)
24 #foreach ($attach in $doc.attachmentList)
25 #set($current = $current + 1)
26 <a href="$doc.getURL("view","diapo=$current")" >
27 <img src="$doc.getAttachmentURL($attach.filename, "download", "height=${height}")" height="${height}" alt="photo ${current}" />
28 </a>
29 #end
30 #end
31
32 ## Compute the size of the thumbnails. If there's no height property specified default to 150
33 #if(!$obj.getProperty("height"))
34 #set($height = 150)
35 #else
36 #set($height = $doc.display("height", "view", $obj))
37 #end
38
39 #photosAlbum2($height)
40
41 #else
42
43 #set($current = 0)
44 #set($height = 400)
45 #foreach ($attach in $doc.attachmentList)
46 #set($current = $current + 1)
47 #set($scurrent = "$current")
48 #if("$diapo" == "$current")
49 #set($prev = ($current - 1))
50 #set($next = ($current + 1))
51 <a href="$doc.getAttachmentURL($attach.filename,"download")" >
52 <img src="$doc.getAttachmentURL($attach.filename, "download", "height=${height}")" height="${height}" />
53 </a>
54 #end
55 #end
56 #if($prev==0)
57 #set($prev = $doc.attachmentList.size())
58 #end
59 #if($next==$doc.attachmentList.size()+1)
60 #set($next = 1)
61 #end
62
63 #if(!$prev)
64 #set($prev = 1)
65 #set($next = 1)
66 #end
67 <br />
68 ~~[Previous Photo>${doc.name}?diapo=$prev] [Next Photo>${doc.name}?diapo=$next]~~
69
70 #end
71
72 <br />
73 ~~<a href="$doc.getURL("attach")">Add Photos</a> <a href="$doc.getURL("inline")">Modify the Album</a> [All Photos>${doc.name}?diapo=all] [Diaporama>${doc.name}?diapo=1]~~
74 #end
75
76 #set($showattachments = 0)