Commits

Anonymous committed b79f19d

add support for date ranges and do some cleanup on the ui

Comments (0)

Files changed (20)

+# create range facets for previous RAE periods
+# create install scripts and readmes
 {
+    "service_name" : "BRUCE Reporting Tool",
+    
     # solr service base url
     "solr_url" : "http://localhost:8983/solr",
     
     # default minimum number of results required to trigger a facet being included (integer)
     "facet_mincount" : 1,
     
+    "always_visible" : 5,
+    
     # The fields which are plain text/value facets, and their display names
     # (object with keys representing facet names, and values as objects containing
     # a single key/value pair for the display name)
     # "facet_fields" : { "<facet_name>" : { "display" : "<Display Name>" } ... }
     #
     "facet_fields" : {
+        "entity" : { "display" : "Report On" },
         "org_unit_name" : { "display" : "Org Unit"},
         "gender" : {"display" : "Gender"},
         "fte" : {"display" : "FTE"},
-        "phd_supervisions" : {"display" : "Total PhD Students"},
         "funding_code" : {"display" : "Funding Code"},
         "primary_position" : {"display" : "Position"}
     },
     #                                       "mincount" : "<Minimum number per Gap>",
     #                                       "infinity" : "<Effective Infinity>"}
     "facet_ranges" : {
-        "journal_count" : {
-            "display" : "Total Journal Count", 
-            "min" : 0, "max" : 300, "gap" : 2, "mincount" : 2, "infinity" : 350
-        }, 
-        "book_count" : {
-            "display" : "Total Book Count",
-            "min" : 0, "max" : 100, "gap" : 2, "mincount" : 2, "infinity" : 150
-        }, 
-        "chapter_count" : {
-            "display" : "Total Chapter Count",
-            "min" : 0, "max" : 8, "gap" : 2, "mincount" : 2, "infinity" : 10
-        }, 
-        "conference_count" : {
-            "display" : "Total Conference Count",
-            "min" : 0, "max" : 8, "gap" : 2, "mincount" : 2, "infinity" : 10
-        }
+        #"journal_count" : {
+        #    "display" : "Total Journal Count", 
+        #    "min" : 0, "max" : 300, "gap" : 2, "mincount" : 2, "infinity" : 350
+        #}, 
+        #"book_count" : {
+        #    "display" : "Total Book Count",
+        #    "min" : 0, "max" : 100, "gap" : 2, "mincount" : 2, "infinity" : 150
+        #}, 
+        #"chapter_count" : {
+        #    "display" : "Total Chapter Count",
+        #    "min" : 0, "max" : 8, "gap" : 2, "mincount" : 2, "infinity" : 10
+        #}, 
+        #"conference_count" : {
+        #    "display" : "Total Conference Count",
+        #    "min" : 0, "max" : 8, "gap" : 2, "mincount" : 2, "infinity" : 10
+        #}
     },
     
     "facet_dates" : {
         }
     },
     
