1
0
mirror of https://gitlab.com/JKANetwork/CheckServer.git synced 2026-02-15 09:41:33 +01:00
Files
CheckServer/assets/html/panel/p_checks.twig

252 lines
14 KiB
Twig
Executable File

{% include 'panel/p_header.twig' %}
<!-- Checks -->
<section>
<div class="col-lg-12">
<div class="card">
<div class="card-header d-flex align-items-center">
<h2 class="h5 display">Checks de la web. Desde aquí puedes ver, editar, y añadir nuevos checkeos a tus servidores</h2>
</div>
<div class="card">
{% if you.fullRights == 1 %}
<div class="card-header d-flex align-items-center">
{% if groups is not empty %}
<h2><a href="?page=addcheck" class="btn btn-info">{{T_.add}}</a></h2>
{%else%}
<h5>{{T_.add_grp_to_add_chk}}</h5>
{%endif%}
</div>
{% endif %}
<div class="card-block">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>{{T_.name}}</th>
<th>Tipo Check</th>
<th>{{T_.edit}}</th>
</tr>
</thead>
<tbody>
{% for check in checks %}
{% if check.ID_G != beforegroup %}
<tr>
<th colspan="4" class="thgrp">{{check.nameGroup}}</th>
</tr>
{% endif %}
{% set beforegroup = check.ID_G %}
<tr>
<td>{{check.name}}</td>
<td>{{check.nameTCheck}} - {{check.url}}</td>
<td>
<a href="?page=viewhist&ID_C={{check.ID_C}}" class="btn btn-info">{{T_.view_hist}}</a>
{% if you.fullRights == 1 %}
<a href="?page=editcheck&ID_C={{check.ID_C}}" class="btn btn-primary">{{T_.edit}}</a>
{% if check.ID_TC == 3 %}{#Visitas#}
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#countercode_{{check.ID_C}}">Código del contador</button>
{% elseif check.ID_TC == 4 %}{#Database#}
<a href="#" data-toggle="modal" data-target="#dbcode_{{check.ID_C}}" class="btn btn-info">Codigo para check database</a>
{% endif %}
<div class="dropdown show"> <!-- Dropdown más opciones -->
<a class="btn btn-secondary dropdown-toggle" href="#" id="more_{{check.ID_C}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{T_.more_opts}}
</a>
<div class="dropdown-menu" aria-labelledby="more_{{check.ID_C}}">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editGrp_{{check.ID_C}}">Cambiar de grupo</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editName_{{check.ID_C}}">Editar nombre</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#delChk_{{check.ID_C}}">{{T_.delete}}</a>
</div>
</div>
{% endif %}
</td>
</tr>
<!-- Modal de "Cambiar de grupo" -->
<div id="editGrp_{{check.ID_C}}" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" role="document">
<div class="modal-header">
<h5 class="modal-title">Nuevo grupo para {{check.name}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="?page=modcheckgrp&ID_C={{check.ID_C}}" method="POST">
<div class="modal-body">
<select name="group_{{check.ID_C}}" class="form-control">
{% for group in groups %}
<option value="{{group.ID_G}}" {%if group.ID_G == check.ID_G %} selected="selected" {%endif%}>
{{group.name}}
</option>
{%endfor%}
</select>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Cambiar grupo</button>
</div>
</form>
</div>
</div>
</div>
<!-- Fin modal -->
<!-- Modal de "Editar nombre" -->
<div id="editName_{{check.ID_C}}" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" role="document">
<div class="modal-header">
<h5 class="modal-title">Editando el nombre de {{check.name}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="?page=modcheckname&ID_C={{check.ID_C}}" method="POST">
<div class="modal-body">
<input type="text" name="name_{{check.ID_C}}" value="{{check.name}}"/>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Cambiar nombre</button>
</div>
</form>
</div>
</div>
</div>
<!-- Fin modal -->
<!-- Modal de "Eliminar" -->
<div id="delChk_{{check.ID_C}}" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" role="document">
<div class="modal-header">
<h5 class="modal-title">{{T_.delete}} {{check.name}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="?page=delcheck&ID_C={{check.ID_C}}" method="POST">
<div class="modal-body">
<p>¿Estas seguro de eliminar el check {{check.name}}? Es irreversible</p>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-danger">{{T_.delete}}</button>
</div>
</form>
</div>
</div>
</div>
<!-- Fin modal -->
{# Modales concretos #}
{% if check.ID_TC == 3 %} {#Contador de visitas #}
<!-- Modal para descargar el codigo de comprobación de DB -->
<div id="countercode_{{check.ID_C}}" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" role="document">
<div class="modal-header">
<h5 class="modal-title">Código HTML del contador de visitas</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<h3>Código a copiar para que el contador de visitas funcione:</h3>
<pre style="width:100%;">
&lt;script type=&quot;text/javascript&quot;&gt;
var SiteID={{check.ID_C}};
&lt;/script&gt;
&lt;script src=&quot;{{you.webRoot}}counter.js&quot;&gt;&lt;/script&gt;
</pre>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" class="btn btn-primary">Cerrar</button>
</div>
</div>
</div>
</div>
<!-- Fin modal -->
{% elseif check.ID_TC == 4 %}
<!-- Modal para descargar el codigo de comprobación de DB -->
<div id="dbcode_{{check.ID_C}}" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" role="document">
<div class="modal-header">
<h5 class="modal-title">{{T_.delete}} {{check.name}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="downdbcode.php?ID_C={{check.ID_C}}" method="POST">
<div class="modal-body">
<h3>Datos de la conexión (Para generar el fichero)</h3>
<p>Tipo de base de datos:
<select id="dbcode_type" name="dbcode_type" onchange="showOptD(this);">
<option value="sqlite3">SQLite3</option>
<option value="mysqli">MySql</option>
<option value="pgsql">PostgreSQL</option>
</select>
</p>
<p><small>En sqlite, el host es la ubicación relativa al fichero</small></p>
<p>Host (Usualmente localhost): <input type="text" name="dbcode_host" placeholder="Host" /></p>
<p id="userBD">Usuario bd<input type="text" name="dbcode_user" placeholder="Usuario" /></p>
<p id="passBD">Contraseña bd<input type="password" name="dbcode_pass" placeholder="Contraseña" /></p>
<p id="baseBD">Base de datos<input type="text" name="dbcode_db" placeholder="Base de datos" /></p>
</div>
<!-- Script for showing options -->
<script>
function showOptD(valSel){
optVal = valSel.value;
if(optVal == 'sqlite3'){
document.getElementById("userBD").style.display = "none";
document.getElementById("passBD").style.display = "none";
document.getElementById("baseBD").style.display = "none";
}else if(optVal == 'mysqli'){
document.getElementById("userBD").style.display = "block";
document.getElementById("passBD").style.display = "block";
document.getElementById("baseBD").style.display = "none";
}else if(optVal == 'pgsql'){
document.getElementById("userBD").style.display = "block";
document.getElementById("passBD").style.display = "block";
document.getElementById("baseBD").style.display = "block";
}
}
showOptD(document.getElementById("dbcode_type"))
</script>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Enviar y descargar php</button>
</div>
</form>
</div>
</div>
</div>
<!-- Fin modal -->
{% endif %}
{% endfor %}
{% for group in emptygrp %}
<tr>
<th colspan="4" class="thgrp">{{group.name}}</th>
</tr>
<tr>
<td>Este grupo está vacío. Puedes eliminarlo desde grupos</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</section>
{% include 'footer.twig' %}