aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-10 16:00:52 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-10 16:00:52 +0000
commit37446557462b35b5c6690f7f8f739c4dd861b85b (patch)
treeef72ca9f73bf31583350af4cb174f1a6c0ff3bab /views/default
parentf40da8fcaaeb193b155f8e51081bcaef468d9770 (diff)
downloadelgg-37446557462b35b5c6690f7f8f739c4dd861b85b.tar.gz
elgg-37446557462b35b5c6690f7f8f739c4dd861b85b.tar.bz2
Admin area now uses standard submenu tools.
git-svn-id: http://code.elgg.org/elgg/trunk@5992 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default')
-rw-r--r--views/default/admin/components/admin_page_layout.php36
-rw-r--r--views/default/admin/components/sidemenu.php105
-rw-r--r--views/default/navigation/submenu_item.php16
-rw-r--r--views/default/output/url.php13
-rw-r--r--views/default/page_elements/owner_block.php9
5 files changed, 26 insertions, 153 deletions
diff --git a/views/default/admin/components/admin_page_layout.php b/views/default/admin/components/admin_page_layout.php
deleted file mode 100644
index 4f2a67d48..000000000
--- a/views/default/admin/components/admin_page_layout.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Elgg admin page layout. Includes the admin sidebar and the ownerblock (for legacy support)
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
-
-$notices_html = '';
-if ($notices = elgg_get_admin_notices()) {
- foreach ($notices as $notice) {
- $notices_html .= elgg_view_entity($notice);
- }
-}
-
-?>
-<div id="elgg_content" class="clearfloat sidebar">
- <div id="elgg_sidebar">
- <?php
- echo elgg_view('admin/components/sidemenu', $vars);
- echo '<hr />';
- echo elgg_view('page_elements/owner_block');
- ?>
- </div>
-
- <div id="elgg_page_contents" class="clearfloat">
- <?php
- if ($notices) {
- echo "<div class=\"admin_notices\">$notices_html</div>";
- }
- echo $vars['content'];
- ?>
- </div>
-</div>
diff --git a/views/default/admin/components/sidemenu.php b/views/default/admin/components/sidemenu.php
deleted file mode 100644
index 4e02eecd9..000000000
--- a/views/default/admin/components/sidemenu.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * Elgg admin sidebar
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
-
-$sections = $vars['config']->admin_sections;
-$current_section = $vars['page'][0];
-$child_section = (isset($vars['page'][1])) ? $vars['page'][1] : NULL;
-
-// "Plugin Settings" is a special sidemenu item that is added automatically
-// it's calculated here instead of in admin_init() because of preformance concerns.
-$installed_plugins = get_installed_plugins();
-$plugin_settings_children = $sort = array();
-foreach ($installed_plugins as $plugin_id => $info) {
- if (!$info['active']) {
- continue;
- }
-
- // @todo might not need to check if plugin is enabled here because
- // this view wouldn't exist if it's not. right?
- if (is_plugin_enabled($plugin_id) && elgg_view_exists("settings/{$plugin_id}/edit")) {
- $plugin_settings_children[$plugin_id] = array(
- 'title' => $info['manifest']['name']
- );
- $sort[] = elgg_strtolower($info['manifest']['name']);
- }
-}
-
-array_multisort($sort, SORT_ASC, SORT_STRING, $plugin_settings_children);
-
-if ($plugin_settings_children) {
- // merge in legacy support with new support.
- if (!isset($sections['plugin_settings'])) {
- $sections['plugin_settings'] = array(
- 'title' => elgg_echo('admin:plugin_settings'),
- 'children' => $plugin_settings_children
- );
- } else {
- $sections['plugin_settings']['title'] = elgg_echo('admin:plugin_settings');
- if (isset($sections['plugin_settings']['children'])) {
- $children = array_merge($plugin_settings_children, $sections['plugin_settings']['children']);
- $sections['plugin_settings']['children'] = $children;
- }
- }
-}
-
-?>
-
-<ul class="admin submenu">
- <?php foreach ($sections as $id => $info) {
- $parent_class = ($current_section == $id) ? 'selected' : '';
- $link = "{$vars['url']}pg/admin/$id";
-
- $expand_child = $children_menu = $expanded = '';
- // parent menu items with children default to the first child element.
- if (isset($info['children']) && $info['children']) {
- $link = '';
- if ($current_section == $id) {
- $hidden = '';
- $expanded = '-';
- } else {
- $hidden = 'style="display: none;"';
- $expanded = '+';
- }
- $expand_child = "<span class=\"expand_child\">$expanded</span> ";
- $children_menu = "<ul class=\"admin child_submenu\" $hidden>";
- foreach ($info['children'] as $child_id => $child_info) {
- $child_selected = ($child_section == $child_id) ? "class=\"selected\"" : '';
- $child_link = "{$vars['url']}pg/admin/$id/$child_id";
- if (!$link) {
- $link = $child_link;
- }
- $children_menu .= "<li $child_selected><a href=\"$child_link\">{$child_info['title']}</a></li>";
- }
- $children_menu .= '</ul>';
- }
-
- $parent_class = ($parent_class) ? "class=\"$parent_class\"" : '';
-
- echo "<li $parent_class><a href=\"$link\">$expand_child{$info['title']}</a>
- $children_menu
- </li>";
- }
- ?>
-</ul>
-
-<script type="text/javascript">
- $('a span.expand_child').click(function() {
- var submenu = $(this).parent().parent().find('ul.child_submenu');
- submenu.slideToggle();
-
- if ($(this).html() == '+') {
- $(this).html('-');
- } else {
- $(this).html('+');
- }
-
- return false;
- });
-</script> \ No newline at end of file
diff --git a/views/default/navigation/submenu_item.php b/views/default/navigation/submenu_item.php
index c64f8a679..ff2cc48d1 100644
--- a/views/default/navigation/submenu_item.php
+++ b/views/default/navigation/submenu_item.php
@@ -13,7 +13,7 @@
$group = (isset($vars['group'])) ? $vars['group'] : 'default';
$item = (isset($vars['item'])) ? $vars['item'] : FALSE;
-$children_html = (isset($vars['children_html'])) ? $vars['children_html'] : FALSE;
+$children_html = (isset($vars['children_html'])) ? $vars['children_html'] : '';
if ($item) {
@@ -34,8 +34,16 @@ if ($item) {
$child_indicator = "<span class=\"child_indicator\">$child_indicator </span>";
}
- $url = htmlentities($item->url);
+ $url = htmlentities($item->href);
$text = $child_indicator . htmlentities($item->text);
+
+ $link_vars = array_merge($vars, array(
+ 'href' => $item->href,
+ 'text' => $text,
+ 'encode_text' => FALSE
+ ));
+
+ $link = elgg_view('output/url', $link_vars);
}
-?>
-<li <?php echo $selected; ?>><a href="<?php echo $url; ?>" <?php echo $js; ?>><?php echo $text; ?></a><?php echo $children_html; ?></li>
+
+echo "<li $selected>$link$children_html</li>";
diff --git a/views/default/output/url.php b/views/default/output/url.php
index 87d3a68a1..19ad331e1 100644
--- a/views/default/output/url.php
+++ b/views/default/output/url.php
@@ -10,7 +10,8 @@
*
* @uses string $vars['href'] The string to display in the <a></a> tags
* @uses string $vars['text'] The string between the <a></a> tags.
- * @uses bool $vars['target'] Set the target="" attribute.
+ * @uses string $vars['target'] Set the target="" attribute.
+ * @uses bool $vars['encode_text'] Run $vars['text'] through htmlentities()?
* @uses string $vars['class'] what to add in class=""
* @uses string $vars['js'] Javascript to insert in <a> tag
* @uses bool $vars['is_action'] Is this a link to an action?
@@ -39,13 +40,17 @@ if (!empty($url)) {
}
if (array_key_exists('text', $vars) && $vars['text']) {
- $text = htmlentities($vars['text'], ENT_QUOTES, 'UTF-8');
+ if (isset($vars['encode_text']) && $vars['encode_text']) {
+ $text = htmlentities($vars['text'], ENT_QUOTES, 'UTF-8');
+ } else {
+ $text = $vars['text'];
+ }
} else {
$text = htmlentities($url, ENT_QUOTES, 'UTF-8');
}
- if ((substr_count($url, "http://") == 0) && (substr_count($url, "https://") == 0)) {
- $url = "http://" . $url;
+ if ((substr_count($url, "http://") == 0) && (substr_count($url, "https://") == 0)) {
+ $url = "http://" . $url;
}
if (array_key_exists('is_action', $vars) && $vars['is_action']) {
diff --git a/views/default/page_elements/owner_block.php b/views/default/page_elements/owner_block.php
index a45fad826..ef77d6895 100644
--- a/views/default/page_elements/owner_block.php
+++ b/views/default/page_elements/owner_block.php
@@ -38,14 +38,14 @@ if(is_plugin_enabled('profile')) {
}
$display = "<div class='owner_block_icon'>" . $icon . "</div>";
$display .= "<div class='owner_block_contents clearfloat'>" . $info;
-
+
if ($owner->briefdescription) {
$desc = $owner->briefdescription;
$display .= "<p class='profile_info briefdescription'>" . $desc . "</p>";
}
$display .= "<p class='profile_info location'>{$location}</p>";
$display .= "</div>"; // close owner_block_contents
-
+
$contents .= "<div id='owner_block' class='radius8'>".$display."</div>";
}
}
@@ -58,9 +58,10 @@ if (isset($vars['content']))
$contents .= $vars['content'];
// Initialise the current tool/page submenu (plugins can add to the submenu)
-$submenu = get_submenu();
+$submenu = elgg_get_submenu();
+
if (!empty($submenu))
- $contents .= $submenu;
+ $contents .= $submenu;
if (!empty($contents)) {
echo $contents;