first changes to docker

This commit is contained in:
jt-chris
2026-04-10 02:25:36 +02:00
parent 1c94d0d810
commit 615cf26bdd
114 changed files with 65043 additions and 0 deletions

View File

@@ -0,0 +1,408 @@
<?php
if (isset($_COOKIE['NAS_USER']) && isset($_COOKIE['NAS_SID'])) {
$context = stream_context_create(array('ssl'=>array(
'verify_peer' => false,
'verify_peer_name' => false
)));
libxml_set_streams_context($context);
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://127.0.0.1:$_SERVER[SERVER_PORT]/cgi-bin/authLogin.cgi?sid=".$_COOKIE['NAS_SID'];
$xml = simplexml_load_file($url);
unset($context);
if ( (false === $xml) || !isset($xml->authPassed) || !isset($xml->username) || !isset($xml->isAdmin) ) {
die('Unable to retrieve xml authentication info from your qnap device.');
}
if ( !(bool)(int)$xml->authPassed[0] || !(bool)(int)$xml->isAdmin[0] || (string)$xml->username[0] !== $_COOKIE['NAS_USER']) {
die('No authentic session id of an admin user!');
}
} else {
die('Not logged in!');
}
$ContributorsManual = array(
array(
'login' => 'RoonLabs',
'avatar_url' => 'https://avatars2.githubusercontent.com/u/15744118?v=4',
'html_url' => 'https://github.com/RoonLabs',
'description' => 'For the continuous support and help.'
),
array(
'login' => 'QNAP',
'avatar_url' => 'https://www.qnap.com/i/images/q_logo.jpg',
'html_url' => 'https://www.qnap.com',
'description' => ''
),
array(
'login' => 'marianoglas',
'avatar_url' => 'https://avatars0.githubusercontent.com/u/5198307?v=4',
'html_url' => 'https://github.com/marianoglas',
'description' => 'For your help with the API and AJAX.'
),
array(
'login' => 'Ignaas Vanden Poel',
'description' => 'Dutch translation'
),
array(
'login' => 'Aldewin Bedoya',
'description' => 'Spanish translation'
)
);
?>
<div class="modal-header">
<h4 id="modal-title" class="modal-title"><?php echo localize("MODAL_ABOUT_HEADLINE"); ?></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div id="modal-body" class="modal-body modal-content">
<div class="container">
<div id="cr">
<img src="img/cr_logo.svg" width="70px" height="70px"><br>
Copyright 2016-<?php echo date("Y"); ?> Christopher Rieke<br>
<a href="https://roononnas.org" target="_blank">roononnas.org</a>
</div><br><br>
<div style="border: 5px; padding: 10px; text-align: center; border-style: dotted;">
<?php echo localize("MODAL_ABOUT_COFFEE"); ?>
<div style="text-align: center; font-size: 50px;">
<span class="fa-layers fa-fw">
<i class="fas fa-coffee" data-fa-transform="shrink-8" data-fa-mask="fas fa-circle"></i>
<i class="far fa-heart" style="color: #000000" data-fa-transform="shrink-12.5w left-0.5 up-0.8"></i>
</span>
</div>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<div style="text-align: center;">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="27D9FUZPC3JNC">
<input type="hidden" name="lc" value="<?php echo substr(localize("SYSTEM_LOCALE"), -2); ?>">
<input type="image"
src="https://www.paypalobjects.com/<?php echo localize("SYSTEM_LOCALE"); ?>/i/btn/btn_donate_SM.gif"
border="0"
name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1"
height="1">
</form>
</div>
</div>
<br><br>
<div id="about-github" style="background-color: #d7d7d7; padding: 20px; text-align: center;">
<div>
<?php echo localize("MODAL_ABOUT_GITHUB"); ?><br>
<div style="text-align: center; font-size: 50px;">
<i class="fab fa-github-alt"></i>
</div>
</div>
<div class="row" style="justify-content: center; align-items: center; text-align: center;">
<button id="btnFA" class="btn btn-primary"
onclick="window.open('https://github.com/crieke/RoonServer_QNAP_Installer')">
<i class="fab fa-github"></i>
<?php echo localize("MODAL_ABOUT_BTN_GITHUB"); ?><br>
</button>
</div>
</div>
<br><br>
<h4><?php echo localize("MODAL_ABOUT_THANKS"); ?>:</h4><br>
<div id="contrib"></div>
<script>
var manualContrib = JSON.parse('<?php echo json_encode($ContributorsManual)?>');
$(document).ready(function () {
$('#contrib').html('<div class="fa-4x text-center" style="text-align: center;"><svg id="loading" width="70" height="70"></svg></div>');
var repo = 'https://api.github.com/repos/crieke/RoonServer_QNAP_Installer/contributors';
requestJSON(repo, function (json) {
var gitAndManual = json.concat(manualContrib);
var outhtml = '<ul class=\"media-list\">';
jQuery.each(gitAndManual, function (i, obj) {
// else we have a user and we display their info
var username = obj.login;
var aviurl = obj.avatar_url;
var userprofile = obj.html_url;
var contr = obj.contributions;
var descrText = obj.description;
if (aviurl == undefined) {
aviurl = 'assets/identicon.php?string=' + username;
}
outhtml = outhtml + '<li id="contriblist" class="media contriblist">';
outhtml = outhtml + '<span class="pull-left">';
if (userprofile != undefined) {
outhtml = outhtml + '<a href="' + userprofile + '" target="_blank">';
}
outhtml = outhtml + '<img class="media-object d-block" style="max-height: 80px" src="' + aviurl + '" alt="...">';
if (userprofile != undefined) {
outhtml = outhtml + '</a>';
}
outhtml = outhtml + '</span>';
outhtml = outhtml + '<div class="media-body" style="padding-left: 15px; display:inline;">';
if (userprofile != undefined) {
outhtml = outhtml + '<a href="' + userprofile + '" target="_blank">';
}
outhtml = outhtml + '<h4 class="media-heading">' + username + '</h4>';
if (userprofile != undefined) {
outhtml = outhtml + '</a>';
}
if (contr != undefined) {
outhtml = outhtml + '<div style="ghicon"><i class="fab fa-github"></i>-Contributions: ' + contr + '</div>';
}
if (descrText != undefined) {
outhtml = outhtml + '<p> ' + descrText + '</p>';
}
outhtml = outhtml + '</div>';
outhtml = outhtml + '</li>';
}); // end each
outhtml = outhtml + '</ul>';
function outputPageContent() {
$('#contrib').html(outhtml);
} // end outputPageContent()
outputPageContent();
}); // end requestJSON Ajax call
}); // end click event handler
function requestJSON(url, callback) {
$.ajax({
url: url,
complete: function (xhr) {
callback.call(null, xhr.responseJSON);
}
});
}
var s = Snap("#loading");
var svgSize = 70;
var RoonCircle = s.circle(svgSize / 2, svgSize / 2, svgSize / 2);
var maskRect = s.paper.rect(0, 0, svgSize / 2, svgSize);
maskRect.attr({
fill: "#fff"
});
RoonCircle.attr({
mask: maskRect
});
linespacing = svgSize / 100 * 5;
centerpoint = svgSize / 2;
linew = svgSize / 100 * 5;
line1h = svgSize / 100 * 90;
line2h = svgSize / 100 * 40;
line3h = svgSize / 100 * 60;
line4h = svgSize / 100 * 22;
var line1 = s.rect(centerpoint + (0 * (linew + linespacing)) + linespacing, centerpoint - (line1h / 2), linew, line1h);
var line2 = s.rect(centerpoint + (1 * (linew + linespacing)) + linespacing, centerpoint - (line2h / 2), linew, line2h);
var line3 = s.rect(centerpoint + (2 * (linew + linespacing)) + linespacing, centerpoint - (line3h / 2), linew, line3h);
var line4 = s.rect(centerpoint + (3 * (linew + linespacing)) + linespacing, centerpoint - (line4h / 2), linew, line4h);
function cw($c_height) {
var $arr = new Array();
$arr['y'] = (centerpoint - ($c_height / 2) / 100 * svgSize);
$arr['height'] = $c_height / 100 * svgSize;
return $arr;
}
function roonAnimate() {
line1.animate(
cw(52), 200, function () {
this.animate(
cw(96), 200, function () {
this.animate(
cw(80), 240, function () {
this.animate(
cw(86), 200, function () {
this.animate(
cw(92), 40, function () {
this.animate(
cw(86), 40, function () {
this.animate(
{
height: svgSize / 100 * 90,
y: svgSize / 100 * 5
}, 40
)
}
)
}
)
}
)
}
)
}
)
}
);
line2.animate(
cw(76), 280, function () {
this.animate(
cw(30), 200, function () {
this.animate(
cw(50), 240, function () {
this.animate(
cw(55), 120, function () {
this.animate(
cw(57), 40, function () {
this.animate(
cw(40), 40, function () {
this.animate(
{
height: svgSize / 100 * 60,
y: svgSize / 100 * 20
}, 40
)
}
)
})
})
})
})
});
line3.animate(
cw(63), 120, function () { // 3 frames
this.animate(
cw(30), 240, function () { // 6 frames
this.animate(
cw(70), 200, function () { //5 frames
this.animate(
cw(54), 240, function () { // 6 frames
this.animate(
cw(56), 40, function () { //1 frame
this.animate(
cw(42), 40, function () { // 1 frame
this.animate(
cw(58), 40), function () {
this.animate(
{
height: svgSize / 100 * 22,
y: svgSize / 100 * 56
}, 40
)
}
})
})
})
})
})
});
line4.animate(
cw(14), 200, function () {
this.animate(
cw(26), 200, function () {
this.animate(
cw(8), 240, function () {
this.animate(
cw(20), 200, function () {
this.animate(
cw(62), 40, function () {
this.animate(
cw(24), 40, function () {
this.animate(
{
height: svgSize / 100 * 40,
y: svgSize / 100 * 30
}, 40
)
}
)
}
)
}
)
}
)
}
)
}
);
}
roonAnimate();
setInterval(roonAnimate, 1000);
</script>
<br>
<br>
<br>
<?php
// USED ASSETS AND LIBRARIES
echo localize("MODAL_ABOUT_ASSETS"); ?><br><br>
<ul class="list-group list-group-flush">
<?php $assetList = array(
array(
'assetName' => 'Bootstrap',
'author' => 'Twitter',
'href' => 'https://github.com/twbs/bootstrap',
'license' => 'MIT'
),
array(
'assetName' => 'Popper.js',
'author' => 'Federico Zivolo',
'href' => 'https://github.com/FezVrasta/popper.js',
'license' => 'MIT'
),
array(
'assetName' => 'Jquery',
'author' => 'JS Foundation',
'href' => 'http://jquery.com',
'license' => 'MIT'
),
array(
'assetName' => 'Gijgo Tree',
'author' => 'Atanas Atanasov',
'href' => 'https://github.com/atatanasov/gijgo',
'license' => 'MIT'
),
array(
'assetName' => 'Fontawesome',
'author' => 'Fort Awesome',
'href' => 'https://fontawesome.com',
'license' => 'MIT, CC'
),
array(
'assetName' => 'Fontawesome Animation',
'author' => 'Louis LIN',
'href' => 'https://github.com/l-lin/font-awesome-animation',
'license' => 'MIT'
),
array(
'assetName' => 'Snap.svg',
'author' => 'Adobe',
'href' => 'https://github.com/adobe-webplatform/Snap.svg',
'license' => 'Apache 2.0'
)
);
$usedAssets = '<ul class="media-list">';
foreach ($assetList as $singleAsset) {
$usedAssets = $usedAssets . '<li class="list-group-item"><b><a href="' . $singleAsset['href'] . '" target="_blank">' . $singleAsset['assetName'] . '</a></b> ' . localize("MODAL_ABOUT_BY") . ' ' . $singleAsset['author'] . '<br>' . localize("MODAL_ABOUT_LICENSE") . ': ' . $singleAsset['license'] . '</li>';
}
$usedAssets = $usedAssets . '</ul>';
echo $usedAssets;
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary"
data-dismiss="modal"><?php echo localize("BTN_CLOSE"); ?></button>

