2011-07-29 18:37:11 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
2011-11-05 17:04:10 +00:00
|
|
|
'use strict';
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.ui.mainPanel = function() {
|
2014-02-12 08:59:07 +00:00
|
|
|
var ui = pandora.user.ui,
|
|
|
|
that = Ox.SplitPanel({
|
2011-09-27 23:30:13 +00:00
|
|
|
elements: [
|
|
|
|
{
|
|
|
|
collapsible: true,
|
2014-02-12 08:59:07 +00:00
|
|
|
collapsed: !ui.showSidebar,
|
2011-09-27 23:30:13 +00:00
|
|
|
element: pandora.$ui.leftPanel = pandora.ui.leftPanel(),
|
|
|
|
resizable: true,
|
|
|
|
resize: [192, 256, 320, 384],
|
2014-02-12 08:59:07 +00:00
|
|
|
size: ui.sidebarSize,
|
2014-02-14 15:23:59 +00:00
|
|
|
tooltip: Ox._('sidebar') + ' <span class="OxBright">'
|
2012-04-23 08:38:43 +00:00
|
|
|
+ Ox.SYMBOLS.SHIFT + 'S</span>'
|
2011-09-27 23:30:13 +00:00
|
|
|
},
|
|
|
|
{
|
2014-02-12 08:59:07 +00:00
|
|
|
element: getRightPanel()
|
2011-09-27 23:30:13 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
orientation: 'horizontal'
|
|
|
|
})
|
|
|
|
.bindEvent({
|
2013-05-27 20:06:56 +00:00
|
|
|
pandora_edit: function(data) {
|
2013-07-14 09:26:14 +00:00
|
|
|
that.replaceElement(1, pandora.$ui.editPanel = pandora.ui.editPanel());
|
2013-05-27 20:06:56 +00:00
|
|
|
},
|
2011-09-27 23:30:13 +00:00
|
|
|
pandora_find: function() {
|
|
|
|
var previousUI = pandora.UI.getPrevious();
|
2011-11-10 10:30:39 +00:00
|
|
|
Ox.Log('FIND', 'handled in mainPanel', previousUI.item, previousUI._list)
|
2014-02-12 08:59:07 +00:00
|
|
|
if (!previousUI.item && ui._list == previousUI._list) {
|
|
|
|
if (['map', 'calendar'].indexOf(ui.listView) > -1) {
|
2011-10-08 18:36:26 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
2014-02-12 08:59:07 +00:00
|
|
|
pandora.ui.navigationView(ui.listView)
|
2011-10-08 18:36:26 +00:00
|
|
|
);
|
|
|
|
} else {
|
2014-02-12 08:59:07 +00:00
|
|
|
if (['clips', 'clip'].indexOf(ui.listView) > -1) {
|
|
|
|
pandora.$ui.list.options({find: ui.itemFind});
|
2012-02-01 12:01:39 +00:00
|
|
|
}
|
2011-10-08 18:36:26 +00:00
|
|
|
pandora.$ui.list.reloadList();
|
|
|
|
}
|
2011-11-05 21:13:54 +00:00
|
|
|
// FIXME: why is this being handled _here_?
|
2014-02-12 08:59:07 +00:00
|
|
|
ui._filterState.forEach(function(data, i) {
|
2011-11-06 08:28:10 +00:00
|
|
|
if (!Ox.isEqual(data.selected, previousUI._filterState[i].selected)) {
|
2012-04-24 06:15:20 +00:00
|
|
|
pandora.$ui.filters[i].options(
|
2014-02-12 08:59:07 +00:00
|
|
|
ui.showFilters ? {
|
2012-04-24 06:15:20 +00:00
|
|
|
selected: data.selected
|
|
|
|
} : {
|
|
|
|
_selected: data.selected,
|
|
|
|
selected: []
|
|
|
|
}
|
|
|
|
);
|
2011-09-27 23:30:13 +00:00
|
|
|
}
|
2011-11-06 08:28:10 +00:00
|
|
|
if (!Ox.isEqual(data.find, previousUI._filterState[i].find)) {
|
2014-02-12 08:59:07 +00:00
|
|
|
if (!ui.showFilters) {
|
2012-04-24 06:15:20 +00:00
|
|
|
pandora.$ui.filters[i].options({
|
|
|
|
_selected: data.selected
|
|
|
|
});
|
2012-04-22 12:50:03 +00:00
|
|
|
}
|
2012-04-24 06:15:20 +00:00
|
|
|
// we can call reloadList here, since the items function
|
|
|
|
// handles the hidden filters case without making requests
|
|
|
|
pandora.$ui.filters[i].reloadList();
|
2011-10-29 17:46:46 +00:00
|
|
|
}
|
2011-09-27 23:30:13 +00:00
|
|
|
});
|
|
|
|
} else {
|
2013-02-11 11:15:47 +00:00
|
|
|
if (pandora.stayInItemView) {
|
|
|
|
pandora.stayInItemView = false;
|
|
|
|
} else {
|
|
|
|
that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
|
|
|
}
|
2011-09-27 23:30:13 +00:00
|
|
|
}
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
2013-02-21 12:10:35 +00:00
|
|
|
pandora_item: function(data) {
|
|
|
|
if (!data.value || !data.previousValue) {
|
2013-02-16 01:20:40 +00:00
|
|
|
that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
|
|
|
}
|
|
|
|
},
|
2013-02-21 12:10:35 +00:00
|
|
|
pandora_section: function(data) {
|
|
|
|
if (data.value != data.previousValue) {
|
|
|
|
that.replaceElement(0, pandora.$ui.leftPanel = pandora.ui.leftPanel());
|
2014-02-12 08:59:07 +00:00
|
|
|
that.replaceElement(1, getRightPanel());
|
2011-09-27 23:30:13 +00:00
|
|
|
}
|
2011-10-13 10:12:00 +00:00
|
|
|
},
|
|
|
|
pandora_showsidebar: function(data) {
|
2014-09-22 14:55:12 +00:00
|
|
|
data.value == that.options('elements')[0].collapsed && that.toggleElement(0);
|
2013-02-21 12:10:35 +00:00
|
|
|
},
|
|
|
|
pandora_text: function(data) {
|
2013-11-10 22:01:25 +00:00
|
|
|
if (data.value != data.previousValue) {
|
|
|
|
that.replaceElement(1, pandora.$ui.textPanel = pandora.ui.textPanel());
|
|
|
|
}
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
2011-09-27 23:30:13 +00:00
|
|
|
});
|
2014-02-12 08:59:07 +00:00
|
|
|
function getRightPanel() {
|
|
|
|
return ui.section == 'items' ? pandora.$ui.rightPanel = pandora.ui.rightPanel()
|
|
|
|
: ui.section == 'edits' ? pandora.$ui.editPanel = pandora.ui.editPanel()
|
|
|
|
: pandora.$ui.textPanel = pandora.ui.textPanel();
|
|
|
|
}
|
2011-05-25 19:42:45 +00:00
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|