186 lines
8.6 KiB
PHP
186 lines
8.6 KiB
PHP
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
|
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css" rel="stylesheet" type="text/css"/>
|
|
|
|
<!-- start page title -->
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="page-title-box">
|
|
<div class="page-title-right">
|
|
<ol class="breadcrumb m-0">
|
|
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
|
</li>
|
|
<li class="breadcrumb-item active">Dateiablage</li>
|
|
</ol>
|
|
</div>
|
|
<h4 class="page-title">Dateiablage</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-body mb-3">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="float-left">
|
|
<h4 class="header-title">Liste aller Dateien</h4>
|
|
</div>
|
|
<div class="float-right">
|
|
<a class="btn btn-primary mb-2" href="<?= self::getUrl("Filestore", "add") ?>"><i
|
|
class="fas fa-plus"></i> Neue Datei hochladen</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<?php
|
|
if (!$me->permissions->isAdmin) {
|
|
foreach ($networkaddresses as $networkaddress) {
|
|
if ($me->address->id == $networkaddress->address_id) {
|
|
$allowedNetworks[$networkaddress->network_id] = "ok";
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
|
|
<table id="datatable" class="table table-striped table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Beschreibung</th>
|
|
<th>Netzgebiet</th>
|
|
<th style="min-width: 270px;">Bearbeiter</th>
|
|
<th>Datum/Uhrzeit</th>
|
|
<th class="edit-width-large"></th>
|
|
</tr>
|
|
<tr id="filterrow">
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($files as $file):
|
|
|
|
if (!$me->permissions->isAdmin) {
|
|
if (!array_key_exists($file->networkid, $allowedNetworks)) {
|
|
continue;
|
|
}
|
|
}
|
|
?>
|
|
|
|
<tr>
|
|
<td><?= $file->name ?></td>
|
|
<td><?= $file->description ?></td>
|
|
<td><?= $file->network ?></td>
|
|
|
|
<!--<td>--><?php //= $file->creator->name
|
|
?><!-- (-->
|
|
<?php //= date("d.m.Y , H:i", $file->create)
|
|
?><!--)</td>-->
|
|
<td><?= $file->editor->name ?></td>
|
|
<td><?= date("d.m.Y , H:i", $file->edit) ?></td>
|
|
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
|
<a href="<?= self::getUrl("File", "download", ["id" => $file->file_id]) ?>"><i
|
|
class="far fa-download" title="Download"></i></a>
|
|
<a href="<?= self::getUrl("Filestore", "edit", ["id" => $file->id, "mode" => "add-version"]) ?>"><i
|
|
class="far fa-file-circle-plus" title="Dateiversion hinzufügen"></i></a>
|
|
<?php if (!empty($fileshistory[$file->id])) : ?>
|
|
<i data-id="<?= $file->id ?>" title="Versionsverlauf"
|
|
class="fa-solid fa-clock-rotate-left history-ico check-history"></i>
|
|
<?php endif; ?>
|
|
<a href="<?= self::getUrl("Filestore", "edit", ["id" => $file->id]) ?>"><i
|
|
class="far fa-edit" title="Bearbeiten"></i></a>
|
|
|
|
<?php if ($me->permissions->isAdmin) : ?>
|
|
<a style="float: right"
|
|
href="<?= self::getUrl("Filestore", "delete", ["id" => $file->id]) ?>"
|
|
onclick="if(!confirm('Datei wirklich löschen?')) return false;"
|
|
class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
var hidesearch = [3, 4, 5];
|
|
var cstmdom = "flrtip";
|
|
$(document).ready(function () {
|
|
$(".check-history").click(function () {
|
|
let dataobject = $(this);
|
|
let fsiid = $(this).data('id');
|
|
if ($('.filestore-history-' + fsiid).length) {
|
|
$('.filestore-history-' + fsiid).remove();
|
|
} else {
|
|
$.getJSON("/Filestore/api",
|
|
{id: $(this).data('id')},
|
|
|
|
function (data) {
|
|
if (data) {
|
|
let expandtr;
|
|
|
|
expandtr = `<tr class="filestore-history-tr filestore-history-` + fsiid + `">
|
|
<td colspan="7" class="filestore-history-td" >
|
|
<table class="float-right table table-bordered table-condensed" style="width: 1300px;">
|
|
<thead>
|
|
<tr style="background-color: #fff">
|
|
<th>Beschreibung</th>
|
|
<th style="width: 270px;">Bearbeiter</th>
|
|
<th style="width: 235px;">Datum/Uhrzeit</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
`;
|
|
$.each(data, function (i, item) {
|
|
let isdelete = '';
|
|
var date = new Date(item.edit * 1000);
|
|
var day = "0" + date.getDay();
|
|
var month = "0" + date.getMonth();
|
|
var year = date.getFullYear();
|
|
var hours = date.getHours();
|
|
var minutes = "0" + date.getMinutes();
|
|
var formattedTime = day + '.' + month + '.' + year + ', ' + hours + ':' + minutes.substr(-2);
|
|
if (item.is_delete == "1") {
|
|
isdelete = `<a style="float: right" href="/FilestoreHistory/delete/?id=` + item.id + `&s=0" onclick="if(!confirm('Datei wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>`;
|
|
}
|
|
|
|
expandtr = expandtr + `<tr class="filestore-history">
|
|
<td>` + item.description + `</td>
|
|
<td>` + item.workername + `</td>
|
|
<td>` + formattedTime + `</td>
|
|
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;width: 140px;">
|
|
<a href="/File/download/?id=` + item.file_id + `&s=0"><i class="far fa-download" title="Download"></i></a>
|
|
` + isdelete + `
|
|
</td>
|
|
</tr>`;
|
|
|
|
});
|
|
expandtr = expandtr + `</table></td></tr>`;
|
|
dataobject.closest('tr').after(expandtr);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<script type="text/javascript" src="<?= self::getResourcePath() ?>assets/js/datatables-std.js"></script>
|
|
<script>
|
|
|
|
</script>
|
|
|
|
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|