small code cleanup

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

@ -32,24 +32,10 @@
</div> </div>
</div> </div>
<!-- Dialog to ask user for ICS URL if not specified through GET --> <?php echoIcsUrlDialog(); ?>
<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>
<!-- Renders PHP errors nicely as HTML dialog --> <!-- Renders PHP errors nicely as HTML dialog -->
<?php insertErrorsHtml(); ?> <?php echoErrorsHtml(); ?>
</body> </body>
<script src="script/dialog.js"></script> <script src="script/dialog.js"></script>

@ -19,21 +19,10 @@
</div> </div>
</div> </div>
<!-- Dialog to ask user for ICS URL if not specified through GET --> <?php echoIcsUrlDialog(); ?>
<div class="dialog-parent <?php hideMissingIcsDialog(); ?>">
<div class="dialog"> <!-- Renders PHP errors nicely as HTML dialog -->
<div class="dialog-content"> <?php echoErrorsHtml(); ?>
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>
</body> </body>
<script src="script/dialog.js"></script> <script src="script/dialog.js"></script>

@ -30,7 +30,7 @@ function debug ($text) {
/** /**
* Echoes HTML code to display all collected error messages * Echoes HTML code to display all collected error messages
*/ */
function insertErrorsHtml() { function echoErrorsHtml() {
global $_ERRORS; global $_ERRORS;
if (count ($_ERRORS) == 0) return; if (count ($_ERRORS) == 0) return;
@ -61,13 +61,29 @@ function insertErrorsHtml() {
} }
/** /**
* Hides the dialog box asking for an ICS URL if one * Shows a dialog box asking for an ICS URL if one
* was already specified by the user * was not specified by the user
*/ */
function hideMissingIcsDialog () { function echoIcsUrlDialog () {
global $_GET; global $_GET;
if (isset ($_GET["ics_url"]) && $_GET["ics_url"] != "") { if (!isset ($_GET["ics_url"]) || $_GET["ics_url"] == "") {
echo "hidden"; 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