aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-24 01:27:47 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-24 01:27:47 +0000
commitc667ce609dc3c1f9f071e39293f8c176d3e1c5dc (patch)
tree1ec44df08297b396809af545dcf9568ba7c27aff /engine
parent64547b21f0e0cb4efc55212a5a6ae92824b274aa (diff)
downloadelgg-c667ce609dc3c1f9f071e39293f8c176d3e1c5dc.tar.gz
elgg-c667ce609dc3c1f9f071e39293f8c176d3e1c5dc.tar.bz2
Refs #2997 switching from title to text for menu items
git-svn-id: http://code.elgg.org/elgg/trunk@8455 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/classes/ElggMenuBuilder.php12
-rw-r--r--engine/classes/ElggMenuItem.php31
-rw-r--r--engine/lib/admin.php4
-rw-r--r--engine/lib/deprecated-1.8.php4
-rw-r--r--engine/lib/user_settings.php6
-rw-r--r--engine/lib/users.php30
-rw-r--r--engine/lib/views.php4
7 files changed, 46 insertions, 45 deletions
diff --git a/engine/classes/ElggMenuBuilder.php b/engine/classes/ElggMenuBuilder.php
index 33abc0c6b..4f9e7b447 100644
--- a/engine/classes/ElggMenuBuilder.php
+++ b/engine/classes/ElggMenuBuilder.php
@@ -176,8 +176,8 @@ class ElggMenuBuilder {
ksort($this->menu);
switch ($sort_by) {
- case 'title':
- $sort_callback = array('ElggMenuBuilder', 'compareByTitle');
+ case 'text':
+ $sort_callback = array('ElggMenuBuilder', 'compareByText');
break;
case 'name':
$sort_callback = array('ElggMenuBuilder', 'compareByName');
@@ -221,15 +221,15 @@ class ElggMenuBuilder {
}
/**
- * Compare two menu items by their titles
+ * Compare two menu items by their display text
*
* @param ElggMenuItem $a
* @param ElggMenuItem $b
* @return bool
*/
- public static function compareByTitle($a, $b) {
- $a = $a->getTitle();
- $b = $b->getTitle();
+ public static function compareByText($a, $b) {
+ $a = $a->getText();
+ $b = $b->getText();
return strnatcmp($a, $b);
}
diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php
index 0de5feddb..0a1b948cc 100644
--- a/engine/classes/ElggMenuItem.php
+++ b/engine/classes/ElggMenuItem.php
@@ -16,7 +16,7 @@ class ElggMenuItem {
/**
* @var string The menu display string
*/
- protected $title;
+ protected $text;
/**
* @var string The menu url
@@ -46,7 +46,7 @@ class ElggMenuItem {
/**
* @var string Tooltip
*/
- protected $tooltip = '';
+ protected $title = '';
/**
* @var int Menu weight - smaller weights float to the top
@@ -77,12 +77,12 @@ class ElggMenuItem {
* ElggMenuItem constructor
*
* @param string $name Identifier of the menu item
- * @param string $title Title of the menu item
+ * @param string $text Display text of the menu item
* @param string $url URL of the menu item
*/
- public function __construct($name, $title, $url) {
+ public function __construct($name, $text, $url) {
$this->name = $name;
- $this->title = $title;
+ $this->text = $text;
if ($url) {
$this->url = elgg_normalize_url($url);
}
@@ -99,13 +99,13 @@ class ElggMenuItem {
* @return ElggMenuItem or NULL on error
*/
public static function factory($options) {
- if (!isset($options['name']) || !isset($options['title'])) {
+ if (!isset($options['name']) || !isset($options['text'])) {
return NULL;
}
- $item = new ElggMenuItem($options['name'], $options['title'], $options['url']);
+ $item = new ElggMenuItem($options['name'], $options['text'], $options['url']);
unset($options['name']);
- unset($options['title']);
+ unset($options['text']);
unset($options['url']);
// special catch in case someone uses context rather than contexts
@@ -136,12 +136,12 @@ class ElggMenuItem {
}
/**
- * Get the display title of the menu
+ * Get the display text of the menu
*
* @return string
*/
- public function getTitle() {
- return $this->title;
+ public function getText() {
+ return $this->text;
}
/**
@@ -229,7 +229,7 @@ class ElggMenuItem {
* @return void
*/
public function setTooltip($text) {
- $this->tooltip = $text;
+ $this->title = $text;
}
/**
@@ -238,7 +238,7 @@ class ElggMenuItem {
* @return string
*/
public function getTooltip() {
- return $this->tooltip;
+ return $this->title;
}
/**
@@ -408,13 +408,16 @@ class ElggMenuItem {
* @return string
*/
public function getLink(array $vars = array()) {
- $vars['text'] = $this->title;
+ $vars['text'] = $this->text;
if ($this->url) {
$vars['href'] = $this->url;
}
if ($this->linkClass) {
$vars['class'] = $this->linkClass;
}
+ if ($this->title) {
+ $vars['title'] = $this->title;
+ }
return elgg_view('output/url', $vars);
}
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index d4ebbdd0d..3f4a331de 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -138,7 +138,7 @@ function elgg_add_admin_menu_item($section_id, $section_title, $parent_id = NULL
return elgg_register_menu_item('page', array(
'name' => $name,
'url' => $href,
- 'title' => $section_title,
+ 'text' => $section_title,
'context' => 'admin',
'parent_name' => $parent_id,
'weight' => $weight,
@@ -205,7 +205,7 @@ function admin_init() {
elgg_register_menu_item('page', array(
'name' => 'dashboard',
'url' => 'pg/admin/dashboard',
- 'title' => elgg_echo('admin:dashboard'),
+ 'text' => elgg_echo('admin:dashboard'),
'context' => 'admin',
'weight' => 10,
));
diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php
index 58ea3d48a..e31a9f8ba 100644
--- a/engine/lib/deprecated-1.8.php
+++ b/engine/lib/deprecated-1.8.php
@@ -1205,7 +1205,7 @@ function add_submenu_item($label, $link, $group = 'default', $onclick = false, $
$context = 'all';
}
- $item = array('name' => $label, 'title' => $label, 'url' => $link, 'context' => $context,
+ $item = array('name' => $label, 'text' => $label, 'url' => $link, 'context' => $context,
'section' => $group,);
if ($selected) {
@@ -1250,7 +1250,7 @@ function get_submenu() {
function add_menu($menu_name, $menu_url, $menu_children = array(), $context = "") {
elgg_deprecated_notice('add_menu() deprecated by elgg_register_menu_item()', 1.8);
- return elgg_register_menu_item('site', array('name' => $menu_name, 'title' => $menu_name,
+ return elgg_register_menu_item('site', array('name' => $menu_name, 'text' => $menu_name,
'url' => $menu_url,));
}
diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php
index 0247dc5d9..25aa36dbd 100644
--- a/engine/lib/user_settings.php
+++ b/engine/lib/user_settings.php
@@ -253,19 +253,19 @@ function usersettings_pagesetup() {
$params = array(
'name' => '1_account',
- 'title' => elgg_echo('usersettings:user:opt:linktext'),
+ 'text' => elgg_echo('usersettings:user:opt:linktext'),
'url' => "pg/settings/user/{$user->username}",
);
elgg_register_menu_item('page', $params);
$params = array(
'name' => '1_plugins',
- 'title' => elgg_echo('usersettings:plugins:opt:linktext'),
+ 'text' => elgg_echo('usersettings:plugins:opt:linktext'),
'url' => "pg/settings/plugins/{$user->username}",
);
elgg_register_menu_item('page', $params);
$params = array(
'name' => '1_statistics',
- 'title' => elgg_echo('usersettings:statistics:opt:linktext'),
+ 'text' => elgg_echo('usersettings:statistics:opt:linktext'),
'url' => "pg/settings/statistics/{$user->username}",
);
elgg_register_menu_item('page', $params);
diff --git a/engine/lib/users.php b/engine/lib/users.php
index a78b9565b..9d1cb1ff6 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1087,14 +1087,14 @@ function collections_submenu_items() {
$user = elgg_get_logged_in_user_entity();
elgg_register_menu_item('page', array(
- 'name' => 'friends:collections',
- 'title' => elgg_echo('friends:collections'),
+ 'name' => 'friends:collections:view',
+ 'text' => elgg_echo('friends:collections'),
'url' => "pg/collections/$user->username",
));
elgg_register_menu_item('page', array(
- 'name' => 'friends:collections',
- 'title' => elgg_echo('friends:collections:add'),
+ 'name' => 'friends:collections:add',
+ 'text' => elgg_echo('friends:collections:add'),
'url' => "pg/collections/add",
));
}
@@ -1112,7 +1112,7 @@ function friends_page_handler($page_elements) {
}
if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
// disabled for now as we no longer use friends collections (replaced by shared access)
- // collections_submenu_items();
+ collections_submenu_items();
}
require_once(dirname(dirname(dirname(__FILE__))) . "/pages/friends/index.php");
}
@@ -1131,7 +1131,7 @@ function friends_of_page_handler($page_elements) {
}
if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
// disabled for now as we no longer use friends collections (replaced by shared access)
- // collections_submenu_items();
+ collections_submenu_items();
}
require_once(dirname(dirname(dirname(__FILE__))) . "/pages/friends/of.php");
}
@@ -1467,7 +1467,7 @@ function users_pagesetup() {
if (elgg_get_page_owner_guid()) {
$params = array(
'name' => 'friends',
- 'title' => elgg_echo('friends'),
+ 'text' => elgg_echo('friends'),
'url' => 'pg/friends/' . elgg_get_page_owner_entity()->username,
'contexts' => array('friends')
);
@@ -1475,7 +1475,7 @@ function users_pagesetup() {
$params = array(
'name' => 'friendsof',
- 'title' => elgg_echo('friends:of'),
+ 'text' => elgg_echo('friends:of'),
'url' => 'pg/friendsof/' . elgg_get_page_owner_entity()->username,
'contexts' => array('friends')
);
@@ -1500,8 +1500,7 @@ function users_init() {
elgg_register_page_handler('members', 'elgg_members_page_handler');
elgg_register_page_handler('avatar', 'elgg_avatar_page_handler');
elgg_register_page_handler('profile', 'elgg_profile_page_handler');
-
- //elgg_register_page_handler('collections', 'collections_page_handler');
+ elgg_register_page_handler('collections', 'collections_page_handler');
$item = new ElggMenuItem('members', elgg_echo('members'), 'pg/members');
elgg_register_menu_item('site', $item);
@@ -1511,14 +1510,14 @@ function users_init() {
$params = array(
'name' => 'edit_avatar',
'url' => "pg/avatar/edit/{$user->username}",
- 'title' => elgg_echo('avatar:edit'),
+ 'text' => elgg_echo('avatar:edit'),
'contexts' => array('profile_edit'),
);
elgg_register_menu_item('page', $params);
$params = array(
'name' => 'edit_profile',
'url' => "pg/profile/{$user->username}/edit",
- 'title' => elgg_echo('profile:edit'),
+ 'text' => elgg_echo('profile:edit'),
'contexts' => array('profile_edit'),
);
elgg_register_menu_item('page', $params);
@@ -1534,10 +1533,9 @@ function users_init() {
elgg_register_action('avatar/crop');
elgg_register_action('profile/edit');
- //elgg_register_action('friends/addcollection');
- //elgg_register_action('friends/deletecollection');
- //elgg_register_action('friends/editcollection');
- //elgg_register_action("user/spotlight");
+ elgg_register_action('friends/addcollection');
+ elgg_register_action('friends/deletecollection');
+ elgg_register_action('friends/editcollection');
elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'user_avatar_hook');
diff --git a/engine/lib/views.php b/engine/lib/views.php
index b1c42680a..db510a275 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -1493,8 +1493,8 @@ function elgg_views_boot() {
elgg_register_simplecache_view('js/friendsPickerv1');
elgg_register_simplecache_view('js/elgg');
- elgg_register_js("/vendors/jquery/jquery-1.5.min.js", 'jquery');
- elgg_register_js("/vendors/jquery/jquery-ui-1.8.9.min.js", 'jquery-ui');
+ elgg_register_js("/vendors/jquery/jquery-1.4.2.min.js", 'jquery');
+ elgg_register_js("/vendors/jquery/jquery-ui-1.7.2.min.js", 'jquery-ui');
elgg_register_js("/vendors/jquery/jquery.form.js", 'jquery.form');
elgg_register_event_handler('ready', 'system', 'elgg_views_register_core_head_elements');