Remove old extras, include more RDFa markup for distributions/data resources
Remove old extras, include more RDFa markup for distributions/data resources

--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,17 +8,15 @@
       <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/ckanext/datagovau/templates/package/snippets/resource_item.html" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ckanext/datagovau/templates/package/snippets/package_basic_fields.html" afterPath="$PROJECT_DIR$/ckanext/datagovau/templates/package/snippets/package_basic_fields.html" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ckanext/datagovau/templates/package/snippets/package_metadata_fields.html" afterPath="$PROJECT_DIR$/ckanext/datagovau/templates/package/snippets/package_metadata_fields.html" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ckanext/datagovau/plugin.py" afterPath="$PROJECT_DIR$/ckanext/datagovau/plugin.py" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ckanext/datagovau/templates/package/read.html" afterPath="$PROJECT_DIR$/ckanext/datagovau/templates/package/read.html" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ckanext/datagovau/templates/package/read.rdf" afterPath="$PROJECT_DIR$/ckanext/datagovau/templates/package/read.rdf" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ckanext/datagovau/templates/package/read_base.html" afterPath="$PROJECT_DIR$/ckanext/datagovau/templates/package/read_base.html" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ckanext/datagovau/templates/package/resource_read.html" afterPath="$PROJECT_DIR$/ckanext/datagovau/templates/package/resource_read.html" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/setup.py" afterPath="$PROJECT_DIR$/setup.py" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
     </list>
     <ignored path="ckanext-datagovau.iws" />
     <ignored path=".idea/workspace.xml" />
-    <file path="/Dummy.txt" changelist="89ace156-8d75-43de-ba53-6e829c197435" time="1379979943634" ignored="false" />
+    <file path="/Dummy.txt" changelist="89ace156-8d75-43de-ba53-6e829c197435" time="1379987697128" ignored="false" />
     <file path="/plugin.py" changelist="89ace156-8d75-43de-ba53-6e829c197435" time="1379980346924" ignored="false" />
     <file path="/setup.py" changelist="89ace156-8d75-43de-ba53-6e829c197435" time="1379980236185" ignored="false" />
     <file path="/package_basic_fields.html" changelist="89ace156-8d75-43de-ba53-6e829c197435" time="1379984845682" ignored="false" />
@@ -672,7 +670,7 @@
     <option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="false" />
     <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
     <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
-    <option name="LAST_COMMIT_MESSAGE" value="Move Disqus comments to package not resource page" />
+    <option name="LAST_COMMIT_MESSAGE" value="Allow anonymous access to datastore API search" />
     <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
     <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
     <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
@@ -688,6 +686,7 @@
     <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
     <MESSAGE value="Update HTML package output to interim metadata standard" />
     <MESSAGE value="Move Disqus comments to package not resource page" />
+    <MESSAGE value="Allow anonymous access to datastore API search" />
   </component>
   <component name="XDebuggerManager">
     <breakpoint-manager />

--- a/ckanext/datagovau/templates/package/read.html
+++ b/ckanext/datagovau/templates/package/read.html
@@ -7,13 +7,13 @@
 </div>
 {% endblock %}
 {% block package_additional_info %}
-<section class="additional-info" xmlns:dcat="http://www.w3.org/ns/dcat#"
-         xmlns:dcam="http://purl.org/dc/dcam/"
-         xmlns:aglsterms="http://www.agls.gov.au/agls/terms/"
-         xmlns:agentterms="http://www.agls.gov.au/agls/agentterms/"
-         xmlns:availterms="http://www.agls.gov.au/agls/availterms/"
-         xmlns:adminterms="http://www.agls.gov.au/agls/adminterms/"
-         xmlns:dct="http://purl.org/dc/terms/">
+<section class="additional-info" prefix="dc: http://purl.org/dc/elements/1.1/ dcat: http://www.w3.org/ns/dcat#
+         dcam: http://purl.org/dc/dcam/
+         aglsterms: http://www.agls.gov.au/agls/terms/
+         agentterms: http://www.agls.gov.au/agls/agentterms/
+         availterms: http://www.agls.gov.au/agls/availterms/
+         adminterms: http://www.agls.gov.au/agls/adminterms/
+         dct: http://purl.org/dc/terms/">
     <h3>{{ _('Additional Info') }}</h3>
     <table class="table table-striped table-bordered table-condensed">
         <thead>