View File

@@ -0,0 +1,186 @@
<?php
if (isset($_COOKIE['NAS_USER']) && isset($_COOKIE['NAS_SID'])) {
$context = stream_context_create(array('ssl'=>array(
'verify_peer' => false,
"verify_peer_name"=>false
)));
libxml_set_streams_context($context);
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://127.0.0.1:$_SERVER[SERVER_PORT]/cgi-bin/authLogin.cgi?sid=".$_COOKIE['NAS_SID'];
$xml = simplexml_load_file($url);
unset($context);
if ( (false === $xml) || !isset($xml->authPassed) || !isset($xml->username) || !isset($xml->isAdmin) ) {
die('Unable to retrieve xml authentication info from your qnap device.');
}
if ( !(bool)(int)$xml->authPassed[0] || !(bool)(int)$xml->isAdmin[0] || (string)$xml->username[0] !== $_COOKIE['NAS_USER']) {
die('No authentic session id of an admin user!');
}
} else {
die('Not logged in!');
}
include_once("/home/httpd/cgi-bin/qpkg/RoonServer/__include.php");
include_once("/home/httpd/cgi-bin/qpkg/RoonServer/__functions.php");
?>
<div class="container">
<div class="roon-template">
<h1><?php echo localize("OVERVIEW_HEADLINE"); ?></h1>
<p class="lead"><?php echo localize("OVERVIEW_TEXT1"); ?><br>
<?php echo localize("OVERVIEW_TEXT2"); ?></p>
<div class="row">
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<span class="fa-stack fa-2x">
<i class="fa fa-circle fa-stack-2x" style="color: #222222;"></i>
<img src="img/roonIcon.svg" alt="Roon Icon" style="height: 35px;" class="fa-stack-1x fa-inverse">
</span>
<h5 class="card-title">Roon Server</h5>
<p class="card-text">
<b><?php echo localize("OVERVIEW_ROONSERVER_PANEL_STATUS"); ?>
:</b> <?php if (isRunning()) {
echo '<span data-toggle="tooltip" title="' . localize("OVERVIEW_ROONSERVER_PANEL_PID") .': ' . isRunning("getpid") . '" style="color: green;">' . localize("OVERVIEW_ROONSERVER_PANEL_STATUS_RUNNING") . '</span>';
} else {
echo '<span style="color: red;">' . localize("OVERVIEW_ROONSERVER_PANEL_STATUS_STOPPED") . '</span>';
} ?><br>
<b><?php echo localize("OVERVIEW_ROONSERVER_PANEL_VERSION"); ?>
:</b> <?php echo $RoonVersion[1]; ?><br>
<b><?php echo localize("OVERVIEW_ROONSERVER_PANEL_QPKG_VERSION"); ?>
:</b> <?php echo $qpkg_conf['RoonServer']['Version']; ?><br>
<b><?php echo "ffmpeg"; ?>
:</b>
<span id="ffmpeg" class="getModal" data-toggle="tooltip" title="<?php echo localize("OVERVIEW_ROONSERVER_PANEL_VERSION");?>: <?php echo $ffmpegVersion; ?>"><button class="btn btn-xs btn-outline-dark"><i style="color:#aaaaaa;" class="fas fa-cog"></i> <?php echo $customFfmpeg ? localize('MODAL_FFMPEG_USER_SUPPLIED_VERSION') : localize('MODAL_FFMPEG_SYSTEM_DEFAULT'); ?></button></span>
</p>
<h5><?php echo localize("OVERVIEW_ROONSERVER_PANEL_SUBHEAD_DATABASE"); ?></h5>
<span data-toggle="tooltip" title="<?php echo $dblocation; ?>">
<b><?php echo localize("OVERVIEW_ROONSERVER_PANEL_LOCATION"); ?>: </b><?php echo $dblocation; ?>
</span>
<div class="progress" style="height: 20px;">
<div class="progress-bar" role="progressbar" style="width: <?php echo $db_perc ?>%;" aria-valuenow="<?php echo(100 - $db_perc) ?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<p>
<?php echo $db_perc . '% ' . localize("OVERVIEW_ROONSERVER_PANEL_SPACE_OF") . ' ' . displayStorage($db_vol_cap) . ' ' . localize("OVERVIEW_ROONSERVER_PANEL_SPACE_USED") . '.'; ?>
</p>
<span id="log" class="getModal">
<a href="#"
class="btn btn-light btn-icon float-left"
data-toggle="tooltip"
title="<?php echo localize("MODAL_LOGFILES_ICON_TOOLTIP"); ?>">
<i class="fas fa-ambulance"></i>
</a>
</span>
<span id="setStorage" class="getModal">
<a href="#"
class="btn btn-primary float-right"
data-toggle="tooltip"
title="<?php echo localize("OVERVIEW_ROONSERVER_PANEL_CHANGE_DB_LOCATION_TOOLTIP"); ?>">
<?php echo localize("OVERVIEW_ROONSERVER_PANEL_CHANGE_DB_LOCATION"); ?>
</a>
</span>
<span id="reinstall" class="getModal">
<a href="#"
class="btn btn-light btn-icon float-left"
data-toggle="tooltip"
title="<?php echo localize("MODAL_REINSTALL_ICON_TOOLTIP"); ?>">
<i class="fas fa-box-open"></i>
</a>
</span>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<?php if (!$multimediaDisabled) {
echo '<span class="fa-stack fa-2x">' .
'<i class="fa fa-circle fa-stack-2x" style="color: #222222;"></i>' .
'<i class="fas fa-volume-up fa-stack-1x fa-inverse"></i>' .
'</span>';
} else {
echo '<span class="fa-stack fa-2x">' .
'<i class="fa fa-circle fa-stack-2x" style="color: #dddddd;"></i>' .
'<i class="fas fa-volume-off fa-stack-1x fa-inverse" data-fa-transform="left-3"></i>' .
'<i class="fas fa-times fa-stack-1x fa-inverse" data-fa-transform="shrink-10 right-5" ></i>' .
'</span>';
}
?>
<h5 class="card-title"><?php
if (!$multimediaDisabled) {
echo localize("OVERVIEW_AUDIO_PANEL_HEADLINE");
} else {
echo localize("OVERVIEW_AUDIO_PANEL_NO_MULTIMEDIA_HEADLINE");
}
?></h5>
<?php
if (!$multimediaDisabled) {
if (!$multimedia_disabled_on_start) {
echo '<ul class="list-group">' .
acardsNice() .
'</ul><br>' .
'<span id="alsa" class="getModal">' .
'<a href="#" ' .
'class="btn btn-primary" ' .
'data-toggle="tooltip" ' .
'data-html="true" ' .
'title="' . localize("OVERVIEW_AUDIO_PANEL_BTN_AUDIO_DEVICES_TOOLTIP") . '">' .
'<i class="fas fa-eye"></i> ' . localize("OVERVIEW_AUDIO_PANEL_BTN_AUDIO_DEVICES") .
'</a>' .
'</span>';
} else {
echo localize("OVERVIEW_AUDIO_PANEL_NO_MULTIMEDIA_DESCRIPTION2");
echo '<div id="restartRoonServerAudioPanel">'.
'<a id="restartRoonServer" href="#" onclick="restartRoonServerAndRefresh()"></p>' .
'<div class="fa-4x text-center" style="text-align: center;"><p>' .
'<span class="fa-layers fa-fw">' .
'<i class="fas fa-circle"></i>' .
'<i class="fa-inverse fas fa-redo-alt faa-shake animated" data-fa-transform="shrink-8"></i>' .
'</span></p>' .
'</div>' .
'<div class="text-center">' .
str_replace("'", "\'", localize("MODAL_SETUP_RESTART_ROONSERVER")) .
'</div>' .
'</a>'.
'</div>';
}
} else {
echo localize("OVERVIEW_AUDIO_PANEL_NO_MULTIMEDIA_DESCRIPTION1");
} ?>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var dbexist = <?php if (isset($dblocation)) {
echo "true";
} else {
echo "false";
} ?>;
// Enable Tooltips
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
// Action when button for Modal is clicked
$('.getModal').on('click', function (e) {
// Hide Tooltips when modal opens
$(function () {
$('[data-toggle="tooltip"]').tooltip('dispose')
});
// Check which button fired
e.preventDefault();
var modalContent = $(this).attr('id');
$('#modal-content').load("modals.php?s=" + modalContent);
// Request Modal with content
$('#modal').modal('show');
return false;
});
</script>