-    "display_facet_order" : ["publication_date", "org_unit_name", "gender", "fte", "contract_end",
-                                "funding_code", "primary_position",
-                                "phd_supervisions", "journal_count", "book_count", 
-                                "chapter_count", "conference_count"],
+    "facet_queries" : {
+        "publication_date" : {
+            "display" : "Reporting Period",
+            "queries" : [
+                {"display" : "RAE 2001", "query" : "[1800-01-01T00:00:00Z TO 1899-12-31T23:59:59Z]"},
+                {"display" : "RAE 2008", "query" : "[1900-01-01T00:00:00Z TO 1910-01-01T00:00:00Z]"}
+            ]
+        }
+    }
+    
+    "display_facet_order" : ["entity", "publication_date", "org_unit_name", "gender", "fte", "contract_end",
+                                "funding_code", "primary_position"],
     
     "sort_fields" : {
         "primary_department" : {"display" : "Department"}, 
     },
     
     "facet_value_functions" : {
+        "entity" : {"value_map" : {"cfPers" : "People"}},
         "gender" : {"value_map" : {"M" : "Male", "F" : "Female"}},
         "publication_date" : {"regex_map" : {"expression" : "([\\d]{4})-.*"}},
         "contract_end" : {"regex_map" : {"expression" : "([\\d]{4})-.*"}}
     },
     
     "display_fields" : {
-        "journal_count" : "Total Journal Paper Count",
-        "book_count" : "Total Book Count", 
         "gender" : "Gender", 
-        "org_unit_id" : "Org Unit", 
-        "chapter_count" : "Total Chapter Count",  
         "fte" : "FTE", 
-        "conference_count" : "Total Conference Count", 
         "name" : "Name",
-        "org_unit_name" : "Org Unit",
         "phd_supervisions" : "Total PhD Students",
-        "supervising" : "Supervising",
-        "publication_id" : "Publication ID",
-        "publication_date" : "Publication Date",
         "primary_department" : "Department",
         "primary_position" : "Position",
         "contract_end" : "Contract End",
         "funding_code" : "Funding Code",
-        "period_journals_count" : "Publications in period"
+        "period_publications_count" : "Publications in period",
+        "period_journal_count" : "Journals in period",
+        "period_book_count" : "Books in period",
+        "period_chapter_count" : "Chapters in period",
+        "period_conference_count" : "Conferences in period"
     },
     "display_value_functions" : {
         "contract_end" : {"regex_map" : {"expression" : "([\\d]{4}-[\\d]{2}-[\\d]{2}).*"}}
     },
     "display_field_order" : ["primary_department", "primary_position", "name", "gender", "fte", "contract_end", "funding_code",
-                                "phd_supervisions", "period_journals_count", "book_count", "chapter_count", "conference_count"],
+                                "phd_supervisions", "period_publications_count", "period_journal_count", "period_book_count", 
+                                "period_chapter_count", "period_conference_count"],
     
     "dynamic_fields" :{
-        "period_journals_count" : {
+        "period_publications_count" : {
             "date_range_count" : {
                 "bounding_field" : "publication_date", 
                 "results_field" : "publication_date"
             }
+        },
+        "period_journal_count" : {
+            "date_range_count" : {
+                "bounding_field" : "publication_date", 
+                "results_field" : "journal_date"
+            }
+        },
+        "period_book_count" : {
+            "date_range_count" : {
+                "bounding_field" : "publication_date", 
+                "results_field" : "book_date"
+            }
+        },
+        "period_chapter_count" : {
+            "date_range_count" : {
+                "bounding_field" : "publication_date", 
+                "results_field" : "chapter_date"
+            }
+        },
+        "period_conference_count" : {
+            "date_range_count" : {
+                "bounding_field" : "publication_date", 
+                "results_field" : "conference_date"
+            }
+        },
+        "phd_supervisions" : {
+            "array_count" : { "count_field" : "supervising" }
         }
     }
 }
 from copy import deepcopy
 from pkg_resources import resource_stream
 from datetime import datetime, timedelta
-import logging
-
-logging.basicConfig(level=logging.DEBUG)
 
 class SolrEyesController(object):
     def GET(self):
         else:
             return self.args['q'].has_key(facet)
             
+    def get_search_constraints(self):
+        return self.args['q']
+            
     def get_selected_range_start(self, facet):
         return self.args["q"][facet][0]
     
             if args["facet_date"][f].has_key("gap"):
                 solr_args["f." + f + ".facet.date.gap"] = args["facet_date"][f]["gap"]
         
+        # set up the facet queries
+        for f in args['facet_query'].keys():
+            if not solr_args.has_key("facet.query"):
+                for solr_args["facet.query"] = []
+            for q in args['facet_query'][f]['queries']:
+                solr_args["facet.query"].append(f + ":" + q['query'])
+        
         # facet mincount from config
         solr_args["facet.mincount"] = self.config.facet_mincount
         
         fields = deepcopy(self.facet_fields.keys())
         ranges = deepcopy(self.facet_ranges)
         dates = deepcopy(self.facet_dates)
+        queries = deepcopy(self.facet_queries)
         for k, v in ranges.iteritems():
             del v['display']
         for k, v in dates.iteritems():
             del v['display']