@@ -44,17 +44,11 @@
             <td class="dataset-details"> {{ pkg.agency_program }}</td>
         </tr>
         {% endif %}
-        {% if pkg.get('Agency Program') %}
-        <tr>
-            <th scope="row" class="dataset-label">Agency Program</th>
-            <td class="dataset-details"> {{ pkg.get('Agency Program') }}</td>
-        </tr>
-        {% endif %}
-        {% if h.get_pkg_dict_extra(pkg,'DCTERMS.Source.URI') %}
+        {% if pkg.get('url') %}
         <tr>
             <th scope="row" class="dataset-label">{{ _('Source') }}</th>
-            <td class="dataset-details" property="dct:source">{{ h.link_to(h.get_pkg_dict_extra(pkg,'DCTERMS.Source.URI'),
-                h.get_pkg_dict_extra(pkg,'DCTERMS.Source.URI'), rel='dct:source', target='_blank') }}
+            <td class="dataset-details" property="dct:source">{{ h.link_to(pkg.get('url'),
+                pkg.get('url'), rel='dct:source', target='_blank') }}
             </td>
         </tr>
         {% endif %}
@@ -73,13 +67,6 @@
             <td class="dataset-details" property="dct:spatial"> {{ pkg.spatial_coverage }}</td>
         </tr>
         {% endif %}
-        {% if h.get_pkg_dict_extra(pkg,'Geospatial Coverage') %}
-
-        <tr>
-            <th scope="row" class="dataset-label">Geospatial Coverage</th>
-            <td class="dataset-details" property="dct:spatial"> {{ h.get_pkg_dict_extra(pkg,'Geospatial Coverage') }}</td>
-        </tr>
-        {% endif %}
         {% if pkg.get('granularity') %}
 
         <tr>
@@ -87,43 +74,19 @@
             <td class="dataset-details"> {{ pkg.granularity }}</td>
         </tr>
         {% endif %}
-        {% if h.get_pkg_dict_extra(pkg,'Granularity') %}
-
-        <tr>
-            <th scope="row" class="dataset-label">Data Granularity</th>
-            <td class="dataset-details"> {{ h.get_pkg_dict_extra(pkg,'Granularity') }}</td>
-        </tr>
-        {% endif %}
         {% if pkg.get('jurisdiction') %}
-
         <tr>
             <th scope="row" class="dataset-label">Government Jurisdiction</th>
             <td class="dataset-details" property="aglsterms:AglsJuri"> {{ pkg.jurisdiction }}</td>
         </tr>
         {% endif %}
-        {% if h.get_pkg_dict_extra(pkg,'AGLSTERMS.Jurisdiction') %}
-
-        <tr>
-            <th scope="row" class="dataset-label">Government Jurisdiction</th>
-            <td class="dataset-details" property="aglsterms:AglsJuri"> {{ h.get_pkg_dict_extra(pkg,'AGLSTERMS.Jurisdiction') }}</td>
-        </tr>
-        {% endif %}
         {% if pkg.get('temporal_coverage') %}
-
         <tr>
             <th scope="row" class="dataset-label">Temporal Coverage</th>
             <td class="dataset-details" property="dct:temporal"> {{ pkg.temporal_coverage }}</td>
         </tr>
         {% endif %}
-        {% if h.get_pkg_dict_extra(pkg,'Temporal Coverage') %}
-
-        <tr>
-            <th scope="row" class="dataset-label">Temporal Coverage</th>
-            <td class="dataset-details" property="dct:temporal"> {{ h.get_pkg_dict_extra(pkg,'Temporal Coverage') }}</td>
-        </tr>
-        {% endif %}
         {% if pkg.get('data_state') %}
-
         <tr>
             <th scope="row" class="dataset-label">Data State</th>
             <td class="dataset-details"> {{ pkg.data_state }}</td>
@@ -134,12 +97,6 @@
         <tr>
             <th scope="row" class="dataset-label">Update Frequency</th>
             <td class="dataset-details"> {{ pkg.update_freq }}</td>
-        </tr>
-        {% endif %}
-        {% if h.get_pkg_dict_extra(pkg,'Update Frequency') %}
-        <tr>
-            <th scope="row" class="dataset-label">Update Frequency</th>
-            <td class="dataset-details"> {{ h.get_pkg_dict_extra(pkg,'Update Frequency') }}</td>
         </tr>
         {% endif %}
 