View File

@@ -0,0 +1,58 @@
<?php
if (isset($_COOKIE['NAS_USER']) && isset($_COOKIE['NAS_SID'])) {
$context = stream_context_create(array('ssl'=>array(
'verify_peer' => false,
'verify_peer_name' => false
)));
libxml_set_streams_context($context);
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://127.0.0.1:$_SERVER[SERVER_PORT]/cgi-bin/authLogin.cgi?sid=".$_COOKIE['NAS_SID'];
$xml = simplexml_load_file($url);
unset($context);
if ( (false === $xml) || !isset($xml->authPassed) || !isset($xml->username) || !isset($xml->isAdmin) ) {
die('Unable to retrieve xml authentication info from your qnap device.');
}
if ( !(bool)(int)$xml->authPassed[0] || !(bool)(int)$xml->isAdmin[0] || (string)$xml->username[0] !== $_COOKIE['NAS_USER']) {
die('No authentic session id of an admin user!');
}
} else {
die('Not logged in!');
}
?>
<div class="roon-template">
<span class="fa-stack fa-8x">
<i class="fa fa-circle fa-stack-1x" style="color: #222222;"></i>
<img src="img/roonIcon.svg" alt="Roon Icon" style="height: 70px;" class="fa-stack-2x fa-inverse">
</span>
<h1><?php echo localize("SETUP_HEADLINE"); ?></h1>
<p class="lead"><?php echo localize("SETUP_DESCRIPTION_1"); ?><br><?php echo localize("SETUP_DESCRIPTION_2"); ?></p>
<button type="button" id="setStorage" class="getModal btn btn-primary"><?php echo localize("SETUP_BTN_CONFIGURE"); ?>
</button>
</div>
<script>
var dbexist = <?php if (isset($dblocation)) {
echo "true";
} else {
echo "false";
} ?>;
// Action when button for Modal is clicked
$('.getModal').on('click', function(e) {
// Check which button fired
e.preventDefault();
var modalContent = $(this).attr('id');
$('#modal-content').load("modals.php?s=" + modalContent);
//$('#modal-body').load("modals.php?s=" + modalContent + "&r=DESCRIPTION");
// Request Modal with content
//Open Modal
$('#modal').modal('show');
return false;
});
</script>

