my datasets deduplication
my datasets deduplication

file:a/README.rst -> file:b/README.rst
--- a/README.rst
+++ b/README.rst
@@ -4,9 +4,11 @@
 
 * A CKAN Extension "plugin" at ``ckanext/datagovau/plugin.py`` which, when
   loaded, overrides various settings in the core ``ini``-file to provide:
-  * A path to local customisations of the core templates
+  * A path to local customisations of the core templates to include AGLS/Dublin Core minimum metadata
   * A custom Package edit form that defaults to cc-by licence
   * A custom n3/rdf output format
+  * Replaces links with http/https protocol independent versions
+  * Provides HTML to users to embed data previews on their own website
 
 * A cut down licenses.json file
 

--- a/ckanext/datagovau/plugin.py
+++ b/ckanext/datagovau/plugin.py
@@ -28,8 +28,12 @@
     created_datasets_list = user_dict['datasets']
     active_datasets_list = [x['data']['package'] for x in 
 				lib.helpers.get_action('user_activity_list',{'id':user_dict['id']}) if x['data'].get('package')]
-    return created_datasets_list + active_datasets_list
-
+    raw_list = created_datasets_list + active_datasets_list
+    filtered_dict = {}
+    for dataset in raw_list:
+	if dataset['id'] not in filtered_dict.keys():
+		filtered_dict[dataset['id']] = dataset
+    return filtered_dict.values()
 
 class DataGovAuPlugin(plugins.SingletonPlugin,
                                 tk.DefaultDatasetForm):

--- /dev/null
+++ b/ckanext/datagovau/templates/dataviewer/snippets/data_preview.html
@@ -1,1 +1,32 @@
+<div class="module-content ckanext-datapreview">
+  {% if embed %}
+    {# images can be embedded directly #}
+    <img src="{{ resource_url }}"></img>
+  {% else %}
+  <div class="data-viewer-error js-hide">
+    <p class="text-error">
+      <i class="icon-info-sign"></i>
+      {{ _('This resource can not be previewed at the moment.') }}
+      <a href="#" data-toggle="collapse" data-target="#data-view-error">
+        {{ _('Click here for more information.') }}
+      </a>
+    </p>
+    <p id="data-view-error" class="collapse"></p>
+    <p>
+      <a href="{{ raw_resource_url }}" class="btn btn-large resource-url-analytics" target="_blank">
+        <i class="icon-large icon-download"></i>
+        {{ _('Download resource') }}
+      </a>
+    </p>
+  </div>
+  <iframe src="{{ resource_url }}" frameborder="0" width="100%" data-module="data-viewer">
+    <p>{{ _('Your browser does not support iframes.') }}</p>
+  </iframe>
+  {% endif %}
+</div>
+<div class="embedhint" style="padding-left: 15px;">
+<h4>Embed this visualisation in your own website...</h4>
+Copy the HTML in the box below and you can display this visualisation on your own website.<br/>
+<textarea style="width:97%">&lt;iframe src="{{ resource_url }}" frameborder="0" width="100%" height="600px"&gt;&lt;/iframe&gt;</textarea>
+</div>