--- a/ckanext/datagovau/templates/package/read.rdf
+++ b/ckanext/datagovau/templates/package/read.rdf
@@ -88,40 +88,21 @@
         </dct:contributor>
 
 
-        <foaf:homepage py:if="h.get_pkg_dict_extra(c.pkg_dict,'DCTERMS.Source.URI')">${h.get_pkg_dict_extra(c.pkg_dict,'DCTERMS.Source.URI') }
-        </foaf:homepage>
-
+        <foaf:homepage py:if="c.pkg_dict.get('url')">${c.pkg_dict.get('url')}</foaf:homepage>
         <dcat:contactPoint py:if="c.pkg_dict.get('contact_point')">${c.pkg_dict.contact_point }</dcat:contactPoint>
         <dct:spatial py:if="c.pkg_dict.get('spatial_coverage')">${ c.pkg_dict.spatial_coverage }</dct:spatial>
-        <dct:spatial py:if="h.get_pkg_dict_extra(c.pkg_dict,'Geospatial Coverage')">${ h.get_pkg_dict_extra(c.pkg_dict,'Geospatial Coverage') }</dct:spatial>
         <aglsterms:AglsJuri py:if="c.pkg_dict.get('jurisdiction')">${ c.pkg_dict.jurisdiction }</aglsterms:AglsJuri>
-        <aglsterms:AglsJuri py:if="h.get_pkg_dict_extra(c.pkg_dict,'AGLSTERMS.Jurisdiction')">${ h.get_pkg_dict_extra(c.pkg_dict,'AGLSTERMS.Jurisdiction') }</aglsterms:AglsJuri>
         <dct:temporal py:if="c.pkg_dict.get('temporal_coverage')">${ c.pkg_dict.get('temporal_coverage') }</dct:temporal>
-        <dct:temporal py:if="h.get_pkg_dict_extra(c.pkg_dict,'Temporal Coverage')">${ h.get_pkg_dict_extra(c.pkg_dict,'Temporal Coverage') }</dct:temporal>
         <dct:relation py:if="c.pkg_dict.get('data_state')">
             <rdf:Description>
                 <rdfs:label>Data State</rdfs:label>
                 <rdf:value>${ c.pkg_dict.get('data_state') }</rdf:value>
             </rdf:Description>
         </dct:relation>
-
         <dct:relation py:if="c.pkg_dict.get('update_freq')">
             <rdf:Description>
                 <rdfs:label>Update Frequency</rdfs:label>
                 <rdf:value>${ c.pkg_dict.get('update_freq') }</rdf:value>
-            </rdf:Description>
-        </dct:relation>
-        <dct:relation py:if="h.get_pkg_dict_extra(c.pkg_dict,'Update Frequency')">
-            <rdf:Description>
-                <rdfs:label>Update Frequency</rdfs:label>
-                <rdf:value>${ h.get_pkg_dict_extra(c.pkg_dict,'Update Frequency') }</rdf:value>
-            </rdf:Description>
-        </dct:relation>
-
-        <dct:relation py:if="h.get_pkg_dict_extra(c.pkg_dict,'Agency Program')">
-            <rdf:Description>
-                <rdfs:label>Agency Program</rdfs:label>
-                <rdf:value>${ h.get_pkg_dict_extra(c.pkg_dict,'Agency Program') }</rdf:value>
             </rdf:Description>
         </dct:relation>
         <dct:relation py:if="c.pkg_dict.get('agency_program')">
@@ -130,20 +111,12 @@
                 <rdf:value>${ c.pkg_dict.get('agency_program') }</rdf:value>
             </rdf:Description>
         </dct:relation>
-
-        <dct:relation py:if="h.get_pkg_dict_extra(c.pkg_dict,'Granularity')">
-            <rdf:Description>
-                <rdfs:label>Data Granularity</rdfs:label>
-                <rdf:value>${ h.get_pkg_dict_extra(c.pkg_dict,'Granularity') }</rdf:value>
-            </rdf:Description>
-        </dct:relation>
         <dct:relation py:if="c.pkg_dict.get('granularity')">
             <rdf:Description>
                 <rdfs:label>Data Granularity</rdfs:label>
                 <rdf:value>${ c.pkg_dict.get('granularity') }</rdf:value>
             </rdf:Description>
         </dct:relation>
-
         <py:for each="extra_dict in c.pkg_dict.get('extras',[])">
             <dct:relation>
                 <rdf:Description>

