move static and files

This commit is contained in:
j 2010-11-06 17:14:40 +01:00
commit aeaa875608
21 changed files with 29 additions and 14 deletions

181
static/css/timeline.css Normal file
View file

@ -0,0 +1,181 @@
body {
margin: 0;
}
#editor {
margin: 4px;
}
#players {
//background: rgb(255, 192, 192);
}
#timelines {
background: rgb(192, 192, 255);
}
.OxEditor .OxVideoPlayer {
position: absolute;
margin: 4px;
//background: red;
}
.OxTimelineLarge {
position: absolute;
height: 72px;
margin: 0 4px 0 4px;
overflow: hidden;
}
.OxTimelineLarge > div {
position: absolute;
height: 72px;
}
.OxTimelineLarge > div > img {
position: absolute;
top: 4px;
}
.OxTimelineLarge .OxCut {
position: absolute;
top: 66px;
width: 2px;
height: 4px;
margin-left: -1px;
z-index: 10;
}
.OxTimelineLarge .OxMarkerPointIn {
position: absolute;
top: 64px;
width: 6px;
height: 6px;
margin-left: -5px;
z-index: 10;
}
.OxTimelineLarge .OxMarkerPointOut {
position: absolute;
top: 64px;
width: 6px;
height: 6px;
z-index: 10;
}
.OxTimelineLarge .OxMarkerPosition {
position: absolute;
top: 2px;
width: 9px;
height: 5px;
z-index: 10;
}
.OxTimelineLarge .OxSubtitle {
position: absolute;
bottom: 9px;
border: 1px solid rgba(255, 255, 255, 0.5);
padding: 1px;
background: rgba(0, 0, 0, 0.25);
font-size: 8px;
line-height: 10px;
text-align: center;
text-overflow: ellipsis;
text-shadow: rgba(0, 0, 0, 1) 1px 1px 1px;
color: rgb(255, 255, 255);
cursor: default;
overflow: hidden;
z-index: 10;
-moz-box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}
.OxTimelineLarge .OxSubtitle.OxHighlight {
border-color: rgba(255, 255, 0, 1);
}
.OxTimelineSmall {
position: absolute;
}
.OxTimelineSmall > div {
position: absolute;
height: 18px;
margin: 3px 4px 3px 4px;
overflow: hidden;
}
.OxTimelineSmall > div > img {
position: absolute;
left: 0;
top: 0;
}
.OxTimelineSmall > div > .OxTimelineSmallImage {
margin-top: 1px;
}
.OxTimelineSmall .OxMarkerPointIn {
position: absolute;
width: 6px;
height: 6px;
margin-left: -1px;
}
.OxTimelineSmall .OxMarkerPointOut {
position: absolute;
width: 6px;
height: 6px;
margin-left: 4px;
}
.OxVideoPlayer > .OxBar .OxInputGroup {
//width: 98px;
}
.OxVideoPlayer > .OxBar .OxButton {
margin-right: -1px;
}
.OxVideoPlayer > .OxBar .OxButton,
.OxVideoPlayer > .OxBar .OxInput,
.OxVideoPlayer > .OxBar .OxLabel {
padding: 0;
-moz-border-radius: 0;
-webkit-border-radius: 0;
}
.OxVideoPlayer > .OxBar .OxLabel {
//width: 22px;
//background: rgb(32, 32, 32);
}
.OxVideoPlayer .OxMarkerFrame {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 16px;
}
.OxVideoPlayer .OxMarkerFrame > div {
float: left;
}
.OxVideoPlayer .OxMarkerFrame > .OxFrame {
background: rgba(0, 0, 0, 0.5);
}
.OxVideoPlayer .OxMarkerFrame > .OxPoster {
border: 1px solid rgba(255, 255, 255, 0.5);
}
.OxVideoPlayer .OxMarkerPoint {
position: absolute;
width: 16px;
height: 16px;
}
.OxVideoPlayer .OxMarkerInTop {
left: 4px;
top: 4px;
}
.OxVideoPlayer .OxMarkerInBottom {
left: 4px;
bottom: 20px;
}
.OxVideoPlayer .OxMarkerOutTop {
right: 4px;
top: 4px;
}
.OxVideoPlayer .OxMarkerOutBottom {
right: 4px;
bottom: 20px;
}
.OxVideoPlayer .OxSubtitle {
position: absolute;
left: 0;
right: 0;
text-align: center;
//text-shadow: rgba(0, 0, 0, 1) 2px 2px 0px;
text-shadow: rgba(0, 0, 0, 1) 0 0 4px;
color: rgb(255, 255, 255);
z-index: 10;
}

