diff --git a/source/Ox.UI/js/Calendar/Ox.ListCalendar.js b/source/Ox.UI/js/Calendar/Ox.ListCalendar.js index 328637b2..c7083287 100644 --- a/source/Ox.UI/js/Calendar/Ox.ListCalendar.js +++ b/source/Ox.UI/js/Calendar/Ox.ListCalendar.js @@ -31,8 +31,6 @@ Ox.ListCalendar = function(options, self) { height: self.options.height + 'px' }); - Ox.print('LCO', self.options) - self.durationCache = {}; self.durationSize = { 86400: 10, @@ -73,7 +71,6 @@ Ox.ListCalendar = function(options, self) { }, { format: function(value, data) { - Ox.print('format', value, data) return data.type ? value : $('').addClass('OxWarning').html(value); @@ -621,7 +618,6 @@ Ox.ListCalendar = function(options, self) { data = {id: id}; data[key] = value; self.options.editEvent(data, function(result) { - Ox.print('EDIT EVENT::', result.data) if (result.status.code == 200) { self.options.events[index][key] = value; self.$list.value(id, key, value); @@ -713,7 +709,6 @@ Ox.ListCalendar = function(options, self) { function selectItem(data) { // Select item in list - Ox.print('selectItem', data); var event, isUndefined, selectedEvent; self.options.selected = data.ids.length ? data.ids[0] : ''; event = self.options.selected @@ -724,7 +719,6 @@ Ox.ListCalendar = function(options, self) { ? self.options.selected : ''; self.$calendar.options({selected: selectedEvent}); selectedEvent && self.$calendar.panToEvent(); - Ox.print('EVENT', event, self.options.hasMatches) if (self.options.selected) { self.$eventName.options({title: event.name || ''}); self.$eventTitle.show(); diff --git a/source/Ox.UI/js/Map/Ox.ListMap.js b/source/Ox.UI/js/Map/Ox.ListMap.js index 23515072..5f5386c4 100644 --- a/source/Ox.UI/js/Map/Ox.ListMap.js +++ b/source/Ox.UI/js/Map/Ox.ListMap.js @@ -817,8 +817,7 @@ Ox.ListMap = function(options, self) { self.$map.removePlace().options({selected: ''}); self.$findPlaceButton.show(); self.$placeFlag.hide(); - self.$placeForm.hide(); - self.$areaKmInput.hide(); + hideForm(); self.$definePlaceButton.options({disabled: false, title: 'Define Place'}) }); } @@ -829,13 +828,13 @@ Ox.ListMap = function(options, self) { } function editPlace(keys) { - Ox.print('EDIT PLACE', keys, self.$placeForm.values()) + Ox.Log('Map', 'EDIT PLACE', keys, self.$placeForm.values()) var values = Ox.filter(self.$placeForm.values(), function(values, key) { return keys.indexOf(key) > -1; }); values.id = self.selectedPlace; self.options.editPlace(values, function(result) { - Ox.print('EDIT PLACE::', result) + Ox.Log('Map', 'EDIT PLACE::', result) if (result.status.code == 200) { if ( keys.indexOf(self.$list.options('sort')[0].key) > -1 @@ -886,6 +885,11 @@ Ox.ListMap = function(options, self) { .options({find: self.$list.value(self.options.selected, 'name')}); } + function hideForm() { + self.$placeForm.hide(); + self.$areaKmInput.hide(); + } + function initList(data) { self.$status.html( Ox.formatNumber(data.items) + ' Place' + ( @@ -935,7 +939,7 @@ Ox.ListMap = function(options, self) { function selectItem(data, place) { // Select item in list - Ox.print('selectItem', data, place); + Ox.Log('Map', 'selectItem', data, place); var isUndefined, selectedPlace; self.options.selected = data.ids.length ? data.ids[0] : ''; place = place || ( @@ -955,13 +959,7 @@ Ox.ListMap = function(options, self) { })[isUndefined ? 'hide' : 'show'](); self.$placeName.options({title: place.name || ''}); self.$placeTitle.show(); - if (!isUndefined) { - self.$placeForm.values(place).show(); - self.$areaKmInput.value(Ox.formatArea(place.area)).show(); - } else { - self.$placeForm.hide(); - self.$areaKmInput.hide(); - } + !isUndefined ? showForm(place) : hideForm(); self.options.hasMatches && self.$matchesInput.value(place.matches || 0).show(); self.options.mode == 'define' && self.$definePlaceButton.options({ disabled: !isUndefined && !place.matches, @@ -973,8 +971,7 @@ Ox.ListMap = function(options, self) { }).show(); } else { self.$placeTitle.hide(); - self.$placeForm.hide(); - self.$areaKmInput.hide(); + hideForm(); self.options.hasMatches && self.$matchesInput.hide(); self.options.mode == 'define' && self.$definePlaceButton.hide(); self.$addPlaceButton.hide(); @@ -983,7 +980,7 @@ Ox.ListMap = function(options, self) { function selectPlace(place) { // Select place on map - Ox.print('selectPlace', place) + Ox.Log('Map', 'selectPlace', place) var isResult = !!place.id && place.id[0] == '_', isUndefined = !!self.options.selected && !self.$list.value(self.options.selected, 'type'), @@ -999,8 +996,7 @@ Ox.ListMap = function(options, self) { self.$placeFlag.attr({ src: Ox.getFlagByGeoname(place.geoname || '', 16) }).show(); - self.$placeForm.values(place).show(); - self.$areaKmInput.value(Ox.formatArea(place.area)).show(); + showForm(place); editPlace([ 'geoname', 'type', 'lat', 'lng', @@ -1014,8 +1010,7 @@ Ox.ListMap = function(options, self) { }).show(); self.$placeName.options({title: place.name || ''}); self.$placeTitle.show(); - self.$placeForm.values(place).show(); - self.$areaKmInput.value(Ox.formatArea(place.area)).show(); + showForm(place); if (self.options.hasMatches) { self.$matchesInput.value('').show(); names = Ox.filter(Ox.merge([place.name], place.alternativeNames), function(name) { @@ -1031,8 +1026,7 @@ Ox.ListMap = function(options, self) { // deselect result place self.$placeFlag.hide(); self.$placeTitle.hide(); - self.$placeForm.hide(); - self.$areaKmInput.hide(); + hideForm(); self.options.hasMatches && self.$matchesInput.hide(); } else if (!self.selectedPlace && isUndefined) { // deselect triggered by selecting an undefined item, @@ -1048,6 +1042,13 @@ Ox.ListMap = function(options, self) { } } + function showForm(place) { + self.$nameInput.removeClass('OxError'); + self.$alternativeNamesInput.setErrors([]); + self.$placeForm.values(place).show(); + self.$areaKmInput.value(Ox.formatArea(place.area)).show(); + } + function toFixed(val) { return Ox.isNumber(val) ? val.toFixed(3) : ''; }