From 9e9a492f607fabb834237a7011fcc592a13a11e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 17 Mar 2014 11:38:23 +0100 Subject: [PATCH] use thesaurus select dialog (#4480) --- src/pfwbged/collection/pfwbcollection.js | 35 +++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/pfwbged/collection/pfwbcollection.js b/src/pfwbged/collection/pfwbcollection.js index 3b81fdd..02be6ef 100644 --- a/src/pfwbged/collection/pfwbcollection.js +++ b/src/pfwbged/collection/pfwbcollection.js @@ -32,6 +32,14 @@ criteria_div.find('select.queryindex').prop('disabled', true); criteria_div.find('.multipleSelectionWidget dt').removeClass('hiddenStructure'); criteria_div.find('.multipleSelectionWidget dd').addClass('widgetPulldownMenu').addClass('hiddenStructure'); + if (index == 'thesaurus_keywords') { + var val = $(criteria_div).find('.queryvalue').val(); + widget = $.querywidget.createWidget('StringWidget', + 'thesaurus_keywords', 'form.widgets.query'); + $(widget).find('.queryvalue').val(val); + $(widget).find('.querylabel').val(val); + criteria_div.find('.queryvalue').replaceWith(widget); + } }); items.each(function () { @@ -202,7 +210,6 @@ $(window).find('.contentTreeAdd').unbind('click').click(function() { var contenttree_window = $(this).parents(".contenttreeWindow"); contenttree_window.find('.navTreeCurrentItem > a').each(function () { - console.log('intid:', $(this).data('intid')); $(initial_input).val($(this).data('intid')); $(input).val($.trim($(this).text())); }); @@ -218,6 +225,26 @@ $(button).appendTo(span); result = span; } + + if (index == 'thesaurus_keywords') { + var span = $(''); + var initial_input = result; + $(result).css('display', 'none').appendTo(span); + var input = $(''); + var button = $('...'); + $(input).appendTo(span); + $(input).click(function() { $(button).click(); }); + $(button).prepOverlay({ + subtype: 'ajax', + filter: '#content>*', + urlmatch: '.*', + urlreplace: 'thesaurus' + }); + $(button).appendTo(span); + result = span; + } + + return result; }; @@ -379,5 +406,11 @@ function select_metatype(elem) $('.save-as-widgets div').show(); return false; }); + $('form#pfwbsearchform').submit(function() { + /* enable select (with criteria type) just before submit, so their values + * are sent to the server. + */ + $(this).find('select:disabled').enable(); + }); }(jQuery));