Commit 47198d37 by aagusti

perbaikan upload

1 parent 596b9659
...@@ -36,18 +36,6 @@ function initMap() { ...@@ -36,18 +36,6 @@ function initMap() {
map.data.setControls(gmapControls); map.data.setControls(gmapControls);
// google.maps.event.addListener(map, 'zoom_changed', function () {
// let zoomLevel = map.getZoom();
// if (zoomLevel < 11) {
// map.data.forEach(function (e) {
// let bounds = new google.maps.LatLngBounds();
// bounds = extendBound(bounds, e);
// map.data.add({
// geometry: new google.maps.Data.Point(bounds.getCenter()),
// });
// });
// }
// });
google.maps.event.addListener(map.data, 'addfeature', function (e) { google.maps.event.addListener(map.data, 'addfeature', function (e) {
if (map.data.map.data.getControls() !== null) { if (map.data.map.data.getControls() !== null) {
let bounds = new google.maps.LatLngBounds(); let bounds = new google.maps.LatLngBounds();
...@@ -57,13 +45,6 @@ function initMap() { ...@@ -57,13 +45,6 @@ function initMap() {
map.fitBounds(bounds); map.fitBounds(bounds);
} }
}); });
// google.maps.event.addListener(map.data, 'polygoncomplete', function (e) {
// e.strokeColor = document.getElementById('strokeColor').value;
// e.strokeOpacity = document.getElementById('strokeOpacity').value;
// e.strokeWeight = document.getElementById('strokeWeight').value;
// e.fillColor = document.getElementById('fillColor').value;
// e.fillOpacity = document.getElementById('fillOpacity').value;
// });
google.maps.event.addListener(map.data, 'click', function (e) { google.maps.event.addListener(map.data, 'click', function (e) {
if (e.hasOwnProperty("feature") === true) { if (e.hasOwnProperty("feature") === true) {
selectedFeature = e.feature; selectedFeature = e.feature;
...@@ -182,20 +163,28 @@ function bindDataLayerListeners(dataLayer) { ...@@ -182,20 +163,28 @@ function bindDataLayerListeners(dataLayer) {
dataLayer.addListener('setgeometry', saveData); dataLayer.addListener('setgeometry', saveData);
} }
function extendBound(bounds, feature) { function extendBound(newbounds, feature) {
if (feature === undefined) return bounds; if (feature === undefined) return newbounds;
let featureType = feature.getGeometry().getType(); let featureType = feature.getGeometry().getType();
if (featureType === 'LineString') { if (featureType === 'LineString') {
feature.getGeometry().getArray().forEach(function (latLng) { feature.getGeometry().getArray().forEach(function (latLng) {
bounds.extend(latLng); newbounds.extend(latLng);
}); });
} else if (featureType === 'Polygon') { } else if (featureType === 'Polygon') {
feature.getGeometry().getArray().forEach(function (path) { feature.getGeometry().getArray().forEach(function (path) {
path.getArray().forEach(function (latLng) { path.getArray().forEach(function (latLng) {
bounds.extend(latLng); newbounds.extend(latLng);
}); });
}); });
} }
return newbounds;
}
function getFeatureBounds() {
let bounds = new google.maps.LatLngBounds();
map.data.forEach(function (e) {
bounds = extendBound(bounds, e);
});
return bounds; return bounds;
} }
......
...@@ -103,6 +103,7 @@ class AddSchema(colander.Schema): ...@@ -103,6 +103,7 @@ class AddSchema(colander.Schema):
colander.String(), colander.String(),
widget=widget_os.CaptchaWidget(), widget=widget_os.CaptchaWidget(),
oid="captcha", title=_("Captcha")) oid="captcha", title=_("Captcha"))
if request.user and request.user.id and not external_user: if request.user and request.user.id and not external_user:
# todo: external user tidak ada password # todo: external user tidak ada password
# validasi harusnya menggunakan authentikasi ke provider lagi # validasi harusnya menggunakan authentikasi ke provider lagi
......
...@@ -69,7 +69,6 @@ def view_file(request): ...@@ -69,7 +69,6 @@ def view_file(request):
input_file = request.POST['upload'].file input_file = request.POST['upload'].file
filename = request.POST['upload'].filename.lower() filename = request.POST['upload'].filename.lower()
ext = get_ext(filename).lower() ext = get_ext(filename).lower()
if ext.lower() not in ['.png', '.ico']: if ext.lower() not in ['.png', '.ico']:
request.session.flash('File harus format png', 'error') request.session.flash('File harus format png', 'error')
return dict(form=form.render()) return dict(form=form.render())
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!