diff options
Diffstat (limited to 'modules-available/locationinfo')
5 files changed, 184 insertions, 2 deletions
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php index d5fec3aa..0a391a83 100644 --- a/modules-available/locationinfo/inc/locationinfo.inc.php +++ b/modules-available/locationinfo/inc/locationinfo.inc.php @@ -121,6 +121,10 @@ class LocationInfo 'urllist' => '', 'insecure-ssl' => 0, 'reload-minutes' => 0, + 'split-login' => 0, + 'browser' => 'slx-browser', + 'interactive' => 0, + 'bookmarks' => '', ); } return array(); diff --git a/modules-available/locationinfo/lang/de/template-tags.json b/modules-available/locationinfo/lang/de/template-tags.json index b63ffc5a..c7875cc5 100644 --- a/modules-available/locationinfo/lang/de/template-tags.json +++ b/modules-available/locationinfo/lang/de/template-tags.json @@ -4,10 +4,15 @@ "lang_autoscaleTooltip": "Berechnet anhand der Bildschirmbreite die optimale Anzahl an Tagen, die der Kalender anzeigt", "lang_backend": "Backend", "lang_backends": "Backends", + "lang_bookmarks": "Lesezeichen", + "lang_bookmarksTooltip": "Füge Lesezeichen hinzu, die der Browser erhalten soll", + "lang_browser": "Browser", + "lang_browserTooltip": "Welcher Browser soll genutzt werden", "lang_calendar": "Kalender", "lang_calendarUpdate": "Kalender Update", "lang_calupdateTooltip": "Zeit nachdem der Kalender aktualisiert wird (in Minuten)", "lang_checkConnection": "Verbindung pr\u00fcfen", + "lang_chromium": "Chromium", "lang_closed": "Geschlossen", "lang_closingTime": "Schlie\u00dfungszeit", "lang_configOverride": "Konfiguration überschreiben", @@ -41,6 +46,8 @@ "lang_generalSettings": "Allgemeine Einstellungen", "lang_ignoreSslTooltip": "Akzeptiere ung\u00fcltige, abgelaufene oder selbstsignierte SSL-Zertifikate", "lang_insecureSsl": "Unsicheres SSL", + "lang_interactive": "Interaktiver Browser", + "lang_interactiveTooltip": "Aktivieren, um reguläres Surfen zuzulassen", "lang_language": "Sprache", "lang_languageTooltip": "Legt die Sprache der angezeigten Oberfl\u00e4che fest", "lang_lastCalendarUpdate": "Kalender Update", @@ -121,6 +128,9 @@ "lang_shortWed": "Mi", "lang_shortWednesday": "Mi", "lang_showLog": "Log", + "lang_slxbrowser": "SLX Browser", + "lang_splitlogin": "Geteiltes Login", + "lang_splitloginTooltip": "Erlaube nur Gast-Login oder Gast+Nutzer-Login wenn aktiviert", "lang_startDay": "Start Tag", "lang_startDayTooltip": "Der Wochentag an dem der Kalender anfängt", "lang_summaryPanel": "\u00dcbersichts-Panel", diff --git a/modules-available/locationinfo/lang/en/template-tags.json b/modules-available/locationinfo/lang/en/template-tags.json index bf51b0b2..3fc409f4 100644 --- a/modules-available/locationinfo/lang/en/template-tags.json +++ b/modules-available/locationinfo/lang/en/template-tags.json @@ -4,10 +4,15 @@ "lang_autoscaleTooltip": "Calculates the optimum amount of days to show from the display width", "lang_backend": "Backend", "lang_backends": "Backends", + "lang_bookmarks": "Bookmarks", + "lang_bookmarksTooltip": "Add bookmarks to the browser", + "lang_browser": "Browser", + "lang_browserTooltip": "Which browser shall be used", "lang_calendar": "Calendar", "lang_calendarUpdate": "Calendar Update", "lang_calupdateTooltip": "Time the calender querys for updates (in minutes)", "lang_checkConnection": "Check connection", + "lang_chromium": "Chromium", "lang_closed": "Closed", "lang_closingTime": "Closing time", "lang_configOverride": "Configuration override", @@ -41,6 +46,8 @@ "lang_generalSettings": "General Settings", "lang_ignoreSslTooltip": "Accept invalid, expired or self-signed ssl certificates", "lang_insecureSsl": "Insecure SSL", + "lang_interactive": "Interactive Browser", + "lang_interactiveTooltip": "Activate to allow regular websurfing", "lang_language": "Language", "lang_languageTooltip": "The language the frontend uses", "lang_lastCalendarUpdate": "Calendar update", @@ -121,6 +128,9 @@ "lang_shortWed": "Wed", "lang_shortWednesday": "Wed", "lang_showLog": "Log", + "lang_slxbrowser": "SLX Browser", + "lang_splitlogin": "Split Login", + "lang_splitloginTooltip": "Allow only guest-login or guest+user-login if activated", "lang_startDay": "Start Day", "lang_startDayTooltip": "The day of the week at which the calendar starts", "lang_summaryPanel": "Summary panel", diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index 339c9f33..f849aa1d 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -413,12 +413,27 @@ class Page_LocationInfo extends Page private function preparePanelConfigUrl() { + $bookmarkNames = Request::post('bookmarkNames', [], 'array'); + $bookmarkUrls = Request::post('bookmarkUrls', [], 'array'); + $bookmarkString = ''; + for ($i = 0; $i < count($bookmarkNames); $i++) { + $bookmarkString .= rawurlencode($bookmarkNames[$i]); + $bookmarkString .= ","; + $bookmarkString .= rawurlencode($bookmarkUrls[$i]); + $bookmarkString .= " "; + } + $bookmarkString = substr($bookmarkString, 0, -1); + $conf = array( 'url' => Request::post('url', 'https://www.bwlehrpool.de/', 'string'), 'insecure-ssl' => Request::post('insecure-ssl', 0, 'int'), 'reload-minutes' => max(0, Request::post('reloadminutes', 0, 'int')), 'iswhitelist' => Request::post('iswhitelist', 0, 'int'), 'urllist' => preg_replace("/[\r\n\\s]+/ms", ' ', Request::post('urllist', '', 'string')), + 'split-login' => Request::post('split-login', 0, 'bool'), + 'browser' => Request::post('browser', 'slx-browser', 'string'), + 'interactive' => Request::post('interactive', '0', 'bool'), + 'bookmarks' => $bookmarkString, ); return array('config' => $conf, 'locationids' => []); } @@ -1020,6 +1035,10 @@ class Page_LocationInfo extends Page 'reloadminutes' => (int)$config['reload-minutes'], 'iswhitelist_' . $config['iswhitelist'] . '_checked' => 'checked', 'urllist' => str_replace(' ', "\r\n", $config['urllist']), + 'split-login_checked' => $config['split-login'] ? 'checked' : '', + 'browser' => $config['browser'], + 'interactive_checked' => $config['interactive'] ? 'checked' : '', + 'bookmarks' => $config['bookmarks'], )); } else { Render::addTemplate('page-config-panel-summary', array( diff --git a/modules-available/locationinfo/templates/page-config-panel-url.html b/modules-available/locationinfo/templates/page-config-panel-url.html index 57b518ce..e34f0477 100644 --- a/modules-available/locationinfo/templates/page-config-panel-url.html +++ b/modules-available/locationinfo/templates/page-config-panel-url.html @@ -108,6 +108,89 @@ </div> </div> + <div class="list-group-item"> + <div class="row"> + <div class="col-sm-3"> + <label for="split-login">{{lang_splitlogin}}</label> + </div> + <div class="col-sm-7"> + <div class="checkbox"> + <input id="split-login" type="checkbox" name="split-login" {{split-login_checked}} value="1"> + <label></label> + </div> + </div> + <div class="col-sm-2"> + <p class="btn btn-static helptext" title="{{lang_splitloginTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </p> + </div> + </div> + </div> + + <div class="list-group-item"> + <div class="row"> + <div class="col-sm-3"> + <label for="browser">{{lang_browser}}</label> + </div> + <div class="col-sm-7"> + <select class="form-control" name="browser" id="browser" onchange="browserChange()"> + <option value="slx-browser" id="slx">{{lang_slxbrowser}}</option> + <option value="chromium" id="chrome">{{lang_chromium}}</option> + </select> + </div> + <div class="col-sm-2"> + <p class="btn btn-static helptext" title="{{lang_browserTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </p> + </div> + </div> + </div> + + <div class="list-group-item b0-h"> + <div class="row"> + <div class="col-sm-3"> + <label for="interactive">{{lang_interactive}}</label> + </div> + <div class="col-sm-7"> + <div class="checkbox"> + <input id="interactive" type="checkbox" name="interactive" {{interactive_checked}} value="1"> + <label></label> + </div> + </div> + <div class="col-sm-2"> + <p class="btn btn-static helptext" title="{{lang_interactiveTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </p> + </div> + </div> + </div> + + <div class="list-group-item" id="bookmarks"> + <div class="row" id="bookmark0"> + <div class="col-sm-3"> + <label for="bookmarks">{{lang_bookmarks}}</label> + </div> + <div class="col-sm-3"> + <input class="form-control" name="bookmarkNames[]" type="text" value="" + placeholder="bwLehrpool" required> + </div> + <div class="col-sm-3"> + <input class="form-control" name="bookmarkUrls[]" type="text" value="" + placeholder="http://www.bwlehrpool.de/" pattern=".*://.*" required> + </div> + <div class="col-sm-1"> + <button type="button" class="btn btn-success" onclick="addBookmark()"> + <span class="glyphicon glyphicon-plus"></span> + </button> + </div> + <div class="col-sm-2"> + <p class="btn btn-static helptext" title="{{lang_bookmarksTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </p> + </div> + </div> + </div> + </div> </div> </div> @@ -122,10 +205,66 @@ <script type="text/javascript"><!-- +var bookmarkCount = 0; + document.addEventListener("DOMContentLoaded", function () { // Initialize fancy tooltips - $('p.helptext').tooltip(); - + $('p.helptext').tooltip(); + // load value to dropdown menus + $('#browser option[value="{{browser}}"]').attr("selected", "selected"); + browserChange(); + // load bookmark fields + getBookmarks(); }); +// Hide interactive-input if slx-browser is selected +function browserChange() { + var value = $('#browser').val(); + if (value !== 'slx-browser') { + $('.b0-h').show(); + } else { + $('.b0-h').hide(); + $('#interactive').prop('checked', false); + } +} + +// Add another bookmark input field to the form +function addBookmark() { + bookmarkCount += 1; + $('#bookmarks').append('<div style="margin-top: 1em;" class="row" id="bookmark' + bookmarkCount + '">' + + '<div class="col-sm-3 col-sm-offset-3">' + + '<input class="form-control" name="bookmarkNames[]" type="text" value="" placeholder="bwLehrpool" required>' + + '</div>' + + '<div class="col-sm-3">' + + '<input class="form-control" name="bookmarkUrls[]" type="text" value="" placeholder="http://www.bwlehrpool.de/" pattern=".*://.*" required>' + + '</div>' + + '<div class="col-sm-1">' + + '<button type="button" class="btn btn-danger" onclick="deleteBookmark(' + bookmarkCount + ')">' + + '<span class="glyphicon glyphicon-minus"></span>' + + '</button>' + + '</div>' + + '</div>'); +} + +// Remove the corresponding bookmark +function deleteBookmark(num) { + $('#bookmark' + num).remove(); + bookmarkCount -= 1; +} + +// Load bookmarks from database and add to form +function getBookmarks() { + var bookmarks = "{{bookmarks}}".split(" "); + if (bookmarks[0] === "") return; + for (var i = 0; i < bookmarks.length; i++) { + var bookmark = bookmarks[i].split(','); + var name = decodeURIComponent(bookmark[0]); + var url = decodeURIComponent(bookmark[1]); + if (i !== 0) addBookmark(); + var bookmarkJquery = $('#bookmark' + bookmarkCount); + bookmarkJquery.find("input[name='bookmarkNames[]']").val(name); + bookmarkJquery.find("input[name='bookmarkUrls[]']").val(url); + } +} + //--></script> |