forked from 0x2620/pandora
refactoring
This commit is contained in:
parent
a6cf963b6e
commit
dc6d9d3185
5 changed files with 1985 additions and 797 deletions
|
@ -33,11 +33,9 @@ def api_getPage(request):
|
|||
return render_to_json_response(response)
|
||||
|
||||
def site_json(request):
|
||||
return render_to_json_response(siteJson())
|
||||
'''
|
||||
#return render_to_json_response(siteJson())
|
||||
siteSettings = {}
|
||||
for s in models.SiteSettings.objects.all():
|
||||
siteSettings[s.key] = s.value
|
||||
context = RequestContext(request, {'settings':settings, 'siteSettings': siteSettings})
|
||||
return render_to_response('site.json', context, mimetype="application/javascript")
|
||||
'''
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
{"id": "dialog", "title": "Dialog"}
|
||||
],
|
||||
"groups": ["director", "country", "year", "language", "genre"],
|
||||
"itemName": {
|
||||
"singular": "Movie",
|
||||
"plural": "Movies"
|
||||
},
|
||||
"itemViews": [
|
||||
{"id": "info", "title": "Info"},
|
||||
{"id": "statistics", "title": "Statistics"},
|
||||
|
@ -45,8 +49,9 @@
|
|||
{"id": "calendar", "title": "on Calendar"}
|
||||
],
|
||||
"site": {
|
||||
"name": "{{settings.SITENAME}}",
|
||||
"id": "{{settings.SITEID}}",
|
||||
"name": "{{settings.SITENAME}}",
|
||||
"sectionName": "{{settings.SITENAME}}",
|
||||
"url": "{{settings.URL}}"
|
||||
},
|
||||
"sections": [
|
||||
|
@ -118,7 +123,7 @@
|
|||
"groupsSize": 128,
|
||||
"itemView": "timeline",
|
||||
"listQuery": {"conditions": [], "operator": ""},
|
||||
"listsSize": 192,
|
||||
"listsSize": 256,
|
||||
"listView": "icons",
|
||||
"sections": ["history", "lists", "public", "featured", "admin"],
|
||||
"showAnnotations": true,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<div id="itemInfo">
|
||||
<div style="width:128px; float: left">
|
||||
<div style="align: center; width: 128px; margin: 8px; float: left">
|
||||
<img class="icon" src="/${id}/poster.128.jpg">
|
||||
</div>
|
||||
<div style="width:544px; float: left">
|
||||
<div style="width: 544px; float: left">
|
||||
<div id="movieTitle" class="movieData textLarge textLeft" style="margin-top: 0px; margin-bottom: 2px">
|
||||
${title}
|
||||
</div>
|
||||
|
|
2159
static/js/pandora.js
2159
static/js/pandora.js
File diff suppressed because it is too large
Load diff
|
@ -1,21 +1,21 @@
|
|||
if(typeof(app.afterLaunch) == "undefined")
|
||||
app.afterLaunch = [];
|
||||
if(typeof(pandora.afterLaunch) == "undefined")
|
||||
pandora.afterLaunch = [];
|
||||
|
||||
//app.afterLaunch[0]();
|
||||
app.afterLaunch.push(function() {
|
||||
//pandora.afterLaunch[0]();
|
||||
pandora.afterLaunch.push(function() {
|
||||
if (typeof(OxFF) == 'undefined')
|
||||
return;
|
||||
app.local = {
|
||||
pandora.local = {
|
||||
api: new OxFF(),
|
||||
volumes: function(cb) {
|
||||
var _this = this;
|
||||
Ox.print('api.volumes');
|
||||
this.api.login(window, app.user.username);
|
||||
this.api.login(window, pandora.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,
|
||||
var dialogHeight = pandora.$document.height()/2,
|
||||
dialogWidth = parseInt((dialogHeight - 48) * 0.75);
|
||||
|
||||
var $dialog = new Ox.Dialog({
|
||||
|
@ -44,7 +44,7 @@ app.afterLaunch.push(function() {
|
|||
});
|
||||
},
|
||||
files: function(archive, cb) {
|
||||
this.api.login(window, app.user.username);
|
||||
this.api.login(window, pandora.user.username);
|
||||
if(!this.api.access())
|
||||
return false;
|
||||
this.api.files(archive, function(result) {
|
||||
|
@ -91,8 +91,8 @@ app.afterLaunch.push(function() {
|
|||
title: 'Volumes'
|
||||
});
|
||||
|
||||
app.$ui.sections.push($section);
|
||||
app.local.volumes(function(data) {
|
||||
pandora.$ui.sections.push($section);
|
||||
pandora.local.volumes(function(data) {
|
||||
Ox.print("got volumes", data);
|
||||
var volumes = 0;
|
||||
$.each(data, function(name, info) {
|
||||
|
@ -114,7 +114,7 @@ app.afterLaunch.push(function() {
|
|||
);
|
||||
$line.click(function() {
|
||||
Ox.print("get files", name);
|
||||
app.local.constructFileList(name);
|
||||
pandora.local.constructFileList(name);
|
||||
});
|
||||
$section.$content.append($line);
|
||||
});
|
||||
|
@ -136,7 +136,7 @@ app.afterLaunch.push(function() {
|
|||
update_button.options({disabled: false});
|
||||
})
|
||||
});
|
||||
app.$ui.lists.replaceWith(app.constructLists());
|
||||
pandora.$ui.lists.replaceWith(pandora.constructLists());
|
||||
$section.find('.OxBar').append($('<div>')
|
||||
.css({'text-align': 'right', 'margin': '2px'})
|
||||
.append(update_button.$element)
|
||||
|
@ -168,8 +168,8 @@ app.afterLaunch.push(function() {
|
|||
},
|
||||
uploadVideo: function(oshash, done, progress) {
|
||||
Ox.print('upload', oshash);
|
||||
var url = app.local.absolute_url('/api/');
|
||||
app.local.upload({
|
||||
var url = pandora.local.absolute_url('/api/');
|
||||
pandora.local.upload({
|
||||
url: url,
|
||||
data: {action: 'upload', oshash: oshash},
|
||||
oshash: oshash,
|
||||
|
@ -179,8 +179,8 @@ app.afterLaunch.push(function() {
|
|||
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(
|
||||
var url = pandora.local.absolute_url('/api/upload/') + '?profile=' + profile + '&oshash=' + oshash;
|
||||
pandora.local.upload(
|
||||
{
|
||||
oshash: oshash,
|
||||
action: 'video',
|
||||
|
@ -195,8 +195,8 @@ app.afterLaunch.push(function() {
|
|||
},
|
||||
uploadFile: function(oshash) {
|
||||
Ox.print('upload file', oshash);
|
||||
var url = app.local.absolute_url('/api/');
|
||||
app.local.upload({
|
||||
var url = pandora.local.absolute_url('/api/');
|
||||
pandora.local.upload({
|
||||
url: url,
|
||||
data: {action: 'upload', oshash: oshash},
|
||||
oshash: oshash,
|
||||
|
@ -260,9 +260,9 @@ app.afterLaunch.push(function() {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
app.local.files(name, function(result) {
|
||||
pandora.local.files(name, function(result) {
|
||||
var fileInfo = result.info;
|
||||
app.api.update({
|
||||
pandora.api.update({
|
||||
'volume': name, 'files': result.files
|
||||
}, function(result) {
|
||||
var videos = {};
|
||||
|
@ -291,7 +291,7 @@ app.afterLaunch.push(function() {
|
|||
return button.$element;
|
||||
}(fid));
|
||||
//$($('#'+fid).find('.OxCell')[2]).html('extracting data...');
|
||||
app.local.uploadVideos(
|
||||
pandora.local.uploadVideos(
|
||||
videos[fid],
|
||||
function(data) {
|
||||
$($('#'+fid).find('.OxCell')[2]).html('done');
|
||||
|
@ -312,7 +312,7 @@ app.afterLaunch.push(function() {
|
|||
});
|
||||
//upload requested files
|
||||
$.each(result.data.file, function(i, oshash) {
|
||||
app.local.uploadFile(oshash);
|
||||
pandora.local.uploadFile(oshash);
|
||||
});
|
||||
};
|
||||
if (result.data.info.length>0) {
|
||||
|
@ -322,7 +322,7 @@ app.afterLaunch.push(function() {
|
|||
post.info[oshash] = fileInfo[oshash];
|
||||
}
|
||||
});
|
||||
app.api.update(post, function(result) {
|
||||
pandora.api.update(post, function(result) {
|
||||
parseResult(result);
|
||||
});
|
||||
} else {
|
||||
|
@ -336,7 +336,7 @@ app.afterLaunch.push(function() {
|
|||
var folder_ids = {};
|
||||
var folders = {};
|
||||
$.each(result.files, function(i, file) {
|
||||
var f = app.local.parsePath(file.path);
|
||||
var f = pandora.local.parsePath(file.path);
|
||||
if(!folders[f.folder]) {
|
||||
folders[f.folder] = {
|
||||
id: file.oshash,
|
||||
|
@ -370,7 +370,7 @@ app.afterLaunch.push(function() {
|
|||
}
|
||||
]
|
||||
});
|
||||
app.$ui.contentPanel.replace(1, $list);
|
||||
pandora.$ui.contentPanel.replace(1, $list);
|
||||
},
|
||||
absolute_url: function (url) {
|
||||
var base = document.location.href;
|
||||
|
@ -388,5 +388,5 @@ app.afterLaunch.push(function() {
|
|||
return url;
|
||||
},
|
||||
};
|
||||
app.local.loadVolumes();
|
||||
pandora.local.loadVolumes();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue