2011-11-05 17:04:10 +00:00
|
|
|
'use strict';
|
2018-06-19 06:33:26 +00:00
|
|
|
|
2014-02-14 16:52:29 +00:00
|
|
|
pandora.ui.filterDialog = function() {
|
2013-03-03 10:15:38 +00:00
|
|
|
|
2011-06-19 17:49:25 +00:00
|
|
|
var that = Ox.Dialog({
|
2013-03-03 10:15:38 +00:00
|
|
|
buttons: [
|
|
|
|
Ox.Button({
|
|
|
|
id: 'done',
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._('Done')
|
2013-03-03 10:15:38 +00:00
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
click: function() {
|
|
|
|
var list = pandora.$ui.filterForm.getList();
|
|
|
|
if (list.save) {
|
|
|
|
pandora.api.addList({
|
|
|
|
name: list.name,
|
|
|
|
query: list.query,
|
|
|
|
status: 'private',
|
|
|
|
type: 'smart'
|
|
|
|
}, function(result) {
|
|
|
|
var $list = pandora.$ui.folderList.personal,
|
|
|
|
id = result.data.id;
|
|
|
|
pandora.UI.set({
|
|
|
|
find: {
|
|
|
|
conditions: [{key: 'list', value: id, operator: '=='}],
|
|
|
|
operator: '&'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
Ox.Request.clearCache(); // fixme: remove
|
|
|
|
$list.bindEventOnce({
|
|
|
|
load: function(data) {
|
|
|
|
$list.gainFocus()
|
|
|
|
.options({selected: [id]});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.reloadList();
|
2011-11-11 15:48:25 +00:00
|
|
|
});
|
2013-03-03 11:15:28 +00:00
|
|
|
} else if (!pandora.user.ui.updateAdvancedFindResults) {
|
2013-03-03 10:15:38 +00:00
|
|
|
pandora.$ui.filterForm.updateResults();
|
|
|
|
}
|
|
|
|
that.close();
|
2011-11-11 15:48:25 +00:00
|
|
|
}
|
2013-03-03 10:15:38 +00:00
|
|
|
})
|
|
|
|
],
|
2019-06-07 15:30:09 +00:00
|
|
|
content: pandora.$ui.filterForm = (pandora.user.ui.section == 'documents'
|
|
|
|
? pandora.ui.documentFilterForm
|
|
|
|
: pandora.ui.filterForm
|
|
|
|
)({
|
|
|
|
mode: 'find'
|
|
|
|
}),
|
2014-09-26 12:12:25 +00:00
|
|
|
maxWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
2013-03-03 10:15:38 +00:00
|
|
|
minHeight: 264,
|
2014-09-26 12:12:25 +00:00
|
|
|
minWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
2013-03-03 10:15:38 +00:00
|
|
|
height: 264,
|
|
|
|
// keys: {enter: 'save', escape: 'cancel'},
|
|
|
|
removeOnClose: true,
|
2014-02-14 16:52:29 +00:00
|
|
|
title: Ox._('Advanced Find'),
|
2014-09-26 12:12:25 +00:00
|
|
|
width: 648 + Ox.UI.SCROLLBAR_SIZE
|
2013-03-03 10:15:38 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
$updateCheckbox = Ox.Checkbox({
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._('Update Results in the Background'),
|
2013-03-03 11:15:28 +00:00
|
|
|
value: pandora.user.ui.updateAdvancedFindResults
|
2013-03-03 10:15:38 +00:00
|
|
|
})
|
|
|
|
.css({float: 'left', margin: '4px'})
|
|
|
|
.bindEvent({
|
|
|
|
change: function(data) {
|
2013-03-03 11:15:28 +00:00
|
|
|
pandora.UI.set({updateAdvancedFindResults: data.value});
|
2013-03-03 10:15:38 +00:00
|
|
|
data.value && pandora.$ui.filterForm.updateResults();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$($updateCheckbox.find('.OxButton')[0]).css({margin: 0});
|
|
|
|
$(that.find('.OxBar')[1]).append($updateCheckbox);
|
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
return that;
|
2013-03-03 10:15:38 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
};
|
|
|
|
|