LP1849212: Use a set list of roles for course users
[Evergreen.git] / Open-ILS / src / templates / opac / course / results.tt2
1 [%- PROCESS "opac/parts/header.tt2";
2     WRAPPER "opac/parts/base.tt2";
3     INCLUDE "opac/parts/topnav.tt2";
4     ctx.page_title = l("Course Search Results");
5     page = CGI.param('page');
6     page = page.match('^\d+$') ? page : 0; # verify page is a sane value
7
8     page_count = (!ctx.page_size.defined || !ctx.hit_count.defined || ctx.page_size == 0) ? 1 : POSIX.ceil(ctx.hit_count / ctx.page_size);
9
10     # We don't want search engines indexing search results
11     ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
12
13     PROCESS "opac/parts/misc_util.tt2";
14     PROCESS get_library;
15     ctx.result_start = 1 + ctx.page_size * page;
16     ctx.result_stop = ctx.page_size * (page + 1);
17     IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
18
19     result_count = ctx.result_start;
20 -%]
21 <h2 class="sr-only">[% l('Course Search Results') %]</h2>
22 [% INCLUDE "opac/parts/searchbar.tt2" %]
23 <div class="almost-content-wrapper">
24   <div id="results_header_bar">
25     <div id="results_header_inner">
26       <div class="results_header_btns">
27         <a href="[% mkurl(ctx.opac_root _ '/course_search', {$loc_name => loc_value}, 1) %]">[% l('Another Search') %]</a>
28       </div>
29     </div>
30   </div>
31 </div>
32 <div id="content-wrapper">
33   <div id="main-content">
34     <div id="results-page">
35       [% PROCESS "opac/parts/result/paginate.tt2" %] 
36       [% ctx.results_count_header = PROCESS results_count_header;
37     ctx.results_count_header %]
38       <div id="result_table_div">
39       <div id="result_block" class="result_block_visible">
40
41       <table id="result_table_table" title="[% l('Search Results') %]"
42         class="table_no_border_space table_no_cell_pad">
43         <thead class="sr-only">
44           <tr>
45             <th>[% l('Search result number') %]</th>
46             <th>[% l('Course details') %]</th>
47           </tr>
48         </thead>
49         <tbody id="result_table">
50         [% FOR course IN ctx.courses %]
51           [% course_url_path = ctx.opac_root _ '/course/' _ course.id; %]
52           [% # Do not pass "advanced params" to result detail code.
53           # Instead, pass the scrubed query in one-line form
54           del_parms = del_parms.merge(['query', 'bool', 
55                    'qtype', 'contains', '_adv']);
56           add_parms.import(
57            {query => ctx.naive_query_scrub(ctx.user_query)} );
58                   %]
59           <tr class="result_table_row">
60             <td class="results_row_count" name="results_row_count">
61               [% result_count; result_count = result_count + 1 %].
62             </td>
63             <td class="result_table_pic_header"></td>
64             <td class="result_table_title_cell" name="result_table_title_cell">
65               <div class="result_metadata">
66                 <a class="record_title search_link" name="course_[% course.id %]"
67                   href="[% mkurl(course_url_path) %]"
68                   [% html_text_attr('title', l('Display course details for "[_1]"', course.name)) %]>
69                   [% course.course_number %]:  [% l(course.name) %]
70                 </a>
71                 <div>
72                   [% FOR instructor IN course.instructors %]
73                     [% instructorString = '';
74                       IF instructor.pref_family_name;
75                         instructorString = instructorString _ instructor.pref_family_name _ ', ';
76                       ELSE;
77                         instructorString = instructorString _ instructor.family_name _ ', ';
78                       END;
79                       IF instructor.pref_first_given_name;
80                         instructorString = instructorString _ instructor.pref_first_given_name;
81                       ELSE;
82                         instructorString = instructorString _ instructor.first_given_name;
83                       END; %]
84                   <a title="[% l('Perform an Instructor Search') %]"
85                     class="record_author"
86                     href="[%
87                        mkurl(ctx.opac_root _ '/results', {qtype => 'instructor', query => instructorString})
88                     %]" rel="nofollow" vocab="">
89                   [% instructorString %] ([% l(instructor.usr_role.name) %])</a>.
90                   [% END %]
91                 </div>
92                 <div>
93                   <span><strong>[% l('Course Number') %]</strong>: [% course.course_number %]</span>
94                 </div>
95                 <div>
96                   <span><strong>[% l('Section Number') %]</strong>: [% course.section_number %]</span>
97                 </div>
98               </div>
99             </td>
100             <td>
101               [% ctx.get_aou(course.owning_lib).name %]
102             </td>
103           </tr>
104         [% END %]
105         </tbody>
106       </table>
107       </div>
108       </div>
109     </div>
110     <div class="common-full-pad"></div>
111   </div>
112   <br class="clear-both" />
113 </div>
114 [%- END %]