88 lines
3.3 KiB
XML
88 lines
3.3 KiB
XML
<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">
|
||
|
||
<tal:contents_header condition="python: 'ajax_load' not in request.form.keys()">
|
||
<h1 class="documentFirstHeading" tal:content="context/Title" />
|
||
<div tal:replace="structure provider:plone.belowcontenttitle" />
|
||
</tal:contents_header>
|
||
|
||
<div id="dmskeywords-navigation"
|
||
tal:attributes="data-thesaurus-url context/absolute_url">
|
||
|
||
<form id="thesaurus-search-form" tal:content="structure view/renderForm">
|
||
</form>
|
||
|
||
<div id="dmsthesaurus-entry-points-field"
|
||
class="field"
|
||
tal:define="widget python:view.widgets.get('entry_points')">
|
||
<label tal:content="widget/label" />
|
||
<br />
|
||
<div tal:content="structure widget/render" />
|
||
</div>
|
||
|
||
<script type="text/javascript" tal:condition="python: 'ajax_load' not in request.form.keys()">
|
||
function autocomplete_ready(event, data, formatted) {
|
||
window.location=window.location+'/'+data[1];
|
||
}
|
||
|
||
$(document).ready(function() {
|
||
$('.keyword-search').autocomplete('listKeywords', {
|
||
'cacheLength': 0, 'matchContains': true, 'scroll': true, 'max': 30}).result(autocomplete_ready);
|
||
});
|
||
</script>
|
||
|
||
|
||
<script type="text/javascript" tal:condition="python: 'ajax_load' in request.form.keys()">
|
||
function prep_thesaurus_overlay() {
|
||
$('.overlay-ajax a').click(function() {
|
||
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');
|
||
field = $('a[rel="#' + overlay_id + '"]').parents('.field');
|
||
var id = $(this).parents('.overlay-ajax').data('keyword-id');
|
||
var title = $(this).parents('.overlay-ajax').find('h1').text();
|
||
$(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');
|
||
$(this).parents('.overlay-ajax').find('.close').click();
|
||
return false;
|
||
});
|
||
}
|
||
|
||
prep_thesaurus_overlay();
|
||
|
||
function autocomplete_ready(event, data, formatted) {
|
||
var keyword_id = data[1];
|
||
$(this).parents('.overlay-ajax').data('keyword-id', keyword_id);
|
||
thesaurus_url = $('#dmskeywords-navigation').data('thesaurus-url');
|
||
$('.pb-ajax > div').load(thesaurus_url+'/'+data[1] + '?ajax_load=123 #content>*', prep_thesaurus_overlay);
|
||
}
|
||
|
||
thesaurus_url = $('#dmskeywords-navigation').data('thesaurus-url');
|
||
$('.keyword-search').autocomplete(thesaurus_url + '/listKeywords', {
|
||
'cacheLength': 0, 'matchContains': true, 'scroll': true, 'max': 30}).result(autocomplete_ready);
|
||
|
||
|
||
</script>
|
||
|
||
</div>
|
||
</metal:main>
|
||
|
||
</body>
|
||
</html>
|
||
|