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
d92d634a
Commit
d92d634a
authored
Apr 11, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
descripcion reportes
parent
963dbf56
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
12 deletions
+58
-12
aside.html
reports/templates/aside.html
+1
-1
sclData.html
reports/templates/sclData.html
+4
-4
urls.py
reports/urls.py
+1
-0
views.py
reports/views.py
+52
-7
No files found.
reports/templates/aside.html
View file @
d92d634a
...
@@ -160,7 +160,7 @@
...
@@ -160,7 +160,7 @@
</a>
</a>
<ul
class=
"treeview-menu sidebar-form"
>
<ul
class=
"treeview-menu sidebar-form"
>
<li>
<li>
<a
class=
"treeview submenu"
href=
"#
"
>
<a
class=
"treeview submenu"
id=
"pruebas"
href=
"{% url 'PDF' purchaseID %}"
target=
"_blank
"
>
<i
class=
"fa fa-file-code-o"
></i>
<i
class=
"fa fa-file-code-o"
></i>
<span>
Export to JSON
</span>
<span>
Export to JSON
</span>
<span
class=
"pull-right-container"
>
<span
class=
"pull-right-container"
>
...
...
reports/templates/sclData.html
View file @
d92d634a
...
@@ -133,7 +133,7 @@
...
@@ -133,7 +133,7 @@
</div>
</div>
</div>
</div>
<div
id=
"selectLeft"
class=
"container floating-panel"
style=
"position:absolute; display:none; bottom: 50px; left: 30%; width: 300px; z-index: 1000"
>
<div
id=
"selectLeft"
class=
"container floating-panel"
style=
"position:absolute; display:none; bottom: 50px; left: 30%; width: 300px; z-index: 1000"
>
<div
class=
"select"
>
<div
class=
"select"
>
<select
onchange=
"selectLeft(this.value)"
id=
"selectLeftCompare"
>
<select
onchange=
"selectLeft(this.value)"
id=
"selectLeftCompare"
>
...
@@ -142,8 +142,8 @@
...
@@ -142,8 +142,8 @@
{% endfor %}
{% endfor %}
</select>
</select>
</div>
</div>
</div>
</div>
<div
id=
"selectRight"
class=
"container floating-panel"
style=
"position:absolute; display:none; bottom: 50px; left: 75%; width: 300px; z-index: 1000"
>
<div
id=
"selectRight"
class=
"container floating-panel"
style=
"position:absolute; display:none; bottom: 50px; left: 75%; width: 300px; z-index: 1000"
>
<div
class=
"select"
>
<div
class=
"select"
>
<select
onchange=
"selectRight(this.value)"
id=
"selectRightCompare"
>
<select
onchange=
"selectRight(this.value)"
id=
"selectRightCompare"
>
...
@@ -152,7 +152,7 @@
...
@@ -152,7 +152,7 @@
{% endfor %}
{% endfor %}
</select>
</select>
</div>
</div>
</div>
</div>
<div
id=
"reportPage"
class=
"wrapper"
style=
"background-color: #ecf0f5"
>
<div
id=
"reportPage"
class=
"wrapper"
style=
"background-color: #ecf0f5"
>
<div
id=
"minimap"
class=
"minimap"
></div>
<div
id=
"minimap"
class=
"minimap"
></div>
...
...
reports/urls.py
View file @
d92d634a
...
@@ -16,4 +16,5 @@ urlpatterns = [
...
@@ -16,4 +16,5 @@ urlpatterns = [
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'^ws/is_public'
,
views
.
wsIs_Public
,
name
=
'wsIs_Public'
),
url
(
r'^ws/wsEditTitle'
,
views
.
wsEditTitle
,
name
=
'wsEditTitle'
),
url
(
r'^ws/wsEditTitle'
,
views
.
wsEditTitle
,
name
=
'wsEditTitle'
),
url
(
r'^ws/PDF/(?P<purchase_id>(\d+))$'
,
views
.
PDFGenerator
,
name
=
'PDF'
),
]
]
reports/views.py
View file @
d92d634a
...
@@ -9,7 +9,7 @@ import xml.etree.ElementTree as ET
...
@@ -9,7 +9,7 @@ import xml.etree.ElementTree as ET
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
datetime
import
datetime
from
datetime
import
datetime
from
django.http
import
HttpResponse
,
Http404
,
JsonResponse
from
django.http
import
HttpResponse
,
Http404
,
JsonResponse
,
FileResponse
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
render
,
redirect
from
reportlab.lib.pagesizes
import
letter
from
reportlab.lib.pagesizes
import
letter
from
reportlab.pdfgen
import
canvas
from
reportlab.pdfgen
import
canvas
...
@@ -48,7 +48,7 @@ def report_L2ASCL(request, purchase_id):
...
@@ -48,7 +48,7 @@ def report_L2ASCL(request, purchase_id):
reporteDir
=
'mask'
reporteDir
=
'mask'
folders
=
""
folders
=
""
purchase
=
Purchase
.
objects
.
values
(
'user__email'
,
'is_public'
,
'name'
,
'search__search_name'
,
purchase
=
Purchase
.
objects
.
values
(
'user__email'
,
'is_public'
,
'name'
,
'search__search_name'
,
'search__process_id__name'
)
.
get
(
pk
=
purchase_id
)
'search__process_id__name'
,
'description'
)
.
get
(
pk
=
purchase_id
)
email
=
purchase
[
'user__email'
]
email
=
purchase
[
'user__email'
]
path
=
USERS_PATH
+
email
+
'/'
+
purchase_id
+
'/'
path
=
USERS_PATH
+
email
+
'/'
+
purchase_id
+
'/'
scl_data_path
=
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/scl_data.json"
scl_data_path
=
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/scl_data.json"
...
@@ -77,13 +77,17 @@ def report_L2ASCL(request, purchase_id):
...
@@ -77,13 +77,17 @@ def report_L2ASCL(request, purchase_id):
"platform"
:
dataProduct
[
'platform'
],
"platform"
:
dataProduct
[
'platform'
],
"productLevel"
:
dataProduct
[
'productLevel'
],
"productLevel"
:
dataProduct
[
'productLevel'
],
"polygon"
:
dataProduct
[
'wkt'
],
"polygon"
:
dataProduct
[
'wkt'
],
"description"
:
purchase
[
'description'
],
"report_name"
:
"SCL Image Classification Data(Km²)"
"report_name"
:
"SCL Image Classification Data(Km²)"
}
}
print
(
searchInfo
[
'description'
])
if
os
.
path
.
exists
(
path
+
reporteDir
+
".pdf"
):
if
os
.
path
.
exists
(
path
+
reporteDir
+
".pdf"
):
print
(
"si existe"
)
print
(
"si existe"
)
else
:
else
:
PDFGenerator
(
request
,
path
,
reporteDir
,
datasets
,
searchInfo
)
#PDFGenerator(request, path, reporteDir, datasets,searchInfo)
pass
return
render
(
request
,
template
,
{
"graphData"
:
json
.
dumps
(
graphData
),
return
render
(
request
,
template
,
{
"graphData"
:
json
.
dumps
(
graphData
),
"searchInfo"
:
searchInfo
,
"IMAGE_PATH"
:
image_path
,
"searchInfo"
:
searchInfo
,
"IMAGE_PATH"
:
image_path
,
...
@@ -458,10 +462,44 @@ def myBarLegend(drawing, labels):
...
@@ -458,10 +462,44 @@ def myBarLegend(drawing, labels):
return
d
return
d
@
csrf_exempt
#def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
def
PDFGenerator
(
request
,
purchase_id
):
purchase
=
Purchase
.
objects
.
values
(
'user__email'
,
'is_public'
,
'name'
,
'search__search_name'
,
'search__process_id__name'
,
'description'
)
.
get
(
pk
=
purchase_id
)
email
=
purchase
[
'user__email'
]
ruta
=
USERS_PATH
+
email
+
'/'
+
purchase_id
+
'/'
thumbs
=
ruta
+
'out/mask/TCI/thumbnails/'
SCL
=
ruta
+
'out/mask/SCL/split/'
reporteDir
=
"mask"
with
open
(
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/findProducts.json"
)
as
p
:
dataProduct
=
json
.
load
(
p
)
startDate
=
str
(
dataProduct
[
'startDate'
])[:
4
]
+
'-'
+
str
(
dataProduct
[
'startDate'
])[
4
:
6
]
+
'-'
+
str
(
dataProduct
[
'startDate'
])[
6
:
8
]
endDate
=
str
(
dataProduct
[
'endDate'
])[:
4
]
+
'-'
+
str
(
dataProduct
[
'endDate'
])[
4
:
6
]
+
'-'
+
str
(
dataProduct
[
'endDate'
])[
6
:
8
]
scl_data_path
=
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/scl_data.json"
graphData
,
label
,
defaultLabel
,
defaultDataset
,
datasets
=
ProcessChartData
(
scl_data_path
)
def
PDFGenerator
(
request
,
ruta
,
reporteDir
,
datasets
,
searchInfo
):
searchInfo
=
{
thumbs
=
ruta
+
'out/'
+
reporteDir
+
'/TCI/thumbnails/'
"title"
:
purchase
[
'name'
],
SCL
=
ruta
+
'out/'
+
reporteDir
+
'/SCL/split/'
# "title": purchase['search__search_name'],
"process"
:
purchase
[
'search__process_id__name'
],
"startDate"
:
startDate
,
"endDate"
:
endDate
,
"clouds"
:
dataProduct
[
'clouds'
],
"platform"
:
dataProduct
[
'platform'
],
"productLevel"
:
dataProduct
[
'productLevel'
],
"polygon"
:
dataProduct
[
'wkt'
],
"description"
:
purchase
[
'description'
],
"report_name"
:
"SCL Image Classification Data(Km²)"
}
story
=
[]
story
=
[]
...
@@ -503,6 +541,10 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
...
@@ -503,6 +541,10 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
story
.
append
(
Paragraph
(
"<strong>Process: "
+
searchInfo
[
'process'
]
+
"</strong>"
,
style2
,))
story
.
append
(
Paragraph
(
"<strong>Process: "
+
searchInfo
[
'process'
]
+
"</strong>"
,
style2
,))
story
.
append
(
Spacer
(
1
,
.40
*
inch
))
story
.
append
(
Spacer
(
1
,
.40
*
inch
))
story
.
append
(
Paragraph
(
"<strong>Clouds: "
+
str
(
searchInfo
[
'clouds'
])
+
"
%
</strong>"
,
style2
,))
story
.
append
(
Paragraph
(
"<strong>Clouds: "
+
str
(
searchInfo
[
'clouds'
])
+
"
%
</strong>"
,
style2
,))
story
.
append
(
Spacer
(
1
,
.70
*
inch
))
story
.
append
(
Paragraph
(
"<strong>Description: </strong>"
,
style2
,
))
story
.
append
(
Spacer
(
1
,
.30
*
inch
))
story
.
append
(
Paragraph
(
searchInfo
[
'description'
],
style2
,))
story
.
append
(
Spacer
(
1
,
.40
*
inch
))
story
.
append
(
Spacer
(
1
,
.40
*
inch
))
story
.
append
(
PageBreak
())
story
.
append
(
PageBreak
())
...
@@ -551,7 +593,10 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
...
@@ -551,7 +593,10 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
# build our document with the list of flowables we put together
# build our document with the list of flowables we put together
doc
=
SimpleDocTemplate
(
ruta
+
reporteDir
+
".pdf"
,
pagesize
=
letter
,
topMargin
=
0
)
doc
=
SimpleDocTemplate
(
ruta
+
reporteDir
+
".pdf"
,
pagesize
=
letter
,
topMargin
=
0
)
doc
.
build
(
story
)
doc
.
build
(
story
)
pass
#return HttpResponse (request.POST.get('ruta'))
return
FileResponse
(
open
(
ruta
+
reporteDir
+
".pdf"
,
'rb'
),
content_type
=
'application/pdf'
)
# -----------------------------------------------------------------------------------------------------------------
# -----------------------------------------------------------------------------------------------------------------
...
...
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