diff options
author | Phil Davis <phil.davis@inf.org> | 2017-01-09 08:25:01 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2017-01-09 08:25:01 +0545 |
commit | c50f228a1583fe694993778e8576322877a15bba (patch) | |
tree | 64b34b9391ff0e8a0322091be4297cc90df21586 | |
parent | 286ed246df8bc25df436fd6a5cbc66e38fe5a06a (diff) | |
download | pfsense-c50f228a1583fe694993778e8576322877a15bba.zip pfsense-c50f228a1583fe694993778e8576322877a15bba.tar.gz |
Breadcrumb links support
-rw-r--r-- | src/usr/local/www/guiconfig.inc | 19 | ||||
-rw-r--r-- | src/usr/local/www/head.inc | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/usr/local/www/guiconfig.inc b/src/usr/local/www/guiconfig.inc index d4fc383..927e85f 100644 --- a/src/usr/local/www/guiconfig.inc +++ b/src/usr/local/www/guiconfig.inc @@ -492,15 +492,28 @@ function gentitle($title) { } } -function genhtmltitle($title) { +function genhtmltitle($title, $links=array()) { // If the array contains only one element, there are no breadcrumbs, so don't // add anything else if (count($title) > 1) { $bc = '<ol class="breadcrumb">'; - foreach ($title as $el) { - $bc .= '<li>'.$el.'</li>'; + foreach ($title as $idx => $el) { + $href = $links[$idx]; + if (strlen($href) > 0) { + // For convenience, if the caller specifies '@self' then make a link + // to the current page, including any query string. + if ($href == '@self') { + $href = $_SERVER['REQUEST_URI']; + } + if (substr($href, 0, 1) != '/') { + $href = '/' . $href; + } + $bc .= '<li><a href="' . htmlentities($href) . '">' . $el . '</a></li>'; + } else { + $bc .= '<li>' . $el . '</li>'; + } } $bc .= '</ol>'; diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc index 6205772..8c3b223 100644 --- a/src/usr/local/www/head.inc +++ b/src/usr/local/www/head.inc @@ -514,7 +514,7 @@ if (are_notices_pending()) { print('<br />'); unset($notitle); } else { - print(genhtmltitle($pgtitle)); + print(genhtmltitle($pgtitle, $pglinks)); } ?> <ul class="context-links"> |