mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge branch 'dev' of https://github.com/wavelog/wavelog into dev
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
<script type="text/javascript" src="<?php echo base_url() ;?>assets/js/sections/common.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url() ;?>assets/js/sections/eqslcharcounter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url() ;?>assets/js/sections/version_dialog.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url() ;?>assets/js/showdown.min.js"></script>
|
||||
|
||||
<script src="<?php echo base_url(); ?>assets/js/htmx.min.js"></script>
|
||||
|
||||
|
||||
@@ -25,44 +25,45 @@
|
||||
}
|
||||
if ($versionDialogMode == 'release_notes' || $versionDialogMode == 'both' || $versionDialogMode == 'disabled') {
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
$url = 'https://api.github.com/repos/wavelog/wavelog/releases';
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => 'User-Agent: Wavelog - Amateur Radio Logbook'
|
||||
]
|
||||
];
|
||||
$context = stream_context_create($options);
|
||||
$response = file_get_contents($url, false, $context);
|
||||
<div>
|
||||
<?php
|
||||
$url = 'https://api.github.com/repos/wavelog/wavelog/releases';
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => 'User-Agent: Wavelog - Amateur Radio Logbook'
|
||||
]
|
||||
];
|
||||
$context = stream_context_create($options);
|
||||
$response = file_get_contents($url, false, $context);
|
||||
|
||||
if ($response !== false) {
|
||||
$data = json_decode($response, true);
|
||||
if ($response !== false) {
|
||||
$data = json_decode($response, true);
|
||||
|
||||
$current_version=$this->optionslib->get_option('version');
|
||||
if ($data !== null && !empty($data)) {
|
||||
foreach ($data as $singledata) {
|
||||
if ($singledata['tag_name']==$current_version) {
|
||||
$firstRelease = $singledata;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$current_version = $this->optionslib->get_option('version');
|
||||
if ($data !== null && !empty($data)) {
|
||||
foreach ($data as $singledata) {
|
||||
if ($singledata['tag_name'] == $current_version) {
|
||||
$firstRelease = $singledata;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$releaseBody = isset($firstRelease['body']) ? $firstRelease['body'] : 'No release information available';
|
||||
$htmlReleaseBody = htmlspecialchars($releaseBody);
|
||||
$htmlReleaseBodyWithLinks = preg_replace('/(https?:\/\/[^\s<]+)/', '<a href="$1" target="_blank">$1</a>', $htmlReleaseBody);
|
||||
$releaseBody = isset($firstRelease['body']) ? $firstRelease['body'] : 'No release information available';
|
||||
$htmlReleaseBody = htmlspecialchars($releaseBody);
|
||||
$htmlReleaseBodyWithLinks = preg_replace('/(https?:\/\/[^\s<]+)/', '<a href="$1" target="_blank">$1</a>', $htmlReleaseBody);
|
||||
|
||||
$releaseName = isset($firstRelease['name']) ? $firstRelease['name'] : 'No version name information available';
|
||||
echo "<h4>".$releaseName."</h4>";
|
||||
echo nl2br($htmlReleaseBodyWithLinks);
|
||||
$releaseName = isset($firstRelease['name']) ? $firstRelease['name'] : 'No version name information available';
|
||||
echo "<h4>" . $releaseName . "</h4>";
|
||||
echo "<div id='markdownDiv' style='display: none;'>" . $releaseBody . "</div>";
|
||||
echo "<div id='formattedHTMLDiv'></div>";
|
||||
} else {
|
||||
echo 'Error at parsing JSON-Data or got empty result from github.';
|
||||
}
|
||||
} else {
|
||||
echo 'Error at parsing JSON-Data or got empty result from github.';
|
||||
echo 'Error at getting the data from GitHub.';
|
||||
}
|
||||
} else {
|
||||
echo 'Error at getting the data from GitHub.';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -71,7 +72,7 @@
|
||||
<?php
|
||||
if ($versionDialogMode !== 'disabled') {
|
||||
?>
|
||||
<button class="btn btn-secondary" onclick="dismissVersionDialog()" data-bs-dismiss="modal"><?php echo lang('options_version_dialog_dismiss'); ?></button>
|
||||
<button class="btn btn-secondary" onclick="dismissVersionDialog()" data-bs-dismiss="modal"><?php echo lang('options_version_dialog_dismiss'); ?></button>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -19,7 +19,15 @@ $('#version_dialog_mode').on('change', function () {
|
||||
showCustomTextarea();
|
||||
});
|
||||
|
||||
// JavaScript-Funktion displayVersionDialog für Bootstrap 5
|
||||
function markdownToHTML() {
|
||||
var markdownContent = $('#markdownDiv').text();
|
||||
var converter = new showdown.Converter({
|
||||
simplifiedAutoLink: true
|
||||
});
|
||||
var html = converter.makeHtml(markdownContent);
|
||||
$('#formattedHTMLDiv').html(html);
|
||||
}
|
||||
|
||||
function displayVersionDialog() {
|
||||
|
||||
$.ajax({
|
||||
@@ -29,13 +37,12 @@ function displayVersionDialog() {
|
||||
success: function(data) {
|
||||
$('body').append(data);
|
||||
|
||||
// Aktiviere das Bootstrap-Modal
|
||||
var versionDialogModal = new bootstrap.Modal(document.getElementById('versionDialogModal'));
|
||||
versionDialogModal.show();
|
||||
markdownToHTML();
|
||||
},
|
||||
error: function() {
|
||||
// Behandlung von Fehlern
|
||||
console.log('Fehler beim Laden der PHP-Datei.');
|
||||
console.log('Error loading the versiondialog view.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
3
assets/js/showdown.min.js
vendored
Normal file
3
assets/js/showdown.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/js/showdown.min.js.map
Normal file
1
assets/js/showdown.min.js.map
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user