aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'views/default')
-rw-r--r--views/default/canvas_header/submenu_group.php19
-rw-r--r--views/default/canvas_header/submenu_template.php24
-rw-r--r--views/default/css.php10
-rw-r--r--views/default/navigation/submenu_group.php42
-rw-r--r--views/default/navigation/submenu_item.php41
-rw-r--r--views/default/navigation/submenu_js.php31
6 files changed, 119 insertions, 48 deletions
diff --git a/views/default/canvas_header/submenu_group.php b/views/default/canvas_header/submenu_group.php
deleted file mode 100644
index 8d23aed3f..000000000
--- a/views/default/canvas_header/submenu_group.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-/**
- * Elgg default layout
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
-if (isset($vars['group_name'])) {
- $groupname = $vars['group_name'];
-} else {
- $groupname = "main";
-}
-
-if (isset($vars['submenu'])) {
- $submenu = "<ul class='submenu {$groupname}'>" . $vars['submenu'] . "</ul>";
- echo $submenu;
-} \ No newline at end of file
diff --git a/views/default/canvas_header/submenu_template.php b/views/default/canvas_header/submenu_template.php
deleted file mode 100644
index 0210e865f..000000000
--- a/views/default/canvas_header/submenu_template.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/**
- * Elgg default layout
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
-
-if (isset($vars['selected']) && $vars['selected'] == true) {
- $selected = "class=\"selected\"";
-} else {
- $selected = "";
-}
-
-if (isset($vars['onclick']) && $vars['onclick'] == true) {
- $onclick = "onclick=\"javascript:return confirm('". elgg_echo('deleteconfirm') . "')\"";
-} else {
- $onclick = "";
-}
-
-?>
-<li <?php echo $selected; ?>><a href="<?php echo $vars['href']; ?>" <?php echo $onclick; ?>><?php echo $vars['label']; ?></a></li> \ No newline at end of file
diff --git a/views/default/css.php b/views/default/css.php
index b81945eb4..bdef42982 100644
--- a/views/default/css.php
+++ b/views/default/css.php
@@ -684,6 +684,11 @@ li.navigation_more ul li {
color:white;
text-decoration:none;
}
+.submenu .child li a{
+ margin-left:15px;
+ background-color:white;
+ color:#4690D6;
+}
@@ -1630,11 +1635,6 @@ form.admin_plugins_simpleview .submit_button {
.admin_settings.menuitems li.custom_menuitem {
margin-bottom:20px;
}
-.admin .child_submenu li a{
- margin-left: 15px;
- background-color: white;
- color: #4690D6;
-}
.admin_notices {
padding-bottom: 15px;
}
diff --git a/views/default/navigation/submenu_group.php b/views/default/navigation/submenu_group.php
new file mode 100644
index 000000000..08e417494
--- /dev/null
+++ b/views/default/navigation/submenu_group.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Elgg submenu group. Writes the <ul> for a submenu and passes items one by one
+ * to navigation/submenu_item
+ *
+ * @uses $vars['group_name']
+ * @uses $vars['items']
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+
+$group = (isset($vars['group'])) ? $vars['group'] : 'default';
+$items = (isset($vars['items'])) ? $vars['items'] : array();
+$hidden = (isset($vars['hidden']) && $vars['hidden']) ? 'hidden' : '';
+$child = (isset($vars['child']) && $vars['child']) ? 'child' : '';
+
+echo "<ul class='submenu $group $hidden $child'>\n";
+
+foreach ($items as $item) {
+ $item_vars = array('item' => $item, 'group' => $group);
+ if (isset($item->vars) && is_array($item->vars)) {
+ $item_vars = array_merge($item->vars, $item_vars);
+ }
+
+ if (isset($item->children)) {
+ $child_vars = array(
+ 'group' => $group,
+ 'items' => $item->children,
+ // if this menu item is selected, make sure to display the full tree
+ // ie, don't hide it.
+ 'hidden' => !$item->selected,
+ 'child' => TRUE
+ );
+ $item_vars['children_html'] = elgg_view('navigation/submenu_group', $child_vars);
+ }
+
+ echo elgg_view('navigation/submenu_item', $item_vars);
+}
+
+echo "</ul>\n"; \ No newline at end of file
diff --git a/views/default/navigation/submenu_item.php b/views/default/navigation/submenu_item.php
new file mode 100644
index 000000000..c64f8a679
--- /dev/null
+++ b/views/default/navigation/submenu_item.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Elgg submenu item. Displays the <li> part of a submenu.
+ *
+ * @uses $vars['group']
+ * @uses $vars['item']
+ * @uses $vars['children_html']
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+
+$group = (isset($vars['group'])) ? $vars['group'] : 'default';
+$item = (isset($vars['item'])) ? $vars['item'] : FALSE;
+$children_html = (isset($vars['children_html'])) ? $vars['children_html'] : FALSE;
+
+
+if ($item) {
+ $has_children = (isset($item->children) && $item->children) ? TRUE : FALSE;
+ $selected = (isset($item->selected) && $item->selected == TRUE) ? 'class="selected"' : '';
+ $js = (isset($vars['js'])) ? $vars['js'] : '';
+
+ $child_indicator = '';
+ if ($has_children) {
+ if ($selected) {
+ $child_indicator = '<span class="close_child">-</span>';
+ $child_indicator .= '<span class="hidden open_child">+</span>';
+ } else {
+ $child_indicator = '<span class="hidden close_child">-</span>';
+ $child_indicator .= '<span class="open_child">+</span>';
+ }
+
+ $child_indicator = "<span class=\"child_indicator\">$child_indicator </span>";
+ }
+
+ $url = htmlentities($item->url);
+ $text = $child_indicator . htmlentities($item->text);
+}
+?>
+<li <?php echo $selected; ?>><a href="<?php echo $url; ?>" <?php echo $js; ?>><?php echo $text; ?></a><?php echo $children_html; ?></li>
diff --git a/views/default/navigation/submenu_js.php b/views/default/navigation/submenu_js.php
new file mode 100644
index 000000000..0f0c88888
--- /dev/null
+++ b/views/default/navigation/submenu_js.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Javascript to expand submenu items.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+?>
+
+<script type="text/javascript">
+$(document).ready(function() {
+ $('.submenu span.child_indicator').click(function() {
+ var submenu = $(this).parent().parent().find('ul.submenu.child:first');
+ var closeChild = $($(this).find('.close_child'));
+ var openChild = $($(this).find('.open_child'));
+
+ if (submenu.is(':visible')) {
+ closeChild.addClass('hidden');
+ openChild.removeClass('hidden');
+ } else {
+ closeChild.removeClass('hidden');
+ openChild.addClass('hidden');
+ }
+
+ submenu.slideToggle();
+ return false;
+ });
+});
+</script> \ No newline at end of file