From f4926e595d2ebc924447ebeaf6a0603ea45637a6 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 26 Mar 2012 09:57:59 +0000 Subject: [PATCH] minor update, users & statistics dialogs --- static/js/pandora/statisticsDialog.js | 19 +++++++++++++------ static/js/pandora/usersDialog.js | 8 +++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/static/js/pandora/statisticsDialog.js b/static/js/pandora/statisticsDialog.js index 8df08838..292b8d76 100644 --- a/static/js/pandora/statisticsDialog.js +++ b/static/js/pandora/statisticsDialog.js @@ -89,14 +89,14 @@ pandora.ui.statisticsDialog = function() { $tabPanel; - //Ox.getJSON('/static/json/deleteme.json', function(result) { - ///* + Ox.getJSON('/static/json/deleteme.json', function(result) { + /* pandora.api.findUsers({ - keys: ['browser', 'firstseen', 'lastseen', 'level', 'location', 'system'], + keys: ['browser', 'email', 'firstseen', 'lastseen', 'level', 'location', 'system'], range: [0, 1000000], sort: [{key: 'username', operator: '+'}] - }, function(result) { - //*/ + }, function(result) { + */ var data = {}, flagCountry = {}, @@ -134,6 +134,13 @@ pandora.ui.statisticsDialog = function() { data[mode].day[day] = (data[mode].day[day] || 0) + 1; data[mode].hour[hour] = (data[mode].hour[hour] || 0) + 1; }); + Ox.print("IL:::", item.location) + if (!item.location) { + Ox.print("??:::", item.email, item.email.split('.').pop().replace(/(edu|gov|mil)/i, 'us')) + item.location = (Ox.getCountryByCode( + item.email.split('.').pop().replace(/(edu|gov|mil)/i, 'us') + ) || {}).name || ''; + } if (item.location) { split = item.location.split(', ') if (split.length == 1) { @@ -327,7 +334,7 @@ pandora.ui.statisticsDialog = function() { textOverflow: 'ellipsis' }) .html( - Ox.last(split).replace('ern A', ' A') + Ox.last(split) ) ) .append( diff --git a/static/js/pandora/usersDialog.js b/static/js/pandora/usersDialog.js index 2a620c4c..ce40da6e 100644 --- a/static/js/pandora/usersDialog.js +++ b/static/js/pandora/usersDialog.js @@ -174,12 +174,18 @@ pandora.ui.usersDialog = function() { }, { format: function(value, data) { + var country; + if (!value) { + country = (Ox.getCountryByCode( + data.email.split('.').pop().replace(/(edu|gov|mil)/i, 'us') + ) || {}).name || ''; + } return Ox.Element({ element: '', tooltip: value }) .attr({ - src: Ox.getFlagByGeoname(value, 16) + src: Ox.getFlagByGeoname(value || country, 16) }) .css({ width: '14px',