From 353fce1f1415916cdcfce701353f5cd4b1e603fb Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 5 Feb 2012 01:56:23 +0000 Subject: [PATCH] changes in video editor and list map --- source/Ox.UI/js/Form/Ox.ArrayEditable.js | 15 +++++---- source/Ox.UI/js/Map/Ox.ListMap.js | 36 ++++++++++++++------- source/Ox.UI/js/Map/Ox.Map.js | 4 ++- source/Ox.UI/js/Video/Ox.AnnotationPanel.js | 9 +++--- source/Ox.UI/js/Video/Ox.VideoEditor.js | 3 +- 5 files changed, 41 insertions(+), 26 deletions(-) diff --git a/source/Ox.UI/js/Form/Ox.ArrayEditable.js b/source/Ox.UI/js/Form/Ox.ArrayEditable.js index 9078f539..1b75389d 100644 --- a/source/Ox.UI/js/Form/Ox.ArrayEditable.js +++ b/source/Ox.UI/js/Form/Ox.ArrayEditable.js @@ -192,7 +192,7 @@ Ox.ArrayEditable = function(options, self) { self.editing = false; that.blurItem(); } - Ox.print('AE SELECT ITEM', self.options.selected, self.selected); + Ox.print('SELECT ITEM', self.options.selected, self.selected); that.find('.OxSelected').removeClass('OxSelected'); self.selected > -1 && self.$items[self.selected].addClass('OxSelected'); triggerSelectEvent(); @@ -233,15 +233,16 @@ Ox.ArrayEditable = function(options, self) { position = $element.data('position'); if (!$target.is('.OxInput')) { if ($element.length) { - if (!$element.is('.OxSelected')) { + // if clicked on an element + if (position != self.selected) { // select another item - selectItem( - e.metaKey && position == self.selected - ? '' : position - ); + selectItem(position); + } else if (e.metaKey) { + // or deselect current item + selectNone(); } } else if (!self.blurred) { - // if there wasn't an active input element + // otherwise, if there wasn't an active input element if (self.editing) { // blur if still in editing mode that.blurItem(); diff --git a/source/Ox.UI/js/Map/Ox.ListMap.js b/source/Ox.UI/js/Map/Ox.ListMap.js index 3b7e6369..eee74b7d 100644 --- a/source/Ox.UI/js/Map/Ox.ListMap.js +++ b/source/Ox.UI/js/Map/Ox.ListMap.js @@ -69,7 +69,7 @@ Ox.ListMap = function(options, self) { title: 'Id', unique: true, visible: false, - width: 64 + width: 32 }, { format: function(value, data) { @@ -326,7 +326,8 @@ Ox.ListMap = function(options, self) { columnsVisible: true, //items: Ox.clone(self.options.places), items: self.options.places, - keys: ['area', 'geoname'], // needed for icon and flag + // area needed for icon, geoname needed for flag + keys: ['area', 'geoname', 'matches'], max: 1, min: 0, pageLength: self.options.pageLength, @@ -649,7 +650,7 @@ Ox.ListMap = function(options, self) { .appendTo(self.$placeStatusbar); self.$addPlaceButton = Ox.Button({ - tooltip: 'Add Place', + title: 'Add Place', width: 90 }) .css({float: 'right', margin: '4px'}) @@ -833,8 +834,8 @@ Ox.ListMap = function(options, self) { var values = { id: self.selectedPlace, alternativeNames: [], geoname: '', type: '', - latitude: null, longitude: null, - south: null, west: null, north: null, east: null + lat: null, lng: null, + south: null, west: null, north: null, east: null, area: null }; self.$definePlaceButton.options({disabled: true, title: 'Clearing...'}); self.options.editPlace(values, function() { @@ -848,7 +849,7 @@ Ox.ListMap = function(options, self) { } function definePlace() { - self.$map.newPlace(); + self.$map.newPlace(); // this will call selectPlace, then editPlace self.$definePlaceButton.options({title: 'Clear Place'}) } @@ -917,6 +918,9 @@ Ox.ListMap = function(options, self) { self.$addPlaceButton.options({disabled: true, title: 'Removing...'}) self.options.removePlace({id: self.selectedPlace}, function() { self.$list.options({selected: []}).reloadList(true); + self.options.mode == 'define' && self.$definePlaceButton.options({ + disabled: true + }); self.$addPlaceButton.options({disabled: false, title: 'Add Place'}) }); } @@ -946,6 +950,7 @@ Ox.ListMap = function(options, self) { title: 'Define Place' }).show(); self.$addPlaceButton.options({ + disabled: self.$list.value(self.options.selected, 'matches') > 0, title: 'Remove Place' }).show(); } @@ -960,14 +965,19 @@ Ox.ListMap = function(options, self) { isUndefined = !!self.options.selected && !self.$list.value(self.options.selected, 'type'); Ox.print('isResult', isResult, 'isUndefined', isUndefined, self.options.selected) - if (!isUndefined) { + if (!(isUndefined && !place.id)) { + // if isUndefined && !place.id, then we're handling the + // map deselect, which we don't want to pass to the list self.$list.options({ selected: place.id && !isResult ? [place.id] : [] }); } if (place.id) { if (isResult && isUndefined) { - place.name = self.$list.value(self.selectedPlace, 'name'); + self.selectedPlace = self.options.selected; + place.id = self.options.selected; + place.name = self.$list.value(self.options.selected, 'name'); + Ox.print('PLACE::::::', place) } self.options.mode == 'define' && self.$findPlaceButton.hide(); self.$placeFlag.attr({ @@ -977,19 +987,21 @@ Ox.ListMap = function(options, self) { self.$placeTitle.show(); self.$placeForm.values(place).show(); self.$areaKmInput.value(Ox.formatArea(place.area)); - updateMatches(); + self.$matchesInput.value(place.matches); + //updateMatches(); self.options.mode == 'define' && self.$definePlaceButton.options({ title: isUndefined && !isResult ? 'Define Place' : 'Clear Place' }).show(); self.$addPlaceButton.options({ + disabled: self.options.mode == 'define' && place.matches > 0, title: isResult ? 'Add Place' : 'Remove Place' }).show(); if (isResult && isUndefined) { - Ox.print('???? s.o.s s.sP', self.options.selected, self.selectedPlace) - self.selectedPlace = self.options.selected; + self.$map.addPlace(place); + self.$addPlaceButton.options({title: 'Remove Place'}); editPlace([ 'geoname', 'type', - 'latitude', 'longitude', + 'lat', 'lng', 'south', 'west', 'north', 'east', 'area' ]); } diff --git a/source/Ox.UI/js/Map/Ox.Map.js b/source/Ox.UI/js/Map/Ox.Map.js index 8f23a7c7..ab0fb078 100644 --- a/source/Ox.UI/js/Map/Ox.Map.js +++ b/source/Ox.UI/js/Map/Ox.Map.js @@ -530,6 +530,7 @@ Ox.Map = function(options, self) { var place = getSelectedPlace(), country = Ox.getCountryByGeoname(place.geoname); Ox.extend(place, data); + Ox.print('addPlaceToPlaces, place name:', place.name) self.options.selected = place.id; place.countryCode = country ? country.code : ''; Ox.Log('Map', 'addP2P', data, place); @@ -1132,6 +1133,7 @@ Ox.Map = function(options, self) { self.places.splice(Ox.getIndexById(self.places, place.id), 1); self.resultPlace && self.resultPlace.remove(); self.resultPlace = place; + Ox.print('removed place, place is now', place); place.marker.update(); } @@ -1537,7 +1539,7 @@ Ox.Map = function(options, self) { that.value = function(id, key, value) { // fixme: should be like the corresponding List/TextList/etc value function - Ox.Log('Map', 'Map.value', id, key, value) + Ox.print('Map', 'Map.value', id, key, value) getPlaceById(id).options(key, value); } diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index 0673a147..77612304 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -261,8 +261,7 @@ Ox.AnnotationPanel = function(options, self) { } function scrollToSelected(type) { - try { - Ox.print('scrollToSelected $item', that.find('.OxEditableElement.OxSelected')) + //try { var $item = that.find('.OxEditableElement.OxSelected'), itemHeight = $item.height() + (type == 'text' ? 8 : 0), itemTop = $item.offset().top, @@ -280,9 +279,9 @@ Ox.AnnotationPanel = function(options, self) { scrollTop: scrollTop + 'px' }, 0); } - } catch(e) { - Ox.print('THIS SHOULD NOT HAPPEN'); - } + //} catch(e) { + // Ox.print('THIS SHOULD NOT HAPPEN'); + //} } function selectAnnotation(data, index) { diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 55a41b1f..a402e97b 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -692,7 +692,8 @@ Ox.VideoEditor = function(options, self) { // we need a timeout so that a chained bindEvent // actually catches the event self.options.find && setTimeout(function() { - submitFindInput(self.options.find, true); + // only submit if no annotation is selected + submitFindInput(self.options.find, !self.options.selected); }, 0); function addAnnotation(layer) {