[#214] Removed genshi templates
This commit is contained in:
parent
121e8bd918
commit
41975a93d8
|
@ -1,5 +1,4 @@
|
|||
import logging
|
||||
import genshi
|
||||
from urllib import urlencode
|
||||
|
||||
from ckan import plugins as p
|
||||
|
@ -59,16 +58,7 @@ class OrganizationController(GroupController):
|
|||
q += ' owner_org: "%s"' % c.group_dict.get('id')
|
||||
else:
|
||||
q += ' groups: "%s"' % c.group_dict.get('name')
|
||||
|
||||
try:
|
||||
description_formatted = ckan.misc.MarkdownFormat().to_html(
|
||||
c.group_dict.get('description', ''))
|
||||
c.description_formatted = genshi.HTML(description_formatted)
|
||||
except Exception, e:
|
||||
error_msg = "<span class='inline-warning'>%s</span>" %\
|
||||
p.toolkit._("Cannot render description")
|
||||
c.description_formatted = genshi.HTML(error_msg)
|
||||
|
||||
|
||||
context['return_query'] = True
|
||||
|
||||
# c.group_admins is used by CKAN's legacy (Genshi) templates only,
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
<html xmlns:py="http://genshi.edgewall.org/"
|
||||
xmlns:i18n="http://genshi.edgewall.org/i18n"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
py:strip="">
|
||||
|
||||
<py:def function="page_title">Harvesting Sources</py:def>
|
||||
|
||||
<py:def function="body_class">harvest no-sidebar</py:def>
|
||||
<py:def function="page_heading">Harvesting Sources</py:def>
|
||||
|
||||
<py:def function="optional_head">
|
||||
<link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/style.css" />
|
||||
</py:def>
|
||||
<py:def function="optional_footer">
|
||||
<script>$("#show-inactive-sources").click(function(){$("#harvest-sources .inactive").toggle()});</script>
|
||||
</py:def>
|
||||
|
||||
<div py:match="content">
|
||||
<div class="harvest-content">
|
||||
|
||||
<div py:if="c.status" class="status">
|
||||
<h3>Status:</h3>
|
||||
${h.literal(c.status)}
|
||||
</div>
|
||||
|
||||
<div id="new-harvest-source"><a href="harvest/new">Add a harvesting source</a></div>
|
||||
<py:choose>
|
||||
<py:when test="c.sources">
|
||||
<div id="show-inactive-sources-content">
|
||||
<input type="checkbox" id="show-inactive-sources" />
|
||||
<label for="show-inactive-sources"> Show inactive sources</label>
|
||||
</div>
|
||||
|
||||
<table id="harvest-sources" class="table table-bordered table-condensed ${'publishers' if c.publisher_auth else ''}" >
|
||||
<tr>
|
||||
<th class="action">View</th>
|
||||
<th class="action">Edit</th>
|
||||
<th class="action">Refresh</th>
|
||||
<th>URL</th>
|
||||
<th>Type</th>
|
||||
<th>Active</th>
|
||||
<th>Statistics</th>
|
||||
<th>Next Harvest</th>
|
||||
<th>Created</th>
|
||||
</tr>
|
||||
<?python old_publisher = None ?>
|
||||
<py:for each="source in c.sources">
|
||||
<tr class="publisher" py:if="c.publisher_auth and old_publisher != source['publisher_id']">
|
||||
<py:choose>
|
||||
<py:when test="source.get('publisher_title')">
|
||||
<td colspan="9">${source['publisher_title']}</td>
|
||||
</py:when>
|
||||
<py:otherwise>
|
||||
<td colspan="9">${source['publisher_id']}</td>
|
||||
</py:otherwise>
|
||||
</py:choose>
|
||||
|
||||
</tr>
|
||||
<?python old_publisher = source['publisher_id'] ?>
|
||||
<tr class="${'active' if source.active else 'inactive'}">
|
||||
<td><a href="harvest/${source.id}"><img src="ckanext/harvest/images/icons/source_view.png" alt="View" title="View" /></a></td>
|
||||
<td><a href="harvest/edit/${source.id}"><img src="ckanext/harvest/images/icons/source_edit.png" alt="Edit" title="Edit" /></a></td>
|
||||
<td><a href="harvest/refresh/${source.id}"><img src="ckanext/harvest/images/icons/source_refresh.png" alt="Refresh" title="Refresh" /></a></td>
|
||||
<?python
|
||||
from webhelpers.text import truncate
|
||||
?>
|
||||
<td title="${source.url}">${truncate(source.url, 50)}</td>
|
||||
<td>${source.type}</td>
|
||||
<td class="state">${source.active}</td>
|
||||
<py:choose>
|
||||
<py:when test="'msg' in source.status">
|
||||
<td>${source.status.msg}</td>
|
||||
<td>${source.status.msg}</td>
|
||||
</py:when>
|
||||
<py:otherwise>
|
||||
<td>Datasets: <a href="harvest/${source.id}#datasets">${source.status.overall_statistics.added}</a> <br/>
|
||||
Last errors: <a href="harvest/${source.id}#errors">${source.status.last_harvest_statistics.errors}</a></td>
|
||||
<td>${source.status.next_harvest}</td>
|
||||
</py:otherwise>
|
||||
</py:choose>
|
||||
|
||||
<td>${h.render_datetime(source.created)}</td>
|
||||
</tr>
|
||||
</py:for>
|
||||
</table>
|
||||
</py:when>
|
||||
<py:otherwise>
|
||||
<div id="no-harvest-sources">No harvest sources defined yet.</div>
|
||||
</py:otherwise>
|
||||
</py:choose>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<xi:include href="layout.html" />
|
||||
</html>
|
|
@ -1,24 +0,0 @@
|
|||
<html xmlns:py="http://genshi.edgewall.org/"
|
||||
xmlns:i18n="http://genshi.edgewall.org/i18n"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
py:strip="">
|
||||
|
||||
<py:def function="page_title">Edit - Harvest Source</py:def>
|
||||
<py:def function="page_heading">Edit harvest source </py:def>
|
||||
|
||||
<py:def function="body_class">hide-sidebar</py:def>
|
||||
<py:def function="optional_head">
|
||||
<link rel="stylesheet" href="${g.site_url}/css/forms.css" type="text/css" media="screen, print" />
|
||||
<link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/style.css" />
|
||||
</py:def>
|
||||
|
||||
<div py:match="content">
|
||||
<div class="harvest-content">
|
||||
|
||||
|
||||
${h.literal(c.form)}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<xi:include href="../layout.html" />
|
||||
</html>
|
|
@ -1,23 +0,0 @@
|
|||
<html xmlns:py="http://genshi.edgewall.org/"
|
||||
xmlns:i18n="http://genshi.edgewall.org/i18n"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
py:strip="">
|
||||
|
||||
<py:def function="page_title">New - Harvest Source</py:def>
|
||||
<py:def function="page_heading">New harvest source </py:def>
|
||||
|
||||
<py:def function="body_class">hide-sidebar</py:def>
|
||||
<py:def function="optional_head">
|
||||
<link rel="stylesheet" href="${g.site_url}/css/forms.css" type="text/css" media="screen, print" />
|
||||
<link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/style.css" />
|
||||
</py:def>
|
||||
|
||||
<div py:match="content">
|
||||
<div class="harvest-content">
|
||||
|
||||
${h.literal(c.form)}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<xi:include href="../layout.html" />
|
||||
</html>
|
|
@ -1,89 +0,0 @@
|
|||
<form id="source-new" class="ckan" method="post"
|
||||
py:attrs="{'class':'has-errors'} if errors else {}"
|
||||
xmlns:i18n="http://genshi.edgewall.org/i18n"
|
||||
xmlns:py="http://genshi.edgewall.org/"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<div class="error-explanation" py:if="error_summary">
|
||||
<h2>Errors in form</h2>
|
||||
<p>The form contains invalid entries:</p>
|
||||
<ul>
|
||||
<li py:for="key, error in error_summary.items()">${"%s: %s" % (key, error)}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Details</legend>
|
||||
<dl>
|
||||
<dt><label class="field_req" for="url">URL for source of metadata *</label></dt>
|
||||
<dd><input id="url" name="url" size="80" type="text" value="${data.get('url', '')}" /></dd>
|
||||
<dd class="field_error" py:if="errors.get('url', '')">${errors.get('url', '')}</dd>
|
||||
<dd class="instructions basic">This should include the <tt>http://</tt> part of the URL</dd>
|
||||
<dt><label class="field_req" for="type">Source Type *</label></dt>
|
||||
<dd>
|
||||
<select id="type" name="type">
|
||||
<py:for each="harvester in harvesters">
|
||||
<option value="${harvester.name}" py:attrs="{'selected': 'selected' if data.get('type', '') == harvester.name else None, 'data-config': harvester.show_config}" >${harvester.title}</option>
|
||||
</py:for>
|
||||
</select>
|
||||
</dd>
|
||||
<dd class="field_error" py:if="errors.get('type', '')">${errors.get('type', '')}</dd>
|
||||
<dd class="instructions basic">Which type of source does the URL above represent?
|
||||
<ul>
|
||||
<py:for each="harvester in harvesters">
|
||||
<li><span class="harvester-title">${harvester.title}</span>: ${harvester.description}</li>
|
||||
</py:for>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt class="harvest-source-title"><label class="field_req" for="title">Title</label></dt>
|
||||
<dd class="harvest-source-title"><input id="title" name="title" size="80" type="text" value="${data.get('title', '')}" /></dd>
|
||||
<dd class="harvest-source-title field_error" py:if="errors.get('title', '')">${errors.get('title', '')}</dd>
|
||||
<dd class="harvest-source-title instructions basic">This will be shown as the datasets source.</dd>
|
||||
|
||||
<dt><label class="field_opt" for="description">Description</label></dt>
|
||||
<dd><textarea id="description" name="description" cols="30" rows="2" style="height:75px">${data.get('description', '')}</textarea></dd>
|
||||
<dd class="instructions basic">You can add your own notes here about what the URL above represents to remind you later.</dd>
|
||||
|
||||
<dt py:if="c.publisher_auth"><label class="field_opt" for="groups__${len(data.get('groups', []))}__id">Publisher</label></dt>
|
||||
<dd py:if="c.publisher_auth and c.groups">
|
||||
<select id="publisher_id" name="publisher_id">
|
||||
<py:for each="group in c.groups">
|
||||
<option value="${group['id']}" py:attrs="{'selected': 'selected' if group['id'] == data.get('publisher_id',None) else None}">${group['title']}</option>
|
||||
</py:for>
|
||||
</select>
|
||||
</dd>
|
||||
<dd py:if="c.publisher_auth and not c.groups"><em>Cannot add any publishers.</em></dd>
|
||||
|
||||
|
||||
<dt class="harvest-source-config"><label class="field_opt" for="config">Configuration</label></dt>
|
||||
<dd class="harvest-source-config"><textarea id="config" name="config" cols="30" rows="2" style="height:75px">${data.get('config', '')}</textarea></dd>
|
||||
|
||||
<dt><label class="field_opt" for="active">State</label></dt>
|
||||
<dd>
|
||||
<select id="active" name="active">
|
||||
<option py:attrs="{'selected': 'selected' if data.get('active') or not 'active' in data else None}" value="True">active</option>
|
||||
<option py:attrs="{'selected': 'selected' if 'active' in data and not data.get('active') else None}" value="False">withdrawn</option>
|
||||
</select>
|
||||
<py:if test="data.get('active') or not 'active' in data">
|
||||
<div>This harvest source is <span class="source-state-active">Active</span></div>
|
||||
</py:if>
|
||||
<py:if test="'active' in data and not data.get('active')">
|
||||
<div>This harvest source is <span class="source-state-inactive">Withdrawn</span></div>
|
||||
</py:if>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<input id="save" name="save" value="Save" type="submit" class="btn"/> or <a href="/harvest">Return to the harvest sources list</a>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#type").change(function(){
|
||||
var show_config = ($("#type option:selected").attr("data-config") == "True");
|
||||
if (!show_config) $("#config").val("");
|
||||
$("#config").attr("disabled", !show_config);
|
||||
});
|
||||
$("#type").trigger("change");
|
||||
});
|
||||
</script>
|
||||
</form>
|
|
@ -1,149 +0,0 @@
|
|||
<html xmlns:py="http://genshi.edgewall.org/"
|
||||
xmlns:i18n="http://genshi.edgewall.org/i18n"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
py:strip="">
|
||||
|
||||
<py:def function="page_title">Harvest Source Details</py:def>
|
||||
<py:def function="page_heading">Harvest Source Details</py:def>
|
||||
|
||||
<py:def function="optional_head">
|
||||
<link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/style.css" />
|
||||
</py:def>
|
||||
|
||||
<div py:match="content">
|
||||
<div class="harvest-content">
|
||||
<py:if test="c.source">
|
||||
<div id="harvest-source-actions">
|
||||
<img src="/ckanext/harvest/images/icons/source_edit.png" alt="Edit" /><a href="/harvest/edit/${c.source.id}">Edit source</a> |
|
||||
<img src="/ckanext/harvest/images/icons/source_refresh.png" alt="Refresh" /><a href="/harvest/refresh/${c.source.id}">Refresh source</a> |
|
||||
<a href="/harvest">Sources list</a>
|
||||
|
||||
</div>
|
||||
<div py:if="not c.source.active" class="alert alert-block">NB: This Harvest Source is Withdrawn. Therefore the Gemini XML will not be harvested again. However, any metadata that was previously harvested, remains in the catalogue.</div>
|
||||
<table id="harvest-source-details" class="table table-bordered table-condensed">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<td>${c.source.id}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
<td>${c.source.url}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<td>${c.source.type}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Withdrawn</th>
|
||||
<td>${not c.source.active}</td>
|
||||
</tr>
|
||||
<tr py:if="c.source.title">
|
||||
<th>Title</th>
|
||||
<td>${c.source.title}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td>${c.source.description}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Configuration</th>
|
||||
<py:if test="c.source.config">
|
||||
<td>${c.source.config}</td>
|
||||
</py:if>
|
||||
<py:if test="not c.source.config">
|
||||
<td>-</td>
|
||||
</py:if>
|
||||
</tr>
|
||||
<tr py:if="c.publisher_auth">
|
||||
<th>User</th>
|
||||
<td>${c.source.user_id}</td>
|
||||
</tr>
|
||||
<tr py:if="c.publisher_auth">
|
||||
<th>Publisher</th>
|
||||
<py:if test="c.source.publisher_title">
|
||||
<td>${c.source.publisher_title}</td>
|
||||
</py:if>
|
||||
<py:if test="not c.source.publisher_title">
|
||||
<td>${c.source.publisher_id}</td>
|
||||
</py:if>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Created</th>
|
||||
<td>${c.source.created}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total jobs</th>
|
||||
<td>${c.source.status.job_count}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td>
|
||||
<a name="errors"/>Last Harvest Errors: ${c.source.status.last_harvest_statistics.errors}<br/>
|
||||
<py:choose>
|
||||
<py:when test="len(c.source.status.last_harvest_errors.gather)>0">
|
||||
<i>Gathering errors</i>
|
||||
<ul>
|
||||
<li py:for="error in c.source.status.last_harvest_errors.gather">
|
||||
<?python
|
||||
lines = error.split('\n')
|
||||
?>
|
||||
<div py:for="line in lines">${line}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</py:when>
|
||||
</py:choose>
|
||||
<py:choose>
|
||||
<py:when test="len(c.source.status.last_harvest_errors.object)>0">
|
||||
<i>Object errors</i>
|
||||
<ul>
|
||||
<li py:for="error in c.source.status.last_harvest_errors.object">
|
||||
<div>GUID <a href="${g.site_url}/harvest/object/${error.object_id}">${error.object_guid}</a></div>
|
||||
<?python
|
||||
lines = error['message'].split('\n')
|
||||
?>
|
||||
<div py:for="line in lines">${line}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</py:when>
|
||||
</py:choose>
|
||||
|
||||
Last Harvest Added: ${c.source.status.last_harvest_statistics.added}<br/>
|
||||
Last Harvest Updated: ${c.source.status.last_harvest_statistics.updated}<br/>
|
||||
Last Harvest: ${c.source.status.last_harvest_request} <br/>
|
||||
Next Harvest: ${c.source.status.next_harvest}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total Errors</th>
|
||||
<td>${c.source.status.overall_statistics.errors}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total Datasets</th>
|
||||
<td>${c.source.status.overall_statistics.added}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Datasets</th>
|
||||
<td>
|
||||
<a name="datasets"/>
|
||||
<div>There could be a 10 minutes delay before these datasets (or changes to them) appear on
|
||||
the site or on search results.</div>
|
||||
|
||||
<p i18n:msg="item_count">There are <strong>${c.page.item_count}</strong> datasets.</p>
|
||||
|
||||
${c.page.pager()}
|
||||
<py:for each="item in c.page.items">
|
||||
<div>
|
||||
<a href="/dataset/${item}">${item}</a>
|
||||
</div>
|
||||
</py:for>
|
||||
${c.page.pager()}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</py:if>
|
||||
</div>
|
||||
</div>
|
||||
<xi:include href="../layout.html" />
|
||||
</html>
|
Loading…
Reference in New Issue