diff --git a/static/js/pandora/mainMenu.js b/static/js/pandora/mainMenu.js
index 7496224a..7cd0ff52 100644
--- a/static/js/pandora/mainMenu.js
+++ b/static/js/pandora/mainMenu.js
@@ -308,7 +308,7 @@ pandora.ui.mainMenu = function() {
} else if (data.id == 'deletelist') {
pandora.ui.deleteListDialog().open();
} else if (data.id == 'print') {
- window.open('#?print=true', '_blank')
+ window.open(document.location.href + '#?print=true', '_blank');
} else if (data.id == 'showsidebar') {
pandora.UI.set({showSidebar: !ui.showSidebar});
} else if (data.id == 'showinfo') {
@@ -413,7 +413,7 @@ pandora.ui.mainMenu = function() {
}
},
key_control_p: function() {
- window.open('#?print=true', '_blank');
+ window.open(document.location.href + '#?print=true', '_blank');
},
key_control_shift_f: function() {
if (!pandora.hasDialogOrScreen()) {
diff --git a/static/js/pandora/printView.js b/static/js/pandora/printView.js
index 210684a9..6904c327 100644
--- a/static/js/pandora/printView.js
+++ b/static/js/pandora/printView.js
@@ -10,83 +10,95 @@ pandora.ui.printView = function(data) {
backgroundColor: 'rgb(255, 255, 255)',
color: 'rgb(0, 0, 0)'
}),
- keys = ['director', 'year', 'title'];
+ $loading = Ox.LoadingScreen().appendTo(that),
+ sortKey = pandora.user.ui.listSort[0].key,
+ keys = Ox.unique(
+ ['director', 'id', 'summary', 'title', 'year'].concat(sortKey)
+ );
Ox.$body.css({
background: 'rgb(255, 255, 255)',
overflow: 'auto'
});
- Ox.LoadingScreen().appendTo(that);
-
pandora.api.find({
- keys: keys.concat(['id', 'summary']),
- query: pandora.user.ui.find,
- range: [0, 1000000],
- sort: keys.map(function(key) {
- return {
- key: key,
- operator: Ox.getObjectById(pandora.site.itemKeys, key).operator
- };
- })
+ query: pandora.user.ui.find
}, function(result) {
- var padding;
- that.empty();
- $('
')
- .css({
- height: '16px'
- })
- .html(
- '
' + pandora.site.site.name + ' - '
- + (pandora.user.ui._list || 'All ' + pandora.site.itemName.plural)
- + ''
- )
- .appendTo(that);
- $('
').css({height: '16px'}).appendTo(that);
- result.data.items && result.data.items.forEach(function(item) {
- var url = (pandora.site.https ? 'https://' : 'http://')
- + pandora.site.site.url + '/' + item.id;
+ var totals = pandora.getStatusText(result.data);
+ pandora.api.find({
+ keys: keys,
+ query: pandora.user.ui.find,
+ range: [0, result.data.items],
+ sort: pandora.user.ui.listSort
+ }, function(result) {
+ var padding;
+ $loading.remove();
$('
')
- .attr({title: url})
- .css({
- height: '16px',
- textAlign: 'justify',
- textOverflow: 'ellipsis',
- overflow: 'hidden'
- })
+ .css({height: '16px'})
.html(
- (item.director ? item.director.join(', ') + ': ' : '')
- + '
' + item.title + ''
- + (item.year ? ' (' + item.year + ')' : '')
- + (
- item.summary
- ? '
'
- + item.summary + ''
- : ''
- )
+ '
' + pandora.site.site.name + ' - '
+ + (pandora.user.ui._list || 'All ' + pandora.site.itemName.plural)
+ + ''
+ )
+ .appendTo(that);
+ $('
').css({height: '16px'}).appendTo(that);
+ result.data.items && result.data.items.forEach(function(item) {
+ var format = Ox.clone(
+ Ox.getObjectById(pandora.site.itemKeys, sortKey).format
+ ),
+ url = (pandora.site.https ? 'https://' : 'http://')
+ + pandora.site.site.url + '/' + item.id;
+ if (format && format.type == 'ColorPercent') {
+ format = {type: 'percent', args: [100, 1]};
+ }
+ $('
')
+ .attr({title: url})
+ .css({
+ height: '16px',
+ textAlign: 'justify',
+ textOverflow: 'ellipsis',
+ overflow: 'hidden'
+ })
+ .html(
+ (item.director ? item.director.join(', ') + ' ' : '')
+ + '
' + item.title + ''
+ + (item.year ? ' (' + item.year + ')' : '')
+ + (
+ item[sortKey] && !Ox.contains(['director', 'title', 'year'], sortKey)
+ ? ' ' + (
+ format && !/^color/.test(format.type)
+ ? Ox['format' + Ox.toTitleCase(format.type)].apply(
+ this, [item[sortKey]].concat(format.args || [])
+ )
+ : item[sortKey]
+ )
+ : ''
+ )
+ + (
+ item.summary
+ ? '
'
+ + item.summary + ''
+ : ''
+ )
+ )
+ .on({
+ click: function() {
+ document.location.href = url;
+ }
+ })
+ .appendTo(that);
+ });
+ if (result.data.items.length) {
+ $('
').css({height: '16px'}).appendTo(that);
+ }
+ $('
')
+ .css({height: '16px'})
+ .html(
+ '
'
+ + totals + '').css({height: '16px'}).appendTo(that);
- }
- $('
')
- .css({
- height: '16px'
- })
- .html(
- Ox.formatCount(
- result.data.items.length,
- pandora.site.itemName.singular,
- pandora.site.itemName.plural
- ).toLowerCase()
- )
- .appendTo(that);
});
that.display = function() {
diff --git a/static/js/pandora/statusbar.js b/static/js/pandora/statusbar.js
index 20f00f56..51888d5c 100644
--- a/static/js/pandora/statusbar.js
+++ b/static/js/pandora/statusbar.js
@@ -29,35 +29,6 @@ pandora.ui.statusbar = function() {
.append($text.selected)
);
- function getText(data) {
- var ui = pandora.user.ui,
- canSeeFiles = pandora.site.capabilities.canSeeFiles[pandora.user.level],
- canSeeSize = pandora.site.capabilities.canSeeSize[pandora.user.level],
- itemName = ui.listView == 'clip'
- ? (data.items == 1 ? 'Clip' : 'Clips')
- : (pandora.site.itemName[data.items == 1 ? 'singular' : 'plural']),
- parts = [];
- parts.push(Ox.formatNumber(data.items) + ' '+ itemName);
- if (data.runtime) {
- parts.push(Ox.formatDuration(data.runtime, 'short'));
- } else if (data.duration) {
- parts.push(Ox.formatDuration(data.duration, 'short'));
- }
- if (canSeeFiles) {
- data.files && parts.push(
- Ox.formatNumber(data.files) + ' file' + (data.files == 1 ? '' : 's')
- );
- data.duration && parts.push(Ox.formatDuration(data.duration));
- }
- if (canSeeSize) {
- data.size && parts.push(Ox.formatValue(data.size, 'B'));
- }
- if (canSeeFiles) {
- data.pixels && parts.push(Ox.formatValue(data.pixels, 'px'));
- }
- return parts.join(', ');
- }
-
function setTotal() {
pandora.api.find({
query: pandora.user.ui.find,
@@ -83,10 +54,10 @@ pandora.ui.statusbar = function() {
} else {
$text.titleTotal.show();
$text.titleSelected.show();
- $text.selected.html(getText(data)).show();
+ $text.selected.html(pandora.getStatusText(data)).show();
}
} else {
- $text.total.html(getText(data)).show();
+ $text.total.html(pandora.getStatusText(data)).show();
}
}
};
diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js
index cc14210a..d5bdbe60 100644
--- a/static/js/pandora/utils.js
+++ b/static/js/pandora/utils.js
@@ -1041,6 +1041,35 @@ pandora.getSpan = function(state, str, callback) {
};
+pandora.getStatusText = function(data) {
+ var ui = pandora.user.ui,
+ canSeeFiles = pandora.site.capabilities.canSeeFiles[pandora.user.level],
+ canSeeSize = pandora.site.capabilities.canSeeSize[pandora.user.level],
+ itemName = ui.listView == 'clip'
+ ? (data.items == 1 ? 'Clip' : 'Clips')
+ : (pandora.site.itemName[data.items == 1 ? 'singular' : 'plural']),
+ parts = [];
+ parts.push(Ox.formatNumber(data.items) + ' '+ itemName);
+ if (data.runtime) {
+ parts.push(Ox.formatDuration(data.runtime, 'short'));
+ } else if (data.duration) {
+ parts.push(Ox.formatDuration(data.duration, 'short'));
+ }
+ if (canSeeFiles) {
+ data.files && parts.push(
+ Ox.formatNumber(data.files) + ' file' + (data.files == 1 ? '' : 's')
+ );
+ data.duration && parts.push(Ox.formatDuration(data.duration));
+ }
+ if (canSeeSize) {
+ data.size && parts.push(Ox.formatValue(data.size, 'B'));
+ }
+ if (canSeeFiles) {
+ data.pixels && parts.push(Ox.formatValue(data.pixels, 'px'));
+ }
+ return parts.join(', ');
+};
+
pandora.getVideoURL = function(id, resolution, part) {
var prefix = pandora.site.site.videoprefix
.replace('{id}', id)