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) {
|
2016-01-13 06:52:25 +00:00
|
|
|
var dialogs = {
|
|
|
|
appDialog: ['about', 'faq', 'terms', 'development', 'contact'],
|
|
|
|
updateDialog: ['update'],
|
|
|
|
userDialog: ['preferences', 'peers', 'transfers'],
|
|
|
|
importExportDialog: ['import', 'export']
|
|
|
|
};
|
2014-05-04 17:26:43 +00:00
|
|
|
// close dialogs
|
2016-01-13 07:29:53 +00:00
|
|
|
if (Ox.every(dialogs, function(pages) {
|
2016-01-13 06:52:25 +00:00
|
|
|
return !Ox.contains(pages, page);
|
2016-01-13 07:29:53 +00:00
|
|
|
}) && Ox.some(dialogs, function(pages) {
|
2016-01-13 06:52:25 +00:00
|
|
|
return Ox.contains(pages, previousPage)
|
|
|
|
})) {
|
2014-05-17 08:17:34 +00:00
|
|
|
$('.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
|
|
|
});
|
|
|
|
}
|
2016-01-13 06:52:25 +00:00
|
|
|
// open dialogs
|
|
|
|
Ox.forEach(dialogs, function(pages, dialog) {
|
|
|
|
if (Ox.contains(pages, page) && !Ox.contains(pages, previousPage)) {
|
|
|
|
$('.OxDialog:visible').each(function() {
|
|
|
|
Ox.$elements[$(this).data('oxid')].close();
|
|
|
|
});
|
|
|
|
oml.$ui[dialog] = oml.ui[dialog]().open();
|
2014-05-17 08:17:34 +00:00
|
|
|
}
|
2016-01-13 06:52:25 +00:00
|
|
|
});
|
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;
|
|
|
|
|
|
|
|
};
|