Définition du comportement par défaut pour les requêtes ajax quelconques : on utilise...
[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 id="lightbox" tal:attributes="class python:'lightbox photo-drop-target' if dropable else 'lightbox'">
15 <span metal:define-macro="thumbnails" tal:repeat="info infos" tal:omit-tag="">
16 <span tal:define="size info/thumbSize;
17 margin_top python:(slide_size - size['height']) / 2;
18 margin_left python:(slide_size - size['width']) / 2;
19 selected info/selected|nothing"
20 tal:attributes="class info/className;
21 name info/cmf_uid"
22 metal:define-macro="thumbnail">
23 <a class="slide" tal:attributes="href info/href; title info/title">
24 <img tal:attributes="src info/thumbUrl;
25 alt info/title;
26 height size/height;
27 width size/width;
28 style string:margin-top:${margin_top}px;; margin-left:${margin_left}px;"/>
29 </a>
30 <tal:block tal:condition="python:features.has_key('select')">
31 <span class="button slide-select" tal:condition="not:selected">
32 <a name="add_to_selection" title="Add to selection"
33 tal:attributes="href python:features['select'](info['o'], False)"
34 i18n:attributes="title">
35 <img tal:attributes="src string:${portal_url}/transparent.gif"
36 height="17" width="12" alt="Add to selection"
37 i18n:attributes="alt"/>
38 </a>
39 </span>
40 <span class="button slide-deselect" tal:condition="selected">
41 <a name="remove_to_selection" title="Remove to selection"
42 tal:attributes="href python:features['select'](info['o'], True)"
43 i18n:attributes="title">
44 <img height="17" width="12" alt="Remove to selection"
45 tal:attributes="src string:${portal_url}/transparent.gif"
46 i18n:attributes="alt"/>
47 </a>
48 </span>
49 </tal:block>
50 <span class="button slide-cart" tal:condition="python:info.get('buyable')">
51 <a name="add_to_cart" title="Add to cart"
52 tal:attributes="href python:features['cart'](info['o'])"
53 i18n:attributes="title">
54 <img height="17" width="20" alt="Add to cart"
55 tal:attributes="src string:${portal_url}/transparent.gif"
56 i18n:attributes="alt"/>
57 </a>
58 </span>
59 <span class="button slide-del" tal:condition="python:features.has_key('del')">
60 <a title="Delete"
61 tal:attributes="href python:features['del'](info['o'])"
62 i18n:attributes="title">
63 <img height="19" width="18" alt="Delete"
64 tal:attributes="src string:${portal_url}/transparent.gif"
65 i18n:attributes="alt"/>
66 </a>
67 </span>
68 <span class="button cb" tal:condition="features/checkbox|nothing">
69 <input type="checkbox" name="uids:list"
70 tal:attributes="value info/cmf_uid"/>
71 </span>
72 <tal:block tal:condition="features/hideAnonymous|nothing">
73 <span class="button slide-hide"
74 tal:define="mtop python:margin_top + 4;
75 mleft python:margin_left + size['width'] - 17"
76 tal:condition="not:info/hiddenForAnonymous"
77 tal:attributes="style python:'margin-top:%dpx;; margin-left:%dpx' % (mtop, mleft)">
78 <a title="Hide for anonymous" name="hide_for_anonymous"
79 tal:attributes="href string:${info/href}/hideForAnonymous"
80 i18n:attributes="title">
81 <img height="15" width="16" alt="Hide for anonymous"
82 tal:attributes="src string:${portal_url}/transparent.gif"
83 i18n:attributes="alt"/>
84 </a>
85 </span>
86 <span class="button slide-show"
87 tal:define="mtop python:margin_top + 4;
88 mleft python:margin_left + size['width'] - 17"
89 tal:condition="info/hiddenForAnonymous"
90 tal:attributes="style python:'margin-top:%dpx;; margin-left:%dpx' % (mtop, mleft)">
91 <a title="Show for anonymous" name="show_for_anonymous"
92 tal:attributes="href string:${info/href}/resetHide"
93 i18n:attributes="title">
94 <img height="15" width="16" alt="Show for anonymous"
95 tal:attributes="src string:${portal_url}/transparent.gif"
96 i18n:attributes="alt"/>
97 </a>
98 </span>
99 </tal:block>
100 </span>
101 </span>
102 </div>
103 <br clear="all"/>
104 <noscript>
105 <div metal:use-macro="here/batch_macros/macros/navigation">batch navigation</div>
106 </noscript>
107 <script type="text/javascript" tal:condition="not:dropable"
108 tal:content="structure python:'''
109 new Lightbox(document.getElementById('lightbox'),
110 document.getElementById('lightbox_toolbar'),
111 %(complete)s,
112 '%(container_type)s');
113 ''' % {'complete' : 'true' if not batch.next else 'false',
114 'container_type' : options.get('container_type', 'portfolio')}">
115 </script>
116 <script type="text/javascript"
117 tal:condition="dropable"
118 tal:content="structure python:'''
119 (function(){
120 var lb = document.getElementById('lightbox');
121 new Lightbox(lb,
122 document.getElementById('lightbox_toolbar'),
123 %(complete)s,
124 '%(container_type)s');
125 var uploadUrl = '%(putUrl)s';
126 var options = {'slideSize' : %(slideSize)d,
127 'thumbnailSize' : %(thumbnailSize)d};
128 new DDImageUploader(lb, uploadUrl, options);
129 })();
130 ''' % {'putUrl' : '%s/put_upload' % here.absolute_url(),
131 'slideSize' : portal_object.slide_size,
132 'thumbnailSize' : portal_object.thumb_size,
133 'complete': 'true' if not batch.next else 'false',
134 'container_type' : options.get('container_type', 'portfolio')}">
135 </script>
136 </div>
137 <div metal:define-macro="film_bar" tal:omit-tag="">
138 <div id="film_bar">
139 <table cellspacing="0">
140 <tr tal:define="slide_size python:portal_object.thumb_size/2 + 10;
141 blank_img string:$portal_url/transparent.gif">
142 <td tal:repeat="info contextInfos/infos">
143 <a tal:attributes="href info/href;
144 title info/title;
145 class info/className;
146 portfolio:position info/index;">
147 <img tal:define="size info/thumbSize;
148 margin_top python:(slide_size - size['height']) / 2"
149 tal:attributes="src python:info['src'] if info['displayed'] else blank_img;
150 alt info/title;
151 height size/height;
152 width size/width;
153 style string:margin-top : ${margin_top}px ;"/>
154 </a>
155 </td>
156 </tr>
157 </table>
158 </div>
159 <div class="jsslider">
160 <span id="slider"/>
161 </div>
162 <script type="text/javascript"
163 tal:content="python:'''
164 var startSlideShow, slideShowNext, stopSlideShow;
165 (function(){
166 var ctxInfos = {'filmLength': %(filmLength)s,
167 'center': %(center)s,
168 'slideSize': %(slideSize)d,
169 'ctxUrlTranslation' : [%(reBaseCtxUrl)s, %(canonicalUrl)s]};
170 var fs = new FilmSlider(document.getElementById('film_bar'),
171 document.getElementById('slider'),
172 ctxInfos,
173 document.getElementById('medium_image').getElementsByTagName('img')[0],
174 document.getElementById('image_toolbar'),
175 document.getElementById('Breadcrumbs'));
176 startSlideShow = function() {return fs.startSlideShow();};
177 stopSlideShow = function() {return fs.stopSlideShow();};
178 slideShowPrevious = function() {return fs.slideShowPrevious();};
179 slideShowNext = function() {return fs.slideShowNext();};
180 slideShowImageLoaded = function() {return fs.slideShowImageLoaded();};
181 })();
182 ''' % {'filmLength' : len(contextInfos['infos']),
183 'center' : index,
184 'slideSize' : portal_object.thumb_size/2 + 11,
185 'reBaseCtxUrl' : contextInfos['reBaseCtxUrl'],
186 'canonicalUrl' : contextInfos['canonicalUrl']}">
187 </script>
188 </div>
189 </body>
190 </html>