+        for k, v in queries.iteritems():
+            del v['display']
         return {
             "q" : {},
             "start" : 0,
             return func(lower, upper, args)
         else:
             return True
+            
+    def is_range(self, facet):
+        return facet in self.facet_ranges.keys()
+        
+    def is_date_range(self, facet):
+        return facet in self.facet_dates.keys()
 
 def value_map(value, d):
     return d.get(value, value)
     return lyear != uyear
 
 def date_range_count(args, result, dict):
-    if not args['q'].has_key('bounding_field'):
+    if not args['q'].has_key(dict['bounding_field']):
         values = result.get(dict['results_field'])
-        return str(len(values))
+        if values is not None:
+            return str(len(values))
+        else:
+            return 0
     start, end = args['q'][dict['bounding_field']]
     sdate = datetime.strptime(start, "%Y-%m-%dT%H:%M:%SZ")
     edate = datetime.strptime(end, "%Y-%m-%dT%H:%M:%SZ")
     values = result.get(dict['results_field'])
+    if values is None:
+        return 0
     count = 0
-    for val in values:
-        vdate = datetime.strptime(val, "%Y-%m-%dT%H:%M:%SZ")
+    for vdate in values:
+        # convert to offset aware datetime
+        strdate = '{0.year}-{0.month:{1}}-{0.day:{1}}T{0.hour:{1}}:{0.minute:{1}}:{0.second:{1}}Z'.format(vdate, '02')
+        vdate = datetime.strptime(strdate, "%Y-%m-%dT%H:%M:%SZ")
         if vdate >= sdate and vdate <= edate:
             count += 1
-    return str(count)
+    return str(count)
+    
+def array_count(args, result, dict):
+    values = result.get(dict['count_field'])
+    if values is None:
+        return 0
+    return len(values)

static/styless.css

+#header {
+    width: 100%
+    clear: both;
+}
+
+#logo {
+    width: 17%
+    float: left;
+}
+
+#title {
+    width: 80%;
+    text-align: center;
+    font-weight: bold;
+    font-size: 140%;
+    float: right;
+}
+
+#navigation {
+    padding-top: 20px;
+    clear: left;
+    float:left;
+    width: 17%;
+}
+
+#panel {
+    width: 80%;
+    float: right;
+}

templates/date-facets.mako

+% for lower, upper, count in c['results'].get_ordered_facets(facet):
+    <a href="${c['url_manager'].get_add_date_url(facet, lower, upper)}">
+    % if upper != -1:
+        ${c['config'].get_value_display(facet, str(lower))}
+        % if c['config'].display_upper(facet, str(lower), str(upper)):
+            - 
+            ${c['config'].get_value_display(facet, str(upper))} 
+        % endif
+        (${count})
+    % else:
+        ${c['config'].get_value_display(facet, str(lower))}+ (${count})
+    % endif
+    </a><br/>
+% endfor

templates/date-selected.mako

+% if c['results'].get_selected_range_end(facet) != -1:
+
+    <em>
+    ${c['config'].get_value_display(facet, str(c['results'].get_selected_range_start(facet)))}
+    % if c['config'].display_upper(facet, str(c['results'].get_selected_range_start(facet)), str(c['results'].get_selected_range_end(facet))):
+        - 
+        ${c['config'].get_value_display(facet, str(c['results'].get_selected_range_end(facet)))}
+    % endif
+
+    (${c['results'].numFound()})
+    </em>
+    &nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a>
+
+% else:
+
+    <em>${c['config'].get_value_display(facet, str(c['results'].get_selected_range_start(facet)))}+
+    (${c['results'].numFound()})
+    </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a>
+    
+% endif
+<br/>

templates/facet-extra.mako

