diff --git a/pandora/place/models.py b/pandora/place/models.py index 3527b6e..a10f185 100644 --- a/pandora/place/models.py +++ b/pandora/place/models.py @@ -27,6 +27,7 @@ class Place(models.Model): countryCode = models.CharField(max_length=16, default='') wikipediaId = models.CharField(max_length=1000, blank=True) + type= models.CharField(max_length=1000, blank=True) south = models.FloatField(default=0) west = models.FloatField(default=0) @@ -35,6 +36,9 @@ class Place(models.Model): lat = models.FloatField(default=0) lng = models.FloatField(default=0) size = models.FloatField(default=0) + size = models.FloatField(default=0) + + matches = models.IntegerField(default=0) objects = managers.PlaceManager() @@ -60,7 +64,7 @@ class Place(models.Model): for key in ('created', 'modified', 'name', 'geoname', 'countryCode', 'south', 'west', 'north', 'east', - 'lat', 'lng', 'size'): + 'lat', 'lng', 'size', 'matches', 'type'): j[key] = getattr(self, key) return j diff --git a/static/js/pandora.js b/static/js/pandora.js index 75c0274..6798ba3 100755 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -444,10 +444,10 @@ }) .bindEvent({ resize: function(event, data) { - app.user.ui.annotationsSize = data; + app.user.ui.annotationsSize = data.width; }, resizeend: function(event, data) { - UI.set({annotationsSize: data}); + UI.set({annotationsSize: data.width}); }, toggle: function(event, data) { UI.set({showAnnotations: !data.collapsed}); @@ -524,31 +524,21 @@ if (!app.user.ui.item) { app.$ui.groups = ui.groups(); that = new Ox.SplitPanel({ - elements: [ - { - 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 - }, - ], + elements: Ox.map(app.$ui.groups, function(group) { + return {element: group}; + }), id: 'browser', orientation: 'horizontal' }) .bindEvent({ resize: function(event, data) { - app.user.ui.groupsSize = data; + app.user.ui.groupsSize = data.height; $.each(app.$ui.groups, function(i, list) { list.size(); }); }, resizeend: function(event, data){ - UI.set({groupsSize: data}); + UI.set({groupsSize: data.height}); }, toggle: function(event, data) { UI.set({showGroups: !data.collapsed}); @@ -604,7 +594,7 @@ }); } 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; }, @@ -1611,10 +1601,8 @@ } function replaceGroup(i, id, query) { // if query is passed, selected items will be derived from it - var isOuter = i % 4 == 0; - app.$ui[isOuter ? 'browser' : 'groupsInnerPanel'].replace( - isOuter ? i / 2 : i - 1, - app.$ui.groups[i] = ui.group(id, query) + app.$ui['browser'].replaceElement( + i, app.$ui.groups[i] = ui.group(id, query) ); } }) @@ -1648,25 +1636,6 @@ }); 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() { var that = new Ox.Element() .append( @@ -1768,11 +1737,11 @@ } } })); - app.$ui.contentPanel.replace(1, app.$ui.item = $edit); + app.$ui.contentPanel.replaceElement(1, app.$ui.item = $edit); } else { $.get('/static/html/itemInfo.html', {}, function(template) { //Ox.print(template); - app.$ui.contentPanel.replace(1, + app.$ui.contentPanel.replaceElement(1, app.$ui.item = new Ox.Element('div') .append($.tmpl(template, result.data.item)) ); @@ -1786,7 +1755,7 @@ video.height = video.profiles[0] video.width = parseInt(video.height * video.aspectRatio / 2) * 2; 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, duration: video.duration, height: app.$ui.contentPanel.size(1), @@ -1811,7 +1780,7 @@ exitfullscreen: exitFullscreen, resize: function(event, data) { app.$ui.player.options({ - height: data + height: data.height }); } })); @@ -1827,7 +1796,7 @@ $.each(app.config.layers, function(i, layer) { 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, cuts: cuts, duration: video.duration, @@ -1854,7 +1823,7 @@ }).bindEvent({ resize: function(event, data) { app.$ui.editor.options({ - height: data + height: data.height }); }, togglesize: function(event, data) { @@ -1883,7 +1852,7 @@ that.bindEvent('resize', function(event, data) { //Ox.print('resize item', data) app.$ui.editor.options({ - height: data + height: data.height }); }); /* @@ -1895,7 +1864,7 @@ }); */ } else if (app.user.ui.itemView == 'files') { - app.$ui.contentPanel.replace(1, + app.$ui.contentPanel.replaceElement(1, app.$ui.item = new Ox.FilesView({ id: result.data.item.id }) @@ -1929,12 +1898,12 @@ .bindEvent({ resize: function(event, data) { var infoSize = Math.round(data / app.ui.infoRatio) + 16; - app.user.ui.sidebarSize = data; - if (data < app.ui.sectionButtonsWidth && app.$ui.sectionButtons) { + app.user.ui.sidebarSize = data.width; + if (data.width < app.ui.sectionButtonsWidth && app.$ui.sectionButtons) { app.$ui.sectionButtons.remove(); delete app.$ui.sectionButtons; 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(); delete app.$ui.sectionSelect; app.$ui.sectionbar.append(app.$ui.sectionButtons = ui.sectionButtons()); @@ -1944,7 +1913,7 @@ resizeFolders(); }, resizeend: function(event, data) { - UI.set({sidebarSize: data}); + UI.set({sidebarSize: data.width}); }, toggle: function(event, data) { UI.set({showSidebar: !data.collapsed}); @@ -2376,7 +2345,7 @@ } }); 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; }, @@ -3069,10 +3038,10 @@ } else { app.$ui.browser.scrollToSelection(); app.user.ui.itemView == 'player' && app.$ui.player.options({ - width: data + width: data.width }); app.user.ui.itemView == 'timeline' && app.$ui.editor.options({ - width: data + width: data.width }); } } @@ -3228,7 +3197,7 @@ app.$ui.findElement = ui.findElement() ); 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; }, @@ -3262,7 +3231,7 @@ var id = data.selected[0].id; //UI.set({itemView: 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; @@ -3376,10 +3345,12 @@ function getFoldersWidth() { var width = app.user.ui.sidebarSize; // fixme: don't use height(), look up in splitpanels + /* 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()) { width -= app.ui.scrollbarSize; } + */ return width; } @@ -3461,8 +3432,8 @@ return getGroupWidth(i, width); }); //Ox.print('widths', widths); - 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.browser.size(0, widths[0].list).size(2, widths[4].list); + //app.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list); $.each(app.$ui.groups, function(i, list) { list.resizeColumn('name', widths[i].column); }); @@ -3879,15 +3850,15 @@ update: function() { URL.parse(); 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) { - 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) { - app.$ui.mainPanel.replace(1, app.$ui.rightPanel = ui.rightPanel()); - app.$ui.leftPanel.replace(2, app.$ui.info = ui.info()); + app.$ui.mainPanel.replaceElement(1, app.$ui.rightPanel = ui.rightPanel()); + app.$ui.leftPanel.replaceElement(2, app.$ui.info = ui.info()); } else { - app.$ui.contentPanel.replace(1, ui.item()); - app.$ui.leftPanel.replace(2, app.$ui.info = ui.info()); + app.$ui.contentPanel.replaceElement(1, ui.item()); + app.$ui.leftPanel.replaceElement(2, app.$ui.info = ui.info()); } if ( old.user.ui.item && @@ -3941,7 +3912,7 @@ }); if (!match) { Query.fromString(location.hash.substr(1)); - app.$ui.rightPanel.replace(1, ui.contentPanel()); + app.$ui.rightPanel.replaceElement(1, ui.contentPanel()); } }