aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-13 10:23:15 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-13 10:23:15 +0000
commit2cb14281668abaabfff6eeea1b20ad31efba7da6 (patch)
tree4abf423777611d7ff3c1788bd6abfa3284bfaf60 /engine/lib
parent6accd1b71319d02c91534b63a192b3e8230b7308 (diff)
downloadelgg-2cb14281668abaabfff6eeea1b20ad31efba7da6.tar.gz
elgg-2cb14281668abaabfff6eeea1b20ad31efba7da6.tar.bz2
Fixed select class issue for submenus
git-svn-id: https://code.elgg.org/elgg/trunk@1877 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php34
1 files changed, 28 insertions, 6 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index e8cc9878d..00a0c83ba 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -540,18 +540,40 @@
function get_submenu() {
$submenu = "";
+ global $CONFIG;
if ($submenu_register = get_register('submenu')) {
- foreach($submenu_register as $item) {
+
+ $preselected = false;
+ $comparevals = array();
+ $maxcompareval = 999999;
+
+ foreach($submenu_register as $key => $item) {
+
+ $comparevals[$key] = (levenshtein($item->value, $_SERVER['REQUEST_URI']));
+ if ($comparevals[$key] < $maxcompareval) {
+ $maxcompareval = $comparevals[$key];
+ $preselected = $key;
+ }
+
+ }
+
+ foreach($submenu_register as $key => $item) {
- if (substr_count($item->value, $_SERVER['REQUEST_URI'])) {
- $selected = true;
+ if (!$preselected) {
+ if (substr_count($item->value, $_SERVER['REQUEST_URI'])) {
+ $selected = true;
+ } else {
+ $selected = false;
+ }
} else {
- $selected = false;
+ if ($key == $preselected) {
+ $selected = true;
+ } else {
+ $selected = false;
+ }
}
- $submenu .= "<!-- {$item->value} {$_SERVER['REQUEST_URI']} -->";
-
$submenu .= elgg_view('canvas_header/submenu_template',
array(
'href' => $item->value,