diff options
author | Phil Davis <phil.davis@inf.org> | 2017-01-09 08:25:01 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2017-02-11 18:25:30 +0545 |
commit | 990bc1fb8b2e577e7a332b7b1e24b2faa3f3be27 (patch) | |
tree | db83fbd9b4b989724f467b5fa43550a4da774d91 /src/usr/local/www | |
parent | c9e18377b703baab4549b3685b5ed9066a2210e5 (diff) | |
download | pfsense-990bc1fb8b2e577e7a332b7b1e24b2faa3f3be27.zip pfsense-990bc1fb8b2e577e7a332b7b1e24b2faa3f3be27.tar.gz |
Breadcrumb links support
(cherry picked from commit c50f228a1583fe694993778e8576322877a15bba)
Diffstat (limited to 'src/usr/local/www')
-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 40acdc6..190a662 100644 --- a/src/usr/local/www/guiconfig.inc +++ b/src/usr/local/www/guiconfig.inc @@ -517,15 +517,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 456eaac..600fc9e 100644 --- a/src/usr/local/www/head.inc +++ b/src/usr/local/www/head.inc @@ -530,7 +530,7 @@ if (are_notices_pending()) { print('<br />'); unset($notitle); } else { - print(genhtmltitle($pgtitle)); + print(genhtmltitle($pgtitle, $pglinks)); } ?> <ul class="context-links"> |