source: trunk/skins/lemill/resource_list_macro.pt @ 3035

Revision 3035, 9.9 KB checked in by jukka, 10 years ago (diff)

A fix to remove references to real objects when browsing results. Now the browse pages can be built from catalog metadata and cover images can come from cache.

Line 
1<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
2      lang="en"
3      i18n:domain="lemill">
4<body>
5
6
7 <metal:block define-macro="memberfolder_object_info" tal:define="HasCoverImage obj/getHasCoverImage | python:None;
8     interests obj/getInterests | nothing;
9     nicename obj/getNicename | nothing;
10     location_country obj/getLocation_country | nothing;
11     obj_url obj/getURL;
12     ">
13
14     <div class="coverimage" tal:condition="HasCoverImage">
15        <span></span>
16             <a href="" tal:attributes="href obj_url">
17                 <img src="" tal:attributes="src string:${obj/getURL}/coverImage;alt nicename"/>
18             </a>
19     </div>
20     <div class="coverimage" tal:condition="not:HasCoverImage">
21        <span></span>
22         <a href="" tal:attributes="href obj_url">
23             <img src="images/default_member.png" alt="Member Folder" height="120" width="120" />
24         </a>
25     </div>
26     <a href=""
27         tal:attributes="href obj_url" class="browse_title_d">
28         <span tal:replace="nicename"></span>
29     </a>
30    <div class="metadata">
31    <ul class="metadata">
32     <li class="browse_title_r">
33        <a href=""
34            tal:attributes="href obj_url">
35            <span tal:replace="nicename"></span>
36        </a>
37     </li>
38     <li class="browse_info" tal:condition="location_country">
39             <tal:block i18n:translate="label_location">Location</tal:block>:
40                <a href="#" tal:attributes="href string:${community_section}/country?location=${location_country}" tal:content="location_country">Country</a>
41     </li>       
42     <li class="browse_info" tal:condition="interests">
43         <div><tal:block i18n:translate="label_interests">Interests</tal:block>:
44             <tal:block tal:repeat="interests python:interests[:20]"  tal:omit-tag="">
45                <a href="#" tal:attributes="href string:${community_section}/interests?interests=${interests}" tal:content="interests">PLACEHOLDER</a><span tal:condition="not:repeat/interests/end" tal:omit-tag="">, </span>
46             </tal:block>
47         </div>
48     </li>
49
50    </ul>
51   </div>
52
53 </metal:block>
54
55
56 <metal:block define-macro="group_object_info" tal:define="HasCoverImage obj/getHasCoverImage | python:None;
57     name obj/Title | obj/getId;
58     tags obj/getTags;
59     obj_url obj/getURL;
60     lang obj/getLanguage_skills;
61     ">
62     <div class="coverimage" tal:condition="HasCoverImage">
63        <span></span>
64             <a href="" tal:attributes="href obj_url">
65                 <img src="" alt="Group Blog" tal:attributes="src string:${obj/getURL}/coverImage" />
66             </a>
67     </div>
68     <div class="coverimage" tal:condition="not:HasCoverImage">
69        <span></span>
70         <a href="" tal:attributes="href obj_url">
71             <img src="images/default_group.png" alt="Group Blog" height="120" width="120" />
72         </a>
73     </div>
74    <a href=""
75        tal:attributes="href obj_url" class="browse_title_d">
76        <span tal:replace="name"></span>
77    </a>
78    <div class="metadata">
79     <ul class="metadata">
80
81      <li class="browse_title_r">
82          <a href=""
83              tal:attributes="href obj_url">
84              <span tal:replace="name"></span>
85          </a>
86      </li>
87    <li class="browse_info" tal:condition="tags">
88        <tal:block i18n:translate="label_tags">Tags</tal:block>:
89        <tal:block tal:repeat="tag python:tags[:20]"  tal:omit-tag="">
90            <a href="#" tal:attributes="href string:${tag_link_pref}${tag}" tal:content="tag">PLACEHOLDER</a><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span>
91        </tal:block>   
92    </li>
93    <li class="browse_info" tal:condition="lang">
94        <tal:block i18n:translate="label_languages">Languages</tal:block>:
95        <tal:block tal:repeat="la lang"  tal:omit-tag="">
96            <a href="#" tal:attributes="href python:'%s%s' % (lang_link_pref, la)" tal:content="python:context.script_getPrettyLanguage(la)">PLACEHOLDER</a><span tal:condition="not:repeat/la/end" tal:omit-tag="">, </span>
97        </tal:block>   
98    </li>
99
100     </ul>
101    </div>
102 </metal:block>
103
104
105
106
107
108<metal:block define-macro="resource_object_info">
109
110    <tal:outer_defs define="obj_state obj/getState | string:"
111        condition="python:obj_state!='deleted'">
112
113    <tal:defs define="obj_url obj/getURL | obj/absolute_url;
114            showAuthor python:obj_state != 'draft';
115            obj_url python:test(use_view_action, '%s/view' % obj_url, obj_url);
116            HasCoverImage obj/getHasCoverImage | python:None;
117            name obj/Title | obj/getId;
118            creator obj/Creator;
119            modDate obj/ModificationDate;
120            authors obj/listCreators;
121            lang obj/Language;
122            tags obj/getTags | string:;">
123
124     <div class="coverimage" tal:condition="HasCoverImage">
125        <span></span>
126         <span tal:define="piccyurl string:${obj/getURL}/coverImage" tal:omit-tag="">
127             <a href="" tal:attributes="href obj_url">
128                 <img src="" tal:attributes="src piccyurl; alt python:obj.portal_type" />
129             </a>
130         </span>
131     </div>
132     <div class="coverimage" tal:condition="not:HasCoverImage">
133         <a href="" tal:attributes="href obj_url">
134             <img src="" tal:attributes="src python:context.content.getDefaultIcon(obj.portal_type); alt python:obj.portal_type" height="120" width="120" />
135         </a>
136     </div>
137
138    <a href=""
139        tal:attributes="href obj_url" class="browse_title_d">
140        <span tal:replace="name"/>
141    </a>
142    <div class="metadata">
143     <ul class="metadata">
144
145     <li class="browse_title_r">
146         <a href=""
147             tal:attributes="href obj_url">
148             <strong tal:content="name" />
149         </a>
150     </li>
151
152     <li class="browse_info" tal:condition="showAuthor"><span i18n:translate="label_authors">Authors</span>:
153        <tal:loop tal:repeat="author authors">
154                 <a tal:replace="structure python:lutool.linkTo(author)" />
155                 <tal:sep tal:condition="not:repeat/author/end">,</tal:sep>
156        </tal:loop>
157    </li>
158    <li class="browse_info" tal:condition="tags">
159        <tal:block i18n:translate="label_tags">Tags</tal:block>:
160        <tal:block tal:repeat="tag python:tags[:20]"  tal:omit-tag="">
161            <a href="#" tal:attributes="href string:${link_pref}${tag}" tal:content="tag">PLACEHOLDER</a><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span>
162        </tal:block>
163   
164    </li>
165    <li class="browse_info" tal:condition="lang">
166        <tal:block i18n:domain="plone" i18n:translate="label_language">Language</tal:block>: <span tal:replace="python:here.script_getPrettyLanguage(lang)"></span></li>
167    </ul>
168   </div>
169   </tal:defs>
170   </tal:outer_defs>
171
172</metal:block>
173
174
175
176<metal:block define-macro="resources_list">
177<tal:split define="special_list python:here.lemill_tool.splitResultList(batch); link_pref string:${context/aq_inner/aq_parent/absolute_url}/tags?tag=">
178<tal:rep repeat="special special_list">
179<h2 tal:condition="python:special[0] != ''" tal:content="python:special[0]" i18n:translate="" class="learning_story_title" />
180<ul id="resource_list" class="expanded">
181    <li tal:repeat="obj python:special[1]" class="resultobject">
182        <metal:tds use-macro="here/resource_list_macro/macros/resource_object_info" />
183    </li>
184</ul>
185</tal:rep>
186</tal:split>
187</metal:block>
188
189<metal:block define-macro="resources_list_unsorted">
190<ul id="resource_list" class="expanded" tal:define="link_pref string:${context/aq_inner/aq_parent/absolute_url}/tags?tag=">
191    <li tal:repeat="obj batch" class="resultobject">
192        <metal:tds use-macro="here/resource_list_macro/macros/resource_object_info" />
193    </li>
194</ul>
195</metal:block>
196
197
198<metal:block define-macro="members_list"> 
199<ul id="resources_list" class="expanded" tal:define="community_section python: '%s/community' % portal_url;">
200    <li tal:repeat="obj batch" class="resultobject">
201        <metal:tds use-macro="here/resource_list_macro/macros/memberfolder_object_info" />
202    </li>
203</ul>
204</metal:block>
205
206<metal:block define-macro="groups_list"> 
207<ul id="resources_list" class="expanded" tal:define="tag_link_pref string:${portal_url}/community/tags?tag=;
208lang_link_pref string:${portal_url}/community/g_language?language_skills=">
209    <li tal:repeat="obj batch" class="resultobject">
210        <metal:tds use-macro="here/resource_list_macro/macros/group_object_info" />
211    </li>
212</ul>
213</metal:block>
214
215<metal:block define-macro="mixed_results_list"> 
216<ul id="resources_list" class="expanded" tal:define="
217        pu python:portal_url;
218        tag_link_pref string:${pu}/community/tags?tag=;
219        lang_link_pref string:${pu}/community/g_language?language_skills=;
220        community_section python: '%s/community' % pu;
221        section_dictionary python: {'Activity':'methods', 'Tool':'tools', 'MultimediaMaterial':'content',  'PresentationMaterial':'content', 'ExerciseMaterial':'content', 'PILOTMaterial':'content', 'SchoolProjectMaterial':'content', 'Piece':'content', 'LeMillReference':'content', 'BlogPost':'community', 'DiscussionItem':'community', 'Collection':'community', 'CollectionsFolder':'community','LessonPlan':'content', 'LeMillPrintResource':'content'}">
222    <li tal:repeat="obj batch" class="resultobject">
223        <tal:if_group condition="python: obj.portal_type=='GroupBlog'">
224            <metal:tds use-macro="here/resource_list_macro/macros/group_object_info" />
225        </tal:if_group>
226        <tal:if_member condition="python: obj.portal_type=='MemberFolder'">
227            <metal:tds use-macro="here/resource_list_macro/macros/memberfolder_object_info" />
228        </tal:if_member>
229        <tal:if_resource condition="python: obj.portal_type in section_dictionary.keys()">
230            <tal:defs define="link_pref python:'%s/%s/tags?tag=' % (pu,section_dictionary[obj.portal_type])">
231                <metal:tds use-macro="here/resource_list_macro/macros/resource_object_info" />
232            </tal:defs>
233        </tal:if_resource>
234    </li>
235</ul>
236</metal:block>
237
238
239</body>
240</html>
Note: See TracBrowser for help on using the repository browser.