remove last active user
--- a/ckanext/agls/plugin.py
+++ b/ckanext/agls/plugin.py
@@ -10,18 +10,6 @@
from sqlalchemy import orm
import ckan.model
-#parse the activity feed for last active non-system user
-def get_last_active_user(id):
- system_user = lib.helpers.get_action('user_show',{'id': config.get('ckan.site_id', 'ckan_site_user')})
- user_list = [x for x in lib.helpers.get_action('package_activity_list',{'id':id}) if x['user_id'] != system_user['id']]
- user = None
- if len(user_list) > 0:
- user = user_list[0].get('user_id', None)
- if user is None:
- return system_user
- else:
- return lib.helpers.get_action('user_show',{'id':user})
-
class AGLSPlugin(plugins.SingletonPlugin,
tk.DefaultDatasetForm):
'''An example IDatasetForm CKAN plugin.
@@ -31,7 +19,6 @@
'''
plugins.implements(plugins.IConfigurer, inherit=False)
plugins.implements(plugins.IDatasetForm, inherit=False)
- plugins.implements(plugins.ITemplateHelpers, inherit=False)
def update_config(self, config):
# Add this plugin's templates dir to CKAN's extra_template_paths, so
@@ -44,8 +31,6 @@
tk.add_resource('theme/public', 'ckanext-agls')
# config['licenses_group_url'] = 'http://%(ckan.site_url)/licenses.json'
- def get_helpers(self):
- return {'get_last_active_user': get_last_active_user}
def is_fallback(self):
# Return True to register this plugin as the default handler for
@@ -95,7 +80,16 @@
'data_state': [tk.get_converter('convert_from_extras'),
tk.get_validator('ignore_empty')],
'update_freq': [tk.get_converter('convert_from_extras'),
- tk.get_validator('ignore_empty')]
+ tk.get_validator('ignore_empty')],
+ #harvesting fields
+ #'spatial_harvester': [tk.get_converter('convert_from_extras'),
+ # tk.get_validator('ignore_missing')],
+ #'harvest_object_id': [tk.get_converter('convert_from_extras'),
+ # tk.get_validator('ignore_missing')],
+ #'harvest_source_id': [tk.get_converter('convert_from_extras'),
+ # tk.get_validator('ignore_missing')],
+ #'harvest_source_title': [tk.get_converter('convert_from_extras'),
+ # tk.get_validator('ignore_missing')],
})
return schema
@@ -121,7 +115,17 @@
'data_state': [tk.get_converter('convert_to_extras'),
tk.get_validator('not_empty')],
'update_freq': [tk.get_converter('convert_to_extras'),
- tk.get_validator('not_empty')]
+ tk.get_validator('not_empty')],
+ #harvesting fields
+ #'spatial_harvester': [tk.get_validator('ignore_missing'),
+ # tk.get_converter('convert_to_extras')],
+ #'harvest_object_id': [tk.get_validator('ignore_missing'),
+ # tk.get_converter('convert_to_extras')],
+ #'harvest_source_id': [tk.get_validator('ignore_missing'),
+ # tk.get_converter('convert_to_extras')],
+ #'harvest_source_title': [tk.get_validator('ignore_missing'),
+ # tk.get_converter('convert_to_extras')],
+
})
return schema
--- a/ckanext/agls/templates/package/read.html
+++ b/ckanext/agls/templates/package/read.html
@@ -42,6 +42,13 @@
<th scope="row" class="dataset-label">{{ _('Source') }}</th>
<td class="dataset-details" property="dct:source">{{ h.link_to(pkg.get('url'),
pkg.get('url'), rel='dct:source', target='_blank') }}
+ </td>
+ </tr>
+ {% endif %}
+ {% if h.get_pkg_dict_extra(c.pkg_dict, 'spatial_harvester','') != '' %}
+ <tr>
+ <th scope="row" class="dataset-label">XML Metadata Document</th>
+ <td class="dataset-details">{{ h.link_to("View",h.url_for(controller='HarvestMetadataApi', action='display_xml_original', id=h.get_pkg_dict_extra(c.pkg_dict, 'harvest_object_id'))) }}
</td>
</tr>
{% endif %}
@@ -93,13 +100,6 @@
</tr>
{% endif %}
-{% set email =h.get_last_active_user(c.pkg_dict['id']).get('email','') %}
- <tr>
- <th scope="row" class="dataset-label">{{ _('Maintainer') }}</th>
- <td class="dataset-details" property="dc:contributor">{{
- h.mail_to(email_address=(email or ' '), name=h.get_last_active_user(c.pkg_dict['id']).get("display_name",'')) }}
- </td>
- </tr>
<tr>
<th scope="row" class="dataset-label">Publisher/Agency</th>
<td class="dataset-details" property="dc:publisher">{{ c.pkg_dict['organization']['title']}}
--- a/ckanext/agls/templates/package/read.rdf
+++ b/ckanext/agls/templates/package/read.rdf
@@ -74,13 +74,6 @@
<foaf:name>${ c.pkg_dict['organization']['title'] }</foaf:name>
</rdf:Description>
</dct:creator>
- <dct:contributor>
- <rdf:Description>
- <foaf:name>${h.get_last_active_user(c.pkg_dict['id'])["display_name"]}</foaf:name>
- <foaf:mbox py:if="h.get_last_active_user(c.pkg_dict['id']).get('email', None)"
- rdf:resource="mailto:${h.get_last_active_user(c.pkg_dict['id'])['email']}"/>
- </rdf:Description>
- </dct:contributor>
<py:for each="extra_dict in c.pkg_dict.get('extras',[])">
<dct:relation>