+% for facet in c['config'].display_facet_order:
+    % if c['results'].has_values(facet):
+        <a href="" id="fh_${facet}"><strong>${c['config'].get_facet_display(facet)}</strong></a><br/>
+        <div id="selected_${facet}">
+        
+        % if facet in c['config'].facet_ranges.keys():
+        
+            % if c['results'].in_args(facet):
+                % if c['results'].get_selected_range_end(facet) != -1:
+                    <em>${c['results'].get_selected_range_start(facet)} - ${c['results'].get_selected_range_end(facet)}
+                    (${c['results'].numFound()})
+                    </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
+                % else:
+                    <em>${c['results'].get_selected_range_start(facet)}+
+                    (${c['results'].numFound()})
+                    </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
+                % endif
+            % endif
+            
+        % elif facet in c['config'].facet_dates.keys():
+            % if c['results'].in_args(facet):
+                % if c['results'].get_selected_range_end(facet) != -1:
+                    <em>
+                    ${c['config'].get_value_display(facet, str(c['results'].get_selected_range_start(facet)))}
+                    % if c['config'].display_upper(facet, str(c['results'].get_selected_range_start(facet)), str(c['results'].get_selected_range_end(facet))):
+                        - 
+                        ${c['config'].get_value_display(facet, str(c['results'].get_selected_range_end(facet)))}
+                % endif
+                (${c['results'].numFound()})
+                </em>
+                &nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
+                % else:
+                    <em>${c['config'].get_value_display(facet, str(c['results'].get_selected_range_start(facet)))}+
+                    (${c['results'].numFound()})
+                    </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
+                % endif
+            % endif 
+    
+        % else:
+        
+            % for value, count in c['results'].get_ordered_facets(facet):
+                % if c['results'].in_args(facet, value):
+                    <em>
+                    ${c['config'].get_value_display(facet, value)} (${count})
+                    </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet, value)}">x</a>
+                    <br/>
+                % endif
+            % endfor
+            
+        % endif
+        </div>
+        
+        
+    % if c['results'].has_values(facet):
+        <div id="fr_${facet}" style="display:none">
+        % if facet in c['config'].facet_ranges.keys():
+            % if not c['results'].in_args(facet):
+                % for lower, upper, count in c['results'].get_ordered_facets(facet):
+                    <a href="${c['url_manager'].get_add_url(facet, lower, upper)}">
+                    % if upper != -1:
+                        ${lower} - ${upper} (${count})
+                    % else:
+                        ${lower}+ (${count})
+                    % endif
+                    </a><br/>
+                % endfor
+            % endif
+        % elif facet in c['config'].facet_dates.keys():
+            % if not c['results'].in_args(facet):
+                % for lower, upper, count in c['results'].get_ordered_facets(facet):
+                    <a href="${c['url_manager'].get_add_date_url(facet, lower, upper)}">
+                    % if upper != -1:
+                        ${c['config'].get_value_display(facet, str(lower))}
+                        % if c['config'].display_upper(facet, str(lower), str(upper)):
+                            - 
+                            ${c['config'].get_value_display(facet, str(upper))} 
+                        % endif
+                        (${count})
+                    % else:
+                        ${c['config'].get_value_display(facet, str(lower))}+ (${count})
+                    % endif
+                    </a><br/>
+                % endfor
+            % endif
+        % else:
+            % for value, count in c['results'].get_ordered_facets(facet):
+                % if not c['results'].in_args(facet, value):
+                    <a href="${c['url_manager'].get_add_url(facet, value)}">
+                    ${c['config'].get_value_display(facet, value)} (${count})
+                    </a><br/>
+                % endif
+            % endfor
+        % endif
+        </div><br/>
+        
+    % endif
+    % endif
+% endfor

templates/facet-fields.mako

+% for value, count in c['results'].get_ordered_facets(facet):
+    % if not c['results'].in_args(facet, value):
+        <a href="${c['url_manager'].get_add_url(facet, value)}">
+        ${c['config'].get_value_display(facet, value)} (${count})
+        </a><br/>
+    % endif
+% endfor

templates/facet-selected.mako

+% for value, count in c['results'].get_ordered_facets(facet):
+    % if c['results'].in_args(facet, value):
+        <em>
+        ${c['config'].get_value_display(facet, value)} (${count})
+        </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet, value)}">x</a>
+        <br/>
+    % endif
+% endfor

templates/facets-plus.mako

+ <!-- Faceted Navigation -->
+
+% for facet in c['config'].display_facet_order:
+    % if c['results'].has_values(facet):
+    
+        <a href="" id="fh_${facet}"><strong>${c['config'].get_facet_display(facet)}</strong></a><br/>
+        <div id="selected_${facet}">
+            % if c['config'].is_range(facet) and c['config'].in_args(facet):
+                <%include file="/range-selected.mako"/>
+            % elif c['config'].is_date_range(facet) and c['config'].in_args(facet):
+                <%include file="/date-selected.mako"/>
+            % else:
+                <%include file="/facet-selected.mako"/>
+            % endif
+        </div>
+        <div id="visible_${facet}">
+           xxxx
+        </div>
+        <div id="fr_${facet}" style="display:none">
+            % if c['config'].is_range(facet) and not c['results'].in_args(facet):
+                <%include file="/range-facets.mako"/>
+            % elif c['config'].is_date_range(facet) and not c['results'].in_args(facet):
+                <%include file="/date-facets.mako"/>
+            % else:
+                <%include file="/facet-fields.mako"/>
+            % endif
+        </div>
+    
+    % endif
+% endfor

