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