2013-02-21 16:18:56 +05:30
|
|
|
'use strict';
|
|
|
|
|
2013-03-09 09:19:15 +05:30
|
|
|
// FIXME: rename to embedView
|
2013-03-01 11:24:33 +00:00
|
|
|
|
2013-02-18 15:47:19 +05:30
|
|
|
pandora.ui.embedPanel = function() {
|
2013-02-20 10:09:12 +05:30
|
|
|
|
2013-03-01 11:24:33 +00:00
|
|
|
var that,
|
2013-02-20 14:28:15 +05:30
|
|
|
ui = pandora.user.ui,
|
2013-03-01 11:24:33 +00:00
|
|
|
view = !ui.item ? ui.listView : ui.itemView;
|
|
|
|
|
2014-02-14 16:49:42 +00:00
|
|
|
if (!ui.page) {
|
|
|
|
if (ui.section == 'items') {
|
|
|
|
if (!ui.item) {
|
|
|
|
if (view == 'grid') {
|
|
|
|
that = pandora.ui.embedGrid();
|
|
|
|
} else if (view == 'clip') {
|
|
|
|
that = pandora.ui.embedError(true);
|
|
|
|
} else if (Ox.contains(['map', 'calendar'], view)) {
|
|
|
|
that = pandora.ui.embedNavigation(view);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (view == 'info') {
|
|
|
|
that = pandora.ui.embedInfo();
|
|
|
|
} else if (Ox.contains(['player', 'editor'], view)) {
|
|
|
|
that = pandora.ui.embedPlayer();
|
|
|
|
} else if (view == 'timeline') {
|
|
|
|
that = pandora.ui.embedTimeline();
|
|
|
|
} else if (view == 'clips') {
|
|
|
|
that = pandora.ui.embedError(true);
|
|
|
|
} else if (Ox.contains(['map', 'calendar'], view)) {
|
|
|
|
that = pandora.ui.embedNavigation(view);
|
|
|
|
}
|
2013-02-20 18:08:51 +05:30
|
|
|
}
|
2018-03-05 16:55:03 +05:30
|
|
|
} else if (ui.section == 'documents') {
|
|
|
|
that = pandora.ui.embedDocument()
|
2014-02-14 16:49:42 +00:00
|
|
|
} else if (ui.section == 'edits') {
|
|
|
|
// FIXME: this is non-standard, see above!
|
|
|
|
that = pandora.ui.editPanel(true);
|
2013-02-20 18:08:51 +05:30
|
|
|
} else {
|
2014-02-14 16:49:42 +00:00
|
|
|
that = pandora.ui.embedError(true)
|
2013-02-20 15:37:58 +05:30
|
|
|
}
|
2018-03-05 16:55:03 +05:30
|
|
|
} else if (ui.page == 'document' && ui.part.document) {
|
|
|
|
ui.document = ui.part.document
|
|
|
|
ui.section = 'documents'
|
|
|
|
ui.page = ''
|
|
|
|
that = pandora.ui.embedDocument()
|
2013-02-20 15:37:58 +05:30
|
|
|
}
|
2013-03-01 11:24:33 +00:00
|
|
|
if (!that) {
|
|
|
|
that = pandora.ui.embedError();
|
2013-02-20 14:28:15 +05:30
|
|
|
}
|
|
|
|
|
2013-02-18 15:47:19 +05:30
|
|
|
that.display = function() {
|
|
|
|
// fixme: move animation into Ox.App
|
|
|
|
var animate = $('.OxScreen').length == 0;
|
|
|
|
Ox.Log('', 'ANIMATE?', animate)
|
2017-01-26 17:41:50 +01:00
|
|
|
animate && Ox.$body.css({opacity: 0});
|
|
|
|
that.appendTo(Ox.$body);
|
|
|
|
animate && Ox.$body.animate({opacity: 1}, 1000);
|
2013-02-18 15:47:19 +05:30
|
|
|
return that;
|
|
|
|
};
|
2013-02-20 10:09:12 +05:30
|
|
|
|
2014-02-14 16:49:42 +00:00
|
|
|
// only add reloadPanel if not defined by embed element
|
2013-08-10 10:53:59 +00:00
|
|
|
that.reloadPanel = that.reloadPanel || function(data) {
|
|
|
|
if (Ox.isUndefined(data) || data.value != data.previousValue) {
|
|
|
|
pandora.$ui.embedPanel.replaceWith(pandora.$ui.embedPanel = pandora.ui.embedPanel());
|
2013-08-10 10:57:24 +00:00
|
|
|
return pandora.$ui.embedPanel;
|
2013-08-10 10:53:59 +00:00
|
|
|
}
|
2013-03-01 11:24:33 +00:00
|
|
|
return that;
|
2013-02-22 02:27:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
that.bindEvent({
|
2014-02-04 06:55:06 +00:00
|
|
|
pandora_find: that.reloadPanel,
|
2013-02-22 02:27:13 +00:00
|
|
|
pandora_item: that.reloadPanel,
|
|
|
|
pandora_itemview: that.reloadPanel,
|
2014-02-04 06:55:06 +00:00
|
|
|
pandora_listview: that.reloadPanel,
|
2013-02-22 02:27:13 +00:00
|
|
|
pandora_videopoints: that.reloadPanel,
|
|
|
|
pandora_hash: that.reloadPanel
|
2013-02-20 18:08:51 +05:30
|
|
|
});
|
|
|
|
|
2013-02-18 15:47:19 +05:30
|
|
|
return that;
|
2013-02-20 10:09:12 +05:30
|
|
|
|
2013-02-20 10:46:24 +00:00
|
|
|
};
|