--- a/ckanext/datagovau/templates/package/read_base.html
+++ b/ckanext/datagovau/templates/package/read_base.html
@@ -14,11 +14,11 @@
 <meta name="DCTERMS.Creator" scheme="AGLSTERMS.AglsAgent" content="{{ pkg['organization']['title'] }}" />
 <meta name="DCTERMS.Modified" scheme="DCTERMS.ISO8601" content="{{pkg['metadata_modified']}}" />
 <meta name="DCTERMS.Published" scheme="DCTERMS.ISO8601" content="{{pkg['metadata_created']}}" />
-{% if  h.get_pkg_dict_extra(pkg,'DCTERMS.Source.URI') %}<meta name="DCTERMS.Source.URI" content="{{h.get_pkg_dict_extra(pkg,'DCTERMS.Source.URI')}}" />{% endif %}
+<meta name="DCTERMS.Source.URI" content="{{pkg.url}}" />
 <meta name="DCTERMS.License" content="{{pkg['license_url']}}" />
-<meta name="DCTERMS.Coverage.Temporal" content="{{pkg.temporal_coverage or h.get_pkg_dict_extra(pkg,'Temporal Coverage')}}" />
-<meta name="DCTERMS.Coverage.Spatial" content="{{pkg.spatial_coverage or h.get_pkg_dict_extra(pkg,'Geospatial Coverage')}}" />
-<meta name="AGLSTERMS.Jurisdiction" scheme="AGLSTERMS.AglsJuri" content="{{pkg.jurisdiction or h.get_pkg_dict_extra(pkg,'AGLSTERMS.Jurisdiction')}}" />
+<meta name="DCTERMS.Coverage.Temporal" content="{{pkg.temporal_coverage}}" />
+<meta name="DCTERMS.Coverage.Spatial" content="{{pkg.spatial_coverage}}" />
+<meta name="AGLSTERMS.Jurisdiction" scheme="AGLSTERMS.AglsJuri" content="{{pkg.jurisdiction}}" />
 <meta name="DCAT.Theme" scheme="VO" content="{% for x in pkg.groups %}{{x['title']}},{% endfor %}" />
 <meta name="DCTERMS.Identifier" content="{{h.url_for(controller='package',action='read',id=c.pkg_dict['name'], qualified=True)}}" />
 <meta name="DCTERMS.Title" content="{{pkg['title']}}" />
@@ -30,7 +30,7 @@
 {% block package_info %}
 <div class="module context-info">
     <div class="module-content">
-        <h1 class="heading" property="dct:title">{{ pkg.title or pkg.name }}</h1>
+        <h1 class="heading" property="dc:title">{{ pkg.title or pkg.name }}</h1>
         <div class="nums">
             <dl>
                 <dt>{{ _('Followers') }}</dt>

--- a/ckanext/datagovau/templates/package/resource_read.html
+++ b/ckanext/datagovau/templates/package/resource_read.html
@@ -14,11 +14,11 @@
 <meta name="DCTERMS.Creator" scheme="AGLSTERMS.AglsAgent" content="{{ pkg['organization']['title'] }}" />
 <meta name="DCTERMS.Modified" scheme="DCTERMS.ISO8601" content="{{res['revision_timestamp']}}" />
 <meta name="DCTERMS.Published" scheme="DCTERMS.ISO8601" content="{{res['created']}}" />
-{% if  h.get_pkg_dict_extra(pkg,'DCTERMS.Source.URI') %}<meta name="DCTERMS.Source.URI" content="{{h.get_pkg_dict_extra(pkg,'DCTERMS.Source.URI')}}" />{% endif %}
+<meta name="DCTERMS.Source.URI" content="{{pkg.url}}" />{% endif %}
 <meta name="DCTERMS.License" content="{{pkg['license_url']}}" />
