diff --git a/pandora/itemlist/managers.py b/pandora/itemlist/managers.py index 4d912fcf6..6f0a7b897 100644 --- a/pandora/itemlist/managers.py +++ b/pandora/itemlist/managers.py @@ -36,6 +36,13 @@ def parseCondition(condition, user): exclude = True else: exclude = False + if k == 'id': + v = v.split('/') + if len(v) == 2: + q = Q(user__username=v[0], name=v[1]) + else: + q = Q(id__in=[]) + return q if k == 'subscribed': key = 'subscribed_users__username' v = user.username diff --git a/pandora/templates/site.json b/pandora/templates/site.json index d13b310cf..39905481e 100644 --- a/pandora/templates/site.json +++ b/pandora/templates/site.json @@ -39,13 +39,14 @@ {"id": "info", "title": "Info"}, {"id": "statistics", "title": "Statistics"}, {"id": "clips", "title": "Clips"}, + {"id": "player", "title": "Player"}, {"id": "timeline", "title": "Timeline"}, {"id": "map", "title": "Map"}, {"id": "calendar", "title": "Calendar"}, {"id": "files", "title": "Files", "admin": true} ], "layers": [ - {"id": "privatenotes", "title": "Private Notes", "type": "text"}, + {"id": "privatenotes", "title": "Private Notes", "type": "text", "private": true}, {"id": "publicnotes", "title": "Public Notes", "type": "text"} ], "listViews": [ @@ -171,6 +172,7 @@ "section": "items", "sections": ["my", "public", "featured"], "showAnnotations": true, + "showControls": true, "showGroups": true, "showInfo": true, "showMovies": true, @@ -182,7 +184,8 @@ "showSidebar": true, "sidebarSize": 256, "sitePage": "home", - "theme": "modern" + "theme": "modern", + "videoSize": "fit" }, "username": "" } diff --git a/static/js/pandora.js b/static/js/pandora.js index 66b6f7653..6762af6fa 100755 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -14,7 +14,7 @@ var pandora = new Ox.App({ $ui: { body: $('body'), document: $(document), - window: $(window) + window: $(window).resize(resizeWindow) }, config: data.config, requests: {}, @@ -38,50 +38,23 @@ var pandora = new Ox.App({ function load() { - $(function() { - // fixme: use jquery ajaxStart? - var $body = $('body'); - Ox.Request.requests() && app.$ui.loadingIcon.start(); - $body.bind('requestStart', function() { - //Ox.print('requestStart') - app.$ui.loadingIcon && app.$ui.loadingIcon.start(); - }); - $body.bind('requestStop', function() { - //Ox.print('requestStop') - app.$ui.loadingIcon && app.$ui.loadingIcon.stop(); - }); - }); - - //Query.fromString(location.hash.substr(1)); - URL.parse(); window.onpopstate = function() { URL.update(); }; app.$ui.appPanel = ui.appPanel(); - app.$ui.appPanel.display(); - app.ui.sectionButtonsWidth = app.$ui.sectionButtons.width() + 8; + $(function() { + + app.$ui.appPanel.display(); + + Ox.Request.requests() && app.$ui.loadingIcon.start(); + app.$ui.body.ajaxStart(app.$ui.loadingIcon.start); + app.$ui.body.ajaxStop(app.$ui.loadingIcon.stop); + + app.ui.sectionButtonsWidth = app.$ui.sectionButtons.width() + 8; - app.$ui.window.resize(function() { - resizeSections(); - if (app.user.ui.item == '') { - app.$ui.list.size(); - resizeGroups(app.$ui.rightPanel.width()); - if (app.user.ui.listView == 'map') { - app.$ui.map.triggerResize(); - } - } else { - //Ox.print('app.$ui.window.resize'); - app.$ui.browser.scrollToSelection(); - app.user.ui.itemView == 'timeline' && app.$ui.editor.options({ - height: app.$ui.document.height() - - 20 - 24 - app.$ui.contentPanel.size(0) - 1 - 16, - width: app.$ui.document.width() - - app.$ui.mainPanel.size(0) - app.$ui.item.size(1) - 2 - }); - } }); } @@ -963,6 +936,8 @@ var pandora = new Ox.App({ var that; if (app.user.ui.itemView == 'info') { that = new Ox.Element('div'); + } else if (app.user.ui.itemView == 'player') { + that = new Ox.Element('div'); } else if (app.user.ui.itemView == 'timeline') { that = new Ox.SplitPanel({ elements: [ @@ -992,6 +967,36 @@ var pandora = new Ox.App({ .append($.tmpl(template, result.data.item)) ); }); + } else if (app.user.ui.itemView == 'player') { + var video = result.data.item.stream, + subtitles = result.data.item.layers.subtitles; + video.height = 96; + video.width = parseInt(video.height * video.aspectRatio / 2) * 2; + video.url = video.baseUrl + '/' + video.height + 'p.' + ($.support.video.webm ? 'webm' : 'mp4'); + app.$ui.contentPanel.replace(1, app.$ui.player = new Ox.VideoPanelPlayer({ + annotationsSize: app.user.ui.annotationsSize, + duration: video.duration, + height: app.$ui.contentPanel.size(1), + showAnnotations: app.user.ui.showAnnotations, + showControls: app.user.ui.showControls, + videoHeight: video.height, + videoId: app.user.ui.item, + videoWidth: video.width, + videoSize: app.user.ui.videoSize, + videoURL: video.url, + width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1 + }).bindEvent({ + change: function(event, data) { + // showAnnotations, showControls, videoSize + UI.set(data); + } + }))/*.bindEvent({ + resize: function(event, data) { + app.$ui.player.options({ + height: data + }); + } + })*/; } else if (app.user.ui.itemView == 'timeline') { var video = result.data.item.stream, cuts = result.data.item.layers.cuts || {}, @@ -1318,7 +1323,18 @@ var pandora = new Ox.App({ }); } - ['list', 'icons'].indexOf(view) > -1 && that.bindEvent({ + ['list', 'icons'].indexOf(view) > -1 && that.bind({ + dragstart: function(e) { + app.$ui.sectionList.forEach(function($list, i) { + $list.addClass('OxDrop'); + }); + }, + dragend: function(e) { + app.$ui.sectionList.forEach(function($list, i) { + $list.removeClass('OxDrop'); + }); + }, + }).bindEvent({ closepreview: function(event, data) { app.$ui.previewDialog.close(); delete app.$ui.previewDialog; @@ -1346,8 +1362,9 @@ var pandora = new Ox.App({ app.$ui.selected.html(ui.status('selected', data)); }, open: function(event, data) { - var id = data.ids[0]; - URL.set(id); + var id = data.ids[0], + title = that.value(id, 'title'); + URL.set(title, id); }, openpreview: function(event, data) { app.requests.preview && pandora.api.cancel(app.requests.preview); @@ -1770,7 +1787,7 @@ var pandora = new Ox.App({ var isGuest = app.user.group == 'guest', that = new Ox.MainMenu({ extras: [ - $('