merging changes

This commit is contained in:
rolux 2011-03-03 22:37:37 +00:00
parent 7b1de7e847
commit 1e4510815d
2 changed files with 43 additions and 68 deletions

View file

@ -27,6 +27,7 @@ class Place(models.Model):
countryCode = models.CharField(max_length=16, default='') countryCode = models.CharField(max_length=16, default='')
wikipediaId = models.CharField(max_length=1000, blank=True) wikipediaId = models.CharField(max_length=1000, blank=True)
type= models.CharField(max_length=1000, blank=True)
south = models.FloatField(default=0) south = models.FloatField(default=0)
west = models.FloatField(default=0) west = models.FloatField(default=0)
@ -35,6 +36,9 @@ class Place(models.Model):
lat = models.FloatField(default=0) lat = models.FloatField(default=0)
lng = models.FloatField(default=0) lng = models.FloatField(default=0)
size = models.FloatField(default=0) size = models.FloatField(default=0)
size = models.FloatField(default=0)
matches = models.IntegerField(default=0)
objects = managers.PlaceManager() objects = managers.PlaceManager()
@ -60,7 +64,7 @@ class Place(models.Model):
for key in ('created', 'modified', for key in ('created', 'modified',
'name', 'geoname', 'countryCode', 'name', 'geoname', 'countryCode',
'south', 'west', 'north', 'east', 'south', 'west', 'north', 'east',
'lat', 'lng', 'size'): 'lat', 'lng', 'size', 'matches', 'type'):
j[key] = getattr(self, key) j[key] = getattr(self, key)
return j return j

View file

