fix manage events bugs

This commit is contained in:
rolux 2012-01-30 23:29:04 +00:00
parent ddf8655959
commit e3e117588f
5 changed files with 54 additions and 8 deletions

View file

@ -49,7 +49,7 @@ urlpatterns += patterns('',
(r'^(V[a-z0-9]*/.*)$', 'urlalias.views.padma_video'), (r'^(V[a-z0-9]*/.*)$', 'urlalias.views.padma_video'),
) )
urlpatterns += patterns('', urlpatterns += patterns('',
(r'^(?P<id>[A-Z0-9].+)/embed', 'app.views.embed'), (r'^(?P<id>[A-Z0-9].*)/embed', 'app.views.embed'),
(r'^(?P<id>[A-Z0-9].*)$', 'item.views.item'), (r'^(?P<id>[A-Z0-9].*)$', 'item.views.item'),
(r'^[a-z0-9].+$', 'app.views.index'), (r'^[a-z0-9].+$', 'app.views.index'),
(r'^$', 'app.views.index'), (r'^$', 'app.views.index'),

View file

@ -0,0 +1,39 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
pandora.ui.embedDialog = function(data) {
var content = Ox.Element().css({margin: '16px'}),
height = 240,
width = 320,
that = Ox.Dialog({
buttons: [
Ox.Button({
id: 'close',
title: 'Close'
}).bindEvent({
click: function() {
that.close();
}
})
],
closeButton: true,
content: content,
height: Math.round((window.innerHeight - 24) * 0.75),
keys: {
'escape': 'close'
},
maximizeButton: true,
minHeight: 256,
minWidth: 640,
title: 'Embed Video',
width: Math.round(window.innerWidth * 0.75)
})
.bindEvent({
close: function(data) {
}
}),
url = document.location.origin + '/' + pandora.user.ui.item + '/embed';
content.html('To embed this video you need unicorns... or try this code:<br>');
content.append($('<textarea>').css({width:"100%", height:"100%"}).val('<iframe width="'+width+'" height="'+height+'" src="'+url+'" frameborder="0" allowfullscreen></iframe>'));
return that;
};

View file

@ -55,7 +55,6 @@ pandora.ui.eventsDialog = function() {
$content && $content.options({height: data.height}); $content && $content.options({height: data.height});
}, },
resizeend: function(data) { resizeend: function(data) {
Ox.print('RESIZEEND', data)
$content && $content.options({height: data.height, width: data.width}); $content && $content.options({height: data.height, width: data.width});
} }
}), }),

View file

@ -226,7 +226,7 @@ pandora.ui.item = function() {
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
cuts: result.data.cuts || [], cuts: result.data.cuts || [],
duration: result.data.duration, duration: result.data.duration,
download: pandora.site.video.download, enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= result.data.rightslevel,
enableSubtitles: pandora.user.ui.videoSubtitles, enableSubtitles: pandora.user.ui.videoSubtitles,
find: pandora.user.ui.itemFind.conditions[0] find: pandora.user.ui.itemFind.conditions[0]
? pandora.user.ui.itemFind.conditions[0].value : '', ? pandora.user.ui.itemFind.conditions[0].value : '',
@ -300,11 +300,20 @@ pandora.ui.item = function() {
pandora.$ui.placesDialog && pandora.$ui.placesDialog.remove(); pandora.$ui.placesDialog && pandora.$ui.placesDialog.remove();
pandora.$ui.placesDialog = pandora.ui.placesDialog(data).open(); pandora.$ui.placesDialog = pandora.ui.placesDialog(data).open();
}, },
download: function(data) { downloadVideo: function(data) {
Ox.print('download', data); document.location.href = '/' + pandora.user.ui.item + '/torrent/';
document.location.href = '/' + pandora.user.ui.item + '/download';
}, },
downloadSelection: function(data) { downloadSelection: function(data) {
document.location.href = [
'/',
pandora.user.ui.item,
'/',
Ox.max(pandora.site.video.resolutions),
'p.webm?t=',
data['in'],
',',
data.out
].join('');
}, },
editannotation: function(data) { editannotation: function(data) {
Ox.Log('', 'editAnnotation', data); Ox.Log('', 'editAnnotation', data);

View file

@ -97,8 +97,7 @@ pandora.ui.placesDialog = function(options) {
}) })
.bindEvent({ .bindEvent({
resize: function(data) { resize: function(data) {
// data is {width: ..., height: ...} $content.options({width: width, height: height});
$content.options(data);
} }
}); });
return that; return that;