From bc3496649646ab75ddcccbf69ada7fcea0820321 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 17 Feb 2012 10:06:43 +0000 Subject: [PATCH] flush cache on list/item switch when sort is accessed/timesaccessed (fixes #245) --- pandora/padma.jsonc | 3 ++- static/js/pandora.js | 6 ++++-- static/js/pandora/backButton.js | 3 +++ static/js/pandora/clipList.js | 5 ++++- static/js/pandora/list.js | 3 +++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pandora/padma.jsonc b/pandora/padma.jsonc index c3a2622c2..da7dceaf9 100644 --- a/pandora/padma.jsonc +++ b/pandora/padma.jsonc @@ -381,7 +381,8 @@ "id": "accessed", "title": "Date Accessed", "type": "date", - "columnWidth": 90 + "columnWidth": 90, + "format": {"type": "date", "args": ["%Y-%m-%d %H:%M:%S"]} }, { "id": "timesaccessed", diff --git a/static/js/pandora.js b/static/js/pandora.js index b76eefd49..8a8c45ded 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -130,11 +130,12 @@ appPanel } function loadOxJS(callback) { - var script = document.createElement('script'); + var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement, + script = document.createElement('script'); script.onload = callback; script.src = '/static/oxjs/dev/Ox.js'; script.type = 'text/javascript'; - document.head.appendChild(script); + head.appendChild(script); } function loadOxUI(callback) { @@ -150,6 +151,7 @@ appPanel url: '/api/', }).bindEvent({ load: function(data) { + Ox.print('browser', browserSupported); data.browserSupported = browserSupported; Ox.extend(pandora, { requests: {}, diff --git a/static/js/pandora/backButton.js b/static/js/pandora/backButton.js index 91a72b00b..8894aa076 100644 --- a/static/js/pandora/backButton.js +++ b/static/js/pandora/backButton.js @@ -18,6 +18,9 @@ pandora.ui.backButton = function() { so we'd have to cancel with a function -- and it's unclear if the best place for that is here */ + if (['accessed', 'timesaccessed'].indexOf(pandora.user.ui.listSort[0].key) > -1) { + Ox.Request.clearCache('find'); + } pandora.UI.set({item: ''}); } }); diff --git a/static/js/pandora/clipList.js b/static/js/pandora/clipList.js index 9f033c34c..f0271360a 100644 --- a/static/js/pandora/clipList.js +++ b/static/js/pandora/clipList.js @@ -4,7 +4,7 @@ pandora.ui.clipList = function(videoRatio) { - Ox.print('CLIP LIST FIND', !pandora.user.ui.item ? pandora.getItemFind(pandora.user.ui.find) : pandora.user.ui.itemFind); + //Ox.print('CLIP LIST FIND', !pandora.user.ui.item ? pandora.getItemFind(pandora.user.ui.find) : pandora.user.ui.itemFind); var ui = pandora.user.ui, fixedRatio = !ui.item ? 16/9 : videoRatio, @@ -131,6 +131,9 @@ pandora.ui.clipList = function(videoRatio) { set['videoPoints.' + item] = Ox.extend(points, { position: points['in'] }); + if (['accessed', 'timesaccessed'].indexOf(ui.listSort[0].key) > -1) { + Ox.Request.clearCache('find'); + } pandora.UI.set(set); }, openpreview: function(data) { diff --git a/static/js/pandora/list.js b/static/js/pandora/list.js index 1274548c2..cc128dc6c 100644 --- a/static/js/pandora/list.js +++ b/static/js/pandora/list.js @@ -398,6 +398,9 @@ pandora.ui.list = function() { if (data.isSpecialTarget) { set.itemView = pandora.user.ui.videoView; } + if (['accessed', 'timesaccessed'].indexOf(pandora.user.ui.listSort[0].key) > -1) { + Ox.Request.clearCache('find'); + } pandora.UI.set(set); }, openpreview: function(data) {