@ -444,10 +444,10 @@
}) })
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
app.user.ui.annotationsSize = data; app.user.ui.annotationsSize = data.width;
}, },
resizeend: function(event, data) { resizeend: function(event, data) {
UI.set({annotationsSize: data}); UI.set({annotationsSize: data.width});
}, },
toggle: function(event, data) { toggle: function(event, data) {
UI.set({showAnnotations: !data.collapsed}); UI.set({showAnnotations: !data.collapsed});
@ -524,31 +524,21 @@
if (!app.user.ui.item) { if (!app.user.ui.item) {
app.$ui.groups = ui.groups(); app.$ui.groups = ui.groups();
that = new Ox.SplitPanel({ that = new Ox.SplitPanel({
elements: [ elements: Ox.map(app.$ui.groups, function(group) {
{ return {element: group};
element: app.$ui.groups[0], }),
size: app.ui.groups[0].size
},
{
element: app.$ui.groupsInnerPanel = ui.groupsInnerPanel()
},
{
element: app.$ui.groups[4],
size: app.ui.groups[4].size
},
],
id: 'browser', id: 'browser',
orientation: 'horizontal' orientation: 'horizontal'
}) })
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
app.user.ui.groupsSize = data; app.user.ui.groupsSize = data.height;
$.each(app.$ui.groups, function(i, list) { $.each(app.$ui.groups, function(i, list) {
list.size(); list.size();
}); });
}, },
resizeend: function(event, data){ resizeend: function(event, data){
UI.set({groupsSize: data}); UI.set({groupsSize: data.height});
}, },
toggle: function(event, data) { toggle: function(event, data) {
UI.set({showGroups: !data.collapsed}); UI.set({showGroups: !data.collapsed});
@ -604,7 +594,7 @@
}); });
} }
that.update = function() { that.update = function() {
app.$ui.contentPanel.replace(0, app.$ui.browser = ui.browser()); app.$ui.contentPanel.replaceElement(0, app.$ui.browser = ui.browser());
} }
return that; return that;
}, },
@ -1611,10 +1601,8 @@
} }
function replaceGroup(i, id, query) { function replaceGroup(i, id, query) {
// if query is passed, selected items will be derived from it // if query is passed, selected items will be derived from it
var isOuter = i % 4 == 0; app.$ui['browser'].replaceElement(
app.$ui[isOuter ? 'browser' : 'groupsInnerPanel'].replace( i, app.$ui.groups[i] = ui.group(id, query)
isOuter ? i / 2 : i - 1,
app.$ui.groups[i] = ui.group(id, query)
); );
} }
}) })
@ -1648,25 +1636,6 @@
}); });
return $groups; return $groups;
}, },
groupsInnerPanel: function() {
var that = new Ox.SplitPanel({
elements: [
{
element: app.$ui.groups[1],
size: app.ui.groups[1].size
},
{
element: app.$ui.groups[2],
},
{
element: app.$ui.groups[3],
size: app.ui.groups[3].size
}
],
orientation: 'horizontal'
});
return that;
},
info: function() { info: function() {
var that = new Ox.Element() var that = new Ox.Element()
.append( .append(
@ -1768,11 +1737,11 @@
} }
} }
})); }));
app.$ui.contentPanel.replace(1, app.$ui.item = $edit); app.$ui.contentPanel.replaceElement(1, app.$ui.item = $edit);
} else { } else {
$.get('/static/html/itemInfo.html', {}, function(template) { $.get('/static/html/itemInfo.html', {}, function(template) {
//Ox.print(template); //Ox.print(template);
app.$ui.contentPanel.replace(1, app.$ui.contentPanel.replaceElement(1,
app.$ui.item = new Ox.Element('div') app.$ui.item = new Ox.Element('div')
.append($.tmpl(template, result.data.item)) .append($.tmpl(template, result.data.item))
); );
@ -1786,7 +1755,7 @@
video.height = video.profiles[0] video.height = video.profiles[0]
video.width = parseInt(video.height * video.aspectRatio / 2) * 2; video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
video.url = video.baseUrl + '/' + video.height + 'p.' + format; video.url = video.baseUrl + '/' + video.height + 'p.' + format;
app.$ui.contentPanel.replace(1, app.$ui.player = new Ox.VideoPanelPlayer({ app.$ui.contentPanel.replaceElement(1, app.$ui.player = new Ox.VideoPanelPlayer({
annotationsSize: app.user.ui.annotationsSize, annotationsSize: app.user.ui.annotationsSize,
duration: video.duration, duration: video.duration,
height: app.$ui.contentPanel.size(1), height: app.$ui.contentPanel.size(1),
@ -1811,7 +1780,7 @@
exitfullscreen: exitFullscreen, exitfullscreen: exitFullscreen,
resize: function(event, data) { resize: function(event, data) {
app.$ui.player.options({ app.$ui.player.options({
height: data height: data.height
}); });
} }
})); }));
@ -1827,7 +1796,7 @@
$.each(app.config.layers, function(i, layer) { $.each(app.config.layers, function(i, layer) {
layers[i] = $.extend({}, layer, {items: result.data.item.layers[layer.id]}); layers[i] = $.extend({}, layer, {items: result.data.item.layers[layer.id]});
}); });
app.$ui.contentPanel.replace(1, app.$ui.editor = new Ox.VideoEditor({ app.$ui.contentPanel.replaceElement(1, app.$ui.editor = new Ox.VideoEditor({
annotationsSize: app.user.ui.annotationsSize, annotationsSize: app.user.ui.annotationsSize,
cuts: cuts, cuts: cuts,
duration: video.duration, duration: video.duration,
@ -1854,7 +1823,7 @@
}).bindEvent({ }).bindEvent({
resize: function(event, data) { resize: function(event, data) {
app.$ui.editor.options({ app.$ui.editor.options({
height: data height: data.height
}); });
}, },
togglesize: function(event, data) { togglesize: function(event, data) {
@ -1883,7 +1852,7 @@
that.bindEvent('resize', function(event, data) { that.bindEvent('resize', function(event, data) {
//Ox.print('resize item', data) //Ox.print('resize item', data)
app.$ui.editor.options({ app.$ui.editor.options({
height: data height: data.height
}); });
}); });
/* /*
@ -1895,7 +1864,7 @@
}); });
*/ */
} else if (app.user.ui.itemView == 'files') { } else if (app.user.ui.itemView == 'files') {
app.$ui.contentPanel.replace(1, app.$ui.contentPanel.replaceElement(1,
app.$ui.item = new Ox.FilesView({ app.$ui.item = new Ox.FilesView({
id: result.data.item.id id: result.data.item.id
}) })
@ -1929,12 +1898,12 @@
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
var infoSize = Math.round(data / app.ui.infoRatio) + 16; var infoSize = Math.round(data / app.ui.infoRatio) + 16;
app.user.ui.sidebarSize = data; app.user.ui.sidebarSize = data.width;
if (data < app.ui.sectionButtonsWidth && app.$ui.sectionButtons) { if (data.width < app.ui.sectionButtonsWidth && app.$ui.sectionButtons) {
app.$ui.sectionButtons.remove(); app.$ui.sectionButtons.remove();
delete app.$ui.sectionButtons; delete app.$ui.sectionButtons;
app.$ui.sectionbar.append(app.$ui.sectionSelect = ui.sectionSelect()); app.$ui.sectionbar.append(app.$ui.sectionSelect = ui.sectionSelect());
} else if (data >= app.ui.sectionButtonsWidth && app.$ui.sectionSelect) { } else if (data.width >= app.ui.sectionButtonsWidth && app.$ui.sectionSelect) {
app.$ui.sectionSelect.remove(); app.$ui.sectionSelect.remove();
delete app.$ui.sectionSelect; delete app.$ui.sectionSelect;
app.$ui.sectionbar.append(app.$ui.sectionButtons = ui.sectionButtons()); app.$ui.sectionbar.append(app.$ui.sectionButtons = ui.sectionButtons());
@ -1944,7 +1913,7 @@
resizeFolders(); resizeFolders();
}, },
resizeend: function(event, data) { resizeend: function(event, data) {
UI.set({sidebarSize: data}); UI.set({sidebarSize: data.width});
}, },
toggle: function(event, data) { toggle: function(event, data) {
UI.set({showSidebar: !data.collapsed}); UI.set({showSidebar: !data.collapsed});
@ -2376,7 +2345,7 @@
} }
}); });
that.display = function() { // fixme: used? that.display = function() { // fixme: used?
app.$ui.rightPanel.replace(1, app.$ui.contentPanel = ui.contentPanel()); app.$ui.rightPanel.replaceElement(1, app.$ui.contentPanel = ui.contentPanel());
}; };
return that; return that;
}, },
@ -3069,10 +3038,10 @@
} else { } else {
app.$ui.browser.scrollToSelection(); app.$ui.browser.scrollToSelection();
app.user.ui.itemView == 'player' && app.$ui.player.options({ app.user.ui.itemView == 'player' && app.$ui.player.options({
width: data width: data.width
}); });
app.user.ui.itemView == 'timeline' && app.$ui.editor.options({ app.user.ui.itemView == 'timeline' && app.$ui.editor.options({
width: data width: data.width
}); });
} }
} }
@ -3228,7 +3197,7 @@
app.$ui.findElement = ui.findElement() app.$ui.findElement = ui.findElement()
); );
that.display = function() { that.display = function() {
app.$ui.rightPanel.replace(0, app.$ui.toolbar = ui.toolbar()); // fixme: remove later app.$ui.rightPanel.replaceElement(0, app.$ui.toolbar = ui.toolbar()); // fixme: remove later
} }
return that; return that;
}, },
@ -3262,7 +3231,7 @@
var id = data.selected[0].id; var id = data.selected[0].id;
//UI.set({itemView: id}); //UI.set({itemView: id});
URL.set(app.user.ui.item + '/' + id); URL.set(app.user.ui.item + '/' + id);
// app.$ui.contentPanel.replace(1, app.$ui.item = ui.item()); // app.$ui.contentPanel.replaceElement(1, app.$ui.item = ui.item());
} }
}); });
return that; return that;
@ -3376,10 +3345,12 @@
function getFoldersWidth() { function getFoldersWidth() {
var width = app.user.ui.sidebarSize; var width = app.user.ui.sidebarSize;
// fixme: don't use height(), look up in splitpanels // fixme: don't use height(), look up in splitpanels
/*
Ox.print(getFoldersHeight(), '>', app.$ui.leftPanel.height() - 24 - 1 - app.$ui.info.height()) Ox.print(getFoldersHeight(), '>', app.$ui.leftPanel.height() - 24 - 1 - app.$ui.info.height())
if (getFoldersHeight() > app.$ui.leftPanel.height() - 24 - 1 - app.$ui.info.height()) { if (getFoldersHeight() > app.$ui.leftPanel.height() - 24 - 1 - app.$ui.info.height()) {
width -= app.ui.scrollbarSize; width -= app.ui.scrollbarSize;
} }
*/
return width; return width;
} }
@ -3461,8 +3432,8 @@
return getGroupWidth(i, width); return getGroupWidth(i, width);
}); });
//Ox.print('widths', widths); //Ox.print('widths', widths);
app.$ui.browser.size(0, widths[0].list).size(2, widths[4].list); //app.$ui.browser.size(0, widths[0].list).size(2, widths[4].list);
app.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list); //app.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list);
$.each(app.$ui.groups, function(i, list) { $.each(app.$ui.groups, function(i, list) {
list.resizeColumn('name', widths[i].column); list.resizeColumn('name', widths[i].column);
}); });
@ -3879,15 +3850,15 @@
update: function() { update: function() {
URL.parse(); URL.parse();
if (app.user.ui.section != old.user.ui.section) { if (app.user.ui.section != old.user.ui.section) {
app.$ui.appPanel.replace(1, app.$ui.mainPanel = ui.mainPanel()); app.$ui.appPanel.replaceElement(1, app.$ui.mainPanel = ui.mainPanel());
} else if (app.user.ui.sitePage != old.user.ui.sitePage) { } else if (app.user.ui.sitePage != old.user.ui.sitePage) {
app.$ui.mainPanel.replace(1, app.$ui.rightPanel = ui.rightPanel()); app.$ui.mainPanel.replaceElement(1, app.$ui.rightPanel = ui.rightPanel());
} else if (!app.user.ui.item || !old.user.ui.item) { } else if (!app.user.ui.item || !old.user.ui.item) {
app.$ui.mainPanel.replace(1, app.$ui.rightPanel = ui.rightPanel()); app.$ui.mainPanel.replaceElement(1, app.$ui.rightPanel = ui.rightPanel());
app.$ui.leftPanel.replace(2, app.$ui.info = ui.info()); app.$ui.leftPanel.replaceElement(2, app.$ui.info = ui.info());
} else { } else {
app.$ui.contentPanel.replace(1, ui.item()); app.$ui.contentPanel.replaceElement(1, ui.item());
app.$ui.leftPanel.replace(2, app.$ui.info = ui.info()); app.$ui.leftPanel.replaceElement(2, app.$ui.info = ui.info());
} }
if ( if (
old.user.ui.item && old.user.ui.item &&
@ -3941,7 +3912,7 @@
}); });
if (!match) { if (!match) {
Query.fromString(location.hash.substr(1)); Query.fromString(location.hash.substr(1));
app.$ui.rightPanel.replace(1, ui.contentPanel()); app.$ui.rightPanel.replaceElement(1, ui.contentPanel());
} }
} }