Prise en charge des permissions dans l'affichage / masquage de la barre d'outils.
[Portfolio.git] / skins / photo_layout_macros.pt
1 <html xmlns:tal="http://xml.zope.org/namespaces/tal"
2 xmlns:metal="http://xml.zope.org/namespaces/metal"
3 xmlns:i18n="http://xml.zope.org/namespaces/i18n">
4 <head>
5 <title>Display macros for arbitrary set of photos</title>
6 <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
7 </head>
8 <body>
9 <div metal:define-macro="grid"
10 tal:define="slide_size portal_object/slide_size;
11 mayBeDropable exists:dropable;
12 dropable python:True if mayBeDropable and dropable else False"
13 i18n:domain="portfolio">
14 <div metal:use-macro="here/batch_macros/macros/navigation">batch navigation</div>
15 <div id="lightbox" tal:attributes="class python:'lightbox photo-drop-target' if dropable else 'lightbox'">
16 <span tal:repeat="info infos" tal:omit-tag="">
17 <span tal:define="size info/thumbSize;
18 margin_top python:(slide_size - size['height']) / 2;
19 margin_left python:(slide_size - size['width']) / 2;
20 selected info/selected|nothing"
21 tal:attributes="class info/className;
22 name info/cmf_uid"
23 metal:define-macro="thumbnail">
24 <a class="slide" tal:attributes="href info/href; title info/title">
25 <img tal:attributes="src info/thumbUrl;
26 alt info/title;
27 height size/height;
28 width size/width;
29 style string:margin-top : ${margin_top}px ;;margin-left:${margin_left}px;"/>
30 </a>
31 <tal:block tal:condition="python:features.has_key('select')">
32 <span class="button slide-select" tal:condition="not:selected">
33 <a name="add_to_selection" title="Add to selection"
34 tal:attributes="href python:features['select'](info['o'], False)"
35 i18n:attributes="title">
36 <img tal:attributes="src string:${portal_url}/transparent.gif"
37 height="17" width="12" alt="Add to selection"
38 i18n:attributes="alt"/>
39 </a>
40 </span>
41 <span class="button slide-deselect" tal:condition="selected">
42 <a name="remove_to_selection" title="Remove to selection"
43 tal:attributes="href python:features['select'](info['o'], True)"
44 i18n:attributes="title">
45 <img height="17" width="12" alt="Remove to selection"
46 tal:attributes="src string:${portal_url}/transparent.gif"
47 i18n:attributes="alt"/>
48 </a>
49 </span>
50 </tal:block>
51 <span class="button slide-cart" tal:condition="python:info.get('buyable')">
52 <a name="add_to_cart" title="Add to cart"
53 tal:attributes="href python:features['cart'](info['o'])"
54 i18n:attributes="title">
55 <img height="17" width="20" alt="Add to cart"
56 tal:attributes="src string:${portal_url}/transparent.gif"
57 i18n:attributes="alt"/>
58 </a>
59 </span>
60 <span class="button slide-del" tal:condition="python:features.has_key('del')">
61 <a title="Delete"
62 tal:attributes="href python:features['del'](info['o'])"
63 i18n:attributes="title">
64 <img height="19" width="18" alt="Delete"
65 tal:attributes="src string:${portal_url}/transparent.gif"
66 i18n:attributes="alt"/>
67 </a>
68 </span>
69 <span class="button cb" tal:condition="features/checkbox|nothing">
70 <input type="checkbox" name="uids:list"
71 tal:attributes="value info/cmf_uid"/>
72 </span>
73 <tal:block tal:condition="features/hideAnonymous|nothing">
74 <span class="button slide-hide"
75 tal:define="mtop python:margin_top + 4;
76 mleft python:margin_left + size['width'] - 17"
77 tal:condition="not:info/hiddenForAnonymous"
78 tal:attributes="style python:'margin-top:%dpx;; margin-left:%dpx' % (mtop, mleft)">
79 <a title="Hide for anonymous" name="hide_for_anonymous"
80 tal:attributes="href string:${info/href}/hideForAnonymous"
81 i18n:attributes="title">
82 <img height="15" width="16" alt="Hide for anonymous"
83 tal:attributes="src string:${portal_url}/transparent.gif"
84 i18n:attributes="alt"/>
85 </a>
86 </span>
87 <span class="button slide-show"
88 tal:define="mtop python:margin_top + 4;
89 mleft python:margin_left + size['width'] - 17"
90 tal:condition="info/hiddenForAnonymous"
91 tal:attributes="style python:'margin-top:%dpx;; margin-left:%dpx' % (mtop, mleft)">
92 <a title="Show for anonymous" name="show_for_anonymous"
93 tal:attributes="href string:${info/href}/resetHide"
94 i18n:attributes="title">
95 <img height="15" width="16" alt="Show for anonymous"
96 tal:attributes="src string:${portal_url}/transparent.gif"
97 i18n:attributes="alt"/>
98 </a>
99 </span>
100 </tal:block>
101 </span>
102 </span>
103 </div>
104 <br clear="all"/>
105 <div metal:use-macro="here/batch_macros/macros/navigation">batch navigation</div>
106 <script type="text/javascript" tal:condition="not:dropable">
107 new Lightbox(document.getElementById('lightbox'));
108 </script>
109 <script type="text/javascript"
110 tal:condition="dropable"
111 tal:content="structure python:'''
112 (function(){
113 var lb = document.getElementById('lightbox');
114 new Lightbox(lb);
115 var uploadUrl = '%(putUrl)s';
116 var options = {'slideSize' : %(slideSize)d,
117 'thumbnailSize' : %(thumbnailSize)d};
118 new DDImageUploader(lb, uploadUrl, options);
119 })();
120 ''' % {'putUrl' : '%s/put_upload' % here.absolute_url(),
121 'slideSize' : portal_object.slide_size,
122 'thumbnailSize' : portal_object.thumb_size}">
123 </script>
124 </div>
125 <div metal:define-macro="film_bar" tal:omit-tag="">
126 <div id="film_bar">
127 <table cellspacing="0">
128 <tr tal:define="slide_size python:portal_object.thumb_size/2 + 10">
129 <td tal:repeat="info contextInfos/infos">
130 <a tal:attributes="href info/href;
131 class info/className;
132 portfolio:position info/index">
133 <img tal:define="size info/thumbSize;
134 margin_top python:(slide_size - size['height']) / 2"
135 tal:attributes="src info/src;
136 alt info/title;
137 height size/height;
138 width size/width;
139 style string:margin-top : ${margin_top}px ;"/>
140 </a>
141 </td>
142 </tr>
143 </table>
144 </div>
145 <div class="jsslider">
146 <span id="slider"/>
147 </div>
148 <script type="text/javascript"
149 tal:content="python:'''
150 var startSlideShow, slideShowNext, stopSlideShow;
151 (function(){
152 var ctxInfos = {'filmLength': %(filmLength)s,
153 'center': %(center)s,
154 'slideSize': %(slideSize)d,
155 'ctxUrlTranslation' : [%(reBaseCtxUrl)s, %(canonicalUrl)s]};
156 var fs = new FilmSlider(document.getElementById('film_bar'),
157 document.getElementById('slider'),
158 ctxInfos,
159 document.getElementById('medium_image').getElementsByTagName('img')[0],
160 document.getElementById('image_toolbar'),
161 document.getElementById('Breadcrumbs'));
162 startSlideShow = function() {return fs.startSlideShow();};
163 stopSlideShow = function() {return fs.stopSlideShow();};
164 slideShowPrevious = function() {return fs.slideShowPrevious();};
165 slideShowNext = function() {return fs.slideShowNext();};
166 slideShowImageLoaded = function() {return fs.slideShowImageLoaded();};
167 })();
168 ''' % {'filmLength' : len(contextInfos['infos']),
169 'center' : index,
170 'slideSize' : portal_object.thumb_size/2 + 11,
171 'reBaseCtxUrl' : contextInfos['reBaseCtxUrl'],
172 'canonicalUrl' : contextInfos['canonicalUrl']}">
173 </script>
174 </div>
175 </body>
176 </html>