View File

@@ -0,0 +1,144 @@
<?php
if (isset($_COOKIE['NAS_USER']) && isset($_COOKIE['NAS_SID'])) {
$context = stream_context_create(array('ssl'=>array(
'verify_peer' => false,
'verify_peer_name' => false
)));
libxml_set_streams_context($context);
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://127.0.0.1:$_SERVER[SERVER_PORT]/cgi-bin/authLogin.cgi?sid=".$_COOKIE['NAS_SID'];
$xml = simplexml_load_file($url);
unset($context);
if ( (false === $xml) || !isset($xml->authPassed) || !isset($xml->username) || !isset($xml->isAdmin) ) {
die('Unable to retrieve xml authentication info from your qnap device.');
}
if ( !(bool)(int)$xml->authPassed[0] || !(bool)(int)$xml->isAdmin[0] || (string)$xml->username[0] !== $_COOKIE['NAS_USER']) {
die('No authentic session id of an admin user!');
}
} else {
die('Not logged in!');
}
include_once("/home/httpd/cgi-bin/qpkg/RoonServer/__include.php");
include_once("/home/httpd/cgi-bin/qpkg/RoonServer/__functions.php");
?>
<script type="text/javascript">
var json_obj = <?php echo json_encode(getTreeRoot($strSessionID)); ?>;
</script>
<div class="modal-header">
<h4 id="modal-title" class="modal-title"><?php echo localize("MODAL_SETUP_HEADLINE"); ?></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div id="modal-body" class="modal-body modal-content">
<div class="container">
<!-- Placed at the end of the document so the pages load faster -->
<div class="container-fluid">
<div id="tree" style="overflow-y:scroll;"></div>
</div>
<script>
var newdbpath = "";
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
var tree;
tree = $('#tree').tree({
dataSource: json_obj,
hasChildrenField: 'anychildren',
iconsLibrary: 'fontawesome',
imageCssClassField: 'faCssClass',
uiLibrary: 'bootstrap4',
icons: {
expand: '<i class="fas fa-angle-right" />',
collapse: '<i class="fas fa-angle-down" />'
}
});
tree.on('select', function (e, node, id) {
var nodeData = tree.getDataById(id);
newdbpath = nodeData['path'];
$('#dblocform').val(newdbpath);
$('#btn_save').prop("disabled", false);
$('#btn_save').removeClass('disabled');
});
tree.on('unselect', function () {
$('#dblocform').val('<?php if (isset($dblocation)) {
echo $dblocation;
} else {
echo localize("MODAL_SETUP_FORM_NO_FOLDER_SELECTED");
} ?>');
$('#btn_save').prop("disabled", true);
$('#btn_save').addClass('disabled');
});
// Actions when expanding an item
tree.on('expand', function (e, node, id) {
var nodeData = tree.getDataById(id);
anychildren = nodeData['anychildren'];
if (anychildren) {
var path = encodeURIComponent(nodeData['path']);
var action = 'gettree';
var strUrl = '<?php echo NASHOST;?>/cgi-bin/qpkg/RoonServer/ajax/ajax.php?a=' + action + '&t=' + path;
$.ajax({
url: strUrl,
dataType: 'json',
success: function (cb_data) {
nodechildren = tree.getChildren(node);
nodechildren.forEach(function (entry) {
tree.removeNode(entry);
});
cb_data.forEach(function (entry) {
tree.addNode(entry, node);
});
}
});
}
});
</script>
<div class="row">
<div class="col-lg-offset-3 col-lg-12">
<div class="input-group">
<span class="input-group-btn">
<span class="form form-control"
style="background: #F5F5F5; border-radius: 0.25em 0 0 0.25em !important;"
readonly><?php echo localize("MODAL_SETUP_DB_LOCATION"); ?></span>
</span>
<input id="dblocform" type="text" class="form-control" style="background: #ffffff;" value="<?php
if (isset($dblocation)) {
echo $dblocation;
} else {
echo localize("MODAL_SETUP_FORM_NO_FOLDER_SELECTED");
} ?>" readonly>
<span class="input-group-btn">
<button id="btn_save" class="btn btn-secondary disabled" onclick="db_save_button()"
disabled="disabled" formmethod="post" type="submit"
style="background: #007bff;"><?php echo localize("BTN_SAVE"); ?>
</button>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal"><?php echo localize("BTN_CLOSE"); ?></button>