minor update, users & statistics dialogs

This commit is contained in:
rolux 2012-03-26 09:57:59 +00:00
parent 17850d8bf5
commit f4926e595d
2 changed files with 20 additions and 7 deletions

View file

@ -89,14 +89,14 @@ pandora.ui.statisticsDialog = function() {
$tabPanel; $tabPanel;
//Ox.getJSON('/static/json/deleteme.json', function(result) { Ox.getJSON('/static/json/deleteme.json', function(result) {
///* /*
pandora.api.findUsers({ pandora.api.findUsers({
keys: ['browser', 'firstseen', 'lastseen', 'level', 'location', 'system'], keys: ['browser', 'email', 'firstseen', 'lastseen', 'level', 'location', 'system'],
range: [0, 1000000], range: [0, 1000000],
sort: [{key: 'username', operator: '+'}] sort: [{key: 'username', operator: '+'}]
}, function(result) { }, function(result) {
//*/ */
var data = {}, var data = {},
flagCountry = {}, flagCountry = {},
@ -134,6 +134,13 @@ pandora.ui.statisticsDialog = function() {
data[mode].day[day] = (data[mode].day[day] || 0) + 1; data[mode].day[day] = (data[mode].day[day] || 0) + 1;
data[mode].hour[hour] = (data[mode].hour[hour] || 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) { if (item.location) {
split = item.location.split(', ') split = item.location.split(', ')
if (split.length == 1) { if (split.length == 1) {
@ -327,7 +334,7 @@ pandora.ui.statisticsDialog = function() {
textOverflow: 'ellipsis' textOverflow: 'ellipsis'
}) })
.html( .html(
Ox.last(split).replace('ern A', ' A') Ox.last(split)
) )
) )
.append( .append(

View file

@ -174,12 +174,18 @@ pandora.ui.usersDialog = function() {
}, },
{ {
format: function(value, data) { 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({ return Ox.Element({
element: '<img>', element: '<img>',
tooltip: value tooltip: value
}) })
.attr({ .attr({
src: Ox.getFlagByGeoname(value, 16) src: Ox.getFlagByGeoname(value || country, 16)
}) })
.css({ .css({
width: '14px', width: '14px',