37
static/css/ui.css Normal file
View file

@ -0,0 +1,37 @@
body {
background: rgb(16, 16, 16);
}
div {
-moz-user-select: none;
-webkit-user-select: none;
}
input#find {
position: absolute;
top: 4px;
right: 24px;
width: 240px;
}
img#loading {
position: absolute;
top: 4px;
right: 4px;
width: 16px;
height: 16px;
display: hidden;
}
#sideBrowserPlayer {
text-align: center;
}
#statusBar {
-moz-box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.75);
-webkit-box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.75);
}
.OxCell.OxColumnTitle {
//font-weight: bold;
}

1
static/jquery Symbolic link
View file

@ -0,0 +1 @@
js/jquery/

View file

@ -0,0 +1,91 @@
ajax_filtered_fields = {
request_url: "/ajax_filtered_fields/json_index/",
data_loaded: "data_loaded",
_appendOption: function(obj, selector) {
// append a json data row as an option to the selector
var option = $('<option>' + obj[1] + '</option>');
option.attr({value: obj[0]});
option.appendTo(selector);
return option;
},
_removeOptions: function(selector) {
// remove all options from selector
selector.children("option").each(function(i) {
$(this).remove();
});
},
getManyToManyJSON: function(element_id, app_label, object_name,
lookup_string, select_related) {
// manage the ManyToMany ajax request
var selector_from = $("#" + element_id + "_from");
var selector_to = $("#" + element_id + "_to");
$("#" + element_id + "_input").val("");
selector_from.attr("disabled", true);
selector_to.attr("disabled", true);
this._removeOptions(selector_from);
$.getJSON(this.request_url, {
app_label: app_label,
object_name: object_name,
lookup_string: lookup_string,
select_related: select_related},
function(data){
$.each(data, function(i, obj){
var option_is_selected = selector_to.children("option[value='" + obj[0] + "']").length;
if (!option_is_selected) {
ajax_filtered_fields._appendOption(obj, selector_from);
};
});
SelectBox.init(element_id + "_from");
selector_from.attr("disabled", false);
selector_to.attr("disabled", false);
selector_from.trigger(ajax_filtered_fields.data_loaded);
});
},
getForeignKeyJSON: function(element_id, app_label, object_name,
lookup_string, select_related) {
// manage the ForeignKey ajax request
var selector = $("#" + element_id);
var hidden = $("#hidden-" + element_id);
$("#" + element_id + "_input").val("");
selector.attr("disabled", true);
this._removeOptions(selector);
$.getJSON(this.request_url, {
app_label: app_label,
object_name: object_name,
lookup_string: lookup_string,
select_related: select_related},
function(data){
var selection = hidden.val();
ajax_filtered_fields._appendOption(new Array("", "---------"), selector);
$.each(data, function(i, obj){
ajax_filtered_fields._appendOption(obj, selector);
});
selector.children("option[value='" + selection + "']").attr("selected", "selected");
selector.attr("disabled", false);
SelectBox.init(element_id);
ajax_filtered_fields.bindForeignKeyOptions(element_id);
selector.trigger(ajax_filtered_fields.data_loaded);
});
},
bindForeignKeyOptions: function(element_id) {
// bind the dummy options to the hidden field that do the work
var selector = $("#" + element_id);
var hidden = $("#hidden-" + element_id);
selector.change(function(e) {
hidden.val($(this).val());
});
}
};

19
static/js/jquery/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,18 @@
jQuery.support.video = function() {
jQuery.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
var video = {};
var v = document.createElement('video');
if (v) {
video.support = true;
video.webm = !!(v.canPlayType && v.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, ''));
//Disable WebM on Safari/Perian, seeking does not work
if(video.webm && jQuery.browser.safari && !jQuery.browser.chrome)
video.webm = false;
video.h264 = !!(v.canPlayType && v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''));
video.ogg = !!(v.canPlayType && v.canPlayType('video/ogg; codecs="theora, vorbis"').replace(/no/, ''));
} else {
video.support = false;
}
return video;
}();

2063
static/js/pandora.js Executable file

File diff suppressed because it is too large Load diff

392
static/js/pandora.local.js Normal file
View file

