openmedialibrary/static/js/appPanel.js

66 lines
1.8 KiB
JavaScript
Raw Normal View History

2014-05-04 17:26:43 +00:00
'use strict';
oml.ui.appPanel = function() {
var ui = oml.user.ui,
that = Ox.SplitPanel({
elements: [
{
element: oml.$ui.mainMenu = oml.ui.mainMenu(),
size: 20
},
{
element: oml.$ui.mainPanel = oml.ui.mainPanel()
}
],
orientation: 'vertical'
})
.bindEvent({
oml_page: function(data) {
2014-05-17 08:17:34 +00:00
setPage(data.value, data.previousValue);
2014-05-04 17:26:43 +00:00
}
});
setPage(ui.page);
2014-05-17 08:17:34 +00:00
function setPage(page, previousPage) {
2014-05-04 17:26:43 +00:00
// close dialogs
2014-05-17 08:17:34 +00:00
if (
!Ox.contains(['import', 'export'], page)
|| !Ox.contains(['import', 'export'], previousPage)
) {
$('.OxDialog:visible').each(function() {
2014-09-29 13:17:59 +00:00
Ox.$elements[$(this).data('oxid')].close();
2014-05-17 08:17:34 +00:00
});
}
2014-05-04 17:26:43 +00:00
// open dialog
if (Ox.contains([
'welcome', 'app', 'update', 'preferences', 'users',
2014-05-04 17:26:43 +00:00
'notifications', 'transfers', 'help'
], page)) {
oml.$ui[page + 'Dialog'] = oml.ui[page + 'Dialog']().open();
2014-05-17 08:17:34 +00:00
} else if (Ox.contains(['import', 'export'], page)) {
if (
oml.$ui.importExportDialog
&& oml.$ui.importExportDialog.is(':visible')
) {
oml.$ui.importExportDialog.select(page);
} else {
oml.$ui.importExportDialog = oml.ui.importExportDialog(page).open();
}
2014-05-04 17:26:43 +00:00
}
}
that.reload = function() {
Ox.Request.cancel();
Ox.Request.clearCache();
2014-05-18 23:24:04 +00:00
oml.unbindEvent();
2014-05-04 17:26:43 +00:00
oml.$ui.appPanel.remove();
oml.$ui.appPanel = oml.ui.appPanel().appendTo(Ox.$body);
return that;
};
return that;
};