6fe4a896fabf258c2f003b75b804e11669a66a95
[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">
70 <input type="checkbox" />
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 <div metal:use-macro="here/batch_macros/macros/navigation">batch navigation</div>
105 <script type="text/javascript" tal:condition="not:dropable">
106 new Lightbox(document.getElementById('lightbox'));
107 </script>
108 <script type="text/javascript"
109 tal:condition="dropable"
110 tal:content="structure python:'''
111 (function(){
112 var lb = document.getElementById('lightbox');
113 new Lightbox(lb);
114 var uploadUrl = '%(putUrl)s';
115 var options = {'slideSize' : %(slideSize)d,
116 'thumbnailSize' : %(thumbnailSize)d};
117 new DDImageUploader(lb, uploadUrl, options);
118 })();
119 ''' % {'putUrl' : '%s/put_upload' % here.absolute_url(),
120 'slideSize' : portal_object.slide_size,
121 'thumbnailSize' : portal_object.thumb_size}">
122 </script>
123 </div>
124 <div metal:define-macro="film_bar" tal:omit-tag="">
125 <div id="film_bar">
126 <table cellspacing="0">
127 <tr tal:define="slide_size python:portal_object.thumb_size/2 + 10">
128 <td tal:repeat="info contextInfos/infos">
129 <a tal:attributes="href info/href;
130 class info/className;
131 portfolio:position info/index">
132 <img tal:define="size info/thumbSize;
133 margin_top python:(slide_size - size['height']) / 2"
134 tal:attributes="src info/src;
135 alt info/title;
136 height size/height;
137 width size/width;
138 style string:margin-top : ${margin_top}px ;"/>
139 </a>
140 </td>
141 </tr>
142 </table>
143 </div>
144 <div class="jsslider">
145 <span id="slider"/>
146 </div>
147 <script type="text/javascript"
148 tal:content="python:'''
149 var startSlideShow, slideShowNext, stopSlideShow;
150 (function(){
151 var ctxInfos = {'filmLength': %(filmLength)s,
152 'center': %(center)s,
153 'slideSize': %(slideSize)d,
154 'ctxUrlTranslation' : [%(reBaseCtxUrl)s, %(canonicalUrl)s]};
155 var fs = new FilmSlider(document.getElementById('film_bar'),
156 document.getElementById('slider'),
157 ctxInfos,
158 document.getElementById('medium_image').getElementsByTagName('img')[0],
159 document.getElementById('image_toolbar'),
160 document.getElementById('Breadcrumbs'));
161 startSlideShow = function() {return fs.startSlideShow();};
162 stopSlideShow = function() {return fs.stopSlideShow();};
163 slideShowPrevious = function() {return fs.slideShowPrevious();};
164 slideShowNext = function() {return fs.slideShowNext();};
165 slideShowImageLoaded = function() {return fs.slideShowImageLoaded();};
166 })();
167 ''' % {'filmLength' : len(contextInfos['infos']),
168 'center' : index,
169 'slideSize' : portal_object.thumb_size/2 + 11,
170 'reBaseCtxUrl' : contextInfos['reBaseCtxUrl'],
171 'canonicalUrl' : contextInfos['canonicalUrl']}">
172 </script>
173 </div>
174 </body>
175 </html>