use thesaurus select dialog (#4480)

This commit is contained in:
Frédéric Péters 2014-03-17 11:38:23 +01:00
parent 5ec0ecae4a
commit 9e9a492f60
1 changed files with 34 additions and 1 deletions

View File

@ -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 = $('<span>');
var initial_input = result;
$(result).css('display', 'none').appendTo(span);
var input = $('<input type="text" class="querylabel" readonly="readonly"/>');
var button = $('<a href="#" style="display: none">...</a>');
$(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));