Timestamp Formatierung geändert

parent 8d481ba5
# Get apache with php 7.4 as base image
FROM php:7.4-apache
# Install needed tools and php extensions
RUN apt-get update && apt-get install -y libpng-dev git zip libonig-dev libldap2-dev nano
RUN apt-get update && apt-get install -y libpng-dev git zip libonig-dev libldap2-dev nano sqlite3
RUN docker-php-ext-install mbstring gd ldap
# Install composer
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
......@@ -13,9 +13,9 @@ RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
# Copy SecDoc files and prepare folders
COPY / /var/www/html/
WORKDIR /var/www/
RUN rm html/install.php && mkdir secdoc && mv html/assets/demo.db secdoc/demo.db && mv html/assets/ajax/secdoc.conf.php secdoc/secdoc.conf.php
RUN rm html/install.php && mkdir secdoc temp && mv html/assets/demo.db secdoc/demo.db && mv html/assets/ajax/secdoc.conf.php secdoc/secdoc.conf.php
RUN mkdir secdoc/PDF secdoc/inc secdoc/sessions
RUN chmod -R 755 secdoc & chown -R www-data secdoc
RUN chmod -R 755 secdoc && chown -R www-data secdoc && chmod -R 755 temp && chown -R www-data temp
# Install dependencies with composer
WORKDIR /var/www/html/assets
RUN composer install
......
......@@ -287,11 +287,12 @@
$mpdf->WriteHTML($style,1);
# Ersetzungen durchführen
$lastEditor = $dbcon->getHistorie($verfahrensId)[0];
$lastEditor = !empty($lastEditor['Anzeigename']) ? $lastEditor['Anzeigename'] : $lastEditor['Kennung'];
$lastUpdate = $dbcon->getHistorie($verfahrensId)[0];
$lastEditor = !empty($lastUpdate['Anzeigename']) ? $lastUpdate['Anzeigename'] : $lastUpdate['Kennung'];
$html = str_replace('$lasteditor$', $lastEditor, $html);
$html = str_replace('$docurl$', $prog_url . "?id=$verfahrensId", $html);
$html = str_replace('$baseurl$', $prog_url, $html);
$html = str_replace('$lastedited$', $lastUpdate['Datum'], $html);
# Revisionen holen und einfügen
$revisionsHTML = <<<EOH
......
......@@ -40,7 +40,7 @@ function getCombinedPDF() {
pdfBuffer[i] = pdfData.charCodeAt(i);
}
let blob = new Blob([pdfBuffer], {type: "application/pdf"});
let lastUpdate = new Date(); // Safari benötigt das Format YYYY-MM-DDTHH:MM:SS (mit T)
let lastUpdate = new Date();
let fileTitle = 'SecDoc_VVT_' + lastUpdate.getFullYear() + ('0' + (lastUpdate.getMonth() + 1)).slice(-2) + ('0' + lastUpdate.getDate()).slice(-2) + ('0' + lastUpdate.getHours()).slice(-2) + ('0' + lastUpdate.getMinutes()).slice(-2) + '.pdf';
// PDF-Anzeige starten (Unterscheidung, ob Edge genutzt wird)
......@@ -84,7 +84,7 @@ function getCompletePDF(docId) {
pdfBuffer[i] = pdfData.charCodeAt(i);
}
let blob = new Blob([pdfBuffer], {type: "application/pdf"});
let lastUpdate = new Date(); // Safari benötigt das Format YYYY-MM-DDTHH:MM:SS (mit T)
let lastUpdate = new Date();
let typeName = {1: 'Verarbeitungstätigkeit', 2: 'IT-Verfahren', 3: 'Fachapplikation', 4: 'Übergreifende_Massnahme'};
let fileTitle = 'SecDoc_' + typeName[data['data']['type']] + '_(komplett)_' + docId + '_' + data['data']['title'].substr(0, 30) + '_' + lastUpdate.getFullYear() + ('0' + (lastUpdate.getMonth() + 1)).slice(-2) + ('0' + lastUpdate.getDate()).slice(-2) + ('0' + lastUpdate.getHours()).slice(-2) + ('0' + lastUpdate.getMinutes()).slice(-2);
fileTitle = fileTitle.replace(/[/\\?%*:|"<>\.,;=\s]/g, '_');
......@@ -141,6 +141,8 @@ function loadTables(tier) {
for(var c=0; c < data['count']; c++) {
if(parseInt(data['data'][c]['Typ']) !== tier) continue;
let lastUpdate = data['data'][c]['Aktualisierung'] ? formatDate(new Date(data['data'][c]['Aktualisierung'].replace(' ', 'T'))) : 'Unbekannt';
var newEntry = $('<tr></tr>');
newEntry.append('<td style="width: 16px;"></td>');
newEntry.append('<td>' + data['data'][c]['Bezeichnung'] + ' <i data-toggle="tooltip" class="fa fa-info-circle" title="' + data['data'][c]['Beschreibung'] + '"></i></td>');
......@@ -148,7 +150,7 @@ function loadTables(tier) {
newEntry.append('<td>' + (data['data'][c]['FachKontakt'] ? data['data'][c]['FachKontakt'] : '-- nicht angegeben --') + '</td>');
newEntry.append('<td>' + (data['data'][c]['TechKontakt'] ? data['data'][c]['TechKontakt'] : '-- nicht angegeben --') + '</td>');
newEntry.append('<td>' + data['data'][c]['Erstelldatum'] + '</td>');
newEntry.append('<td>' + data['data'][c]['Aktualisierung'] + ' <i class="fa fa-history cursor-progress revisionload" data-id="' + data['data'][c]['ID'] + '"></i></td>');
newEntry.append('<td>' + lastUpdate + ' <i class="fa fa-history cursor-progress revisionload" data-id="' + data['data'][c]['ID'] + '"></i></td>');
newEntry.append('<td><textarea class="form-control comment" data-id="' + data['data'][c]['ID'] + '" style="resize: both;">' + htmlDecode(data['data'][c]['DSBKommentar']) + '</textarea></td>');
newEntry.append('<td><div class="btn-group inline"><a class="btn" href="?id=' + data['data'][c]['ID'] + (debug ? '&debug=true' : '') + '" target="_blank"><i class="fa fa-edit"></i> Bearbeiten</a><a class="btn" href="?copy=' + data['data'][c]['ID'] + (debug ? '&debug=true' : '') + '" target="_blank"><i class="fa fa-copy"></i> Kopieren</a><button type="button" class="btn pdfdownload" data-id="' + data['data'][c]['ID'] + '" ' + (data['data'][c]['PDF'] ? '' : 'disabled') + '><i class="fa fa-file-pdf-o"></i> ' + (parseInt(data['data'][c]['Status']) === 0 ? 'Letzte abgeschlossene PDF anzeigen' : 'PDF anzeigen') + '</button></div> <button type="button" data-id="' + data['data'][c]['ID'] +'" data-name="' + data['data'][c]['Bezeichnung'] +'" class="btn del btn-danger"><i class="fa fa-minus"></i> Löschen</button></td>');
......
......@@ -204,6 +204,29 @@ function formatBytes(bytes, decimals = 2) {
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
/**
* Datum in ein gut lesbares Format bringen.
* @param {Date} dateToFormat Datumsobjekt
* @return {String} Gut lesbares Datum als String
*/
function formatDate(dateToFormat) {
let currDate = new Date();
let formattedDate = '';
if(dateToFormat.getFullYear() === currDate.getFullYear() && dateToFormat.getMonth() === currDate.getMonth()) {
if(dateToFormat.getDate() === currDate.getDate()) formattedDate = 'Heute ';
if(dateToFormat.getDate() === (currDate.getDate() - 1)) formattedDate = 'Gestern ';
formattedDate += ('0' + dateToFormat.getHours()).slice(-2) + ':' + ('0' + dateToFormat.getMinutes()).slice(-2) + ':' + ('0' + dateToFormat.getSeconds()).slice(-2);
}
else {
let dateOptions = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };
formattedDate = dateToFormat.toLocaleDateString('de-DE', dateOptions);
}
return formattedDate;
}
/**
* Generiert eine Debug-Ausgabe, falls der globale debug-Parameter 'true' ist
* @param {Object} msg Ausgabenachricht (kann null sein) (wird mittels console.log(msg) ausgegeben)
......@@ -223,8 +246,7 @@ function debugLog(msg, obj = null) {
* @returns {undefined}
*/
function setSaveLabel(action, currDate = new Date()) {
var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };
var saveTime = currDate.toLocaleDateString('de-DE', options);
var saveTime = formatDate(currDate);
$('#successLabel, #savingLabel, #failedLabel, #refreshedLabel').addClass('hidden');
switch(action) {
case 'saving':
......
This diff is collapsed.
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