diff options
-rw-r--r-- | engine/lib/pageowner.php | 2 | ||||
-rw-r--r-- | engine/lib/plugins.php | 3 | ||||
-rw-r--r-- | views/default/navigation/toolbox.php | 24 |
3 files changed, 24 insertions, 5 deletions
diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php index 4531b5037..c6bd5bcaf 100644 --- a/engine/lib/pageowner.php +++ b/engine/lib/pageowner.php @@ -139,6 +139,8 @@ if (isset($CONFIG->context) && !empty($CONFIG->context)) {
return $CONFIG->context;
}
+ if ($context = get_plugin_name(true))
+ return $context;
return "main";
}
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index f12ed3cac..cc03bba04 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -45,10 +45,11 @@ }
/**
- * Get the name of the most recent plugin to be called in the call stack.
+ * Get the name of the most recent plugin to be called in the call stack (or the plugin that owns the current page, if any).
*
* i.e., if the last plugin was in /mod/foobar/, get_plugin_name would return foo_bar.
*
+ * @param boolean $mainfilename If set to true, this will instead determine the context from the main script filename called by the browser. Default = false.
* @return string|false Plugin name, or false if no plugin name was called
*/
function get_plugin_name($mainfilename = false) {
diff --git a/views/default/navigation/toolbox.php b/views/default/navigation/toolbox.php index 6ee04f00b..91a96d1fb 100644 --- a/views/default/navigation/toolbox.php +++ b/views/default/navigation/toolbox.php @@ -25,13 +25,14 @@ <ul class="drawers"> <?php - +
+ $key = 0; foreach($menu as $item) { ?> <li class="drawer"> - <h2 class="drawer-handle"><?php echo $item->name ?></h2> + <h2 id="nav_<?php echo $contexts[$key]; ?>" class="drawer-handle"><?php echo $item->name ?></h2> <?php if (sizeof($item->children) > 0 ) { @@ -50,7 +51,8 @@ ?> </li> -<?php +<?php
+ $key++; } @@ -62,7 +64,21 @@ <?php } - +
+ if (in_array(get_context(),$contexts)) {
+ $key = array_search(get_context(),$contexts); ?> +<script language="javascript">
+ $(document).ready(function(){
+ $('h2#nav_<?php echo $contexts[$key]; ?>').click();
+ });
+</script>
+
+
+<?php
+
+ }
+
+?>
\ No newline at end of file |