update folder selection criteria to have a content tree selection box (#3800)
This commit is contained in:
parent
00b94a15eb
commit
2b3e4e73b1
|
@ -150,6 +150,62 @@
|
|||
});
|
||||
};
|
||||
|
||||
$.querywidget.createWidgetOrig = $.querywidget.createWidget;
|
||||
$.querywidget.createWidget = function (type, index, fname) {
|
||||
result = $.querywidget.createWidgetOrig(type, index, fname);
|
||||
if (index == 'object_folders') {
|
||||
var span = $('<span>');
|
||||
var initial_input = result;
|
||||
$(result).css('display', 'none').appendTo(span);
|
||||
var input = $('<input type="text" readonly="readonly"/>');
|
||||
var button = $('<button>...</button>');
|
||||
$(input).appendTo(span);
|
||||
$(input).click(function() { $(button).click(); });
|
||||
$(button).click(function() {
|
||||
var window = $('<div class="contenttreeWindow"><div class="contenttreeWindowHeader"></div>'+
|
||||
'<div class="contenttreeWidget"></div>' +
|
||||
'<div class="contenttreeWindowActions">' +
|
||||
'<input class="context contentTreeAdd" type="button" value="Valider" />' +
|
||||
'<input class="standalone contentTreeCancel" type="button" value="Annuler" />' +
|
||||
'</div></div>');
|
||||
var parent = $(input);
|
||||
window.showDialog('@@foldertree-fetch', 200);
|
||||
$(window).find('.contenttreeWidget').contentTree(
|
||||
{
|
||||
script: '@@foldertree-fetch',
|
||||
folderEvent: 'click',
|
||||
selectEvent: 'click',
|
||||
expandSpeed: 200,
|
||||
collapseSpeed: 200,
|
||||
multiFolder: true,
|
||||
multiSelect: false,
|
||||
rootUrl: '/'
|
||||
},
|
||||
function(event, selected, data, title) {
|
||||
// alert(event + ', ' + selected + ', ' + data + ', ' + title);
|
||||
});
|
||||
$(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()));
|
||||
});
|
||||
$(this).contentTreeCancel();
|
||||
$.querywidget.updateSearch();
|
||||
});
|
||||
$(window).find('.contentTreeCancel').unbind('click').click(function() {
|
||||
$(this).contentTreeCancel();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$(button).appendTo(span);
|
||||
result = span;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
|
||||
function update_portaltypes()
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<records interface="plone.app.querystring.interfaces.IQueryField"
|
||||
prefix="plone.app.querystring.field.object_folders">
|
||||
<value key="title" i18n:translate="">Is in folder</value>
|
||||
<value key="title" i18n:translate="">Folder</value>
|
||||
<value key="description" i18n:translate="">Find items that are in that folder</value>
|
||||
<value key="enabled">True</value>
|
||||
<value key="sortable">False</value>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<option disabled>Date de réunion</option>
|
||||
</optgroup>
|
||||
<optgroup label="Rangement">
|
||||
<option data-index="object_folders">Dossier</option>
|
||||
<option disabled>Thésaurus</option>
|
||||
</optgroup>
|
||||
<optgroup label="Autres">
|
||||
|
|
Reference in New Issue