use Ox.localStorage

This commit is contained in:
j 2011-12-31 02:17:40 +05:30
parent 691b1e98cc
commit 90a36cfa17
5 changed files with 22 additions and 20 deletions

View file

@ -47,6 +47,7 @@ class Command(BaseCommand):
for s in models.Stream.objects.exclude(format=format, resolution=resolution).filter(source=None): for s in models.Stream.objects.exclude(format=format, resolution=resolution).filter(source=None):
s.source = models.Stream.objects.get(file=s.file, resolution=resolution, format=format) s.source = models.Stream.objects.get(file=s.file, resolution=resolution, format=format)
s.save() s.save()
print "update streams"
for s in models.Stream.objects.filter(source=None): for s in models.Stream.objects.filter(source=None):
if not glob("%s*"%s.timeline_prefix): if not glob("%s*"%s.timeline_prefix):
s.make_timeline() s.make_timeline()

View file

@ -10,8 +10,8 @@
<meta name="application-url" content="{{base_url}}"/> <meta name="application-url" content="{{base_url}}"/>
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="{{settings.SITENAME}}" /> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="{{settings.SITENAME}}" />
<script> <script>
if (localStorage && !localStorage.OxTheme) if (localStorage && !localStorage['Ox.theme'])
localStorage.OxTheme = '{{settings.CONFIG.user.ui.theme}}'; localStorage['Ox.theme'] = '"{{settings.CONFIG.user.ui.theme}}"';
</script> </script>
<script type="text/javascript" src="/static/oxjs/build/Ox.js"></script> <script type="text/javascript" src="/static/oxjs/build/Ox.js"></script>
<script type="text/javascript" src="/static/js/pandora.js"></script> <script type="text/javascript" src="/static/js/pandora.js"></script>

View file

@ -31,8 +31,9 @@ appPanel
} catch(e) {} } catch(e) {}
}; };
var debug = localStorage && localStorage.pandoraDebug, var debug = localStorage && localStorage['pandora.debug'],
theme = localStorage && localStorage.OxTheme || 'modern'; theme = localStorage && localStorage['Ox.theme']
&& JSON.parse(localStorage['Ox.theme']) || 'modern';
loadImages(function(images) { loadImages(function(images) {
loadScreen(images); loadScreen(images);
@ -143,7 +144,10 @@ appPanel
} }
function loadPandora(browserSupported) { function loadPandora(browserSupported) {
window.pandora = Ox.App({url: '/api/'}).bindEvent({ window.pandora = Ox.App({
name: 'pandora',
url: '/api/',
}).bindEvent({
load: function(data) { load: function(data) {
data.browserSupported = browserSupported; data.browserSupported = browserSupported;
Ox.extend(pandora, { Ox.extend(pandora, {
@ -152,11 +156,12 @@ appPanel
}); });
loadPandoraFiles(function() { loadPandoraFiles(function() {
initPandora(data); initPandora(data);
if (localStorage && localStorage.pandoraLocal) { if (pandora.localStorage('local')) {
var url = pandora.localStorage('local');
window.pandora.local = Ox.API({ window.pandora.local = Ox.API({
'url': localStorage.pandoraLocal + '/api/' 'url': url + '/api/'
}, function() { }, function() {
pandora.site.site.videoprefix = localStorage.pandoraLocal; pandora.site.site.videoprefix = url;
}); });
} }
}); });
@ -166,7 +171,7 @@ appPanel
function loadPandoraFiles(callback) { function loadPandoraFiles(callback) {
var prefix = '/static/'; var prefix = '/static/';
if (localStorage && localStorage.pandoraDebug) { if (localStorage && localStorage['pandora.debug']) {
Ox.getJSON(prefix + 'json/pandora.json', function(files) { Ox.getJSON(prefix + 'json/pandora.json', function(files) {
var promises = []; var promises = [];
files.forEach(function(file) { files.forEach(function(file) {
@ -268,12 +273,6 @@ appPanel
videoFormat: Ox.UI.getVideoFormat(pandora.site.video.formats) videoFormat: Ox.UI.getVideoFormat(pandora.site.video.formats)
}); });
/* disabled
if (data.user.level == 'guest' && $.browser.mozilla && !localStorage.OxTheme) {
pandora.user.ui.theme = 'classic';
}
*/
// set up url controller // set up url controller
pandora.URL.init().parse(function() { pandora.URL.init().parse(function() {

View file

@ -144,7 +144,7 @@ pandora.ui.mainMenu = function() {
{ id: 'clearcache', title: 'Clear Cache'}, { id: 'clearcache', title: 'Clear Cache'},
{ id: 'reloadapplication', title: 'Reload Application'}, { id: 'reloadapplication', title: 'Reload Application'},
{ id: 'resetui', title: 'Reset UI Settings'}, { id: 'resetui', title: 'Reset UI Settings'},
{ id: 'debug', title: (localStorage.pandoraDebug?'Disable':'Enable')+' Debug Mode'}, { id: 'debug', title: (pandora.localStorage('debug')?'Disable':'Enable')+' Debug Mode'},
{ id: 'triggererror', title: 'Trigger JavaScript Error'}, { id: 'triggererror', title: 'Trigger JavaScript Error'},
] } ] }
] ]
@ -293,12 +293,12 @@ pandora.ui.mainMenu = function() {
pandora.$ui.appPanel.reload(); pandora.$ui.appPanel.reload();
}); });
} else if (data.id == 'debug') { } else if (data.id == 'debug') {
if(localStorage.pandoraDebug) { if(pandora.localStorage('debug')) {
delete localStorage.pandoraDebug; pandora.localStorage.delete('debug');
} else { } else {
localStorage.pandoraDebug = 1; pandora.localStorage('debug', true);
} }
that.setItemTitle('debug', (localStorage.pandoraDebug ? 'Disable' : 'Enable') + ' Debug Mode'); that.setItemTitle('debug', (pandora.localStorage('debug') ? 'Disable' : 'Enable') + ' Debug Mode');
} else if (data.id == 'triggererror') { } else if (data.id == 'triggererror') {
var e = error; var e = error;
} }

View file

@ -32,6 +32,8 @@ sudo vmbuilder vbox ubuntu --suite=oneiric \
--addpkg python-numpy \ --addpkg python-numpy \
--addpkg python-psycopg2 \ --addpkg python-psycopg2 \
--addpkg python-simplejson \ --addpkg python-simplejson \
--addpkg python-lxml \
--addpkg python-html5lib \
--addpkg oxtimeline \ --addpkg oxtimeline \
--addpkg oxframe \ --addpkg oxframe \
--addpkg mkvtoolnix \ --addpkg mkvtoolnix \