Commit 47ee1ab0 authored by Emmanuel René Huchim Puc's avatar Emmanuel René Huchim Puc

Merge branch 'dev' of gitlab.geoint.mx:mario.chirinos/GeoInt_SIDT into multi-select

parents d55a42dc 324257fc
...@@ -536,6 +536,7 @@ ...@@ -536,6 +536,7 @@
data: {'title': label}, data: {'title': label},
url: '../administration/ws/report_table', url: '../administration/ws/report_table',
success: function (data) { success: function (data) {
console.log("hola");
$('#mostrar').empty(); $('#mostrar').empty();
$('#mostrar').append("<table class=\"table table-hover\" id=\"example\">"+ $('#mostrar').append("<table class=\"table table-hover\" id=\"example\">"+
......
...@@ -69,7 +69,7 @@ def Dashboard(request): ...@@ -69,7 +69,7 @@ def Dashboard(request):
count=Count('search_name')).order_by('-count')[:5] count=Count('search_name')).order_by('-count')[:5]
# Espacio Usado en Sentinel # # Espacio Usado en Sentinel #
'''
bytes_size = 0 bytes_size = 0
for path, directories, files in os.walk(USERS_PATH + "sentinelImages"): for path, directories, files in os.walk(USERS_PATH + "sentinelImages"):
for filename in files: for filename in files:
...@@ -90,7 +90,7 @@ def Dashboard(request): ...@@ -90,7 +90,7 @@ def Dashboard(request):
bytes_size += os.lstat(os.path.join(path, directory)).st_size bytes_size += os.lstat(os.path.join(path, directory)).st_size
bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev") bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev")
size_repsat = best_unit_size(bytes_size) size_repsat = best_unit_size(bytes_size)
'''
...@@ -176,14 +176,15 @@ def wsPurchasesPM(request): ...@@ -176,14 +176,15 @@ def wsPurchasesPM(request):
for user in data: for user in data:
bytes_size = 0 bytes_size = 0
for path, directories, files in os.walk(PATH_USERS+user['user__email']): #for path, directories, files in os.walk(PATH_USERS+user['user__email']):
for filename in files: # for filename in files:
bytes_size += os.lstat(os.path.join(path, filename)).st_size # bytes_size += os.lstat(os.path.join(path, filename)).st_size
for directory in directories: # for directory in directories:
bytes_size += os.lstat(os.path.join(path, directory)).st_size # bytes_size += os.lstat(os.path.join(path, directory)).st_size
bytes_size += os.path.getsize(PATH_USERS+user['user__email']) #bytes_size += os.path.getsize(PATH_USERS+user['user__email'])
storage = best_unit_size(bytes_size) #storage = best_unit_size(bytes_size)
storage = 0
pending = Purchase.objects.filter(user_id=user['user_id'],aggreg_date__month=to_if(request.POST.get('title'))).exclude(progress=100).annotate(dcount=Count('progress')) pending = Purchase.objects.filter(user_id=user['user_id'],aggreg_date__month=to_if(request.POST.get('title'))).exclude(progress=100).annotate(dcount=Count('progress'))
...@@ -195,6 +196,7 @@ def wsPurchasesPM(request): ...@@ -195,6 +196,7 @@ def wsPurchasesPM(request):
'storage':storage, 'storage':storage,
'in_process': pending.count(), 'in_process': pending.count(),
}) })
print (table_data)
return HttpResponse(json.dumps(table_data)) return HttpResponse(json.dumps(table_data))
else: else:
raise Http404 raise Http404
......
...@@ -3,7 +3,7 @@ from django.shortcuts import HttpResponseRedirect ...@@ -3,7 +3,7 @@ from django.shortcuts import HttpResponseRedirect
from django.urls import reverse from django.urls import reverse
# from django.core.urlresolvers import reverse # from django.core.urlresolvers import reverse
from catalog.models import Publics, Purchase from catalog.models import Purchase
class AuthRequiredMiddleware(object): class AuthRequiredMiddleware(object):
......
...@@ -58,6 +58,7 @@ class Process(models.Model): ...@@ -58,6 +58,7 @@ class Process(models.Model):
class Search(models.Model): class Search(models.Model):
area = models.TextField(null=True) area = models.TextField(null=True)
search_name = models.TextField(default="Drawn polygon ") search_name = models.TextField(default="Drawn polygon ")
description = models.TextField(default="")
user = models.ForeignKey(User, on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.CASCADE)
aggreg_date = models.DateTimeField(auto_now=True) # date of product aggregation aggreg_date = models.DateTimeField(auto_now=True) # date of product aggregation
startDate = models.DateTimeField(verbose_name='Start Date') startDate = models.DateTimeField(verbose_name='Start Date')
...@@ -71,11 +72,10 @@ class Purchase(models.Model): ...@@ -71,11 +72,10 @@ class Purchase(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.CASCADE)
search = models.ForeignKey(Search, on_delete=models.CASCADE) search = models.ForeignKey(Search, on_delete=models.CASCADE)
productList = models.TextField(verbose_name="JSON Product List") productList = models.TextField(verbose_name="JSON Product List")
name = models.TextField(default="")
description = models.TextField(default="")
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) 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
...@@ -11,6 +11,10 @@ body ...@@ -11,6 +11,10 @@ body
{ {
/* color:white;*/ /* color:white;*/
} }
body *{
font-family:GeointFont;
}
.btn-primary .btn-primary
{ {
background-color: #e16931; background-color: #e16931;
......
...@@ -157,6 +157,8 @@ function drawPolygon(element) { ...@@ -157,6 +157,8 @@ function drawPolygon(element) {
// set input box with polygon city name // set input box with polygon city name
var input_text = polygon.city + ", " + polygon.state; var input_text = polygon.city + ", " + polygon.state;
$("#ajax-input").val(input_text); $("#ajax-input").val(input_text);
$('#search_name').val(input_text);
$("#area_description").val(polygon.description)
// remove prev polygon // remove prev polygon
// osmap.removePolygon(); // osmap.removePolygon();
...@@ -331,8 +333,7 @@ $('#ajax-input').focus(function () { ...@@ -331,8 +333,7 @@ $('#ajax-input').focus(function () {
$('#polygon-list').click(function () { $('#polygon-list').click(function () {
$('#option-list').hide(); $('#option-list').hide();
OPT_LIST_IS_HIDDEN = true; OPT_LIST_IS_HIDDEN = true;
$('#search_name').val($('#ajax-input').val()); //$('#area_description').val("hola");
// $('#ajax-input').value = $(this);
}); });
...@@ -436,6 +437,7 @@ $(document).ready(function () { ...@@ -436,6 +437,7 @@ $(document).ready(function () {
// function for making POST request to productList in view.py // function for making POST request to productList in view.py
$('#product-form').submit(function (event) { $('#product-form').submit(function (event) {
event.preventDefault(); event.preventDefault();
erase_product_list_globe(); erase_product_list_globe();
var submit_data = $('#product-form').serialize(); var submit_data = $('#product-form').serialize();
......
...@@ -150,6 +150,7 @@ ...@@ -150,6 +150,7 @@
{% csrf_token %} {% csrf_token %}
<input type="hidden" id="user_name" name="user_name" value={{user.get_username}}> <input type="hidden" id="user_name" name="user_name" value={{user.get_username}}>
<input type="hidden" id="search_name" name="search_name" value="Drawn Polygon"> <input type="hidden" id="search_name" name="search_name" value="Drawn Polygon">
<input type="hidden" id="area_description" name="area_description" value="Without Description">
<ul class="sidebar-menu" data-widget="tree"> <ul class="sidebar-menu" data-widget="tree">
<li class="treeview"> <li class="treeview">
<a href="#"> <a href="#">
......
...@@ -90,6 +90,10 @@ def productList(request): ...@@ -90,6 +90,10 @@ def productList(request):
end_date = req['end'][0][:10] end_date = req['end'][0][:10]
clouds = req['cloudPercentage'][0] clouds = req['cloudPercentage'][0]
search_name = req['search_name'][0] search_name = req['search_name'][0]
print (search_name)
description = req['area_description'][0]
print(search_name) print(search_name)
cloud_percentage = "[0 TO " + req['cloudPercentage'][0] + "]" cloud_percentage = "[0 TO " + req['cloudPercentage'][0] + "]"
...@@ -150,7 +154,11 @@ def productList(request): ...@@ -150,7 +154,11 @@ def productList(request):
clouds=clouds, clouds=clouds,
area=area, area=area,
search_name = search_name, search_name = search_name,
description = description,
) )
print ("---------------------------")
print (search_name)
listSearch.save() listSearch.save()
return JsonResponse({'catalog': catalog}); return JsonResponse({'catalog': catalog});
...@@ -521,8 +529,8 @@ def Pay(request): ...@@ -521,8 +529,8 @@ def Pay(request):
user = User.objects.get(id=request.user.id) user = User.objects.get(id=request.user.id)
product_list = [] product_list = []
product_list = Purchase.objects.values('id', 'search__area', 'user', 'user__username', 'user__email', 'search_id', product_list = Purchase.objects.values('id', 'search__area', 'user', 'user__username', 'user__email', 'search_id',
'search__clouds', 'search__startDate', 'search__endDate').filter(user=user, 'search__clouds', 'search__startDate', 'search__endDate', 'search__process_id__name',
purchased=0) 'search__process_id__productLevel','search__process_id__platform__name','search__description','search__search_name').filter(user=user, purchased=0)
for product in product_list: for product in product_list:
...@@ -533,7 +541,10 @@ def Pay(request): ...@@ -533,7 +541,10 @@ def Pay(request):
# print(str(product['search__endDate'].date()).replace("-", "")) # print(str(product['search__endDate'].date()).replace("-", ""))
# print(product['search__clouds']) # print(product['search__clouds'])
# print(product['search__area']) # print(product['search__area'])
print(product['id']) #print(product['search__process_id__name']) # Classification scene L1C o Classification scene L2A
#print(product['search__process_id__productLevel']) #L1C o L2A
#print(product['search__process_id__platform__name']) #Sentinel1 o Sentinel2
#print(product['id'])
username = product['user__username'] username = product['user__username']
useremail = product['user__email'] useremail = product['user__email']
...@@ -547,21 +558,23 @@ def Pay(request): ...@@ -547,21 +558,23 @@ def Pay(request):
if not os.path.exists(purchase_dir): if not os.path.exists(purchase_dir):
os.makedirs(purchase_dir) os.makedirs(purchase_dir)
products_dir = NAS_PATH + "sentinelImages/L2A/" products_dir = NAS_PATH + "sentinelImages/"
linksDir = purchase_dir + "/L2A/" projectDir = purchase_dir + "/"
# obtiene los datos para el json # obtiene los datos para el json
data = {} data = {}
data['wkt'] = product['search__area'] data['wkt'] = product['search__area']
data['platform'] = 'Sentinel-2' data['platform'] = product['search__process_id__platform__name']#'Sentinel-2'
data['productLevel'] = 'L2A' data['productLevel'] = product['search__process_id__productLevel'] #'L2A'
data['startDate'] = str(product['search__startDate'].date()).replace("-", "") # quita los guiones de la fecha data['startDate'] = str(product['search__startDate'].date()).replace("-", "") # quita los guiones de la fecha
data['endDate'] = str(product['search__endDate'].date()).replace("-", "") # quita los guiones de la fecha data['endDate'] = str(product['search__endDate'].date()).replace("-", "") # quita los guiones de la fecha
data['clouds'] = product['search__clouds'] data['clouds'] = product['search__clouds']
data['productsDir'] = products_dir data['productsDir'] = products_dir
data['linksDir'] = linksDir data['projectDir'] = projectDir
data['username'] = API_SENTINEL_USER data['username'] = API_SENTINEL_USER
data['password'] = API_SENTINEL_PASS data['password'] = API_SENTINEL_PASS
data['description'] = product['search__description']
data['name'] = product['search__search_name']
# json_data = json.dumps(data, indent=4,sort_keys=True) # json_data = json.dumps(data, indent=4,sort_keys=True)
# formatea el json # formatea el json
...@@ -572,8 +585,7 @@ def Pay(request): ...@@ -572,8 +585,7 @@ def Pay(request):
fidProductsFile.write(json_data) fidProductsFile.write(json_data)
fidProductsFile.close() fidProductsFile.close()
os.system( os.system(SENTINEL_PATH + "/tools/L2ASCL_AreaProcessing.sh " + purchase_dir + "/ 1 > " + purchase_dir + "/L2ASCL_AreaProcessing.log") ###ejecuta el proceso
SENTINEL_PATH + "/tools/L2ASCL_AreaProcessing.sh " + purchase_dir + "/ 1 > " + purchase_dir + "/L2ASCL_AreaProcessing.log") ###ejecuta el proceso
...@@ -596,7 +608,7 @@ def Pay(request): ...@@ -596,7 +608,7 @@ def Pay(request):
# ------------------------------------- # -------------------------------------
Purchase.objects.filter(user_id=request.user.id, purchased=0).update(purchased=True) Purchase.objects.filter(user_id=request.user.id, purchased=0).update(purchased=True, description=data['description'],name =data["name"])
return redirect('../../reports') return redirect('../../reports')
......
$(document).ready(function () {
$('[data-toggle="popover"]').popover();
});
function showEditModal(zone, description, id) {
$('#edit_id').empty();
$('#zone').empty();
$('#description').empty();
$('#zone').val(zone);
$('#description').val(description);
$('#edit_id').val(id);
//$('#myModalTitle').append(name);
$("#editmodal").modal();
}
function openmodal(info) { function openmodal(info) {
info2 = info.split(";"); info2 = info.split(";");
$("#myModal").modal(); $("#myModal").modal();
...@@ -142,6 +158,21 @@ function change_public(data) { ...@@ -142,6 +158,21 @@ function change_public(data) {
} }
function SaveButton() {
$.ajax({
dataType: "json",
url: '../reports/ws/wsEditTitle',
data: {'purchase_id': $('#edit_id').val(), 'zone': $('#zone').val(), 'description': $('#description').val()},
success: function (data) {
console.log(data)
}
});
var id = 'title' + $('#edit_id').val();
$('#' + id).empty();
$('#' + id).append($('#zone').val());
$('#' + id).attr("data-content", $('#description').val());
$('#editmodal').modal('toggle');
}
function is_public(purchase_id, status) { function is_public(purchase_id, status) {
//alert(purchase_id); //alert(purchase_id);
$.ajax({ $.ajax({
...@@ -149,7 +180,8 @@ function is_public(purchase_id, status) { ...@@ -149,7 +180,8 @@ function is_public(purchase_id, status) {
url: '../reports/ws/is_public', url: '../reports/ws/is_public',
data: {'purchase_id': purchase_id, 'status': status}, data: {'purchase_id': purchase_id, 'status': status},
success: function (data) { success: function (data) {
alert("cambiado"); alert(data);
} }
}); });
}; }
\ No newline at end of file
{% extends "base_top.html" %} {% extends "base_top.html" %}
{% load staticfiles %} {% load staticfiles %}
{% block headMedia %} {% block headMedia %}
<link rel="stylesheet" href="{% static 'catalog/css/body.css' %}" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
...@@ -144,6 +145,10 @@ ...@@ -144,6 +145,10 @@
<!-- Content Wrapper. Contains page content --> <!-- Content Wrapper. Contains page content -->
<!-- Main content --> <!-- Main content -->
<section class="content"> <section class="content">
<!--div id="popover-content-logout" class="hide"-->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">Reports</div> <div class="panel-heading">Reports</div>
<div class="panel-body" id="mytable"> <div class="panel-body" id="mytable">
...@@ -163,8 +168,14 @@ ...@@ -163,8 +168,14 @@
<tbody id="table_body"> <tbody id="table_body">
{% for product in productList %} {% for product in productList %}
<tr> <tr>
<td><a href="#" <td>
<a href="#" id="title{{ product.purchase_id }}" data-toggle="popover" data-trigger="hover"
data-content="{% if product.description %}{{ product.description }}{% else %}Without Description{% endif %}"
onclick="showMyModalSetTitle('{{ product.search_name }}','{{ product.polygon }}');"> {{ product.search_name }}</a> onclick="showMyModalSetTitle('{{ product.search_name }}','{{ product.polygon }}');"> {{ product.search_name }}</a>
<a href="#" onclick="showEditModal('{{ product.search_name }}','{{ product.description }}','{{ product.purchase_id }}')"><span
class="fas fa-pencil-alt"
style="margin:3px 0 0 0"></span></a>
</td> </td>
<td>{{ product.process }}</td> <td>{{ product.process }}</td>
<td>{{ product.purchase_date }}</td> <td>{{ product.purchase_date }}</td>
...@@ -174,7 +185,9 @@ ...@@ -174,7 +185,9 @@
<td>{{ product.size }}</td> <td>{{ product.size }}</td>
<td> <td>
<label class="switch"> <label class="switch">
<input id="{{ product.purchase_id }}" type="checkbox" onclick="change_public({{ product.purchase_id }})" {% if product.is_public %} checked {% endif %}> <input id="{{ product.purchase_id }}" type="checkbox"
onclick="change_public({{ product.purchase_id }})"
{% if product.is_public %} checked {% endif %}>
<span class="slider round"></span> <span class="slider round"></span>
</label> </label>
</td> </td>
...@@ -236,6 +249,7 @@ ...@@ -236,6 +249,7 @@
<!-- Copyright --> <!-- Copyright -->
</footer> </footer>
<!-- /.Footer --> <!-- /.Footer -->
<!-- Modals --> <!-- Modals -->
<div id="myModal" class="modal fade" role="dialog"> <div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
...@@ -276,9 +290,44 @@ ...@@ -276,9 +290,44 @@
</div> </div>
</div> </div>
<div id="editmodal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content ">
<div class="modal-body text-center">
<form role="form">
<input type="hidden" class="form-group-lg" id="edit_id" name="edit_id">
<div class="form-group">
<label for="usr">Title:</label>
<input type="text" class="form-control" id="zone" name="zone" style="text-align:center;">
</div>
<div class="form-group">
<label for="pwd">Description:</label>
<textarea rows="4" class="form-control" id="description" name="description"
style="text-align:center; resize: none"></textarea>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-primary pull-left " id="SaveButton" onclick="SaveButton()">Save</a>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</form>
</div>
</div>
</div>
</div>
<!-- /.modals --> <!-- /.modals -->
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{% static 'reports/js/Reports_scripts.js' %}"></script> <script src="{% static 'reports/js/Reports_scripts.js' %}"></script>
{% endblock %} {% endblock %}
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
<div class="row col-lg-11 title"> <div class="row col-lg-11 title">
<div class="box box-success box-solid info"> <div class="box box-success box-solid info">
<div class="box-header with-border"> <div class="box-header with-border">
<h3>{{ searchInfo.title }} {{ searchInfo.startDate }} to {{ searchInfo.endDate}}</h3> <h3>{{ searchInfo.title }}, {{ searchInfo.startDate }} to {{ searchInfo.endDate}}</h3>
<h6>{{ searchInfo.report_name }}</h6> <h6>{{ searchInfo.report_name }}</h6>
<!-- /.box-tools --> <!-- /.box-tools -->
</div> </div>
......
...@@ -7,9 +7,13 @@ urlpatterns = [ ...@@ -7,9 +7,13 @@ 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'^(?P<purchase_id>(\d+))$', views.report_L2ASCL, name='report'), url(r'^(?P<purchase_id>(\d+))$', 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/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'),
#########################################################
# ajax #
#########################################################
url(r'^ws/process_progress$', views.wsProcessProgress, name='wsProcessProgress'),
url(r'^ws/is_public', views.wsIs_Public, name='wsIs_Public'),
url(r'^ws/wsEditTitle', views.wsEditTitle, name='wsEditTitle'),
] ]
...@@ -46,7 +46,7 @@ def report_L2ASCL(request, purchase_id): ...@@ -46,7 +46,7 @@ def report_L2ASCL(request, purchase_id):
template = "sclData.html" template = "sclData.html"
reporteDir = 'mask' reporteDir = 'mask'
folders = "" folders = ""
purchase = Purchase.objects.values('user__email', 'is_public', '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').get(pk=purchase_id)
email = purchase['user__email'] email = purchase['user__email']
path = USERS_PATH + email + '/' + purchase_id + '/' path = USERS_PATH + email + '/' + purchase_id + '/'
...@@ -70,7 +70,8 @@ def report_L2ASCL(request, purchase_id): ...@@ -70,7 +70,8 @@ def report_L2ASCL(request, purchase_id):
PDFGenerator(request, path, reporteDir, datasets) PDFGenerator(request, path, reporteDir, datasets)
searchInfo = { searchInfo = {
"title": purchase['search__search_name'], "title": purchase['name'],
#"title": purchase['search__search_name'],
"process": purchase['search__process_id__name'], "process": purchase['search__process_id__name'],
"startDate": startDate, "startDate": startDate,
"endDate": endDate, "endDate": endDate,
...@@ -101,7 +102,7 @@ def Reports(request): ...@@ -101,7 +102,7 @@ def Reports(request):
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', 'search__endDate', 'search__process_id__name', 'search__search_name',
'is_public').filter( 'is_public','name','description').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"
...@@ -170,7 +171,8 @@ def Reports(request): ...@@ -170,7 +171,8 @@ def Reports(request):
if file.endswith(".zip"): if file.endswith(".zip"):
zip = zip_path + "/" + file zip = zip_path + "/" + file
productList.append({ productList.append({
"search_name": producto['search__search_name'], "search_name": producto['name'],
"description": producto['description'],
"process": producto['search__process_id__name'], "process": producto['search__process_id__name'],
"purchase_date": producto['aggreg_date'], "purchase_date": producto['aggreg_date'],
"startDate": producto['search__startDate'], "startDate": producto['search__startDate'],
...@@ -330,7 +332,7 @@ def dataToTable(name, data): ...@@ -330,7 +332,7 @@ def dataToTable(name, data):
data.insert(0, name) data.insert(0, name)
return data return data
# create the table for our document # create the table for our document
def myTable(path1, path2, basefile): def myTable(path1, path2, basefile):
#image1 = Image(path1, height=300, width=200, mask='auto') #image1 = Image(path1, height=300, width=200, mask='auto')
...@@ -447,9 +449,12 @@ def myBarLegend(drawing, labels): ...@@ -447,9 +449,12 @@ def myBarLegend(drawing, labels):
def PDFGenerator(request, ruta, reporteDir, datasets): def PDFGenerator(request, ruta, reporteDir, datasets):
thumbs = ruta + 'out/' + reporteDir + '/TCI/thumbnails/' thumbs = ruta + 'out/' + reporteDir + '/TCI/thumbnails/'
SCL = ruta + 'out/' + reporteDir + '/SCL/split/' SCL = ruta + 'out/' + reporteDir + '/SCL/split/'
story = [] story = []
# define the style for our paragraph text # define the style for our paragraph text
styles = getSampleStyleSheet() styles = getSampleStyleSheet()
styleN = styles['Normal'] styleN = styles['Normal']
...@@ -459,6 +464,16 @@ def PDFGenerator(request, ruta, reporteDir, datasets): ...@@ -459,6 +464,16 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
im.hAlign = 'CENTER' im.hAlign = 'CENTER'
story.append(im) story.append(im)
# add the title
# story.append(Paragraph("<strong>Results for Vizard Experiment</strong>", styleN))
# story.append(Spacer(1, .25 * inch))
# convert data to paragraph form and then add paragraphs
# story.append(Paragraph(dataToParagraph(subject1, results1), styleN))
# story.append(Spacer(1, .25 * inch))
# story.append(Paragraph(dataToParagraph(subject2, results2), styleN))
# story.append(Spacer(1, .5 * inch))
story.append(PageBreak()) story.append(PageBreak())
path, dirs, files = next(os.walk(thumbs)) path, dirs, files = next(os.walk(thumbs))
...@@ -491,18 +506,6 @@ def PDFGenerator(request, ruta, reporteDir, datasets): ...@@ -491,18 +506,6 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
story.append(Spacer(1, .5 * inch)) story.append(Spacer(1, .5 * inch))
# add the title
# story.append(Paragraph("<strong>Results for Vizard Experiment</strong>", styleN))
# story.append(Spacer(1, .25 * inch))
# convert data to paragraph form and then add paragraphs
# story.append(Paragraph(dataToParagraph(subject1, results1), styleN))
# story.append(Spacer(1, .25 * inch))
# story.append(Paragraph(dataToParagraph(subject2, results2), styleN))
# story.append(Spacer(1, .5 * inch))
# table with images # table with images
story.append(myTable(path1, SCL, file)) story.append(myTable(path1, SCL, file))
story.append(Spacer(1, .5 * inch)) story.append(Spacer(1, .5 * inch))
...@@ -575,15 +578,23 @@ def ProcessChartData(path): ...@@ -575,15 +578,23 @@ def ProcessChartData(path):
# --------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------
def wsIs_Public(request): def wsIs_Public(request):
if request.is_ajax(): 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 = Purchase.objects.get(pk=request.GET.get("purchase_id"))
purchase.is_public = request.GET.get("status") purchase.is_public = request.GET.get("status")
purchase.save() purchase.save()
# print (purchase.aggreg_date)
return HttpResponse("hola")
else:
raise Http404
# ---------------------------------------------------------------------------------
def wsEditTitle(request):
if request.is_ajax():
purchase = Purchase.objects.get(pk=request.GET.get("purchase_id"))
purchase.name = request.GET.get("zone")
purchase.description = request.GET.get("description")
purchase.save()
print ("hola")
return HttpResponse("hola") return HttpResponse("hola")
else: else:
raise Http404 raise Http404
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment