This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
tabellio.searchform/tabellio/searchform/advsearch-pfb.pt

139 lines
4.8 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="tabellio.searchform">
<body>
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main">
<tal:block tal:define="Batch python:modules['Products.CMFPlone'].Batch;
mq python:modules['ZTUtils'].make_query;
url batch_base_url | request/ACTUAL_URL;
batchformkeys batchformkeys|nothing;
batchlinkparams python:batchformkeys and dict([(key, unicode(request.form[key]).encode('utf-8')) for key in batchformkeys if key in request]) or dict([(key, unicode(request.form[key]).encode('utf-8')) for key in request.form]);
b_size python:10; b_size request/b_size | b_size;
b_start python:0;b_start request/b_start | b_start;">
<h1 class="documentFirstHeading">Recherche avancée</h1>
<a id="other-search" href="pfbsearch">Recherche</a>
<div id="deputies-results" class="advbox">
<h2 id="b_deputy_start">Députés</h2>
<form method="post" tal:attributes="action string:${view/deputiesform_url}">
<div tal:replace="structure view/deputy_search_form"/>
</form>
</div>
<div id="docs-results" class="advbox">
<h2 id="b_doc_start">Documents</h2>
<form method="post" tal:attributes="action string:${view/pfbdocform_url}#resultsbox">
<div tal:replace="structure view/document_pfb_search_form"/>
</form>
</div>
<div id="events-results" class="advbox">
<h2 id="b_event_start">Événements</h2>
<form>
...
</form>
</div>
<div id="pages-results" class="advbox">
<h2 id="b_page_start">Ailleurs sur le site</h2>
<form>
...
</form>
</div>
<div tal:replace="structure provider:plone.belowcontentbody" />
<script type="text/javascript" tal:content="string: var PORTAL_URL='${view/portal_url}';"/>
<script type="text/javascript">
function update_authors_input(input) {
var s = '';
jq(input).nextAll('span.labelbox').each(function() {
s = s + ' ' + jq(this).attr('class').split(' ')[1];
});
jq(input).attr('value', s);
}
function author_autocomplete_ready(event, data, formatted) {
(function($) {
var input_box = $(event.target);
// XXX: don't insert item if it's already present
labelbox = $('<span class="labelbox ' + data[1] + '">' + data[0] + '<' + '/span>');
$(input_box).before(labelbox);
$(labelbox).click(function() {
$(this).remove();
update_authors_input(jq(input_box).prevAll('input')[0]);
});
update_authors_input(jq(input_box).prevAll('input')[0]);
$(input_box).attr('value', '');
}(jQuery));
}
function sync_from_checkboxes(elem, dummyinput)
{
t = '';
$(elem).find('span.option').each(function(idx, el) {
if ($(el).find('input').attr('checked')) {
if (t.length > 0) {
t = t + ', ';
}
t = t + $(el).find('label span').text();
}
});
$(dummyinput).attr('value', t);
}
function setup_appearance(index, elem)
{
var dummyinput = $('<input type="text" readonly="readonly"/>');
sync_from_checkboxes(elem, dummyinput);
dummyinput.click(function() {
$(elem).find('div.droppedcheckboxes').toggle();
});
$(elem).find('.fieldErrorBox').after(dummyinput);
$(elem).find('span.option').wrapAll('<div class="droppedcheckboxes">').click(function() {
sync_from_checkboxes(elem, dummyinput);
});
$(elem).find('div.droppedcheckboxes').hide();
}
function setup_sort_on(index, elem)
{
$(elem).find('label.horizontal').click(function() {
$(elem).find('div.droppedradios').toggle();
});
$(elem).find('span.option').wrapAll('<div class="droppedradios">');
$(elem).find('div.droppedradios').hide();
}
(function($) {
$().ready(function() {
$('.author-autocomplete').autocomplete(PORTAL_URL+'/listAuthors', {
}).result(author_autocomplete_ready);
$('#formfield-document-widgets-l_doctypes').each(setup_appearance);
$('#formfield-document-widgets-l_topics').each(setup_appearance);
$('#formfield-document-widgets-l_polgroups').each(setup_appearance);
$('#formfield-document-widgets-sort_on').each(setup_sort_on);
$('div.advbox form').hide();
$('div.advbox h2').click(function() { $(this).parent().find('form').toggle(); });
});
})(jQuery);
</script>
</tal:block>
</tal:main-macro>
</metal:main>
</body>
</html>