jslint.
[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 <tal:block tal:condition="features/hideAnonymous|nothing">
70 <span class="button slide-hide"
71 tal:define="mtop python:margin_top + 4;
72 mleft python:margin_left + size['width'] - 17"
73 tal:condition="not:info/hiddenForAnonymous"
74 tal:attributes="style python:'margin-top:%dpx;; margin-left:%dpx' % (mtop, mleft)">
75 <a title="Hide for anonymous" name="hide_for_anonymous"
76 tal:attributes="href string:${info/href}/hideForAnonymous"
77 i18n:attributes="title">
78 <img height="15" width="16" alt="Hide for anonymous"
79 tal:attributes="src string:${portal_url}/transparent.gif"
80 i18n:attributes="alt"/>
81 </a>
82 </span>
83 <span class="button slide-show"
84 tal:define="mtop python:margin_top + 4;
85 mleft python:margin_left + size['width'] - 17"
86 tal:condition="info/hiddenForAnonymous"
87 tal:attributes="style python:'margin-top:%dpx;; margin-left:%dpx' % (mtop, mleft)">
88 <a title="Show for anonymous" name="show_for_anonymous"
89 tal:attributes="href string:${info/href}/resetHide"
90 i18n:attributes="title">
91 <img height="15" width="16" alt="Show for anonymous"
92 tal:attributes="src string:${portal_url}/transparent.gif"
93 i18n:attributes="alt"/>
94 </a>
95 </span>
96 </tal:block>
97 </span>
98 </span>
99 </div>
100 <br clear="all"/>
101 <div metal:use-macro="here/batch_macros/macros/navigation">batch navigation</div>
102 <script type="text/javascript" tal:condition="not:dropable">
103 new Lightbox(document.getElementById('lightbox'));
104 </script>
105 <script type="text/javascript"
106 tal:condition="dropable"
107 tal:content="structure python:'''
108 (function(){
109 var lb = document.getElementById('lightbox');
110 new Lightbox(lb);
111 var uploadUrl = '%(putUrl)s';
112 var options = {'slideSize' : %(slideSize)d,
113 'thumbnailSize' : %(thumbnailSize)d};
114 new DDImageUploader(lb, uploadUrl, options);
115 })();
116 ''' % {'putUrl' : '%s/put_upload' % here.absolute_url(),
117 'slideSize' : portal_object.slide_size,
118 'thumbnailSize' : portal_object.thumb_size}">
119 </script>
120 </div>
121 <div metal:define-macro="film_bar" tal:omit-tag="">
122 <div id="film_bar">
123 <table cellspacing="0">
124 <tr tal:define="slide_size python:portal_object.thumb_size/2 + 10">
125 <td tal:repeat="info contextInfos/infos">
126 <a tal:attributes="href info/href;
127 class info/className;
128 portfolio:position info/index">
129 <img tal:define="size info/thumbSize;
130 margin_top python:(slide_size - size['height']) / 2"
131 tal:attributes="src info/src;
132 alt info/title;
133 height size/height;
134 width size/width;
135 style string:margin-top : ${margin_top}px ;"/>
136 </a>
137 </td>
138 </tr>
139 </table>
140 </div>
141 <div class="jsslider">
142 <span id="slider"/>
143 </div>
144 <script type="text/javascript"
145 tal:content="python:'''
146 var startSlideShow, slideShowNext, stopSlideShow;
147 (function(){
148 var ctxInfos = {'filmLength': %(filmLength)s,
149 'center': %(center)s,
150 'slideSize': %(slideSize)d,
151 'ctxUrlTranslation' : [%(reBaseCtxUrl)s, %(canonicalUrl)s]};
152 var fs = new FilmSlider(document.getElementById('film_bar'),
153 document.getElementById('slider'),
154 ctxInfos,
155 document.getElementById('medium_image').getElementsByTagName('img')[0],
156 document.getElementById('image_toolbar'),
157 document.getElementById('Breadcrumbs'));
158 startSlideShow = function() {return fs.startSlideShow();};
159 stopSlideShow = function() {return fs.stopSlideShow();};
160 slideShowPrevious = function() {return fs.slideShowPrevious();};
161 slideShowNext = function() {return fs.slideShowNext();};
162 slideShowImageLoaded = function() {return fs.slideShowImageLoaded();};
163 })();
164 ''' % {'filmLength' : len(contextInfos['infos']),
165 'center' : index,
166 'slideSize' : portal_object.thumb_size/2 + 11,
167 'reBaseCtxUrl' : contextInfos['reBaseCtxUrl'],
168 'canonicalUrl' : contextInfos['canonicalUrl']}">
169 </script>
170 </div>
171 </body>
172 </html>