templates/facets.js.mako

+jQuery(document).ready(function() {
+% for facet in c['config'].display_facet_order:
+        $("#fh_${facet}").toggle(function(){ $("#fr_${facet}").show('slow');},function(){$("#fr_${facet}").hide('fast');});
+% endfor
+    });

templates/facets.mako

+ <!-- Faceted Navigation -->
+%   for facet in c['config'].display_facet_order:
+%       if c['results'].has_values(facet):
+            <a href="" id="fh_${facet}"><strong>${c['config'].get_facet_display(facet)}</strong></a><br/>
+            <div id="fr_${facet}" style="display:none">
+    %       if facet in c['config'].facet_ranges.keys():
+    %           if c['results'].in_args(facet):
+    %               if c['results'].get_selected_range_end(facet) != -1:
+                        <em>${c['results'].get_selected_range_start(facet)} - ${c['results'].get_selected_range_end(facet)}
+                        (${c['results'].numFound()})
+                        </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
+    %               else:
+                        <em>${c['results'].get_selected_range_start(facet)}+
+                        (${c['results'].numFound()})
+                        </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
+    %               endif
+    %           else:
+    %               for lower, upper, count in c['results'].get_ordered_facets(facet):
+                        <a href="${c['url_manager'].get_add_url(facet, lower, upper)}">
+    %                   if upper != -1:
+                            ${lower} - ${upper} (${count})
+    %                   else:
+                            ${lower}+ (${count})
+    %                   endif
+                        </a><br/>
+    %               endfor
+    %           endif
+    %       elif facet in c['config'].facet_dates.keys():
+    
+    %           if c['results'].in_args(facet):
+    %               if c['results'].get_selected_range_end(facet) != -1:
+                        <em>
+                            ${c['config'].get_value_display(facet, str(c['results'].get_selected_range_start(facet)))}
+        %               if c['config'].display_upper(facet, str(c['results'].get_selected_range_start(facet)), str(c['results'].get_selected_range_end(facet))):
+                            - 
+                            ${c['config'].get_value_display(facet, str(c['results'].get_selected_range_end(facet)))}
+        %               endif
+                        (${c['results'].numFound()})
+                        </em>
+                        &nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
+    %               else:
+                        <em>${c['config'].get_value_display(facet, str(c['results'].get_selected_range_start(facet)))}+
+                        (${c['results'].numFound()})
+                        </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
+    %               endif
+    %           else:
+    %               for lower, upper, count in c['results'].get_ordered_facets(facet):
+                        <a href="${c['url_manager'].get_add_date_url(facet, lower, upper)}">
+    %                   if upper != -1:
+                            ${c['config'].get_value_display(facet, str(lower))}
+        %                   if c['config'].display_upper(facet, str(lower), str(upper)):
+                                - 
+                                ${c['config'].get_value_display(facet, str(upper))} 
+        %                   endif
+                            (${count})
+    %                   else:
+                            ${c['config'].get_value_display(facet, str(lower))}+ (${count})
+    %                   endif
+                        </a><br/>
+    %               endfor
+    %           endif 
+    
+    %       else:
+    
+    %           for value, count in c['results'].get_ordered_facets(facet):
+    %               if c['results'].in_args(facet, value):
+                        <em>
+    %               else:
+                        <a href="${c['url_manager'].get_add_url(facet, value)}">
+    %               endif
+        
+                    ${c['config'].get_value_display(facet, value)} (${count})
+        
+    %               if c['results'].in_args(facet, value):
+                        </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet, value)}">x</a>
+    %               else:
+                        </a>
+    %               endif
+                    <br/>
+    %           endfor
+    
+    %       endif
+        </div>
+        <br/>
+%       endif
+%   endfor

templates/header.mako

