Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
bca19837
Commit
bca19837
authored
Mar 25, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch de publico
parent
8ad4750f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
194 additions
and
112 deletions
+194
-112
middleware.py
catalog/middleware.py
+7
-1
models.py
catalog/models.py
+5
-0
Reports.css
reports/static/reports/css/Reports.css
+64
-0
Reports_scripts.js
reports/static/reports/js/Reports_scripts.js
+84
-27
Reports.html
reports/templates/Reports.html
+14
-74
aside.html
reports/templates/aside.html
+1
-9
urls.py
reports/urls.py
+1
-0
views.py
reports/views.py
+18
-1
No files found.
catalog/middleware.py
View file @
bca19837
...
@@ -3,6 +3,8 @@ from django.urls import reverse
...
@@ -3,6 +3,8 @@ from django.urls import reverse
# from django.core.urlresolvers import reverse
# from django.core.urlresolvers import reverse
from
catalog.models
import
Publics
class
AuthRequiredMiddleware
(
object
):
class
AuthRequiredMiddleware
(
object
):
def
__init__
(
self
,
get_response
):
def
__init__
(
self
,
get_response
):
...
@@ -16,8 +18,12 @@ class AuthRequiredMiddleware(object):
...
@@ -16,8 +18,12 @@ class AuthRequiredMiddleware(object):
# if request.path_info == reverse('ws-news-list2'):
# if request.path_info == reverse('ws-news-list2'):
# return response
# return response
if
request
.
path_info
==
reverse
(
'ipn'
):
#publics = Publics.objects.all()
#print (publics)
if
request
.
path_info
==
reverse
(
'ipn'
):
print
(
request
.
path_info
)
print
(
request
.
path_info
)
elif
not
request
.
user
.
is_authenticated
and
request
.
path_info
!=
reverse
(
'login'
)
and
not
request
.
user
.
is_active
:
elif
not
request
.
user
.
is_authenticated
and
request
.
path_info
!=
reverse
(
'login'
)
and
not
request
.
user
.
is_active
:
return
HttpResponseRedirect
(
reverse
(
'login'
))
return
HttpResponseRedirect
(
reverse
(
'login'
))
...
...
catalog/models.py
View file @
bca19837
...
@@ -74,3 +74,8 @@ class Purchase(models.Model):
...
@@ -74,3 +74,8 @@ class Purchase(models.Model):
purchased
=
models
.
BooleanField
(
default
=
False
)
purchased
=
models
.
BooleanField
(
default
=
False
)
price
=
models
.
FloatField
(
default
=
0.0
)
price
=
models
.
FloatField
(
default
=
0.0
)
progress
=
models
.
IntegerField
(
default
=
0
)
progress
=
models
.
IntegerField
(
default
=
0
)
is_public
=
models
.
BooleanField
(
default
=
False
)
class
Publics
(
models
.
Model
):
url
=
models
.
TextField
()
Purchase
=
models
.
ForeignKey
(
Purchase
,
on_delete
=
models
.
CASCADE
)
\ No newline at end of file
reports/static/reports/css/Reports.css
0 → 100644
View file @
bca19837
.map
{
height
:
400px
;
width
:
100%
;
}
.switch
{
position
:
relative
;
display
:
inline-block
;
width
:
60px
;
height
:
34px
;
}
.switch
input
{
opacity
:
0
;
width
:
0
;
height
:
0
;
}
.slider
{
position
:
absolute
;
cursor
:
pointer
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
background-color
:
#ccc
;
-webkit-transition
:
.4s
;
transition
:
.4s
;
}
.slider
:before
{
position
:
absolute
;
content
:
""
;
height
:
26px
;
width
:
26px
;
left
:
4px
;
bottom
:
4px
;
background-color
:
white
;
-webkit-transition
:
.4s
;
transition
:
.4s
;
}
input
:checked
+
.slider
{
background-color
:
#f38e19
;
}
input
:focus
+
.slider
{
box-shadow
:
0
0
1px
#f38e19
;
}
input
:checked
+
.slider
:before
{
-webkit-transform
:
translateX
(
26px
);
-ms-transform
:
translateX
(
26px
);
transform
:
translateX
(
26px
);
}
/* Rounded sliders */
.slider.round
{
border-radius
:
34px
;
}
.slider.round
:before
{
border-radius
:
50%
;
}
\ No newline at end of file
reports/static/reports/js/Reports_scripts.js
View file @
bca19837
...
@@ -47,33 +47,7 @@ $(function () {
...
@@ -47,33 +47,7 @@ $(function () {
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'#example'
).
DataTable
$
(
'#example'
).
DataTable
({
({
language
:
{
"sProcessing"
:
"Procesando..."
,
"sLengthMenu"
:
"Mostrar _MENU_ registros"
,
"sZeroRecords"
:
"No se encontraron resultados"
,
"sEmptyTable"
:
"Ningún dato disponible en esta tabla"
,
"sInfo"
:
"Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros"
,
"sInfoEmpty"
:
"Mostrando registros del 0 al 0 de un total de 0 registros"
,
"sInfoFiltered"
:
"(filtrado de un total de _MAX_ registros)"
,
"sInfoPostFix"
:
""
,
"sSearch"
:
"Buscar:"
,
"sUrl"
:
""
,
"sInfoThousands"
:
","
,
"sLoadingRecords"
:
"Cargando..."
,
"oPaginate"
:
{
"sFirst"
:
"Primero"
,
"sLast"
:
"Último"
,
"sNext"
:
"Siguiente"
,
"sPrevious"
:
"Anterior"
},
"oAria"
:
{
"sSortAscending"
:
": Activar para ordenar la columna de manera ascendente"
,
"sSortDescending"
:
": Activar para ordenar la columna de manera descendente"
}
},
responsive
:
responsive
:
{
{
details
:
details
:
...
@@ -96,3 +70,86 @@ $(document).ready(function () {
...
@@ -96,3 +70,86 @@ $(document).ready(function () {
$
(
function
()
{
$
(
function
()
{
$
(
'#reportPage'
).
show
();
$
(
'#reportPage'
).
show
();
});
});
function
showMyModalSetTitle
(
name
,
data
)
{
$
(
'#map'
).
empty
();
$
(
'#myModalTitle'
).
empty
();
$
(
'#myModalTitle'
).
append
(
name
);
$
(
"#mapmodal"
).
modal
();
setTimeout
(
function
()
{
createmap
(
data
);
},
1000
);
//console.log(data)
}
function
createmap
(
data
)
{
/*var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
view: new ol.View({
center: ol.proj.fromLonLat([-89.63873079999999, 21.0404457]),
zoom: 5
})
});*/
var
raster
=
new
ol
.
layer
.
Tile
({
source
:
new
ol
.
source
.
OSM
()
});
var
format
=
new
ol
.
format
.
WKT
();
var
feature
=
format
.
readFeature
(
data
);
feature
.
getGeometry
().
transform
(
'EPSG:4326'
,
'EPSG:3857'
);
var
vector
=
new
ol
.
layer
.
Vector
({
source
:
new
ol
.
source
.
Vector
({
features
:
[
feature
]
})
});
var
center
=
feature
.
getGeometry
();
var
map
=
new
ol
.
Map
({
controls
:
[],
interactions
:
[],
layers
:
[
raster
,
vector
],
target
:
'map'
,
view
:
new
ol
.
View
({
center
:
[
center
.
getInteriorPoint
().
getFirstCoordinate
()[
0
],
center
.
getInteriorPoint
().
getFirstCoordinate
()[
1
]],
zoom
:
9
})
});
}
function
change_public
(
data
)
{
var
checkBox
=
document
.
getElementById
(
data
);
if
(
checkBox
.
checked
==
true
)
{
is_public
(
data
,
'True'
);
}
else
{
is_public
(
data
,
'False'
);
}
}
function
is_public
(
purchase_id
,
status
)
{
//alert(purchase_id);
$
.
ajax
({
dataType
:
"json"
,
url
:
'../reports/ws/is_public'
,
data
:
{
'purchase_id'
:
purchase_id
,
'status'
:
status
},
success
:
function
(
data
)
{
alert
(
"cambiado"
);
}
});
};
\ No newline at end of file
reports/templates/Reports.html
View file @
bca19837
...
@@ -7,12 +7,7 @@
...
@@ -7,12 +7,7 @@
<link
rel=
"stylesheet"
href=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css"
<link
rel=
"stylesheet"
href=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css"
type=
"text/css"
>
type=
"text/css"
>
<style>
<link
rel=
"stylesheet"
href=
"{% static 'reports/css/Reports.css' %}"
type=
"text/css"
>
.map
{
height
:
400px
;
width
:
100%
;
}
</style>
<script
src=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"
></script>
<script
src=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"
></script>
<link
rel=
"stylesheet"
href=
"https://openlayers.org/en/v5.3.0/css/ol.css"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"https://openlayers.org/en/v5.3.0/css/ol.css"
type=
"text/css"
>
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
...
@@ -127,14 +122,14 @@
...
@@ -127,14 +122,14 @@
</a>
</a>
</li>
</li>
<li>
<li>
<a
class=
"treeview "
href=
"#"
onclick=
"window.history.back();"
>
<a
class=
"treeview "
href=
"#"
onclick=
"window.history.back();"
>
<i
class=
"fa fa-backward"
></i>
<i
class=
"fa fa-backward"
></i>
<span>
Back
</span>
<span>
Back
</span>
<span
class=
"pull-right-container"
>
<span
class=
"pull-right-container"
>
<span
class=
"label label-primary pull-right"
></span>
<span
class=
"label label-primary pull-right"
></span>
</span>
</span>
</a>
</a>
</li>
</li>
</ul>
</ul>
</div>
</div>
<!-- form-group-->
<!-- form-group-->
...
@@ -162,6 +157,7 @@
...
@@ -162,6 +157,7 @@
<th>
End Date
</th>
<th>
End Date
</th>
<!--th>Clouds %</th-->
<!--th>Clouds %</th-->
<th>
Estimated Size
</th>
<th>
Estimated Size
</th>
<th>
Public
</th>
<th>
Actions
</th>
<th>
Actions
</th>
</thead>
</thead>
<tbody
id=
"table_body"
>
<tbody
id=
"table_body"
>
...
@@ -176,6 +172,12 @@
...
@@ -176,6 +172,12 @@
<td>
{{ product.endDate }}
</td>
<td>
{{ product.endDate }}
</td>
<!--td>{{product.clouds}} %</td-->
<!--td>{{product.clouds}} %</td-->
<td>
{{ product.size }}
</td>
<td>
{{ product.size }}
</td>
<td>
<label
class=
"switch"
>
<input
id=
"{{ product.purchase_id }}"
type=
"checkbox"
onclick=
"change_public({{ product.purchase_id }})"
{%
if
product
.
is_public
%}
checked
{%
endif
%}
>
<span
class=
"slider round"
></span>
</label>
</td>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
<div
class=
"progress {% if product.progress == 100 %} hidden {% endif %}"
<div
class=
"progress {% if product.progress == 100 %} hidden {% endif %}"
id=
"main_progess{{ product.purchase_id }}"
>
id=
"main_progess{{ product.purchase_id }}"
>
...
@@ -279,66 +281,4 @@
...
@@ -279,66 +281,4 @@
{% endblock %}
{% endblock %}
{% block scripts %}
{% block scripts %}
<script
src=
"{% static 'reports/js/Reports_scripts.js' %}"
></script>
<script
src=
"{% static 'reports/js/Reports_scripts.js' %}"
></script>
<script
type=
"text/javascript"
>
function
showMyModalSetTitle
(
name
,
data
)
{
$
(
'#map'
).
empty
();
$
(
'#myModalTitle'
).
empty
();
$
(
'#myModalTitle'
).
append
(
name
);
$
(
"#mapmodal"
).
modal
();
setTimeout
(
function
()
{
createmap
(
data
);
},
1000
);
//console.log(data)
}
function
createmap
(
data
)
{
/*var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
view: new ol.View({
center: ol.proj.fromLonLat([-89.63873079999999, 21.0404457]),
zoom: 5
})
});*/
var
raster
=
new
ol
.
layer
.
Tile
({
source
:
new
ol
.
source
.
OSM
()
});
var
format
=
new
ol
.
format
.
WKT
();
var
feature
=
format
.
readFeature
(
data
);
feature
.
getGeometry
().
transform
(
'EPSG:4326'
,
'EPSG:3857'
);
var
vector
=
new
ol
.
layer
.
Vector
({
source
:
new
ol
.
source
.
Vector
({
features
:
[
feature
]
})
});
var
center
=
feature
.
getGeometry
();
var
map
=
new
ol
.
Map
({
controls
:
[],
interactions
:
[],
layers
:
[
raster
,
vector
],
target
:
'map'
,
view
:
new
ol
.
View
({
center
:
[
center
.
getInteriorPoint
().
getFirstCoordinate
()[
0
],
center
.
getInteriorPoint
().
getFirstCoordinate
()[
1
]],
zoom
:
9
})
});
}
</script>
{% endblock %}
{% endblock %}
reports/templates/aside.html
View file @
bca19837
...
@@ -252,15 +252,7 @@
...
@@ -252,15 +252,7 @@
</span>
</span>
</ul>
</ul>
</li>
</li>
<li>
<a
class=
"treeview "
href=
"#"
onclick=
"window.history.back();"
>
<i
class=
"fa fa-backward"
></i>
<span>
Back
</span>
<span
class=
"pull-right-container"
>
<span
class=
"label label-primary pull-right"
></span>
</span>
</a>
</li>
<!-- <li>
<!-- <li>
<a class="treeview " href="#" onclick="showComparisons()">
<a class="treeview " href="#" onclick="showComparisons()">
...
...
reports/urls.py
View file @
bca19837
...
@@ -7,6 +7,7 @@ urlpatterns = [
...
@@ -7,6 +7,7 @@ urlpatterns = [
url
(
r'^(?P<purchase_id>(\d+))/(?P<report>[\w\-]+)$'
,
views
.
report_L2ASCL
,
name
=
'report'
),
url
(
r'^(?P<purchase_id>(\d+))/(?P<report>[\w\-]+)$'
,
views
.
report_L2ASCL
,
name
=
'report'
),
url
(
r'^$'
,
views
.
Reports
,
name
=
'reports'
),
url
(
r'^$'
,
views
.
Reports
,
name
=
'reports'
),
url
(
r'^ws/process_progress$'
,
views
.
wsProcessProgress
,
name
=
'wsProcessProgress'
),
url
(
r'^ws/process_progress$'
,
views
.
wsProcessProgress
,
name
=
'wsProcessProgress'
),
url
(
r'^ws/is_public'
,
views
.
wsIs_Public
,
name
=
'wsIs_Public'
),
url
(
r'^tiles/(?P<purchase_id>(\d+))/(?P<report>[\w\-]+)/(?P<layer_type>[\w\-]+)/(?P<date>[0-9]+)/(?P<z>[0-9]+)/(?P<x>[0-9]+)/(?P<y>[0-9]+).png$'
,
url
(
r'^tiles/(?P<purchase_id>(\d+))/(?P<report>[\w\-]+)/(?P<layer_type>[\w\-]+)/(?P<date>[0-9]+)/(?P<z>[0-9]+)/(?P<x>[0-9]+)/(?P<y>[0-9]+).png$'
,
views
.
tiles
,
name
=
'tile'
),
views
.
tiles
,
name
=
'tile'
),
url
(
r'^tiles/tileinfo$'
,
views
.
tileinfo
,
name
=
'tileinfo'
),
url
(
r'^tiles/tileinfo$'
,
views
.
tileinfo
,
name
=
'tileinfo'
),
...
...
reports/views.py
View file @
bca19837
...
@@ -113,7 +113,7 @@ def Reports(request):
...
@@ -113,7 +113,7 @@ def Reports(request):
folders
=
[]
folders
=
[]
zip
=
""
zip
=
""
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'productList'
,
'aggreg_date'
,
'search__clouds'
,
'search__startDate'
,
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'productList'
,
'aggreg_date'
,
'search__clouds'
,
'search__startDate'
,
'search__endDate'
,
'search__process_id__name'
,
'search__search_name'
)
.
filter
(
'search__endDate'
,
'search__process_id__name'
,
'search__search_name'
,
'is_public'
)
.
filter
(
user_id
=
request
.
user
.
id
,
purchased
=
1
)
user_id
=
request
.
user
.
id
,
purchased
=
1
)
for
producto
in
product_list
:
for
producto
in
product_list
:
log_info
=
USERS_PATH
+
request
.
user
.
email
+
"/"
+
str
(
producto
[
'id'
])
+
"/L2ASCL_AreaProcessing.log"
log_info
=
USERS_PATH
+
request
.
user
.
email
+
"/"
+
str
(
producto
[
'id'
])
+
"/L2ASCL_AreaProcessing.log"
...
@@ -198,6 +198,7 @@ def Reports(request):
...
@@ -198,6 +198,7 @@ def Reports(request):
"initial_folder"
:
initial_folder
,
"initial_folder"
:
initial_folder
,
"zip"
:
zip
,
"zip"
:
zip
,
"polygon"
:
polygon
[
'wkt'
],
"polygon"
:
polygon
[
'wkt'
],
"is_public"
:
producto
[
'is_public'
],
})
})
size
=
0
size
=
0
final_size
=
0
final_size
=
0
...
@@ -438,3 +439,19 @@ def ProcessChartData(path):
...
@@ -438,3 +439,19 @@ def ProcessChartData(path):
defaultLabel
=
graphData
[
'data'
][
'labels'
][
0
]
defaultLabel
=
graphData
[
'data'
][
'labels'
][
0
]
defaultDataset
=
label
[
0
:
4
]
+
"/"
+
label
[
4
:
6
]
+
"/"
+
label
[
6
:]
defaultDataset
=
label
[
0
:
4
]
+
"/"
+
label
[
4
:
6
]
+
"/"
+
label
[
6
:]
return
graphData
,
label
,
defaultLabel
,
defaultDataset
,
data
[
'datasets'
]
return
graphData
,
label
,
defaultLabel
,
defaultDataset
,
data
[
'datasets'
]
#---------------------------------------------------------------------------------
def
wsIs_Public
(
request
):
if
request
.
is_ajax
():
status
=
request
.
GET
.
get
(
"status"
)
path
=
"/reports/"
+
request
.
GET
.
get
(
"purchase_id"
)
+
"/scl_data"
purchase
=
Purchase
.
objects
.
get
(
pk
=
request
.
GET
.
get
(
"purchase_id"
))
purchase
.
is_public
=
request
.
GET
.
get
(
"status"
)
purchase
.
save
()
#print (purchase.aggreg_date)
return
HttpResponse
(
"hola"
)
else
:
raise
Http404
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment