Commit 0d413ed0 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 06c7c471 a62942d0
{% extends "base_top.html" %}
{% load staticfiles %}
{% 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>
<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>
{% endblock %}
{% block messages %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 4 messages</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Support Team
<small><i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<!-- end message -->
<li>
<a href="#">
<div class="pull-left">
<img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
</div>
<h4>
AdminLTE Design Team
<small><i class="fa fa-clock-o"></i> 2 hours</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
</ul>
</li>
<li class="footer"><a href="#">See All Messages</a></li>
</ul>
{% endblock %}
{% block notifications %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 10 notifications</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i> 5 new members joined today
</a>
</li>
</li>
</ul>
</li>
<li class="footer"><a href="#">View all</a></li>
</ul>
{% endblock %}
{% block tasks %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul c{% load static %}lass="dropdown-menu">
<li class="header">You have 9 tasks</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- Task item -->
<a href="#">
<h3>
Design some buttons
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar"
aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li class="footer">
<a href="#">View all tasks</a>
</li>
</ul>
{% endblock %}
{% block sidebar %}
{% include 'administration_aside.html' %}
{% endblock %}
{% block user %}
{% include "user_button.html" %}
{% endblock %}
{% block content %}
<div class="wrapper" style="background-color: #ecf0f5;">
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section class="content">
<div class="panel panel-default">
<div class="panel-heading">{{ Viewname }}</div>
<div class="panel-body text-center">
<div class="row col-md-1 pull-right ">
<a class="btn btn-success btn-sm col-md-6 col-sm-6 col-xs-6 col-lg-6 col-xl-6">New</a>
<br>
<br>
</div>
<table data-toggle="table" id="example" class="table table-striped table-bordered"
style="width:100%">
<thead>
<th>ID</th>
<th>Name</th>
<th>Acronym</th>
<th>Status</th>
<th>Actions</th>
</thead>
<tbody>
{% for platform in platforms %}
<tr>
<td>{{ platform.id }}</td>
<td>{{ platform.name }}</td>
<td>{{ platform.acronym }}</td>
<form method="post" action="{% url 'update' %}">
{% csrf_token %}
<input type="hidden" name="request_path" value="{{ request.path }}">
<input type="hidden" name="user_id" value="{{ user.user_id }}">
<td>
<input type="checkbox" name="is_superuser" value="1"
{% if not request.user.is_superuser %}disabled{% endif %}
{% if platform.status == True %}checked{% endif %}>
</td>
<td>
<button {% if not request.user.is_superuser %}disabled{% endif %} title="save" type="submit" class="btn btn-success"><i
class="fa fa-save"></i></button>
</td>
</form>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</section>
<!-- /.content -->
</div>
<footer class=" page-footer font-small special-color-dark pt-5" style="bottom: 0; position: absolute">
<!-- Footer Elements -->
<div class="container">
<!-- Social buttons
<ul class="list-unstyled list-inline text-center">
<li class="list-inline-item">
<a class="btn-floating btn-fb mx-1">
<i class="fa fa-faceboo"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-tw mx-1">
<i class="fa fa-twitter"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-gplus mx-1">
<i class="fa fa-google-plus"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-li mx-1">
<i class="fa fa-linkedin"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-dribbble mx-1">
<i class="fa fa-dribbble"> </i>
</a>
</li>
</ul>
<!-- Social buttons -->
</div>
<!-- Footer Elements -->
<!-- Copyright -->
<div class="footer-copyright text-center py-3">© 2019 Copyright:
<a href="http://geoint.mx/"> Centro de Investigación en Ciencias de Información Geoespacial.</a>
</div>
<!-- Copyright -->
</footer>
{% if messages %}
<div class="container col-md-2 col-lg-2 col-xs-2 col-sm-2" style="bottom: 0; right: 0;position: absolute">
{% for message in messages %}
<div {% if message.tags %} class="fade in alert alert-dismissible alert-{{ message.tags }}"{% endif %}>
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>{{ message.tags }}!</strong> {{ message }}.
</div>
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% block templates %}{% include "templates.html" %}{% endblock %}
{% block scripts %}
<script>
$(document).ready(function () {
$('#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:
{
details:
{
type: 'column',
target: 'tr'
}
},
columnDefs:
[{
className: 'control',
orderable: false,
targets: 0
}],
order: [1, 'asc']
});
});
</script>
{% endblock %}
\ No newline at end of file
{% extends "base_top.html" %}
{% load staticfiles %}
{% 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>
<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>
{% endblock %}
{% block messages %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 4 messages</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Support Team
<small><i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<!-- end message -->
<li>
<a href="#">
<div class="pull-left">
<img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
</div>
<h4>
AdminLTE Design Team
<small><i class="fa fa-clock-o"></i> 2 hours</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
</ul>
</li>
<li class="footer"><a href="#">See All Messages</a></li>
</ul>
{% endblock %}
{% block notifications %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 10 notifications</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i> 5 new members joined today
</a>
</li>
</li>
</ul>
</li>
<li class="footer"><a href="#">View all</a></li>
</ul>
{% endblock %}
{% block tasks %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul c{% load static %}lass="dropdown-menu">
<li class="header">You have 9 tasks</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- Task item -->
<a href="#">
<h3>
Design some buttons
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar"
aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li class="footer">
<a href="#">View all tasks</a>
</li>
</ul>
{% endblock %}
{% block sidebar %}
{% include 'administration_aside.html' %}
{% endblock %}
{% block user %}
{% include "user_button.html" %}
{% endblock %}
{% block content %}
<div class="wrapper" style="background-color: #ecf0f5;">
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section class="content">
<div class="panel panel-default">
<div class="panel-heading">{{ Viewname }}</div>
<div class="panel-body text-center">
<table data-toggle="table" id="example" class="table table-striped table-bordered"
style="width:100%">
<thead>
<th>ID</th>
<th>Name</th>
<th>Platform</th>
<th>Product Level</th>
<th>Status</th>
<th>Actions</th>
</thead>
<tbody>
{% for process in process %}
<tr>
<td>{{ process.id }}</td>
<td>{{ process.name }}</td>
<td>{{ process.platform_id }}</td>
<td>{{ process.product_level }}</td>
<form method="post" action="{% url 'update' %}">
{% csrf_token %}
<input type="hidden" name="request_path" value="{{ request.path }}">
<input type="hidden" name="user_id" value="{{ user.user_id }}">
<td>
<input type="checkbox" name="status" value="1"
{% if not request.user.is_superuser %}disabled{% endif %}
{% if process.status == True %}checked{% endif %}>
</td>
<td>
<button {% if not request.user.is_superuser %}disabled{% endif %} title="save" type="submit" class="btn btn-success"><i
class="fa fa-save"></i></button>
</td>
</form>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</section>
<!-- /.content -->
</div>
<footer class=" page-footer font-small special-color-dark pt-5" style="bottom: 0; position: absolute">
<!-- Footer Elements -->
<div class="container">
<!-- Social buttons
<ul class="list-unstyled list-inline text-center">
<li class="list-inline-item">
<a class="btn-floating btn-fb mx-1">
<i class="fa fa-faceboo"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-tw mx-1">
<i class="fa fa-twitter"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-gplus mx-1">
<i class="fa fa-google-plus"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-li mx-1">
<i class="fa fa-linkedin"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-dribbble mx-1">
<i class="fa fa-dribbble"> </i>
</a>
</li>
</ul>
<!-- Social buttons -->
</div>
<!-- Footer Elements -->
<!-- Copyright -->
<div class="footer-copyright text-center py-3">© 2019 Copyright:
<a href="http://geoint.mx/"> Centro de Investigación en Ciencias de Información Geoespacial.</a>
</div>
<!-- Copyright -->
</footer>
{% endblock %}
{% block templates %}{% include "templates.html" %}{% endblock %}
{% block scripts %}
<script>
$(document).ready(function () {
$('#example').DataTable();
});
</script>
{% endblock %}
\ No newline at end of file
......@@ -2,7 +2,7 @@
<br>
<ul class="sidebar-menu" data-widget="tree">
<li>
<a class="treeview " href="{{ BASE_URL }}/administration">
<a class="treeview " href="{% url 'Dashboard' %}">
<i class="fa fa-home"></i>
<span>Dashboard</span>
<span class="pull-right-container">
......@@ -11,7 +11,7 @@
</a>
</li>
<li>
<a class="treeview " href="../../administration/request">
<a class="treeview " href="{% url 'request' %}">
<i class="fa fa-user-plus"></i>
<span>Request</span>
<span class="pull-right-container">
......@@ -20,7 +20,7 @@
</a>
</li>
<li>
<a class="treeview " href="../../administration/users">
<a class="treeview " href="{% url 'active_users' %}">
<i class="fa fa-users"></i>
<span>Active users</span>
<span class="pull-right-container">
......@@ -29,6 +29,24 @@
</a>
</li>
<li>
<a class="treeview " href="{% url 'all_process' %}">
<i class="fa fa-sync-alt"></i>
<span>Catalog of Process</span>
<span class="pull-right-container">
<span class="label label-primary pull-right"></span>
</span>
</a>
</li>
<li>
<a class="treeview " href="{% url 'all_platform' %}">
<i class="fa fa-satellite"></i>
<span>Catalog of Platforms</span>
<span class="pull-right-container">
<span class="label label-primary pull-right"></span>
</span>
</a>
</li>
<!--li>
<a class="treeview " href="#" onclick="window.history.back();">
<i class="fa fa-backward"></i>
<span>Back</span>
......@@ -36,6 +54,6 @@
<span class="label label-primary pull-right"></span>
</span>
</a>
</li>
</li-->
</ul>
</div>
\ No newline at end of file
......@@ -8,7 +8,8 @@
<script src="{% static 'js/Chart.min.js' %}"></script>
<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>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css"
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
{% endblock %}
{% block messages %}
......@@ -146,7 +147,7 @@
<span class="info-box-text">Active Users</span>
<span class="info-box-number">{{ Usuarios }}</span>
<span class="info-box-more pull-right">
<a href="../../administration/users" class="small-box-footer">
<a href="{% url 'active_users' %}" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</span>
......@@ -168,7 +169,7 @@
<span class="info-box-text">User Registrations</span>
<span class="info-box-number">{{ Solicitud }}</span>
<span class="info-box-more pull-right">
<a href="../../administration/request" class="small-box-footer">
<a href="{% url 'request' %}" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</span>
......@@ -186,9 +187,7 @@
<span class="info-box-text">Processing</span>
<span class="info-box-number">{{ Descargando }}</span>
<span class="info-box-more pull-right">
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</span>
</div>
<!-- /.info-box-content -->
......@@ -204,9 +203,6 @@
<span class="info-box-text">Repsat Storage</span>
<span class="info-box-number">{{ size_repsat }}</span>
<span class="info-box-more pull-right">
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</span>
</div>
<!-- /.info-box-content -->
......@@ -222,9 +218,6 @@
<span class="info-box-text">Sentinel Storage</span>
<span class="info-box-number">{{ size_sentinel }}</span>
<span class="info-box-more pull-right">
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</span>
</div>
<!-- /.info-box-content -->
......@@ -248,15 +241,14 @@
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-8">
<div class="col-md-8 col-xs-12 col-sm-12">
<p class="text-center">
<strong>Today {% now "jS F Y" %}</strong>
</p>
<div class="chart">
<div class="chart ">
<!-- Sales Chart Canvas -->
<canvas id="salesChart" style="height: 142px; width: 814px;" width="814"
height="142"></canvas>
<canvas id="salesChart" style="height: 142px; width: 814px;" width="814" height="170"></canvas>
</div>
<!-- /.chart-responsive -->
</div>
......@@ -405,6 +397,13 @@
<!-- /.content -->
</div>
{% endblock %}
{% block footer %}
<footer class=" page-footer font-small special-color-dark pt-5" style="bottom: 0; position: absolute">
<!-- Footer Elements -->
<div class="container">
......@@ -447,21 +446,7 @@
<!-- Copyright -->
</footer>
{% if messages %}
<div class="container col-md-2 col-lg-2 col-xs-2 col-sm-2" style="bottom: 0; right: 0;position: absolute">
{% for message in messages %}
<div {% if message.tags %} class="fade in alert alert-dismissible alert-{{ message.tags }}"{% endif %}>
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>{{ message.tags }}!</strong> {{ message }}.
</div>
{% endfor %}
</div>
{% endif %}
<div id="ol"></div>
{% endblock %}
{% block templates %}
......@@ -488,20 +473,11 @@
{% endfor %}
],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
'rgba(222, 130, 50, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
'rgba(222, 130, 50,1)',
],
borderWidth: 1
}]
......@@ -518,7 +494,6 @@
});
// mostrar imagen al dar click en los puntos
document.getElementById("salesChart").onclick = function (evt) {
// activePoints = myChart.getElementsAtEvent(evt);
......@@ -539,35 +514,34 @@
console.log("hola");
$('#mostrar').empty();
$('#mostrar').append("<table class=\"table table-hover\" id=\"example\">"+
$('#mostrar').append("<table class=\"table table-hover\" id=\"example\">" +
"<thead>" +
"<tr>" +
"<th class=\"text-center\">User ID</th>" +
"<th class=\"text-center\">User</th>" +
"<th class=\"text-center\">E-Mail</th>" +
"<th class=\"text-center\">Purchases</th>" +
"<th class=\"text-center\">Storage</th>" +
//"<th class=\"text-center\">Storage</th>" +
"<th class=\"text-center\">Downloads in process</th>" +
"</tr>" +
"</thead>" +
"<tbody id=\"tbody\" class=\"text-center\">");
$.each(data, function (key, val) {
$("#tbody").append("<tr>"+
"<td>"+val['user_id']+"</td>"+
"<td>"+val['username']+"</td>"+
"<td>"+val['email']+"</td>"+
"<td>"+val['purchases']+"</td>"+
"<td>"+val['storage']+"</td>"+
"<td>"+val['in_process']+"</td>"+
$("#tbody").append("<tr>" +
"<td>" + val['user_id'] + "</td>" +
"<td>" + val['username'] + "</td>" +
"<td>" + val['email'] + "</td>" +
"<td>" + val['purchases'] + "</td>" +
//"<td>"+val['storage']+"</td>"+
"<td>" + val['in_process'] + "</td>" +
"</tr>"
);
});
$('#mostrar').append("</tbody>" +
"</table>");
$('#example').DataTable({
});
$('#example').DataTable({});
}
});
......
......@@ -238,51 +238,7 @@
{% block scripts %}
<script>
$(document).ready(function () {
$('#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:
{
details:
{
type: 'column',
target: 'tr'
}
},
columnDefs:
[{
className: 'control',
orderable: false,
targets: 0
}],
order: [1, 'asc']
});
$('#example').DataTable();
});
</script>
{% endblock %}
\ No newline at end of file
......@@ -4,8 +4,10 @@ from . import views
urlpatterns = [
url(r'^$', views.Dashboard, name='Dashboard'),
url(r'^request/$', views.Request_users, name='Request'),
url(r'^request/$', views.Request_users, name='request'),
url(r'^update/$', views.update_user, name='update'),
url(r'^users/$', views.active_users, name='users'),
url(r'^users/$', views.active_users, name='active_users'),
url(r'^platform/$', views.all_Platform, name='all_platform'),
url(r'^process/$', views.all_Process, name='all_process'),
url(r'^ws/report_table$', views.wsPurchasesPM, name='wsPurchasesPM'),
]
\ No newline at end of file
......@@ -13,7 +13,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpRequest, Http404
# Create your views here.
from django.views.decorators.csrf import csrf_exempt
from catalog.models import Purchase, Search
from catalog.models import Purchase, Search, Platform, Process
from catalog.views import config
USERS_PATH = config['PATHS']['PATH_NAS']
......@@ -250,4 +250,32 @@ def best_unit_size(bytes_size):
return str(round(bu_size,2))+" "+unit
#------------------------------------------------
def all_Platform (request):
platforms = Platform.objects.all()
platforms_list=[]
for platform in platforms:
platforms_list.append({
"id": platform.id,
"name": platform.name,
"acronym": platform.acronym,
"status": platform.status,
})
return render(request,"Platform.html",{'platforms': platforms_list})
#------------------------------------------------
def all_Process (request):
process = Process.objects.values('id','name','status','platform__name','productLevel')
process_list = []
for process in process:
process_list.append({
"id": process['id'],
"name": process['name'],
"platform_id": process['platform__name'],
"product_level": process['productLevel'],
"status": process['status'],
})
return render(request, "Process.html", {'process': process_list})
......@@ -9,7 +9,7 @@ from catalog.models import Process
#from django.contrib.auth.models import User
#from buscador.models import Investigador, Reto
all_process = Process.objects.all()
all_process = Process.objects.filter(status=True)
platforms = [ ]
......
......@@ -10,6 +10,7 @@ from django.db import models
class Platform(models.Model):
name = models.CharField(max_length=64)
acronym = models.CharField(max_length=16)
status = models.BooleanField(default=True)
class Polygon(models.Model):
......@@ -53,6 +54,7 @@ class Process(models.Model):
name = models.CharField(max_length=50)
platform = models.ForeignKey(Platform, on_delete=models.CASCADE, default='')
productLevel = models.CharField(max_length=8, default='')
status = models.BooleanField(default=True)
class Search(models.Model):
......
......@@ -33,3 +33,7 @@ html, body
text-decoration: none;
color: black;
}
#cloudPercentageSelector {
background: transparent;
}
{% extends "data_top.html" %}
{% load static %}
{% block content %}
<div class="wrapper">
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-6">
<!-- AREA CHART -->
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Area Km²</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i
class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<div class="chart">
<canvas id="areaChart" style="height:250px"></canvas>
</div>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
<!-- DONUT CHART -->
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title">Donut Chart</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i
class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<canvas id="pieChart" style="height:250px"></canvas>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col (LEFT) -->
<div class="col-md-6">
<!-- LINE CHART -->
<!-- BAR CHART -->
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Bar Chart</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i
class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<div class="chart">
<canvas id="barChart" style="height:230px"></canvas>
</div>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">MAP</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapsexite"><i
class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<div class="chart">
<img id="satImage" src="{% static 'tmpImages/20180219_TCI_60m.jpg' %}" height="512px"/>
</div>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col (RIGHT) -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 2.4.0
</div>
<strong>Copyright &copy; 2014-2016 <a href="https://adminlte.io">Almsaeed Studio</a>.</strong> All rights
reserved.
</footer>
{% endblock %}
{% block scripts %}
<!-- page script -->
<script>
var ctx = document.getElementById("areaChart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'Line',
data: {
labels: [{{labels}}],
datasets: [{
label: 'Vegetacion (4)',
data: {{vegetation}},
backgroundColor: [
'rgba(0, 250, 132, 0.5)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
},
{
label: 'No Vegetacion (5)',
data: {{novegetation}},
backgroundColor: [
'rgba(155, 250, 0, 0.5)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
events: ['click'],
onClick: areaChartonClick,
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
function areaChartonClick(e, element) {
console.log(e);
console.log(element);
console.log(element[0]._index);
console.log(myChart);
console.log(myChart.config.data.labels[element[0]._index]);
document.getElementById("satImage").src = "../../static/tmpImages/" + myChart.config.data.labels[element[0]._index] + "_TCI_60m.jpg"
};
</script>
{% endblock %}
......@@ -22,6 +22,9 @@
<!-- jsPDF -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.3/jspdf.debug.js'></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css"
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
{% block headMedia %}{% endblock %}
</head>
<body class="hold-transition skin-yellow sidebar-mini">
......@@ -31,7 +34,8 @@
<div class="wrmapper">
<header class="main-header">
<!-- Logo -->
<a {% if request.user.is_authenticated %}href="{{ BASE_URL }}/catalog" {% else %} href="../../../" {% endif %}class="logo">
<a {% if request.user.is_authenticated %}href="{{ BASE_URL }}/catalog" {% else %}
href="../../../" {% endif %}class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>G</b>eo</span>
<!-- logo for regular state and mobile devices -->
......@@ -113,8 +117,10 @@
<aside class="control-sidebar control-sidebar-dark">
<!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li id="globe" class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-globe"></i></a></li>
<li id="cart"><a href="#control-sidebar-settings-tab" onclick="updateCart()" data-toggle="tab"><i class="fa fa-shopping-cart"></i></a>
<li id="globe" class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i
class="fa fa-globe"></i></a></li>
<li id="cart"><a href="#control-sidebar-settings-tab" onclick="updateCart()" data-toggle="tab"><i
class="fa fa-shopping-cart"></i></a>
</li>
</ul>
<!-- Tab panes -->
......@@ -202,6 +208,17 @@
{% block footer %}{% endblock %}
{% block scripts %}{% endblock %}
<div id="ol"></div>
{% if messages %}
<div class="container col-md-2 col-lg-2 col-xs-2 col-sm-2" style="bottom: 0; right: 0;position: absolute">
{% for message in messages %}
<div {% if message.tags %} class="fade in alert alert-dismissible alert-{{ message.tags }}"{% endif %}>
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>{{ message.tags }}!</strong> {{ message }}.
</div>
{% endfor %}
</div>
{% endif %}
</body>
</html>
......@@ -219,18 +219,18 @@
</tfoot>
</table>
<div class="text-center">
<a href="../pay">
<input type="image"
<a href="../pay" class="btn btn-danger">PAY
<!--input type="image"
src="https://www.sandbox.paypal.com/es_XC/MX/i/btn/btn_buynowCC_LG.gif"
border="0" name="submit"
alt="PayPal, la forma más segura y rápida de pagar en línea.">
<img alt="" border="0"
src="https://www.sandbox.paypal.com/es_XC/i/scr/pixel.gif" width="1"
height="1">
height="1"-->
</a>
<!--form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business"
......@@ -247,9 +247,9 @@
{% endfor %}
<input type='hidden' name='cancel_return'
value='../reports'>
value='http://repsat.geoint.mx/catalog/cart/'>
<input type='hidden' name='return'
value='../catalog/cart'>
value='http://repsat.geoint.mx/catalog/cart/'>
<input type="hidden" name="notify_url" value="http://repsat.geoint.mx/catalog/ipn/">
<input type="image"
src="https://www.sandbox.paypal.com/es_XC/MX/i/btn/btn_buynowCC_LG.gif"
......@@ -260,7 +260,7 @@
height="1">
</form>
<!--form method="post" action="http://repsat.geoint.mx/catalog/ipn/">
<form method="post" action="http://repsat.geoint.mx/catalog/ipn/">
<input type="text" name="nombre" value="">
<input type="submit">
</form>
......@@ -268,7 +268,7 @@
<form method="post" action="../ipn/">
<input type="text" name="nombre" value="">
<input type="submit">
</form-->
</form>
</div>
......
......@@ -15,7 +15,7 @@
<ul class="sidebar-menu" data-widget="tree">
<!-- History element -->
<li>
<a class="treeview " href="../../../users">
<a class="treeview " href="{% url 'users' %}">
<i class="fa fa-user-circle"></i>
<span>Profile</span>
<span class="pull-right-container">
......@@ -26,7 +26,7 @@
<!-- End History element -->
<!-- History element -->
<li>
<a class="treeview " href="{{ BASE_URL }}/reports">
<a class="treeview " href="{% url 'reports' %}">
<i class="fa fa-history"></i>
<span>Shopping History</span>
<span class="pull-right-container">
......@@ -35,7 +35,7 @@
</a>
</li>
<li>
<a class="treeview " href="{{ BASE_URL }}/catalog/cart">
<a class="treeview " href="{% url 'show-cart' %}">
<i class="fa fa-shopping-cart"></i>
<span>View shopping cart</span>
<span class="pull-right-container">
......
......@@ -293,40 +293,6 @@ def delFromCart(request):
product_list = Purchase.objects.filter(user=user, id=request.POST['id']).delete()
return HttpResponse(status=204)
##-------------------------------------------------------------------------------
# def L2ASCL_data(request):
# with open("/home/mario/NAS_MarioCh/mario_repsat_test/T15QZD_sclData.json") as f:
# json_data = OrderedDict(json.load(f))
# graphData = dict()
# graphData['type']="line"
# data=dict()
# data['labels'] = [ k for k,v in sorted(json_data.items()) ]
# data['datasets'] = list()
# labels = set()
# for d in json_data:
# labels |= set(json_data[d].keys())
# labels.remove('date')
# labelNames = ["No Data", "Saturated", "Shadows", "Cloud Shadows", "Vegetation",
# "Not-Vegetated", "Whater", "Unclassified", "Cloud Medium Probablilty", "Cloud Hight Probablilty", "Thin Cirrus", "Snow"]
# colors = ["Black", "Red", "DarkGray", "Brown", "Green", "Yellow", "Blue", "Grey", "LightGray", "White", "Aqua", "Pink"]
# for l in labels:
# item = dict()
# item['label'] = labelNames[int(l)]
# if l == "0":
# item['hidden'] = "true"
# item['data'] = [ v[l] * 60*60/1000000. for k,v in sorted(json_data.items()) if l in v]
# item['backgroundColor']=colors[int(l)]
# data['datasets'].append(item)
# graphData['data']=data
## graphData['options']['responsive']=True
## graphData['options']['maintainAspectRatio']=False
# print( json.dumps(graphData).encode("utf-8"))
# return render(request, 'L2ASCL_data.html', {"graphData":json.dumps(graphData).encode("utf-8")})
# -------------------------------------------------------------------------------
def wsReportImages(request):
print(request.GET)
......@@ -618,10 +584,12 @@ def IPN(request):
PATH_USERS = config['PATHS']['PATH_USERS']
f = open(PATH_USERS+"myfile.txt", "w")
x = request.POST.dict()
f.write('variables')
f.write('variables\n')
#f.write(request.META['HTTP_REFERER']+'\n')
for key, value in x.items():
f.write(key+": "+value+'\n')
return redirect('../../')
#return redirect('../../')
return HttpResponseRedirect(reverse('map'))
#print("content-type: text/html\r\n\r\n")
#if request.POST.get['payment_status'] == 'Completed':
......@@ -657,41 +625,6 @@ def IPN(request):
# f.write("\n")
# f.close()
# -----------------------------------------------------------------------
# def Pay3(request):
# VERIFY_URL_PROD = 'https://ipnpb.paypal.com/cgi-bin/webscr'
# VERIFY_URL_TEST = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'
#
# # Switch as appropriate
# VERIFY_URL = VERIFY_URL_TEST
#
# # CGI preamble
# print('content-type: text/plain')
# print()
#
# # Read and parse query string
# param_str = sys.stdin.readline().strip()
# params = urllib.parse.parse_qsl(param_str)
#
# # Add '_notify-validate' parameter
# params.append(('cmd', '_notify-validate'))
#
# # Post back to PayPal for validation
#
# headers = {'content-type': 'application/x-www-form-urlencoded',
# 'user-agent': 'Python-IPN-Verification-Script'}
# r = requests.post(VERIFY_URL, params=params, headers=headers, verify=True)
# r.raise_for_status()
#
# # Check return message and take action as needed
# if r.text == 'VERIFIED':
# pass
# elif r.text == 'INVALID':
# pass
# else:
# pass
# return redirect("https://google.com.mx")
# ------------------------------------------------------
def Registration(request):
#user = User.objects.filter(email=request.POST['email'])
......
......@@ -130,7 +130,7 @@
<br>
<ul class="sidebar-menu" data-widget="tree">
<li>
<a class="treeview " href="{{ BASE_URL }}/catalog">
<a class="treeview " href="{% url 'map' %}">
<i class="fa fa-map"></i>
<span>Home</span>
<span class="pull-right-container">
......@@ -226,15 +226,22 @@
{% if product.initial_folder %}
href="../reports/{{ product.purchase_id }}"
{% endif %}
class="btn btn-success btn-sm col-md-6 col-xs-6 col-sm-6 col-lg-6 col-xl-6">
class="btn btn-success btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4">
<i class="fa fa-eye"></i>
</a>
<a title="Download zip" {% if product.progress == 100 %}
href="../../static/reports/tmpImages/repsat_test_dev/{{ request.user.email }}/{{ product.purchase_id }}/myzip.zip"
{% else %}
href="#"
{% endif %} class="btn btn-warning btn-sm col-md-6 col-xs-6 col-sm-6 col-lg-6 col-xl-6">
{% endif %} class="btn btn-warning btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4">
<i class="fa fa-file-zip-o"></i>
</a>
<a title="Download PDF" {% if product.progress == 100 %}
href="{% url 'PDF' product.purchase_id %}"
{% else %}
href="#"
{% endif %} class="btn btn-info btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4" target="_blank" download="{{ product.search_name }} ({{ product.purchase_date }}).pdf">
<i class="fa fa-file-pdf-o"></i>
</a>
<!--a title="View Log" href="#" class="btn btn-info"
onclick="openmodal('{{ product.log_info }}')">
......
......@@ -160,27 +160,29 @@
</a>
<ul class="treeview-menu sidebar-form">
<li>
<a class="treeview submenu" href="#">
<i class="fa fa-file-code-o"></i>
<span>Export to JSON</span>
<a class="treeview submenu" href="../../static/reports/tmpImages/repsat_test_dev/{{ email }}/{{ purchaseID }}/myzip.zip">
<i class="fa fa-file-zip-o"></i>
<span>Export to Zip</span>
<span class="pull-right-container">
<span class="label label-primary pull-right"></span>
</span>
</a>
</li>
<li>
<a class="treeview submenu" href="#" id="downloadPdf">
<i class="fa fa-file-pdf-o"></i>
<span>Export to PDF</span>
<a class="treeview submenu" href="#">
<i class="fa fa-file-code-o"></i>
<span>Export to JSON</span>
<span class="pull-right-container">
<span class="label label-primary pull-right"></span>
</span>
</a>
</li>
<li>
<a class="treeview submenu" href="../../static/reports/tmpImages/repsat_test_dev/{{ email }}/{{ purchaseID }}/{{ zone }}.pdf" id="downloadPdf" target="_blank">
<a class="treeview submenu" href="{% url 'PDF' purchaseID %}" target="_blank" download="{{ searchInfo.title }} ({{ searchInfo.purchase_date }}).pdf">
<i class="fa fa-file-pdf-o"></i>
<span>Export to PDF v2</span>
<span>Export to PDF</span>
<span class="pull-right-container">
<span class="label label-primary pull-right"></span>
</span>
......
......@@ -16,4 +16,5 @@ urlpatterns = [
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'),
url(r'^ws/PDF/(?P<purchase_id>(\d+))$', views.PDFGenerator, name='PDF'),
]
......@@ -9,7 +9,7 @@ import xml.etree.ElementTree as ET
from collections import OrderedDict
from datetime import datetime
from django.http import HttpResponse, Http404, JsonResponse
from django.http import HttpResponse, Http404, JsonResponse, FileResponse, HttpRequest
from django.shortcuts import render, redirect
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
......@@ -19,17 +19,17 @@ from GeoInt_SIDT.settings import BASE_URL
from administration.views import best_unit_size
from catalog.models import Purchase
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch
from reportlab.lib import colors
from reportlab.platypus import Paragraph, Frame, Spacer, Image, Table, TableStyle, SimpleDocTemplate, PageBreak
from reportlab.graphics.charts.barcharts import VerticalBarChart
from reportlab.graphics.shapes import Drawing, String
from reportlab.graphics.charts.textlabels import Label, LabelOffset
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.legends import Legend
# -------------------------------------------------------------------------------
########### lee archivo de configuración ################
......@@ -48,7 +48,7 @@ def report_L2ASCL(request, purchase_id):
reporteDir = 'mask'
folders = ""
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','aggreg_date').get(pk=purchase_id)
email = purchase['user__email']
path = USERS_PATH + email + '/' + purchase_id + '/'
scl_data_path = USERS_PATH + email + "/" + purchase_id + "/scl_data.json"
......@@ -71,19 +71,24 @@ def report_L2ASCL(request, purchase_id):
"title": purchase['name'],
#"title": purchase['search__search_name'],
"process": purchase['search__process_id__name'],
"purchase_date": purchase['aggreg_date'],
"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²)"
}
if os.path.exists(path + reporteDir + ".pdf"):
print ("si existe")
else:
PDFGenerator(request, path, reporteDir, datasets,searchInfo)
#PDFGenerator(request, path, reporteDir, datasets,searchInfo)
pass
return render(request, template, {"graphData": json.dumps(graphData),
"searchInfo": searchInfo, "IMAGE_PATH": image_path,
......@@ -103,6 +108,9 @@ def Reports(request):
size = 0
folders = []
zip = ""
product_list = Purchase.objects.values('id', 'productList', 'aggreg_date', 'search__clouds', 'search__startDate',
'search__endDate', 'search__process_id__name', 'search__search_name',
'is_public','name','description').filter(
......@@ -158,7 +166,7 @@ def Reports(request):
# else:
# initial_folder = folders.pop(0) + "_sclData"
print(initial_folder)
zip_path = USERS_PATH + request.user.email + "/" + str(producto['id'])
# print(zip_path)
......@@ -334,14 +342,21 @@ def dataToTable(name, data):
data.insert(0, name)
return data
def mergeimages(path,file):
from PIL import Image
layer1 = Image.open(path + file[:8] + "_SCL_60m_0.tif")
for i in range(10):
layer2 = Image.open(path + file[:8] + "_SCL_60m_" + str(i) + ".tif")
nueva = Image.alpha_composite(layer1, layer2)
layer1 = nueva
nueva.save(path + file[:8] + "_SCL_60m_10.tif")
return path+file[:8]+"_SCL_60m_10.tif"
# create the table for our document
def myTable(path1, path2, basefile):
#image1 = Image(path1, height=300, width=200, mask='auto')
image1 = Image(path1)
if image1.imageWidth < image1.imageHeight:
print ("mas alto que ancho")
image2 = Image(path1, height=300, width=200, mask='auto')
else:
image2 = Image(path1, height=150, width=400, mask='auto')
......@@ -351,8 +366,10 @@ def myTable(path1, path2, basefile):
if file.startswith(basefile[:8]):
if file.endswith('.tif') and not file.endswith('0.tif'):
# image2 = Image(path2 + file, height=300, width=200, mask='auto')
image3 = image2
if image1.imageWidth < image1.imageHeight:
image3 = Image(mergeimages(path2, file), height=300, width=200, mask='auto')
else:
image3 = Image(mergeimages(path2, file), height=150, width=400, mask='auto')
if image1.imageWidth < image1.imageHeight:
data = [['TCI', 'SCL'], [image2, image3]]
......@@ -449,18 +466,52 @@ def myBarLegend(drawing, labels):
return d
@csrf_exempt
#def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
def PDFGenerator(request,purchase_id):
def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
thumbs = ruta + 'out/' + reporteDir + '/TCI/thumbnails/'
SCL = ruta + 'out/' + reporteDir + '/SCL/split/'
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)
searchInfo = {
"title": purchase['name'],
# "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.append(tileinfo("hola"))
# define the style for our paragraph text
styles = getSampleStyleSheet()
styles2 = getSampleStyleSheet()
styles3 = getSampleStyleSheet()
styleN = styles['Normal']
styleN.alignment = 1
styleN.fontSize=25
......@@ -468,6 +519,11 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
style2 = styles2['Normal']
style2.alignment = 1
style2.fontSize = 15
style2.leading = 20
style3 = styles3['Normal']
style3.alignment = 1
style3.fontSize = 19
# Header
im = Image(USERS_PATH + 'header.png', width=300, height=70)
......@@ -475,32 +531,31 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
story.append(im)
story.append(Spacer(1, 1.5 * inch))
# add the title
story.append(Paragraph("<strong>"+searchInfo['report_name']+"</strong>", styleN,))
story.append(Spacer(1, .60 * inch))
story.append(Paragraph("<strong>"+searchInfo['title']+"</strong>", styleN,))
story.append(Spacer(1, .40 * inch))
story.append(Spacer(1, .50 * inch))
story.append(Paragraph("<strong>"+searchInfo['title']+"</strong>", style3,))
story.append(Spacer(1, .30 * inch))
story.append(Paragraph("<strong>("+searchInfo['startDate']+" - "+searchInfo['endDate']+")</strong>", style2,))
story.append(Spacer(1, .60 * inch))
story.append(Paragraph("<strong>Platform: "+searchInfo['platform']+"</strong>", style2,))
story.append(Spacer(1, .40 * inch))
story.append(Paragraph("<strong>Product level: "+searchInfo['productLevel']+"</strong>", style2,))
story.append(Spacer(1, .40 * inch))
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(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, .10 * inch))
story.append(Paragraph(searchInfo['description'], style2,))
story.append(Spacer(1, .40 * 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())
path, dirs, files = next(os.walk(thumbs))
print (len(files))
for index, file in enumerate(files):
values = []
labels = []
......@@ -516,12 +571,10 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
labels.append(data['label'])
path1 = thumbs + file
# Header
# Header
# print (width)
#########################33
im = Image(USERS_PATH + 'header.png', width=300, height=70)
im.hAlign = 'CENTER'
......@@ -534,9 +587,8 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
story.append(Spacer(1, .5 * inch))
# add barchart and legend
# drawing = myBarChart(values[:len(values) - 1], maxi, file)
drawing = myBarChart(values, maxi, file)
# drawing = myBarLegend(drawing, labels[:len(labels) - 1])
drawing = myBarLegend(drawing, labels)
drawing.hAlign = 'CENTER'
story.append(drawing)
......@@ -544,9 +596,12 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
story.append(PageBreak())
# 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=5, title=searchInfo['report_name']+" "+searchInfo['title'],)
doc.build(story)
pass
#return HttpResponse (request.POST.get('ruta'))
return FileResponse(open(ruta + reporteDir + ".pdf", 'rb'), content_type='application/pdf')
# -----------------------------------------------------------------------------------------------------------------
......@@ -617,7 +672,6 @@ def wsEditTitle(request):
purchase.name = request.GET.get("zone")
purchase.description = request.GET.get("description")
purchase.save()
print ("hola")
return HttpResponse("hola")
else:
raise Http404
......@@ -122,7 +122,7 @@
User Profile
</h1>
<ol class="breadcrumb">
<li><a href="../"><i class="fa fa-home"></i> Home</a></li>
<li><a href="{% url 'map' %}"><i class="fa fa-home"></i> Home</a></li>
<li class="active">User profile</li>
</ol>
</section>
......@@ -368,7 +368,8 @@
type: 'POST',
dataType: "json",
data: {'title': label, "user_id": $('#user_id').val()},
url: '../../users/ws/report_table',
//url: '../../users/ws/report_table',
url: '{% url "wsPurchasesPM" %}',
success: function (data) {
console.log(data);
$('#mostrar').empty();
......
......@@ -2,7 +2,7 @@
<br>
<ul class="sidebar-menu" data-widget="tree">
<li>
<a class="treeview " href="{{ BASE_URL }}/reports">
<a class="treeview " href="{% url 'reports' %}">
<i class="fa fa-files-o"></i>
<span>Reports</span>
<span class="pull-right-container">
......
......@@ -35,14 +35,14 @@ def Users(request):
purchases = Purchase.objects.filter(user_id=user.id)
in_process = Purchase.objects.filter(user_id=user.id).exclude(progress=100)
bytes_size = 0
for path, directories, files in os.walk(USERS_PATH + "repsat_test_dev/" + user.email):
for filename in files:
bytes_size += os.lstat(os.path.join(path, filename)).st_size
for directory in directories:
bytes_size += os.lstat(os.path.join(path, directory)).st_size
bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev/" + user.email)
size_repsat = best_unit_size(bytes_size)
#bytes_size = 0
#for path, directories, files in os.walk(USERS_PATH + "repsat_test_dev/" + user.email):
# for filename in files:
# bytes_size += os.lstat(os.path.join(path, filename)).st_size
# for directory in directories:
# bytes_size += os.lstat(os.path.join(path, directory)).st_size
#bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev/" + user.email)
#size_repsat = best_unit_size(bytes_size)
user_data.append({
"user_id": user.id,
......@@ -50,7 +50,7 @@ def Users(request):
"searches": searches.count(),
"purchases": purchases.count(),
"in_process": in_process.count(),
"size": size_repsat,
#"size": size_repsat,
})
for search in Search.objects.values('search_name').filter(user_id=user.id).annotate(
......@@ -155,13 +155,13 @@ def User_id(request, user_id):
in_process = Purchase.objects.filter(user_id=user.id).exclude(progress=100)
bytes_size = 0
for path, directories, files in os.walk(USERS_PATH + "repsat_test_dev/"+user.email):
for filename in files:
bytes_size += os.lstat(os.path.join(path, filename)).st_size
for directory in directories:
bytes_size += os.lstat(os.path.join(path, directory)).st_size
bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev/"+user.email)
size_repsat = best_unit_size(bytes_size)
#for path, directories, files in os.walk(USERS_PATH + "repsat_test_dev/"+user.email):
# for filename in files:
# bytes_size += os.lstat(os.path.join(path, filename)).st_size
# for directory in directories:
# bytes_size += os.lstat(os.path.join(path, directory)).st_size
#bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev/"+user.email)
#size_repsat = best_unit_size(bytes_size)
user_data.append({
"user_id": user.id,
......@@ -169,7 +169,7 @@ def User_id(request, user_id):
"searches": searches.count(),
"purchases": purchases.count(),
"in_process": in_process.count(),
"size": size_repsat,
#"size": size_repsat,
})
for search in Search.objects.values('search_name').filter(user_id=user.id).annotate(
......@@ -269,13 +269,13 @@ def wsPurchasesPM(request):
table_data = []
data = Purchase.objects.values('user_id', 'search__endDate', 'search__startDate', 'aggreg_date',
'search__process_id__name', 'search__search_name').filter(
'search__process_id__name', 'name').filter(
user_id=request.POST.get('user_id'), purchased=True,
aggreg_date__month=to_if(request.POST.get('title'))).order_by('aggreg_date')
for producto in data:
table_data.append({
"search_name": producto['search__search_name'],
"search_name": producto['name'],
"process": producto['search__process_id__name'],
"purchase_date": str(producto['aggreg_date'])[:10],
"startDate": str(producto['search__startDate'])[:10],
......
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