2013-04-05 17:37:22 +02:00
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
|
|
|
|
|
xmlns:tal="http://xml.zope.org/namespaces/tal"
|
|
|
|
|
xmlns:metal="http://xml.zope.org/namespaces/metal"
|
|
|
|
|
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
|
|
|
|
lang="en"
|
|
|
|
|
metal:use-macro="context/main_template/macros/master"
|
|
|
|
|
i18n:domain="plone.app.dexterity">
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<metal:main fill-slot="main">
|
|
|
|
|
|
2013-04-13 14:53:14 +02:00
|
|
|
|
<tal:contents_header condition="python: 'ajax_load' not in request.form.keys()">
|
2013-04-05 17:37:22 +02:00
|
|
|
|
<h1 class="documentFirstHeading" tal:content="context/Title" />
|
|
|
|
|
<div tal:replace="structure provider:plone.belowcontenttitle" />
|
2013-04-13 14:53:14 +02:00
|
|
|
|
</tal:contents_header>
|
2013-04-05 17:37:22 +02:00
|
|
|
|
|
2013-04-14 17:20:44 +02:00
|
|
|
|
<div id="dmskeywords-navigation"
|
|
|
|
|
tal:attributes="data-thesaurus-url context/absolute_url">
|
2013-04-13 15:09:41 +02:00
|
|
|
|
|
2013-04-13 13:40:37 +02:00
|
|
|
|
<form id="thesaurus-search-form" tal:content="structure view/renderForm">
|
|
|
|
|
</form>
|
2013-04-05 17:37:22 +02:00
|
|
|
|
|
2013-04-11 21:23:45 +02:00
|
|
|
|
<div id="dmsthesaurus-entry-points-field"
|
2013-04-13 02:03:11 +02:00
|
|
|
|
class="field"
|
|
|
|
|
tal:define="widget python:view.widgets.get('entry_points')">
|
|
|
|
|
<label tal:content="widget/label" />
|
|
|
|
|
<br />
|
|
|
|
|
<div tal:content="structure widget/render" />
|
|
|
|
|
</div>
|
2013-04-05 17:37:22 +02:00
|
|
|
|
|
2013-04-13 14:21:43 +02:00
|
|
|
|
<script type="text/javascript" tal:condition="python: 'ajax_load' not in request.form.keys()">
|
2013-08-22 14:15:20 +02:00
|
|
|
|
function autocomplete_ready(event, data, formatted) {
|
|
|
|
|
window.location=window.location+'/'+data[1];
|
2013-04-13 13:40:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
2013-09-23 14:35:54 +02:00
|
|
|
|
$('.keyword-search').autocomplete('listKeywords', {
|
2013-08-22 14:15:20 +02:00
|
|
|
|
'cacheLength': 0, 'matchContains': true, 'scroll': true, 'max': 30}).result(autocomplete_ready);
|
2013-04-13 13:40:37 +02:00
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
2013-04-13 14:21:43 +02:00
|
|
|
|
|
|
|
|
|
<script type="text/javascript" tal:condition="python: 'ajax_load' in request.form.keys()">
|
2013-04-13 15:13:10 +02:00
|
|
|
|
function prep_thesaurus_overlay() {
|
2013-04-13 14:21:43 +02:00
|
|
|
|
$('.overlay-ajax a').click(function() {
|
2013-04-13 15:13:10 +02:00
|
|
|
|
var urlsplit = $(this).attr('href').split('/');
|
|
|
|
|
var keyword_id = urlsplit[urlsplit.length-1];
|
|
|
|
|
$(this).parents('.overlay-ajax').data('keyword-id', keyword_id);
|
|
|
|
|
$('.pb-ajax > div').load($(this).attr('href') + '?ajax_load=123 #content>*', prep_thesaurus_overlay);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
$('.overlay-ajax button').click(function() {
|
|
|
|
|
overlay_id = $(this).parents('.overlay-ajax').attr('id');
|
|
|
|
|
var id = $(this).parents('.overlay-ajax').data('keyword-id');
|
|
|
|
|
var title = $(this).parents('.overlay-ajax').find('h1').text();
|
2014-03-17 11:40:22 +01:00
|
|
|
|
|
|
|
|
|
/* when used as a field widget */
|
|
|
|
|
field = $('a[rel="#' + overlay_id + '"]').parents('.field');
|
|
|
|
|
if (field) {
|
|
|
|
|
$(field).find('select').append('<option id="' + id + '" selected="selected" value="' + id + '"></option>');
|
|
|
|
|
$(field).find('.selected-options').append('<span class="selected-option" data-term-id="' + id + '">' +
|
|
|
|
|
'<span>' + title + '</span>' +
|
|
|
|
|
'<span class="remove">×</span></span>\n');
|
|
|
|
|
|
|
|
|
|
$('span.remove').unbind('click').click(function() {
|
|
|
|
|
var field = $(this).parents('.field');
|
|
|
|
|
var term_id = $(this).parent().attr('data-term-id');
|
|
|
|
|
$(field).find('select option[id=' + term_id + ']').remove();
|
|
|
|
|
$(this).parent().remove();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* when used as a criteria widget */
|
|
|
|
|
criteria = $('a[rel="#' + overlay_id + '"]').parents('.criteria');
|
|
|
|
|
if (criteria) {
|
|
|
|
|
$(criteria).find('input.queryvalue').val(id);
|
|
|
|
|
$(criteria).find('input.querylabel').val(title);
|
|
|
|
|
$.querywidget.updateSearch();
|
|
|
|
|
}
|
2013-04-14 17:22:39 +02:00
|
|
|
|
|
2013-04-13 15:13:10 +02:00
|
|
|
|
$(this).parents('.overlay-ajax').find('.close').click();
|
2013-04-13 14:21:43 +02:00
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-13 15:13:10 +02:00
|
|
|
|
prep_thesaurus_overlay();
|
2013-04-14 17:20:44 +02:00
|
|
|
|
|
2013-08-22 14:15:20 +02:00
|
|
|
|
function autocomplete_ready(event, data, formatted) {
|
|
|
|
|
var keyword_id = data[1];
|
2013-04-14 17:20:44 +02:00
|
|
|
|
$(this).parents('.overlay-ajax').data('keyword-id', keyword_id);
|
|
|
|
|
thesaurus_url = $('#dmskeywords-navigation').data('thesaurus-url');
|
2013-08-22 14:15:20 +02:00
|
|
|
|
$('.pb-ajax > div').load(thesaurus_url+'/'+data[1] + '?ajax_load=123 #content>*', prep_thesaurus_overlay);
|
2013-04-14 17:20:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
thesaurus_url = $('#dmskeywords-navigation').data('thesaurus-url');
|
2013-09-23 14:35:54 +02:00
|
|
|
|
$('.keyword-search').autocomplete(thesaurus_url + '/listKeywords', {
|
2013-08-22 14:15:20 +02:00
|
|
|
|
'cacheLength': 0, 'matchContains': true, 'scroll': true, 'max': 30}).result(autocomplete_ready);
|
2013-04-14 17:20:44 +02:00
|
|
|
|
|
|
|
|
|
|
2013-04-13 14:21:43 +02:00
|
|
|
|
</script>
|
|
|
|
|
|
2013-04-13 15:09:41 +02:00
|
|
|
|
</div>
|
2013-04-05 17:37:22 +02:00
|
|
|
|
</metal:main>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
|