source: trunk/skins/lemill/lemill_browse_results.pt @ 1215

Revision 1215, 12.9 KB checked in by jukka, 13 years ago (diff)

Fixed #1026. Refactored user resources to not generate new topics for every user and use general portfolio-topic. Unauthenticated users tried to create them when one didn't exist in viewed memberfolder. In general I have a gutfeeling that having many so topics reduces their efficiency, but I am open to arguments, it's only feeling.

Line 
1<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
2      lang="en"
3      metal:use-macro="here/main_template/macros/master"
4      i18n:domain="lemill">
5
6
7<metal:block fill-slot="top_slot"
8             tal:define="dummy python:request.set('disable_border',1)" />
9
10<div metal:fill-slot="main"
11     tal:define="Batch python:modules['Products.CMFPlone'].Batch;
12                 DateTime python:modules['DateTime'].DateTime;
13                 b_size python:30;b_start python:0;b_start request/b_start | b_start;
14                 parent_folder python:context.aq_inner.aq_parent.title_or_id().lower();
15                 request_opened python:here.analyzeRequest(request);
16                 searchterm request_opened/searchterms | nothing;
17                 full_url string:$here_url?${request_opened/search_url};
18                 cont_url string:$here_url${request_opened/cont_url};
19                 filter request_opened/filter | nothing;
20                 searchterm_nice request_opened/searchterm_nice;
21                 value_nice request_opened/value_nice;
22                 is_plural request_opened/is_plural;
23                 topic_name python:context.title_or_id().lower();
24                 can_l10n_topic_values python:topic_name in ('target group','subject area');
25                 topic_get_method python:here.public_getSortCriterion(here);
26                 do_tagcloud python:(not searchterm and topic_get_method) and (not here.id in ('drafts','published','my_blogposts','my_stories','recent')) or (here.id=='portfolio' and len(searchterm) &lt; 2 and not filter);
27                 type_criterion python:here.crit__Type_ATPortalTypeCriterion.value;
28                 wrw python:here.whatResourceWhereDictionary();
29                 pmnd here/prettyMethodNameDictionary;
30                 tagcloud_type python:here.tagcloud_type(topic_name);
31                 use_view_action site_properties/typesUseViewActionInListings;
32                 limit_display limit_display|request/limit_display|nothing;
33                 contentsMethod python:test(here.portal_type=='Topic', here.queryCatalog, here.getFolderContents);
34                 folderContents folderContents|python:contentsMethod();
35                 over_limit python: limit_display and len(folderContents) > limit_display;
36                 folderContents python: (over_limit and folderContents[:limit_display]) or folderContents;
37                 results folderContents|request/results|nothing;
38                 results python:here.filterContent(results, filter);
39                 browsed_stuff python:here.getBrowsedStuff(topic_name);
40                 insideMemberFolder here/getMemberFolder | nothing">
41
42    <h1 tal:condition="python:here.id=='drafts'" i18n:translate="" tal:content="string:My draft ${parent_folder}"></h1>
43    <h1 tal:condition="python:here.id=='published'" i18n:translate="" tal:content="string:My published ${parent_folder}"></h1>
44    <h1 tal:condition="python:here.id=='portfolio' and filter"><span i18n:translate="" tal:content="python:filter.capitalize()">Content</span> <span i18n:translate="by_author"> by <span i18n:name="authors_name" tal:content="here/NiceName">author</span></span></h1>
45    <h1 tal:condition="python:here.id=='portfolio' and not filter and not searchterm" i18n:translate="heading_user_tagcloud">User tagcloud: <span i18n:name="authors_name" tal:content="here/NiceName | nothing">author</span></h1>
46    <h1 tal:condition="python:here.id not in ('drafts','published','portfolio') or (here.id=='portfolio' and len(searchterm)>1)">
47        <tal:cond tal:condition="python: tagcloud_type!='hits'" i18n:translate="" tal:content="string:Browse ${topic_name}"></tal:cond>
48        <tal:cond tal:condition="python:tagcloud_type=='hits'">
49            <tal:cond tal:condition="searchterm">
50                <span i18n:translate="" tal:content="string:Browse ${browsed_stuff} where"/>
51          <tal:repeat tal:repeat="si searchterm/items">
52        <span i18n:translate="text_field_is_value">
53                 <span i18n:name="field"><span tal:omit-tag="" i18n:translate="" tal:content="python:searchterm_nice[si[0]].lower()">Field</span></span> is
54                 <span i18n:name="value"><span tal:condition="not:can_l10n_topic_values" tal:content="python:value_nice[si[0]]"/><span tal:condition="can_l10n_topic_values" i18n:translate="" tal:content="python:value_nice[si[0]]"/></span>
55        </span>
56                <span tal:omit-tag="" tal:condition="not: repeat/si/end" i18n:translate="and">and</span>
57          </tal:repeat>
58          </tal:cond>
59          <span tal:condition="not:searchterm" i18n:translate="" tal:content="string:Browse ${browsed_stuff} by ${topic_name}"/>
60        </tal:cond>
61    </h1>
62
63    <!-- Browse by values for keywords or similar fields-->
64
65    <div class="tagcloud" tal:condition="do_tagcloud">
66
67    <div tal:condition="not: results">
68        <p><strong i18n:domain="plone" i18n:translate="description_no_results_found">No results were found.</strong></p>
69    </div>
70
71
72     <fieldset tal:condition="results">
73         <legend tal:condition="python: topic_name in ('tags','content') and parent_folder=='content'">
74             <span tal:omit-tag="" i18n:translate="label_show">Show</span>:
75             <a tal:condition="python:filter!='resources'"  tal:attributes="href string:${cont_url}filter=resources" i18n:translate="label_resources" href="" >learning resources</a>
76             <span tal:condition="python:filter=='resources'" tal:omit-tag="" i18n:translate="label_resources">learning resources</span> |
77             <a tal:condition="python:filter!='pieces'"  tal:attributes="href string:${cont_url}filter=pieces" i18n:translate="label_media_pieces" href="" >media pieces</a>
78             <span tal:condition="python:filter=='pieces'" tal:omit-tag="" i18n:translate="label_media_pieces">media pieces</span> |
79             <a tal:condition="python:filter!='references'"  tal:attributes="href string:${cont_url}filter=references" i18n:translate="label_references" href="" >references</a>
80             <span tal:condition="python:filter=='references'" tal:omit-tag="" i18n:translate="label_references">references</span>
81         </legend>
82         <legend tal:condition="python: topic_name in ('materials','content','pieces','references')">
83             <span tal:omit-tag="" i18n:translate="label_show">Show</span>:
84             <a tal:condition="python:topic_name in ('content', 'pieces', 'references')" i18n:translate="label_resources" href="../materials">learning resources</a>
85             <span tal:condition="python:topic_name=='materials'" tal:omit-tag="" i18n:translate="label_resources">learning resources</span> |
86             <a tal:condition="python:topic_name in ('content','materials','references')" i18n:translate="label_media_pieces" href="../pieces">media pieces</a>
87             <span tal:condition="python:topic_name=='pieces'" tal:omit-tag="" i18n:translate="label_media_pieces">media pieces</span> |
88             <a tal:condition="python:topic_name in ('content','materials','pieces')" i18n:translate="label_references" href="../references">references</a>
89             <span tal:condition="python:topic_name=='references'" tal:omit-tag="" i18n:translate="label_references">references</span> 
90</legend>
91
92        <table class="keyword_list" tal:define="wordtuples python:here.getUniques(results, topic_get_method, tagcloud_type)">
93           <tr>
94             <td>
95             <tal:taggy repeat="wordinfo wordtuples">
96               <tal:taggyvalues define="sort_name python:wordinfo[0];
97                       tagsize python:wordinfo[1];
98                       obj_url python:wordinfo[2];
99                       tag_value python:wordinfo[3];
100                       nicename python:wordinfo[4];
101                       ">
102                <span tal:attributes="class string:size$tagsize">
103                <a tal:attributes="href python: test(tagcloud_type!='hits' or tagsize==1, obj_url, here.getTagURL(context,topic_get_method,tag_value,filter, insideMemberFolder))"><tal:block tal:condition="not:can_l10n_topic_values" tal:content="nicename"/><tal:block tal:condition="can_l10n_topic_values" i18n:translate="" tal:content="nicename"/></a>
104                </span>
105               </tal:taggyvalues>
106               <tal:comma tal:condition="not: repeat/wordinfo/end">, </tal:comma>
107               </tal:taggy>
108              </td>
109            </tr>
110         </table>
111       </fieldset>
112    </div>
113
114    <div tal:condition="not:do_tagcloud" tal:omit-tag="">
115    <fieldset style="border-width:0px">
116    <legend tal:condition="python: parent_folder=='content' and topic_name in ['tags','published','content']">
117        <span tal:omit-tag="" i18n:translate="label_show">Show</span>:
118        <a tal:condition="python:filter!='resources'"  tal:attributes="href string:${cont_url}filter=resources" i18n:translate="label_resources" href="" >learning resources</a>
119        <span tal:condition="python:filter=='resources'" tal:omit-tag="" i18n:translate="label_resources">learning resources</span> |
120        <a tal:condition="python:filter!='pieces'"  tal:attributes="href string:${cont_url}filter=pieces" i18n:translate="label_media_pieces" href="" >media pieces</a>
121        <span tal:condition="python:filter=='pieces'" tal:omit-tag="" i18n:translate="label_media_pieces">media pieces</span> |
122        <a tal:condition="python:filter!='references'"  tal:attributes="href string:${cont_url}filter=references" i18n:translate="label_references" href="" >references</a>
123        <span tal:condition="python:filter=='references'" tal:omit-tag="" i18n:translate="label_references">references</span>
124    </legend>
125
126    <div tal:condition="not: results">
127        <p><strong i18n:domain="plone" i18n:translate="description_no_results_found">No results were found.</strong></p>
128    </div>
129
130        <span tal:define="batch python:Batch(results, b_size, int(b_start), orphan=1);
131                          link_pref string:$here_url/tags?getTags=" tal:omit-tag="">
132
133        <!-- Search results -->
134               <span metal:use-macro="here/resource_list_macro/macros/resources_list" />
135
136        <!-- Navigation -->
137        <div metal:use-macro="here/batch_macros/macros/navigation" />
138        </span>
139
140<tal:other_results condition="python: topic_name not in ('draft','recent','portfolio')">
141    <p/>
142    <div tal:define="frc python:here.fullResultCount(request, topic_name, topic_get_method, request_opened);" tal:omit-tag="">
143           
144        <span tal:repeat="typename frc/keys" tal:omit-tag="">
145        <p tal:define="results_n python:frc[typename];
146            path python:wrw[typename][2];
147            url python:wrw[typename][3];
148            add_filter python:wrw[typename][4];
149            type_nicename python:wrw[typename][1].lower();
150            searchterm python:test(topic_name=='published', {'Creator':member}, searchterm);
151            ">
152        <tal:worth_listing condition="python:results_n>0">
153            <a href="" tal:condition="python: topic_name!='published'"
154                tal:attributes="href python: '%s?%s%s' % (url, request_opened['search_url'],add_filter)">
155        <span i18n:translate="" tal:content="string:Browse ${type_nicename} where"/>
156                <tal:loop tal:omit-tag="" tal:repeat="si searchterm/items">
157        <span i18n:translate="text_field_is_value">
158                 <span i18n:name="field"><span tal:omit-tag="" i18n:translate="" tal:content="python:searchterm_nice[si[0]].lower()">Field</span></span> is
159                 <span i18n:name="value"><span tal:condition="not:can_l10n_topic_values" tal:content="python:value_nice[si[0]]"/><span tal:condition="can_l10n_topic_values" i18n:translate="" tal:content="python:value_nice[si[0]]"/></span>
160        </span>
161        <span tal:omit-tag="" tal:condition="not: repeat/si/end" i18n:translate="and">and</span>
162        </tal:loop>
163
164        (<tal:block tal:content="results_n"/>)
165            </a>
166            <a tal:condition="python:topic_name=='published'" tal:attributes="href python:'%s/../published' % url">
167        <span i18n:translate="" tal:content="string:Browse ${type_nicename}"/>
168        (<tal:block tal:content="results_n"/>)
169            </a>
170        </tal:worth_listing>
171        </p>
172        </span>
173    </div>
174</tal:other_results>
175
176<span i18n:translate="label_n_results"><span tal:omit-tag="" tal:content="python:len(results)" i18n:name="n">234</span> results.</span>
177    <tal:syndicate condition="syntool/isSiteSyndicationAllowed">
178     <a href="" tal:attributes="href string:$here_url/search_rss?${request/QUERY_STRING}">
179     <img i18n:domain="plone" i18n:attributes="title title_rss_feed; alt label_rss_feed;"
180             tal:attributes="src string:$portal_url/rss.gif"
181             src="rss.gif"
182             alt="RSS Feed"
183             title="RSS feed of these search results" />
184     </a>
185    </tal:syndicate>
186    </fieldset>
187</div>
188
189<p i18n:domain="plone" i18n:translate="search_results_advanced">
190Did you not find what you were looking for? Try the
191<span i18n:name="advanced_search">
192<a href=""
193   i18n:translate="search_results_advanced_link"
194   tal:attributes="href string:$portal_url/lemill_search_form">Advanced Search</a>
195</span>
196for more precise search options.
197</p>
198
199</div>
200
201
202</html>
203
Note: See TracBrowser for help on using the repository browser.