From 59774f1999752f941d48dcae43d53d4a6cc8c0c0 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 25 Jun 2011 20:27:02 -0400 Subject: one_column layout was not showing title and nav --- views/default/page/layouts/one_column.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'views/default/page/layouts') diff --git a/views/default/page/layouts/one_column.php b/views/default/page/layouts/one_column.php index c59a574e7..7546a4cdf 100644 --- a/views/default/page/layouts/one_column.php +++ b/views/default/page/layouts/one_column.php @@ -13,11 +13,22 @@ $class = 'elgg-layout elgg-layout-one-column clearfix'; if (isset($vars['class'])) { $class = "$class {$vars['class']}"; } + +// navigation defaults to breadcrumbs +$nav = elgg_extract('nav', $vars, elgg_view('navigation/breadcrumbs')); + ?>
-
- +
-- cgit v1.2.3 From 32387e6db0c56935e93314217b52eab4d9dca016 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 26 Jun 2011 08:16:19 -0400 Subject: Fixes #3470 using rel=toggle now --- engine/classes/ElggMenuItem.php | 4 ++++ engine/lib/navigation.php | 2 +- js/lib/ui.js | 6 +++--- mod/groups/start.php | 4 ++-- mod/logbrowser/views/default/logbrowser/form.php | 8 ++++---- mod/profile/views/default/profile/owner_block.php | 2 +- mod/reportedcontent/views/default/object/reported_content.php | 2 +- views/default/object/plugin/advanced.php | 2 +- views/default/object/plugin/invalid.php | 2 +- views/default/object/widget/elements/controls.php | 6 ++++-- views/default/page/layouts/widgets/add_button.php | 11 ++++++++--- 11 files changed, 30 insertions(+), 19 deletions(-) (limited to 'views/default/page/layouts') diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index cd6267ad6..1181583f2 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -504,6 +504,10 @@ class ElggMenuItem { $vars['class'] = $this->getLinkClass(); } + if ($this->link_rel) { + $vars['rel'] = $this->link_rel; + } + if ($this->rel) { $vars['rel'] = $this->rel; } diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index b51c63b49..4b2c998a2 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -276,7 +276,7 @@ function elgg_river_menu_setup($hook, $type, $return, $params) { 'href' => "#comments-add-$object->guid", 'text' => elgg_view_icon('speech-bubble'), 'title' => elgg_echo('comment:this'), - 'link_class' => "elgg-toggler", + 'link_rel' => 'toggle', 'priority' => 50, ); $return[] = ElggMenuItem::factory($options); diff --git a/js/lib/ui.js b/js/lib/ui.js index 89a996122..fd20acbd1 100644 --- a/js/lib/ui.js +++ b/js/lib/ui.js @@ -11,7 +11,7 @@ elgg.ui.init = function () { $('.elgg-system-messages li').animate({opacity: 0.9}, 6000); $('.elgg-system-messages li').fadeOut('slow'); - $('.elgg-toggler').live('click', elgg.ui.toggles); + $('[rel=toggle]').live('click', elgg.ui.toggles); $('[rel=popup]').live('click', elgg.ui.popsUp); @@ -27,8 +27,8 @@ elgg.ui.init = function () { /** * Toggles an element based on clicking a separate element * - * Use .elgg-toggler on the toggler element - * Set the href to target the item you want to toggle () + * Use rel="toggle" on the toggler element + * Set the href to target the item you want to toggle () * * @param {Object} event * @return void diff --git a/mod/groups/start.php b/mod/groups/start.php index f35c058b6..57c40af5d 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -764,7 +764,7 @@ function discussion_owner_block_menu($hook, $type, $return, $params) { * Add the reply button for the river */ function discussion_add_to_river_menu($hook, $type, $return, $params) { - if (elgg_is_logged_in() && !elgg_get_context('widgets')) { + if (elgg_is_logged_in() && !elgg_in_context('widgets')) { $item = $params['item']; $object = $item->getObjectEntity(); if (elgg_instanceof($object, 'object', 'groupforumtopic')) { @@ -776,7 +776,7 @@ function discussion_add_to_river_menu($hook, $type, $return, $params) { 'href' => "#groups-reply-$object->guid", 'text' => elgg_view_icon('speech-bubble'), 'title' => elgg_echo('reply:this'), - 'link_class' => "elgg-toggler", + 'link_rel' => 'toggle', 'priority' => 50, ); $return[] = ElggMenuItem::factory($options); diff --git a/mod/logbrowser/views/default/logbrowser/form.php b/mod/logbrowser/views/default/logbrowser/form.php index d2476afac..d5cf9f6b8 100644 --- a/mod/logbrowser/views/default/logbrowser/form.php +++ b/mod/logbrowser/views/default/logbrowser/form.php @@ -59,9 +59,12 @@ $toggle_link = elgg_view('output/url', array( 'href' => '#log-browser-search-form', 'text' => elgg_echo('logbrowser:search'), - 'class' => 'elgg-toggler', + 'rel' => 'toggle', )); ?> +

