openmedialibrary/static/js/list.js

115 lines
4.3 KiB
JavaScript
Raw Normal View History

2014-05-04 17:26:43 +00:00
'use strict';
oml.ui.list = function() {
var ui = oml.user.ui,
that = oml.ui[ui.listView + 'View']()
.bindEvent({
closepreview: function() {
oml.$ui.previewButton.options({value: false});
oml.$ui.previewDialog.close();
delete oml.$ui.previewDialog;
},
2014-05-17 11:45:57 +00:00
copy: function(data) {
oml.clipboard.copy(data.ids, 'item');
},
copyadd: function(data) {
oml.clipboard.copy(data.ids, 'item');
},
cut: function(data) {
var listData = oml.getListData();
if (listData.editable && listData.type == 'static') {
oml.clipboard.copy(data.ids, 'item');
oml.doHistory('cut', data.ids, ui._list, function() {
oml.UI.set({listSelection: []});
oml.reloadList();
});
}
},
cutadd: function(data) {
var listData = oml.getListData();
if (listData.editable && listData.type == 'static') {
oml.clipboard.add(data.ids, 'item');
oml.doHistory('cut', data.ids, ui._list, function() {
oml.UI.set({listSelection: []});
oml.reloadList();
});
}
},
'delete': function() {
var listData = oml.getListData();
if (listData.editable && listData.type == 'static') {
oml.doHistory('delete', data.ids, ui._list, function() {
oml.UI.set({listSelection: []});
oml.reloadList();
});
}
},
2014-05-04 17:26:43 +00:00
init: function(data) {
oml.$ui.statusbar.set('total', data);
},
2014-05-17 11:45:57 +00:00
key_control_delete: function() {
var listData = oml.getListData();
if (listData.own) {
oml.ui.deleteItemsDialog().open();
}
},
2014-05-04 17:26:43 +00:00
open: function(data) {
oml.UI.set({
item: data.ids[0],
itemView: 'info'
});
},
openpreview: function() {
if (!oml.$ui.previewDialog) {
oml.$ui.previewButton.options({value: true});
oml.$ui.previewDialog = oml.ui.previewDialog()
.open()
.bindEvent({
close: function() {
that.closePreview();
delete oml.$ui.previewDialog;
}
});
} else {
2014-05-17 11:45:57 +00:00
oml.$ui.previewDialog.updateElement();
2014-05-04 17:26:43 +00:00
}
},
resize: function(data) {
// this is the resize event of the split panel
that.size();
},
select: function(data) {
oml.UI.set({listSelection: data.ids});
},
oml_find: function() {
that.reloadList();
},
oml_item: function() {
if (!ui.item) {
that.gainFocus();
} else {
that.options({selected: [ui.item]});
}
},
oml_listselection: function(data) {
that.options({selected: data.value});
},
oml_listsort: function(data) {
that.options({sort: data.value});
},
oml_sidebarsize: function(data) {
that.size();
}
});
2014-05-12 12:57:47 +00:00
oml.enableDragAndDrop(that);
2014-05-17 11:45:57 +00:00
that.updateElement = function() {
that.reloadList(true);
};
2014-05-04 17:26:43 +00:00
return that;
};