@ -0,0 +1,392 @@
if(typeof(app.afterLaunch) == "undefined")
app.afterLaunch = [];
//app.afterLaunch[0]();
app.afterLaunch.push(function() {
if (typeof(OxFF) == 'undefined')
return;
app.local = {
api: new OxFF(),
volumes: function(cb) {
var _this = this;
Ox.print('api.volumes');
this.api.login(window, app.user.username);
Ox.print('api.now access');
this.api.access(function(access) {
Ox.print('access callback', access);
if(!access) {
var dialogHeight = app.$document.height()/2,
dialogWidth = parseInt((dialogHeight - 48) * 0.75);
var $dialog = new Ox.Dialog({
buttons: [
{
title: 'Close',
click: function() {
$dialog.close();
delete $dialog;
}
}
],
height: dialogHeight,
padding: 0,
title: "Pan.do/ra OxFF Local Archive",
width: dialogWidth
})
.append("For this part of the page to work, you have to allow OxFF to send data to this site")
.open();
} else {
_this.api.volumes(function(result) {
var data = JSON.parse(result);
cb(data);
});
}
});
},
files: function(archive, cb) {
this.api.login(window, app.user.username);
if(!this.api.access())
return false;
this.api.files(archive, function(result) {
var data = JSON.parse(result);
cb(data);
});
return true;
},
upload: function(options, done_cb, progress_cb) {
function wrap(cb) {
if(!cb)
return null;
return function(result) {
var data = JSON.parse(result);
cb(data);
}
}
this.api.upload(JSON.stringify(options),
wrap(done_cb),
wrap(progress_cb));
return true;
},
parsePath: function(path) {
var folder = path.split('/');
folder.pop();
if(folder.length==0) {
folder.push("rootfolder");
}
//FIXME: this is also done on the backend but might require more sub options
if (folder[folder.length-1] == "Extras" || folder[folder.length-1] == "Versions")
folder.pop();
folder = folder.join('/');
return {
folder: folder,
name: path.substring(folder.length),
}
},
loadVolumes: function() {
var _this = this;
Ox.print("load volumes");
var $section = new Ox.CollapsePanel({
id: 'volumes',
size: 'small',
title: 'Volumes'
});
app.$ui.sections.push($section);
app.local.volumes(function(data) {
Ox.print("got volumes", data);
var volumes = 0;
$.each(data, function(name, info) {
volumes ++;
Ox.print("add volume", name, info);
var status = info.available?"online":"offline";
var $line = $('<div>').css({ height: '20px' }).append(
$('<div>').css({ float: 'left', width: '16px', height: '16px', margin: '1px'}).append(
$('<img>').attr({ src: 'static/oxjs/build/png/ox.ui.modern/iconFind.png' })
.css({
width: '16px', height: '16px',
border: 0, background: 'rgb(64, 64, 64)',
WebkitBorderRadius: '2px' })
)
).append(
$('<div>').css({ float: 'left', width: '122px', height: '14px', margin: '2px' }).html(name)
).append(
$('<div>').css({ float: 'left', width: '40px', height: '14px', margin: '2px', textAlign: 'right' }).html(status)
);
$line.click(function() {
Ox.print("get files", name);
app.local.constructFileList(name);
});
$section.$content.append($line);
});
add_button = new Ox.Button({
id: 'add_volume',
title: 'add',
width: 32
}).bindEvent('click', function(event, data) {
if(_this.api.setLocation("Volume "+(volumes+1))) _this.loadVolumes();
});
var update_button = new Ox.Button({
id: 'update_archive',
title: 'update',
width: 48
}).bindEvent('click', function(event, data) {
update_button.options({disabled: true});
_this.api.update(function() {
update_button.options({disabled: false});
})
});
app.$ui.lists.replaceWith(app.constructLists());
$section.find('.OxBar').append($('<div>')
.css({'text-align': 'right', 'margin': '2px'})
.append(update_button.$element)
.append(add_button.$element)
);
});
},
uploadVideos: function(ids, done, progress, total) {
var _this = this;
if(typeof(total) == 'undefined')
total = ids.length;
if(ids.length>0) {
var oshash = ids.pop();
this.uploadVideo(oshash,
function(data) {
if(ids.length>0) {
Ox.print('more files in queue, calling again', ids, total);
_this.uploadVideos(ids, done, progress, total);
} else { //FIXME: should keep info about all uploads
done(data);
}
},
function(data) {
data.progress = data.progress/total;
progress(data);
});
}
},
uploadVideo: function(oshash, done, progress) {
Ox.print('upload', oshash);
var url = app.local.absolute_url('/api/');
app.local.upload({
url: url,
data: {action: 'upload', oshash: oshash},
oshash: oshash,
action: 'frames'
},
function(result) {
Ox.print(result);
//FIXME: check result before posting video
profile = '96p.webm';
var url = app.local.absolute_url('/api/upload/') + '?profile=' + profile + '&oshash=' + oshash;
app.local.upload(
{
oshash: oshash,
action: 'video',
profile: profile,
url: url
},
done,
progress
);
}
);
},
uploadFile: function(oshash) {
Ox.print('upload file', oshash);
var url = app.local.absolute_url('/api/');
app.local.upload({
url: url,
data: {action: 'upload', oshash: oshash},
oshash: oshash,
action: 'file'
},
function(result) {
Ox.print(result);
}
);
},
cancel: function(oshash) {
Ox.print('this function needs to be implemented: cancel ', oshash);
},
constructFileList: function(name) {
var _this = this,
$list = new Ox.TextList({
columns: [
{
align: "left",
id: "id",
operator: "+",
title: "ID",
unique: true,
visible: false,
width: 120
},
{
align: "left",
id: "path",
operator: "+",
title: "path",
unique: false,
visible: true,
width: 600
},
{
align: "left",
id: "files",
operator: "+",
title: "files",
visible: true,
width: 80
},
{
align: "left",
id: "status",
operator: "+",
title: "status",
unique: false,
visible: true,
width:120
},
],
id: "volume",
request: function(options, callback) {
Ox.print("options, volumes", options)
if(!options.range) {
callback({
data: {
items: 58
}
});
} else {
app.local.files(name, function(result) {
var fileInfo = result.info;
app.api.update({
'volume': name, 'files': result.files
}, function(result) {
var videos = {};
function parseResult(result) {
//extract and upload requested videos
$.each(result.data.data, function(i, oshash) {
$.each(folder_ids, function(i, ids) {
if($.inArray(oshash, ids) > -1) {
if(!videos[i]) {
videos[i] = [];
var button = new Ox.Button({
id: 'upload_' + oshash,
title: 'Upload',
width: 48
}).bindEvent('click', function(fid) { return function(event, data) {
Ox.print(videos[fid]);
$($('#'+fid).find('.OxCell')[1]).html(function(fid) {
var button = new Ox.Button({
title: 'Cancel',
width: 48
}).bindEvent('click', function(event, data) {
$.each(videos[fid], function(i, oshash) {
_this.cancel(oshash);
});
});
return button.$element;
}(fid));
//$($('#'+fid).find('.OxCell')[2]).html('extracting data...');
app.local.uploadVideos(
videos[fid],
function(data) {
$($('#'+fid).find('.OxCell')[2]).html('done');
},
function(data) {
$($('#'+fid).find('.OxCell')[2]).html(parseInt(data.progress*100));
}
);
}}(i));
$($('#'+i).find('.OxCell')[2]).html(button.$element);
$('#'+i).css({'font-weight': 'bold'});
}
videos[i].push(oshash);
//add some double click callback here to trigger video upload
return false;
}
});
});
//upload requested files
$.each(result.data.file, function(i, oshash) {
app.local.uploadFile(oshash);
});
};
if (result.data.info.length>0) {
var post = {'info': {}};
$.each(result.data.info, function(i, oshash) {
if(fileInfo[oshash]) {
post.info[oshash] = fileInfo[oshash];
}
});
app.api.update(post, function(result) {
parseResult(result);
});
} else {
parseResult(result);
}
});
var data = {
items: []
}
var folder_ids = {};
var folders = {};
$.each(result.files, function(i, file) {
var f = app.local.parsePath(file.path);
if(!folders[f.folder]) {
folders[f.folder] = {
id: file.oshash,
path: f.folder,
files: 0,
status:'ok',
ids: []
};
folder_ids[file.oshash] = [];
}
folders[f.folder].files++;
folder_ids[folders[f.folder].id].push(file.oshash);
});
var j = 1;
$.each(folders, function(i, folder) {
data.items.push(folder);
});
r = {
data: data,
}
Ox.print(r);
callback(r);
});
}
},
sort: [
{
key: "path",
operator: "+"
}
]
});
app.$ui.contentPanel.replace(1, $list);
},
absolute_url: function (url) {
var base = document.location.href;
if (url.substring(0, 1) == '/') {
base = document.location.protocol + '//' + document.location.hostname;
if(document.location.port) base += ':'+document.location.port
url = base + url;
}
else {
if(base.substring(base.length-1) == '/')
url = base + url;
else
url = base + '/' + url;
}
return url;
},
};
app.local.loadVolumes();
});

1303
static/js/timeline.js Normal file

File diff suppressed because it is too large Load diff

1155
static/js/ui.js Normal file

File diff suppressed because it is too large Load diff

BIN
static/png/frame.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
static/png/icon.16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
static/png/icon.mask.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

BIN
static/png/logo.poster.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

BIN
static/png/timeline.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

3
static/robots.txt Normal file
View file

@ -0,0 +1,3 @@
User-agent: *
Disallow: /

Binary file not shown.