+ +

-

- -

\ No newline at end of file diff --git a/mod/profile/views/default/profile/owner_block.php b/mod/profile/views/default/profile/owner_block.php index 48d7ff24f..5a65a3a26 100644 --- a/mod/profile/views/default/profile/owner_block.php +++ b/mod/profile/views/default/profile/owner_block.php @@ -35,7 +35,7 @@ if (elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != elgg_get_page $text = elgg_echo('admin:options'); $admin_links = '
    '; - $admin_links .= "
  • $text…"; + $admin_links .= "
  • $text…"; $admin_links .= '
      '; foreach ($admin as $menu_item) { $admin_links .= elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); diff --git a/mod/reportedcontent/views/default/object/reported_content.php b/mod/reportedcontent/views/default/object/reported_content.php index b8c443450..6bcbf6e5d 100644 --- a/mod/reportedcontent/views/default/object/reported_content.php +++ b/mod/reportedcontent/views/default/object/reported_content.php @@ -58,7 +58,7 @@ if ($report->state == 'archived') { "#report-$report->guid", 'text' => elgg_echo('reportedcontent:moreinfo'), - 'class' => "elgg-toggler", + 'rel' => "toggle", )); ?>

      diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php index 51fb69d17..84fc0439b 100644 --- a/views/default/object/plugin/advanced.php +++ b/views/default/object/plugin/advanced.php @@ -242,7 +242,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new) echo elgg_view('output/url', array( 'href' => "#elgg-plugin-manifest-{$plugin->getID()}", 'text' => elgg_echo("admin:plugins:label:moreinfo"), - 'class' => 'elgg-toggler', + 'rel' => 'toggle', )); ?>