-<meta name="DCTERMS.Coverage.Temporal" content="{{pkg.temporal_coverage or h.get_pkg_dict_extra(pkg,'Temporal Coverage')}}" />
-<meta name="DCTERMS.Coverage.Spatial" content="{{pkg.spatial_coverage or h.get_pkg_dict_extra(pkg,'Geospatial Coverage')}}" />
-<meta name="AGLSTERMS.Jurisdiction" scheme="AGLSTERMS.AglsJuri" content="{{pkg.jurisdiction or h.get_pkg_dict_extra(pkg,'AGLSTERMS.Jurisdiction')}}" />
+<meta name="DCTERMS.Coverage.Temporal" content="{{pkg.temporal_coverage}}" />
+<meta name="DCTERMS.Coverage.Spatial" content="{{pkg.spatial_coverage}}" />
+<meta name="AGLSTERMS.Jurisdiction" scheme="AGLSTERMS.AglsJuri" content="{{pkg.jurisdiction}}" />
 <meta name="DCAT.Theme" scheme="VO" content="{% for x in pkg.groups %}{{x['title']}},{% endfor %}" />
 <meta name="DCAT.byteSize" content="{{res.get('size')}}" />
 <meta name="DCAT.mediaType" content="{{res.get('mimetype')}}" />
@@ -26,7 +26,6 @@
 <meta name="DCTERMS.Title" content="{{res['name']}}" />
 <meta name="DCTERMS.Description" scheme="" content="{{res['description']}}" />
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-
 <meta name="DCTERMS.Format" content="{{res.format}}" />
 <meta name="DCTERMS.File.Size" content="{{res.size}}" />
 

--- a/ckanext/datagovau/templates/package/snippets/package_basic_fields.html
+++ b/ckanext/datagovau/templates/package/snippets/package_basic_fields.html
@@ -3,6 +3,7 @@
 {% block package_basic_fields_org  %}
 
 {{ super() }}
+
 
 {{ form.input('agency_program', label=_('Agency Program'), id='field-agency_program',
 placeholder=_('Name of the Agency Program that generated the data if relevant'),

--- a/ckanext/datagovau/templates/package/snippets/package_metadata_fields.html
+++ b/ckanext/datagovau/templates/package/snippets/package_metadata_fields.html
@@ -10,8 +10,9 @@
 {# https://github.com/okfn/ckan/blob/master/ckan/templates/macros/form.html documents the macros for fields #}
 
 {% block package_metadata_fields %}
-
-
+{{ form.input('url', label=_('Source URL'), id='field-url',
+placeholder=_('URL where dataset came from or more information can be obtained'),
+value=data.url, error=errors.url, classes=['control-medium']) }}
 {{ super() }}
 
 {% endblock %}

--- /dev/null
+++ b/ckanext/datagovau/templates/package/snippets/resource_item.html
@@ -1,1 +1,54 @@
+{% ckan_extends %}
 
+{% set url = h.url_for(controller='package', action='resource_read', id=pkg.name, resource_id=res.id) %}
+<li class="resource-item" vocab="http://www.w3.org/ns/dcat#"
+ typeof="Distribution">
+    {% block resource_item_title %}
+    <a class="heading" href="{{ url }}" title="{{ res.name or res.description }}" property="title">
+        {{ h.resource_display_name(res) | truncate(50) }}<span class="format-label" property="dc:format" data-format="{{ res.format.lower() or 'data' }}">{{ res.format }}</span>
+        {{ h.popular('views', res.tracking_summary.total, min=10) }}
+    </a>
+    {% endblock %}
+    <p class="description" property="description">
+        {% if res.description %}
+        {{ h.markdown_extract(res.description, extract_length=80) }}
+        {% else %}
+        <span class="empty">{{ _('No description for this resource') }}</span>
+        {% endif %}
+    </p>
+    {% block resource_item_explore %}
+    <div class="dropdown btn-group">
+        <a href="#" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
+            <i class="icon-share-alt"></i>
+            {{ _('Explore') }}
+            <span class="caret"></span>
+        </a>
+        <ul class="dropdown-menu">
+            {% block resource_item_explore_links %}
+            <li>
+                <a href="{{ url }}" property="accessURL">
+                    {% if res.can_be_previewed %}
+                    <i class="icon-bar-chart"></i>
+                    {{ _('Preview') }}
+                    {% else %}
+                    <i class="icon-info-sign"></i>
+                    {{ _('More information') }}
+                    {% endif %}
+                </a>
+            </li>
+            <li>
+                <a href="{{ res.url }}" class="resource-url-analytics" target="_blank" property="accessURL">
+                    {% if res.can_be_previewed %}
+                    <i class="icon-download"></i>
+                    {{ _('Download') }}
+                    {% else %}
+                    <i class="icon-external-link"></i>
+                    {{ _('Go to resource') }}
+                    {% endif %}
+                </a>
+            </li>
+            {% endblock %}
+        </ul>
+    </div>
+    {% endblock %}
+</li>