Skip to content
Snippets Groups Projects
Commit 0a321060 authored by anonymous's avatar anonymous
Browse files
parents c7ceff5d a67515ec
Branches
Tags
No related merge requests found
Showing
with 250 additions and 18 deletions
......@@ -19,6 +19,11 @@ ckan.module('odsh_form', function ($)
var values = $('#field-groups option:selected')
.map(function (a, item) { return item.value; }).get().join(',')
$('#field-groups-value').val(values);
},
onInitialized: function ()
{
var mselectc = $('.multiselect-container.dropdown-menu')
mselectc.width(mselectc.parents("div").width()-2)
}
});
}
......
......@@ -18,11 +18,11 @@ log = logging.getLogger(__name__)
def odsh_openness_score_dataset_html(dataset):
score = 0
score = -1
#dataset = json.loads(dataset)
resources = dataset.get('resources')
if resources is None:
return 0
return score
for resource in resources:
r_qa = resource.get('qa')
if r_qa:
......
No preview for this file type
......@@ -162,6 +162,9 @@ msgstr "Letzte Änderung"
msgid "issued"
msgstr "Veröffentlicht"
msgid "modified"
msgstr "Zuletzt bearbeitet"
msgid "Files"
msgstr "Dateien"
......
......@@ -182,12 +182,10 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
schema['extras'].update({
'key': [
toolkit.get_converter('known_spatial_uri'),
toolkit.get_converter('validate_licenseAttributionByText'),
]
})
##schema.update({'title': [toolkit.get_converter('odsh_validate_extras')]+ schema['title']})
schema.update({'__extras': [toolkit.get_converter('odsh_validate_extras')] })
# eschema = schema['extras']
##schema.update({'extras': None })
def create_package_schema(self):
schema = super(OdshPlugin, self).create_package_schema()
......
......@@ -100,6 +100,13 @@ h3{
margin-bottom: 0px;
}
.with-bottom-line
{
border-bottom: 2px solid #dbdbdb;
margin-bottom: 10px;
}
.search-form .control-order-by select {
width: 225px;
margin: 0;
......@@ -577,6 +584,7 @@ label:after {
.image-upload label:after {
content: ": *";
}
.multiselect.btn.btn-default,
.controls input,
.controls select,
.controls ul.select2-choices,
......@@ -1777,3 +1785,129 @@ p.package-info-categorie
display: table-cell;
width: 25px;
}
.multiselect-native-select,
.multiselect-native-select .btn-group
{
width: 100%;
}
#field-groups
{
color:#F6F7F9;
}
#field-groups,
.multiselect.btn.btn-default
{
width: 100%;
height: 30px;
padding: 0px;
text-align: left;
}
.multiselect.btn.btn-default .multiselect-selected-text
{
padding-left: 10px;
}
.multiselect.btn.btn-default .caret {
border-top: 6px solid #657592;
border-right: 3px solid transparent;
border-left: 3px solid transparent;
float: right;
margin-right: 5px;
}
.select2-container .select2-choice .select2-arrow
{
width: 12px;
}
.select2-container .select2-choice .select2-arrow b
{
background: none;
border-top: 6px solid #657592;
border-right: 3px solid transparent;
border-left: 3px solid transparent;
display: inline-block;
width: 0;
height: 0;
vertical-align: top;
content: '';
margin-top: 10px;
margin-left: 0;
}
.select2-container .select2-choice .select2-arrow
{
background-image: none;
border:none;
background-color:#F6F7F9;
color: #657592;
}
.multiselect-container.dropdown-menu
{
padding-top:10px;
border-top: none;
border-color: #657592;
border-radius: 0px;
top: 26px;
width: 429px;
overflow: hidden;
text-overflow: ellipsis;
}
.multiselect-container.dropdown-menu .checkbox
{
overflow: hidden;
text-overflow: ellipsis;
}
.multiselect-container>li>a>label>input[type=checkbox]
{
float:none;
}
.dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus,
.dropdown-menu > li.active a,
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .dropdown-submenu:hover > a, .dropdown-submenu:focus > a
{
background-color: #3875d7;
background-image: none;
}
.select2-results
{
padding: 0px;
}
.select2-drop
{
border-radius: 0px;
}
.select2-drop-active
{
border-color: #657592;
}
.controls .multiselect:focus,
.controls select:focus,
.controls textarea:focus
{
border-color: rgba(82, 168, 236, 0.8);
outline: 0;
outline: thin dotted \9;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)
}
.search-form .fa-rss
{
float: right;
font-size: 20px;
cursor: pointer;
}
.search-form a
{
color: #003064;
}
\ No newline at end of file
[
["_comment",
"JSON field order as follows:",
["Format", "Score"],
"where:",
" * Format - the short name for it, corresponding to the name in ckan's resource_formats.json.",
" * Score - openness score to award it. Integer from 0 to 5. 0 means it is likely not data e.g. a web page is probably just a link to the data, an OWL file is an ontology rather than data, an EXE is probably not data, ZIP will be looked inside but we can't be sure its data so gets 1, images may be satellite weather images so give benefit of doubt. RDFa is likely basic document info for a web page added automatically by a CMS, not real data."
],
["N3", 5],
["SPARQL", 5],
["RDF", 5],
["TTL", 5],
["KML", 3],
["WCS", 3],
["NetCDF", 3],
["TSV", 3],
["WFS", 3],
["KMZ", 3],
["QGIS", 3],
["ODS", 3],
["JSON", 3],
["ODB", 3],
["ODF", 3],
["ODG", 3],
["XML", 3],
["WMS", 3],
["WMTS", 3],
["SVG", 3],
["JPEG", 3],
["CSV", 3],
["Atom Feed", 3],
["XYZ", 3],
["PNG", 3],
["RSS", 3],
["GeoJSON", 3],
["IATI", 3],
["ICS", 3],
["XLS", 2],
["MDB", 2],
["ArcGIS Map Service", 2],
["BMP", 2],
["TIFF", 2],
["XLSX", 2],
["GIF", 2],
["E00", 2],
["MrSID", 2],
["ArcGIS Map Preview", 2],
["MOP", 2],
["Esri REST", 2],
["dBase", 2],
["SHP", 2],
["PPTX", 1],
["DOC", 1],
["ArcGIS Online Map", 1],
["ZIP", 1],
["GZ", 1],
["ODT", 1],
["RAR", 1],
["TXT", 1],
["DCR", 1],
["DOCX", 1],
["BIN", 1],
["PPT", 1],
["ODP", 1],
["PDF", 1],
["ODC", 1],
["MXD", 1],
["TAR", 1],
["EXE", 0],
["JS", 0],
["Perl", 0],
["OWL", 0],
["HTML", 1],
["XSLT", 0],
["RDFa", 0]
]
\ No newline at end of file
......@@ -22,9 +22,9 @@
<h2> {{ c.group_dict.title or c.group_dict.name }} </h2>
</div>
{% if c.group_dict.description %}
<p class="organizaion-full-description with-bottom-line">
{{ h.markdown_extract(c.group_dict.description, extract_length=0) }}
</p>
<div class="organizaion-full-description with-bottom-line">
{{ h.render_markdown(c.group_dict.description) }}
</div>
{% else %}
<p class="empty">{{ _('There is no description for this organization') }}</p>
{% endif %}
......
......@@ -52,7 +52,9 @@
</div>
</h2>
<div class="dataset-stars">
{% if stars>-1%}
{% snippet "qa/stars.html", stars=stars %}
{% endif %}
</div>
{% if h.check_access('package_update', {'id':pkg.id }) %}
{% endif %}
......
......@@ -56,6 +56,11 @@ Example:
<div>{{ _('issued') }}:</div>
{{issued}}
</div>
<div class="last-change-detail info-detail">
{% set modified = h.odsh_render_datetime(pkg.metadata_modified)%}
<div>{{ _('modified') }}:</div>
{{modified}}
</div>
{% endblock %}
{% endblock %}
......
......@@ -186,7 +186,7 @@ is_required=true,placeholder=_('Enter title')) }}
'/api/2/util/tag/autocomplete?incomplete=?'} %}
{{ form.input('tag_string', id='field-tags', label=_('Tags'), value=data.tag_string, error=errors.tag_string,
classes=['control-full'], attrs=tag_attrs,
is_required=true, placeholder=_('odsh tags placeholder')) }}
is_required=false, placeholder=_('odsh tags placeholder')) }}
{% endblock %}
......
......@@ -98,7 +98,9 @@ Example:
</ul>
{% endif %}
<div class="dataset-stars">
{% if stars>-1%}
{% snippet "qa/stars.html", stars=stars %}
{% endif %}
</div>
<div class="dataset-info issued">
......
......@@ -35,6 +35,7 @@ Example:
{% if query %}
{%- if count -%}
{{ text_query.format(number=h.localised_number(count), query=query) }}
<a href={{h.url_for(controller='feed', action='custom', q=query)}}> <i class="fa fa-medium fa-rss"></i></a>
{%- else -%}
{{ text_query_none.format(query=query) }}
{%- endif -%}
......
......@@ -26,6 +26,7 @@ def validate_extra_groups(data, requireAtLeastOne, errors):
if not value:
if requireAtLeastOne:
errors['groups']= 'at least one group needed'
data[('groups', 0, 'id')] = ''
return
groups = [g.strip() for g in value.split(',') if value.strip()]
......@@ -38,18 +39,19 @@ def validate_extra_groups(data, requireAtLeastOne, errors):
errors['groups']= 'at least one group needed'
return
for num, tag in zip(range(len(groups)), groups):
data[('groups', num, 'id')] = tag
for num, group in zip(range(len(groups)), groups):
data[('groups', num, 'id')] = group
def validate_extras(key, data, errors, context):
extra_errors = {}
isStaNord = ('id',) in data and data[('id',)][:7] == 'StaNord'
validate_extra_groups(data, False, extra_errors)
validate_extra_date_new(key, 'issued', data, False, extra_errors)
validate_extra_date_new(key, 'issued', data, isStaNord, extra_errors)
validate_extra_date_new(key, 'temporal_start', data, isStaNord, extra_errors)
validate_extra_date_new(key, 'temporal_end', data, True, extra_errors)
validate_licenseAttributionByText(data, extra_errors)
if len(extra_errors.values()):
raise toolkit.Invalid(extra_errors)
......@@ -107,7 +109,7 @@ def validate_extra_date(key, field, data, optional=False):
def validate_extra_date_factory(field, optional=False):
return lambda key, data, errors, context: validate_extra_date(key, field, data, optional)
def validate_licenseAttributionByText(data, errors):
def validate_licenseAttributionByText(key, data, errors,context):
register = model.Package.get_license_register()
isByLicense=False
for k in data:
......@@ -118,7 +120,8 @@ def validate_licenseAttributionByText(data, errors):
hasAttribution=False
for k in data:
if data[k] == 'licenseAttributionByText':
if isinstance(data[(k[0], k[1], 'value')], Missing):
print(data[k])
if isinstance(data[(k[0], k[1], 'value')], Missing) or (k[0], k[1], 'value') not in data:
del data[(k[0], k[1], 'value')]
del data[(k[0], k[1], 'key')]
break
......@@ -196,6 +199,8 @@ def tag_string_convert(key, data, errors, context):
current_index = max([int(k[1]) for k in data.keys()
if len(k) == 3 and k[0] == 'tags'] + [-1])
print('TAGS')
print(current_index)
for num, tag in zip(count(current_index+1), tags):
......@@ -210,5 +215,6 @@ def get_validators():
return {
'known_spatial_uri': known_spatial_uri,
'odsh_tag_name_validator': tag_name_validator,
'odsh_validate_extras':validate_extras
'odsh_validate_extras':validate_extras,
'validate_licenseAttributionByText':validate_licenseAttributionByText
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment