<html
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:i18n="http://genshi.edgewall.org/i18n"
  xmlns:py="http://genshi.edgewall.org/"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  py:strip="">

  <xi:include href="facets.html" />
  <py:def function="page_title">Search - ${g.site_title}</py:def>

  <py:match path="primarysidebar">
    
    <li class="widget-container widget_text" py:if="h.am_authorized(c, actions.PACKAGE_CREATE)">
        <h4>Add a package</h4>
        <p>
            Do you know of a dataset that should be added to ${g.site_title}?
            <br/>
            
            <a href="${h.url_for(controller='package', action='new', id=None)}">Register it now</a>.
        </p>
    </li>
 
    ${facet_sidebar('groups', label=h.group_name_to_title)}
    ${facet_sidebar('tags')}
    ${facet_sidebar('res_format')}
    ${facet_sidebar('license')}

    <li class="widget-container widget_text">
        <h4>Other access</h4>
<?python
  from pylons import config
  dumps_url = config.get('ckan.dumps_url')
  dumps_format = config.get('ckan.dumps_format', '')
?>
        <p>
            You can also access this registry using the 
            ${h.link_to(_('API'), h.url_for(controller='api', action='get_api', id=None))}
            (see ${h.link_to(_('API Docs'), 'http://wiki.ckan.net/API')})<py:if test="dumps_url">
                or download a <a href="${dumps_url}">full ${dumps_format} 
                dump</a></py:if>.
        </p>
    </li>
 
  </py:match>

  <div py:match="content">
    <h2>Search ${g.site_title}</h2>
    
    <xi:include href="search_form.html" />
    ${field_list()}   
    
      <py:if test="c.query_error">
        <p i18n:msg="item_count"><strong>There was an error while searching.</strong> 
            Please try another search term.</p>
      </py:if>
      <py:if test="request.params">      
        <h4 i18n:msg="item_count"><strong>${c.page.item_count}</strong> packages found</h4>            
     </py:if>
      <py:if test="c.page.item_count == 0 and request.params">
        <p i18n:msg="">Would you like to <a href="${h.url_for(action='new', id=None)}">create a new package?</a></p>
      </py:if>
      ${package_list(c.page.items)}
      ${c.page.pager(q=c.q)}

  </div>
  <xi:include href="layout.html" />
</html>