+<div id="header">
+
+    <a href="/"><img id="logo" src="/static/Eye_of_Horus_bw.png" alt="The Eye of Horus"/></a>
+    <div id="title">
+        ${c['config'].service_name}
+    </div>
+
+</div>

templates/noresults.mako

+There are currently no results to display.  Try selecting some facets
+from the left to start getting some results.  There are ${c['results'].numFound()} 
+records in the index.

templates/paging.mako

+<div class="paging">
+    <!-- Paging -->
+    
+%   if not c['results'].is_start():
+        <a href="${c['url_manager'].get_position_url(0)}">1 - ${c['results'].first_page_end()}</a>
+        ...
+%   endif
+
+%       for start, finish in c['results'].get_previous(3):
+            <a href="${c['url_manager'].get_position_url(start)}">${start + 1} - ${finish}</a>
+%       endfor
+            <strong>${c['results'].start_offset(1)} - ${c['results'].finish()}</strong>
+
+%       for start, finish in c['results'].get_next(3):
+            <a href="${c['url_manager'].get_position_url(start)}">${start + 1} - ${finish}</a>
+%       endfor
+
+%   if not c['results'].is_end():
+        ...
+        <a href="${c['url_manager'].get_position_url(c['results'].last_page_start())}">
+        ${c['results'].last_page_start() + 1} - 
+        ${c['results'].numFound()}</a>
+%   endif
+</div>

templates/range-facets.mako

+% for lower, upper, count in c['results'].get_ordered_facets(facet):
+    <a href="${c['url_manager'].get_add_url(facet, lower, upper)}">
+    % if upper != -1:
+        ${lower} - ${upper} (${count})
+    % else:
+        ${lower}+ (${count})
+    % endif
+    </a><br/>
+% endfor

templates/range-selected.mako

+% if c['results'].get_selected_range_end(facet) != -1:
+    <em>
+        ${c['results'].get_selected_range_start(facet)} - ${c['results'].get_selected_range_end(facet)}
+        (${c['results'].numFound()})
+    </em>
+    &nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a>
+% else:
+    <em>
+    ${c['results'].get_selected_range_start(facet)}+
+    (${c['results'].numFound()})
+    </em>
+    &nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a>
+% endif
+<br/>

templates/resultsperpage.mako

+<div class="results_per_page">
+    Results per page: 
+% for rpp in c['config'].results_per_page_options:
+%   if rpp == c['results'].page_size():
+    <strong>${rpp}</strong>
+%   else:
+    <a href="${c['url_manager'].get_rpp_url(rpp)}">${rpp}</a>
+%   endif
+% endfor
+
+</div>

templates/search-summary.mako

+<div class="search_constraints">
+% for facet, value in c['results'].get_search_constraints().iteritems():
+    <div class="search_constraint">
+        ${c['config'].get_facet_display(facet)} : ${value}
+        &nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a>
+    </div>
+% endfor
+</div>

templates/solreyes.mako

 <html>
 <head>
-    <script type="text/javascript" src="/static/jquery.js"></script> 
+    <link rel="stylesheet" type="text/css" href="/static/styless.css"/>
+    <script type="text/javascript" src="/static/jquery.js"></script>
     <script>
-    jQuery(document).ready(function() {
-% for facet in c['config'].display_facet_order:
-        $("#fh_${facet}").toggle(function(){ $("#fr_${facet}").show('slow');},function(){$("#fr_${facet}").hide('fast');});
-% endfor
-    });
+    
+    <%include file="/facets.js.mako"/>
+    
     </script>
-    <title>SolrEyes</title>
+    <title>${c['config'].service_name}</title>
 </head>
 
 <body>
     
-    <table align="center">
+    <%include file="/header.mako"/>
     
-    <tr>
-        <td>
-            <a href="/">
-            <img src="/static/Eye_of_Horus_bw.png" alt="The Eye of Horus"/></a><br/><br/>
-        </td>
-        <td valign="top">
-            <h1>SolrEyes</h1>
-        </td>
-    </tr>
+    <div id="navigation">
+        <%include file="/facet-extra.mako"/>
+    </div>
     
-    <tr>
+    <div id="panel">
     
