Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
irul
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 47198d37
authored
Dec 19, 2022
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perbaikan upload
1 parent
596b9659
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
24 deletions
opensipkd/base/static/js/gmap.js
opensipkd/base/views/register.py
opensipkd/base/views/upload.py
opensipkd/base/static/js/gmap.js
View file @
47198d3
...
...
@@ -36,18 +36,6 @@ function initMap() {
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
)
{
if
(
map
.
data
.
map
.
data
.
getControls
()
!==
null
)
{
let
bounds
=
new
google
.
maps
.
LatLngBounds
();
...
...
@@ -57,13 +45,6 @@ function initMap() {
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
)
{
if
(
e
.
hasOwnProperty
(
"feature"
)
===
true
)
{
selectedFeature
=
e
.
feature
;
...
...
@@ -182,20 +163,28 @@ function bindDataLayerListeners(dataLayer) {
dataLayer
.
addListener
(
'setgeometry'
,
saveData
);
}
function
extendBound
(
bounds
,
feature
)
{
if
(
feature
===
undefined
)
return
bounds
;
function
extendBound
(
new
bounds
,
feature
)
{
if
(
feature
===
undefined
)
return
new
bounds
;
let
featureType
=
feature
.
getGeometry
().
getType
();
if
(
featureType
===
'LineString'
)
{
feature
.
getGeometry
().
getArray
().
forEach
(
function
(
latLng
)
{
bounds
.
extend
(
latLng
);
new
bounds
.
extend
(
latLng
);
});
}
else
if
(
featureType
===
'Polygon'
)
{
feature
.
getGeometry
().
getArray
().
forEach
(
function
(
path
)
{
path
.
getArray
().
forEach
(
function
(
latLng
)
{
bounds
.
extend
(
latLng
);
new
bounds
.
extend
(
latLng
);
});
});
}
return
newbounds
;
}
function
getFeatureBounds
()
{
let
bounds
=
new
google
.
maps
.
LatLngBounds
();
map
.
data
.
forEach
(
function
(
e
)
{
bounds
=
extendBound
(
bounds
,
e
);
});
return
bounds
;
}
...
...
opensipkd/base/views/register.py
View file @
47198d3
...
...
@@ -103,6 +103,7 @@ class AddSchema(colander.Schema):
colander
.
String
(),
widget
=
widget_os
.
CaptchaWidget
(),
oid
=
"captcha"
,
title
=
_
(
"Captcha"
))
if
request
.
user
and
request
.
user
.
id
and
not
external_user
:
# todo: external user tidak ada password
# validasi harusnya menggunakan authentikasi ke provider lagi
...
...
opensipkd/base/views/upload.py
View file @
47198d3
...
...
@@ -69,7 +69,6 @@ def view_file(request):
input_file
=
request
.
POST
[
'upload'
]
.
file
filename
=
request
.
POST
[
'upload'
]
.
filename
.
lower
()
ext
=
get_ext
(
filename
)
.
lower
()
if
ext
.
lower
()
not
in
[
'.png'
,
'.ico'
]:
request
.
session
.
flash
(
'File harus format png'
,
'error'
)
return
dict
(
form
=
form
.
render
())
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment