small code cleanup

main
Jonas Lührig 2 years ago
parent 0441d71f41
commit 5ab1feac4f

@ -32,24 +32,10 @@
</div>
</div>
<!-- Dialog to ask user for ICS URL if not specified through GET -->
<div class="dialog-parent <?php hideMissingIcsDialog(); ?>">
<div class="dialog">
<div class="dialog-content">
Es wurde keine ICS URL als GET Parameter &uuml;bergeben.<br>
<br>
<label>Anzuzeigende ICS URL:</label>
<input type="text" form="dialog-form" name="ics_url" />
</div>
<div class="dialog-buttons">
<form id="dialog-form" method="get"></form>
<input type="submit" form="dialog-form" value="OK" />
</div>
</div>
</div>
<?php echoIcsUrlDialog(); ?>
<!-- Renders PHP errors nicely as HTML dialog -->
<?php insertErrorsHtml(); ?>
<?php echoErrorsHtml(); ?>
</body>
<script src="script/dialog.js"></script>

@ -19,21 +19,10 @@
</div>
</div>
<!-- Dialog to ask user for ICS URL if not specified through GET -->
<div class="dialog-parent <?php hideMissingIcsDialog(); ?>">
<div class="dialog">
<div class="dialog-content">
Es wurde keine ICS URL als GET Parameter &uuml;bergeben.<br>
<br>
<label>Anzuzeigende ICS URL:</label>
<input type="text" form="dialog-form" name="icsUrl" />
</div>
<div class="dialog-buttons">
<form id="dialog-form" method="get"></form>
<input type="submit" form="dialog-form" value="OK" />
</div>
</div>
</div>
<?php echoIcsUrlDialog(); ?>
<!-- Renders PHP errors nicely as HTML dialog -->
<?php echoErrorsHtml(); ?>
</body>
<script src="script/dialog.js"></script>

@ -30,7 +30,7 @@ function debug ($text) {
/**
* Echoes HTML code to display all collected error messages
*/
function insertErrorsHtml() {
function echoErrorsHtml() {
global $_ERRORS;
if (count ($_ERRORS) == 0) return;
@ -61,13 +61,29 @@ function insertErrorsHtml() {
}
/**
* Hides the dialog box asking for an ICS URL if one
* was already specified by the user
* Shows a dialog box asking for an ICS URL if one
* was not specified by the user
*/
function hideMissingIcsDialog () {
function echoIcsUrlDialog () {
global $_GET;
if (isset ($_GET["ics_url"]) && $_GET["ics_url"] != "") {
echo "hidden";
if (!isset ($_GET["ics_url"]) || $_GET["ics_url"] == "") {
echo '
<!-- Dialog to ask user for ICS URL if not specified through GET -->
<div class="dialog-parent <?php hideMissingIcsDialog(); ?>">
<div class="dialog">
<div class="dialog-content">
Es wurde keine ICS URL als GET Parameter &uuml;bergeben.<br>
<br>
<label>Anzuzeigende ICS URL:</label>
<input type="text" form="dialog-form" name="ics_url" />
</div>
<div class="dialog-buttons">
<form id="dialog-form" method="get"></form>
<input type="submit" form="dialog-form" value="OK" />
</div>
</div>
</div>
';
}
}
Loading…
Cancel
Save