diff --git a/views/default/object/plugin/invalid.php b/views/default/object/plugin/invalid.php index 9e239b7ca..f29ee8d12 100644 --- a/views/default/object/plugin/invalid.php +++ b/views/default/object/plugin/invalid.php @@ -29,7 +29,7 @@ $error = $plugin->getError(); echo elgg_view('output/url', array( 'href' => "#elgg-plugin-manifest-{$plugin->getID()}", 'text' => elgg_echo("admin:plugins:label:moreinfo"), - 'class' => 'elgg-toggler', + 'rel' => 'toggle', )); ?>
diff --git a/views/default/object/widget/elements/controls.php b/views/default/object/widget/elements/controls.php index 83a2f5767..abf2154fc 100644 --- a/views/default/object/widget/elements/controls.php +++ b/views/default/object/widget/elements/controls.php @@ -12,7 +12,8 @@ $show_edit = elgg_extract('show_edit', $vars, true); $params = array( 'text' => ' ', 'href' => "#elgg-widget-content-$widget->guid", - 'class' => 'elgg-widget-collapse-button elgg-toggler', + 'class' => 'elgg-widget-collapse-button', + 'rel' => 'toggle', ); $collapse_link = elgg_view('output/url', $params); @@ -33,7 +34,8 @@ if ($widget->canEdit()) { 'text' => elgg_view_icon('settings-alt'), 'title' => elgg_echo('widget:edit'), 'href' => "#widget-edit-$widget->guid", - 'class' => "elgg-toggler elgg-widget-edit-button", + 'class' => "elgg-widget-edit-button", + 'rel' => 'toggle', ); $edit_link = elgg_view('output/url', $params); } diff --git a/views/default/page/layouts/widgets/add_button.php b/views/default/page/layouts/widgets/add_button.php index a8670146b..89e83b096 100644 --- a/views/default/page/layouts/widgets/add_button.php +++ b/views/default/page/layouts/widgets/add_button.php @@ -4,7 +4,12 @@ */ ?>
- - - + '#widgets-add-panel', + 'text' => elgg_echo('widgets:add'), + 'class' => 'elgg-button elgg-button-action', + 'rel' => 'toggle', + )); +?>
-- cgit v1.2.3 From 3c34ddf59804767e6a7deea3e3ee6c81d4a09601 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 26 Jun 2011 15:13:50 -0400 Subject: removed buttons logic from content header view, created convenience function rather than copying and pasting, and updated the blog plugin --- engine/lib/navigation.php | 35 +++++++++++++++++++++++++++ mod/blog/lib/blog.php | 6 +++-- views/default/page/layouts/content.php | 1 - views/default/page/layouts/content/header.php | 30 ++++++++--------------- 4 files changed, 49 insertions(+), 23 deletions(-) (limited to 'views/default/page/layouts') diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index 4b2c998a2..1cb289654 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -153,6 +153,41 @@ function elgg_is_menu_item_registered($menu_name, $item_name) { return false; } +/** + * Convenience function for registering an add content button to title menu + * + * The add URL must be $handler/add/$guid where $guid is the guid of the page owner. + * The label of the button is "$handler:add" so that must be defined in a + * language file. + * + * @param string $handler The handler to use or null to autodetect from context + * @return void + * @since 1.8.0 + */ +function elgg_register_add_button($handler = null) { + if (elgg_is_logged_in()) { + + if (!$handler) { + $handler = elgg_get_context(); + } + + $owner = elgg_get_page_owner_entity(); + if (!$owner) { + // no owns the page so this is probably an all site list page + $owner = elgg_get_logged_in_user_entity(); + } + if ($owner && $owner->canWriteToContainer()) { + $guid = $owner->getGUID(); + elgg_register_menu_item('title', array( + 'name' => 'add', + 'href' => "$handler/add/$guid", + 'text' => elgg_echo("$handler:add"), + 'link_class' => 'elgg-button elgg-button-action', + )); + } + } +} + /** * Adds a breadcrumb to the breadcrumbs stack. * diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index 4d1edd50e..d13b2244e 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -92,6 +92,8 @@ function blog_get_page_content_list($container_guid = NULL) { elgg_push_breadcrumb(elgg_echo('blog:blogs')); } + elgg_register_add_button(); + // show all posts for admin or users looking at their own blogs // show only published posts for other users. if (!(elgg_is_admin_logged_in() || (elgg_is_logged_in() && $container_guid == $loggedin_userid))) { @@ -129,6 +131,8 @@ function blog_get_page_content_friends($user_guid) { elgg_push_breadcrumb($crumbs_title, "blog/owner/{$user->username}"); elgg_push_breadcrumb(elgg_echo('friends')); + elgg_register_add_button(); + if (!$friends = get_user_friends($user_guid, ELGG_ENTITIES_ANY_VALUE, 0)) { $return['content'] .= elgg_echo('friends:none:you'); return $return; @@ -235,7 +239,6 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) { return array( 'content' => $content, 'title' => $title, - 'buttons' => '', 'filter' => '', ); } @@ -253,7 +256,6 @@ function blog_get_page_content_edit($page, $guid = 0, $revision = NULL) { elgg_load_js('elgg.blog'); $return = array( - 'buttons' => '', 'filter' => '', ); diff --git a/views/default/page/layouts/content.php b/views/default/page/layouts/content.php index 35d695f0a..c406c9faf 100644 --- a/views/default/page/layouts/content.php +++ b/views/default/page/layouts/content.php @@ -10,7 +10,6 @@ * @uses $vars['filter'] HTML of the content area filter (override) * @uses $vars['title'] Title text (override) * @uses $vars['context'] Page context (override) - * @uses $vars['buttons'] Content header buttons (override) * @uses $vars['filter_context'] Filter context: everyone, friends, mine * @uses $vars['class'] Additional class to apply to layout */ diff --git a/views/default/page/layouts/content/header.php b/views/default/page/layouts/content/header.php index 403da8a0a..345163bdd 100644 --- a/views/default/page/layouts/content/header.php +++ b/views/default/page/layouts/content/header.php @@ -7,9 +7,13 @@ * @uses $vars['header_override'] HTML for overriding the default header (override) * @uses $vars['title'] Title text (override) * @uses $vars['context'] Page context (override) - * @uses $vars['buttons'] Content header buttons (override) */ +if (isset($vars['buttons'])) { + // it was a bad idea to implement buttons with a pass through + elgg_deprecated_notice("Use elgg_register_menu_item() to register for the title menu", 1.0); +} + if (isset($vars['header_override'])) { echo $vars['header_override']; return true; @@ -22,27 +26,13 @@ if ($context) { $title = elgg_echo($context); } - if (isset($vars['buttons'])) { + if (isset($vars['buttons']) && $vars['buttons']) { $buttons = $vars['buttons']; } else { - if (elgg_is_logged_in() && $context) { - $owner = elgg_get_page_owner_entity(); - if (!$owner) { - // this is probably an all page - $owner = elgg_get_logged_in_user_entity(); - } - if ($owner && $owner->canWriteToContainer()) { - $guid = $owner->getGUID(); - elgg_register_menu_item('title', array( - 'name' => 'add', - 'href' => elgg_extract('new_link', $vars, "$context/add/$guid"), - 'text' => elgg_echo("$context:add"), - 'link_class' => 'elgg-button elgg-button-action', - )); - } - } - - $buttons = elgg_view_menu('title', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz')); + $buttons = elgg_view_menu('title', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + )); } echo << -- cgit v1.2.3 From eb43980ad428e9c64406579de0677da7a4fcd081 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 28 Jun 2011 07:30:22 -0400 Subject: using elgg_view_title() in content layout header --- engine/lib/views.php | 15 +++++++----- views/default/page/layouts/content/header.php | 35 ++++++++++++++------------- 2 files changed, 27 insertions(+), 23 deletions(-) (limited to 'views/default/page/layouts') diff --git a/engine/lib/views.php b/engine/lib/views.php index 7358fc0ba..aff0dbd0d 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1076,21 +1076,24 @@ function elgg_view_entity_annotations(ElggEntity $entity, $full_view = true) { } /** - * Returns a rendered title. + * Renders a title. * * This is a shortcut for {@elgg_view page/elements/title}. * - * @param string $title The page title - * @param string $submenu Should a submenu be displayed? (deprecated) + * @param string $title The page title + * @param string $vars View variables (was submenu be displayed? (deprecated)) * * @return string The HTML (etc) */ -function elgg_view_title($title, $submenu = false) { - if ($submenu !== false) { +function elgg_view_title($title, $vars = array()) { + if (!is_array($vars)) { elgg_deprecated_notice('setting $submenu in elgg_view_title() is deprecated', 1.8); + $vars = array('submenu' => $vars); } - return elgg_view('page/elements/title', array('title' => $title, 'submenu' => $submenu)); + $vars['title'] = $title; + + return elgg_view('page/elements/title', $vars); } /** diff --git a/views/default/page/layouts/content/header.php b/views/default/page/layouts/content/header.php index 345163bdd..1e66e52db 100644 --- a/views/default/page/layouts/content/header.php +++ b/views/default/page/layouts/content/header.php @@ -2,7 +2,7 @@ /** * Main content header * - * This includes a title and a new content button by default + * Title and title menu * * @uses $vars['header_override'] HTML for overriding the default header (override) * @uses $vars['title'] Title text (override) @@ -20,23 +20,24 @@ if (isset($vars['header_override'])) { } $context = elgg_extract('context', $vars, elgg_get_context()); -if ($context) { - $title = elgg_extract('title', $vars, ''); - if (!$title) { - $title = elgg_echo($context); - } - if (isset($vars['buttons']) && $vars['buttons']) { - $buttons = $vars['buttons']; - } else { - $buttons = elgg_view_menu('title', array( - 'sort_by' => 'priority', - 'class' => 'elgg-menu-hz', - )); - } - echo << 'elgg-heading-main')); + +if (isset($vars['buttons']) && $vars['buttons']) { + $buttons = $vars['buttons']; +} else { + $buttons = elgg_view_menu('title', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + )); +} + +echo << -

$title

$buttons + $title$buttons HTML; -} -- cgit v1.2.3 From a07f6da7110885ec8600dad1fd63af833a258241 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 28 Jun 2011 07:40:49 -0400 Subject: Fixes #3519 admin area now has title buttons --- views/default/css/admin.php | 12 ++++++++++++ views/default/page/layouts/admin.php | 5 +++++ 2 files changed, 17 insertions(+) (limited to 'views/default/page/layouts') diff --git a/views/default/css/admin.php b/views/default/css/admin.php index d7c154438..ce271f49b 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -604,6 +604,18 @@ input[type="submit"]:hover, .elgg-button-submit:hover, .elgg-button-action:hover padding-bottom: 15px; } +/* *************************************** + TITLE MENU +*************************************** */ +.elgg-menu-title { + float: right; +} + +.elgg-menu-title > li { + display: inline-block; + margin-left: 4px; +} + /* *************************************** FOOTER MENU *************************************** */ diff --git a/views/default/page/layouts/admin.php b/views/default/page/layouts/admin.php index 890c8a06e..8dbdc27e6 100644 --- a/views/default/page/layouts/admin.php +++ b/views/default/page/layouts/admin.php @@ -21,6 +21,11 @@
'priority', + 'class' => 'elgg-menu-hz', + )); + if (isset($vars['title'])) { echo elgg_view_title($vars['title']); } -- cgit v1.2.3