-    <!-- Faceted Navigation -->
-        <td valign="top">
-%   for facet in c['config'].display_facet_order:
-%       if c['results'].has_values(facet):
-            <a href="" id="fh_${facet}"><strong>${c['config'].get_facet_display(facet)}</strong></a><br/>
-            <div id="fr_${facet}" style="display:none">
-    %       if facet in c['config'].facet_ranges.keys():
-    %           if c['results'].in_args(facet):
-    %               if c['results'].get_selected_range_end(facet) != -1:
-                        <em>${c['results'].get_selected_range_start(facet)} - ${c['results'].get_selected_range_end(facet)}
-                        (${c['results'].numFound()})
-                        </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
-    %               else:
-                        <em>${c['results'].get_selected_range_start(facet)}+
-                        (${c['results'].numFound()})
-                        </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
-    %               endif
-    %           else:
-    %               for lower, upper, count in c['results'].get_ordered_facets(facet):
-                        <a href="${c['url_manager'].get_add_url(facet, lower, upper)}">
-    %                   if upper != -1:
-                            ${lower} - ${upper} (${count})
-    %                   else:
-                            ${lower}+ (${count})
-    %                   endif
-                        </a><br/>
-    %               endfor
-    %           endif
-    %       elif facet in c['config'].facet_dates.keys():
+    % if c['results'].set_size() != 0:
+        <%include file="/search-summary.mako"/>
+        <%include file="/paging.mako"/>
+    % endif
+
     
-    %           if c['results'].in_args(facet):
-    %               if c['results'].get_selected_range_end(facet) != -1:
-                        <em>
-                            ${c['config'].get_value_display(facet, str(c['results'].get_selected_range_start(facet)))}
-        %               if c['config'].display_upper(facet, str(c['results'].get_selected_range_start(facet)), str(c['results'].get_selected_range_end(facet))):
-                            - 
-                            ${c['config'].get_value_display(facet, str(c['results'].get_selected_range_end(facet)))}
-        %               endif
-                        (${c['results'].numFound()})
-                        </em>
-                        &nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
-    %               else:
-                        <em>${c['config'].get_value_display(facet, str(c['results'].get_selected_range_start(facet)))}+
-                        (${c['results'].numFound()})
-                        </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet)}">x</a><br/>
-    %               endif
-    %           else:
-    %               for lower, upper, count in c['results'].get_ordered_facets(facet):
-                        <a href="${c['url_manager'].get_add_date_url(facet, lower, upper)}">
-    %                   if upper != -1:
-                            ${c['config'].get_value_display(facet, str(lower))}
-        %                   if c['config'].display_upper(facet, str(lower), str(upper)):
-                                - 
-                                ${c['config'].get_value_display(facet, str(upper))} 
-        %                   endif
-                            (${count})
-    %                   else:
-                            ${c['config'].get_value_display(facet, str(lower))}+ (${count})
-    %                   endif
-                        </a><br/>
-    %               endfor
-    %           endif 
+    % if c['results'].set_size() == 0:
+        <%include file="/noresults.mako"/>
+    % else:
+        
+        <!-- sorting and result sizes -->
+        <%include file="/resultsperpage.mako"/>
+        <%include file="/sort-options.mako"/>
+        
+        <!-- finally, the result set itself -->
+        
+        <%include file="/table-view.mako"/>
     
-    %       else:
-    
-    %           for value, count in c['results'].get_ordered_facets(facet):
-    %               if c['results'].in_args(facet, value):
-                        <em>
-    %               else:
-                        <a href="${c['url_manager'].get_add_url(facet, value)}">
-    %               endif
-        
-                    ${c['config'].get_value_display(facet, value)} (${count})
-        
-    %               if c['results'].in_args(facet, value):
-                        </em>&nbsp;&nbsp;<a href="${c['url_manager'].get_delete_url(facet, value)}">x</a>
-    %               else:
-                        </a>
-    %               endif
-                    <br/>
-    %           endfor
-    
-    %       endif
-        </div>
-        <br/>
-%       endif
-%   endfor
-        </td>
-            
-        <td valign="top">
+    % endif
 
-% if c['results'].set_size() != 0:
-<p>
-    <!-- Paging -->
-    
-%   if not c['results'].is_start():
-        <a href="${c['url_manager'].get_position_url(0)}">1 - ${c['results'].first_page_end()}</a>
-        ...
-%   endif
-
-%       for start, finish in c['results'].get_previous(3):
-            <a href="${c['url_manager'].get_position_url(start)}">${start + 1} - ${finish}</a>
-%       endfor
-            <strong>${c['results'].start_offset(1)} - ${c['results'].finish()}</strong>
-
-%       for start, finish in c['results'].get_next(3):
-            <a href="${c['url_manager'].get_position_url(start)}">${start + 1} - ${finish}</a>
-%       endfor
-
-%   if not c['results'].is_end():
-        ...
-        <a href="${c['url_manager'].get_position_url(c['results'].last_page_start())}">
-        ${c['results'].last_page_start() + 1} - 
-        ${c['results'].numFound()}</a>
-%   endif
-</p>
-% endif
-
-
-
-<!-- Result set -->
-
-% if c['results'].set_size() == 0:
-    There are currently no results to display.  Try selecting some facets
-    from the left to start getting some results.  There are ${c['results'].numFound()} 
-    records in the index.
-% else:
-    <!-- sorting and result sizes -->
-<p>
-    Results per page: 
-% for rpp in c['config'].results_per_page_options:
-%   if rpp == c['results'].page_size():
-    <strong>${rpp}</strong>
-%   else:
-    <a href="${c['url_manager'].get_rpp_url(rpp)}">${rpp}</a>
-%   endif
-% endfor
-
-<br/>
-% if len(c['results'].current_sort_fields()) > 0:
-    Sorting by: 
-% for sortby, direction in c['results'].current_sort_order():
-    <strong>
-    ${c['config'].sort_fields[sortby].get("display", sortby)}
-    % if direction == 'asc':
-        (^ <a href="${c['url_manager'].get_sort_url(sortby, 'desc')}">v</a>)
-    % endif
-    % if direction == 'desc':
-        (<a href="${c['url_manager'].get_sort_url(sortby, 'asc')}">^</a> v)
-    % endif
-    <a href="${c['url_manager'].get_unsort_url(sortby)}">x</a>
-    </strong>
-    then
-% endfor
--
-% endif
-
-% if len([f for f in c['config'].sort_fields.keys() if f not in c['results'].current_sort_fields()]) > 0:
-% if len(c['results'].current_sort_fields()) == 0:
-Sort by:
-% endif
-
-% for sortby in c['config'].sort_fields.keys():
-%   if sortby not in c['results'].current_sort_fields():
-    ${c['config'].sort_fields[sortby].get("display", sortby)} (<a href="${c['url_manager'].get_sort_url(sortby, 'asc')}">^</a> <a href="${c['url_manager'].get_sort_url(sortby, 'desc')}">v</a>)
-%   endif
-% endfor
-% endif
-
-</p>
-
-<%include file="/table-view.mako"/>
-% endif
-
-        </td>
-    
-    </tr></table>
+    </div>
     
 </body>
 </html>

templates/sort-options.mako

+<div class="sort_options">
+% if len(c['results'].current_sort_fields()) > 0:
+    Sorting by: 
+    % for sortby, direction in c['results'].current_sort_order():
+        <strong>
+        ${c['config'].sort_fields[sortby].get("display", sortby)}
+        % if direction == 'asc':
+            (^ <a href="${c['url_manager'].get_sort_url(sortby, 'desc')}">v</a>)
+        % endif
+        % if direction == 'desc':
+            (<a href="${c['url_manager'].get_sort_url(sortby, 'asc')}">^</a> v)
+        % endif
+        <a href="${c['url_manager'].get_unsort_url(sortby)}">x</a>
+        </strong>
+        then
+    % endfor
+    -
+% endif
+
+% if len([f for f in c['config'].sort_fields.keys() if f not in c['results'].current_sort_fields()]) > 0:
+    % if len(c['results'].current_sort_fields()) == 0:
+        Sort by:
+    % endif
+
+    % for sortby in c['config'].sort_fields.keys():
+    %   if sortby not in c['results'].current_sort_fields():
+        ${c['config'].sort_fields[sortby].get("display", sortby)} (<a href="${c['url_manager'].get_sort_url(sortby, 'asc')}">^</a> <a href="${c['url_manager'].get_sort_url(sortby, 'desc')}">v</a>)
+    %   endif
+    % endfor
+% endif
+</div>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.