From 700ae307bd2bc698f60ffd02afcc87aaff9f74e5 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 26 Sep 2011 20:31:58 -0400 Subject: Fixes #2921 clearing new ignore internal variables --- views/default/input/userpicker.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'views/default/input/userpicker.php') diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php index dcd65072a..b852d24fc 100644 --- a/views/default/input/userpicker.php +++ b/views/default/input/userpicker.php @@ -6,15 +6,15 @@ * @subpackage Core * * @uses $vars['value'] Array of user guids for already selected users or null - * @uses $vars['name'] The name of the input field * + * The name of the hidden fields is members[] * * Defaults to lazy load user lists in paginated alphabetical order. User needs - * two type two characters before seeing the user popup list. + * to type two characters before seeing the user popup list. * * As users are checked they move down to a "users" box. - * When this happens, a hidden input is created also. - * {$internalnal}[] with the value the GUID. + * When this happens, a hidden input is created with the + * name of members[] and a value of the GUID. * * @warning: this is not stable */ -- cgit v1.2.3 From 7e23a3bd6382190084f136ed5aeb6b910ae00eee Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 13 Oct 2011 20:45:40 -0400 Subject: got the friends option working for user picker --- js/lib/userpicker.js | 53 ++++++++++---------------------------- views/default/input/userpicker.php | 3 ++- 2 files changed, 16 insertions(+), 40 deletions(-) (limited to 'views/default/input/userpicker.php') diff --git a/js/lib/userpicker.js b/js/lib/userpicker.js index 826bf21a0..780fa47c6 100644 --- a/js/lib/userpicker.js +++ b/js/lib/userpicker.js @@ -1,14 +1,14 @@ elgg.provide('elgg.userpicker'); elgg.userpicker.init = function() { + // binding autocomplete. // doing this as an each so we can pass this to functions. $('.elgg-input-user-picker').each(function() { - - var _this = this; - + $(this).autocomplete({ source: function(request, response) { + var params = elgg.userpicker.getSearchParams(this); elgg.get('livesearch', { @@ -20,53 +20,28 @@ elgg.userpicker.init = function() { }); }, minLength: 2, + html: "html", select: elgg.userpicker.addUser }) - - //@todo This seems convoluted - .data("autocomplete")._renderItem = elgg.userpicker.formatItem; }); }; -elgg.userpicker.formatItem = function(ul, item) { - switch (item.type) { - case 'user': - case 'group': - r = item.icon + item.name + ' - ' + item.desc; - break; - - default: - r = item.name + ' - ' + item.desc; - break; - } - - return $("
  • ") - .data("item.autocomplete", item) - .append(r) - .appendTo(ul); -}; - +/** + * elgg.userpicker.userList is defined in the input/userpicker view + */ elgg.userpicker.addUser = function(event, ui) { var info = ui.item; - + // do not allow users to be added multiple times if (!(info.guid in elgg.userpicker.userList)) { elgg.userpicker.userList[info.guid] = true; - - var picker = $(this).closest('.elgg-user-picker'); - var users = picker.find('.elgg-user-picker-entries'); - var internalName = users.find('[type=hidden]').attr('name'); - - // not sure why formatted isn't. - var formatted = elgg.userpicker.formatItem(data); - - // add guid as hidden input and to list. - var li = formatted + ' ' - + ''; + var users = $(this).siblings('.elgg-user-picker-entries'); + var li = ''; $('
  • ').html(li).appendTo(users); - - $(this).val(''); } + + $(this).val(''); + event.preventDefault(); }; elgg.userpicker.removeUser = function(link, guid) { @@ -74,7 +49,7 @@ elgg.userpicker.removeUser = function(link, guid) { }; elgg.userpicker.getSearchParams = function(e) { - if ($(e).closest('.elgg-user-picker').find('[name=match_on]').attr('checked')) { + if (e.element.siblings('[name=match_on]').attr('checked')) { return {'match_on[]': 'friends', 'term' : e.term}; } else { return {'match_on[]': 'users', 'term' : e.term}; diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php index b852d24fc..94129d1e0 100644 --- a/views/default/input/userpicker.php +++ b/views/default/input/userpicker.php @@ -62,7 +62,8 @@ foreach ($vars['value'] as $user_id) { ?>
    - + +
    \ No newline at end of file -- cgit v1.2.3 From fa0dbc7f8a34597345f7939ca9914438624c3cee Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 5 Nov 2011 17:09:34 -0400 Subject: Fixes #3567 standardized classes for icons --- engine/lib/input.php | 12 ++--- engine/lib/views.php | 4 +- .../views/default/theme_preview/icons/avatars.php | 4 +- mod/file/views/default/icon/object/file.php | 8 +++- .../views/default/groups/invitationrequests.php | 2 +- .../views/default/groups/membershiprequests.php | 2 +- .../notifications/subscriptions/forminternals.php | 2 +- mod/profile/views/default/profile/owner_block.php | 2 +- views/default/icon/default.php | 11 ++++- views/default/icon/user/default.php | 51 ++++++++++++++++------ views/default/input/friendspicker.php | 2 +- views/default/input/userpicker.php | 2 +- views/default/profile/icon.php | 2 +- .../river/user/default/profileiconupdate.php | 5 ++- 14 files changed, 75 insertions(+), 34 deletions(-) (limited to 'views/default/input/userpicker.php') diff --git a/engine/lib/input.php b/engine/lib/input.php index 2f68195f2..57e35786f 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -301,12 +301,12 @@ function input_livesearch_page_handler($page) { } $output = elgg_view_list_item($entity, array( - 'hover' => false, + 'use_hover' => false, 'class' => 'elgg-autocomplete-item', )); $icon = elgg_view_entity_icon($entity, 'tiny', array( - 'hover' => false, + 'use_hover' => false, )); $result = array( @@ -344,12 +344,12 @@ function input_livesearch_page_handler($page) { } $output = elgg_view_list_item($entity, array( - 'hover' => false, + 'use_hover' => false, 'class' => 'elgg-autocomplete-item', )); $icon = elgg_view_entity_icon($entity, 'tiny', array( - 'hover' => false, + 'use_hover' => false, )); $result = array( @@ -391,12 +391,12 @@ function input_livesearch_page_handler($page) { } $output = elgg_view_list_item($entity, array( - 'hover' => false, + 'use_hover' => false, 'class' => 'elgg-autocomplete-item', )); $icon = elgg_view_entity_icon($entity, 'tiny', array( - 'hover' => false, + 'use_hover' => false, )); $result = array( diff --git a/engine/lib/views.php b/engine/lib/views.php index 2ec56c97e..6ca68ac8c 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -860,7 +860,9 @@ function elgg_view_entity(ElggEntity $entity, $vars = array(), $bypass = true, $ * * @param ElggEntity $entity The entity to display * @param string $size The size: tiny, small, medium, large - * @param array $vars An array of variables to pass to the view + * @param array $vars An array of variables to pass to the view. Some possible + * variables are img_class and link_class. See the + * specific icon view for more parameters. * * @return string HTML to display or false */ diff --git a/mod/developers/views/default/theme_preview/icons/avatars.php b/mod/developers/views/default/theme_preview/icons/avatars.php index cbce5bc7d..f50a6b70d 100644 --- a/mod/developers/views/default/theme_preview/icons/avatars.php +++ b/mod/developers/views/default/theme_preview/icons/avatars.php @@ -18,7 +18,7 @@ '; - echo elgg_view_entity_icon($user, $size, array('hover' => false)); + echo elgg_view_entity_icon($user, $size, array('use_hover' => false)); echo ''; } ?> @@ -28,7 +28,7 @@ '; - echo elgg_view_entity_icon($group, $size, array('hover' => false)); + echo elgg_view_entity_icon($group, $size, array('use_hover' => false)); echo ''; } ?> diff --git a/mod/file/views/default/icon/object/file.php b/mod/file/views/default/icon/object/file.php index 51a4469e9..a3190310b 100644 --- a/mod/file/views/default/icon/object/file.php +++ b/mod/file/views/default/icon/object/file.php @@ -5,6 +5,7 @@ * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method * @uses $vars['size'] topbar, tiny, small, medium (default), large, master * @uses $vars['href'] Optional override for link + * @uses $vars['img_class'] Optional CSS class added to img * @uses $vars['link_class'] Optional CSS class added to link */ @@ -25,8 +26,13 @@ if (isset($vars['href'])) { } $class = ''; +if (isset($vars['img_class'])) { + $class = $vars['img_class']; +} if ($entity->thumbnail) { - $class = 'class="elgg-photo"'; + $class = "class=\"elgg-photo $class\""; +} else if ($class) { + $class = "class=\"$class\""; } $img_src = $entity->getIconURL($vars['size']); diff --git a/mod/groups/views/default/groups/invitationrequests.php b/mod/groups/views/default/groups/invitationrequests.php index e644b6bdc..94dbdf1f2 100644 --- a/mod/groups/views/default/groups/invitationrequests.php +++ b/mod/groups/views/default/groups/invitationrequests.php @@ -10,7 +10,7 @@ if (!empty($vars['invitations']) && is_array($vars['invitations'])) { echo '
      '; foreach ($vars['invitations'] as $group) { if ($group instanceof ElggGroup) { - $icon = elgg_view_entity_icon($group, 'tiny', array('hover' => 'true')); + $icon = elgg_view_entity_icon($group, 'tiny', array('use_hover' => 'true')); $group_title = elgg_view('output/url', array( 'href' => $group->getURL(), diff --git a/mod/groups/views/default/groups/membershiprequests.php b/mod/groups/views/default/groups/membershiprequests.php index bc6d9af5a..9cd28262f 100644 --- a/mod/groups/views/default/groups/membershiprequests.php +++ b/mod/groups/views/default/groups/membershiprequests.php @@ -10,7 +10,7 @@ if (!empty($vars['requests']) && is_array($vars['requests'])) { $user = elgg_get_logged_in_user_entity(); echo '
        '; foreach ($vars['requests'] as $user) { - $icon = elgg_view_entity_icon($user, 'tiny', array('hover' => 'true')); + $icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => 'true')); $user_title = elgg_view('output/url', array( 'href' => $user->getURL(), diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php index a7fbec2fd..e89ce02be 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -234,7 +234,7 @@ END; false)); + echo elgg_view_entity_icon($friend, 'tiny', array('use_hover' => false)); ?>
        @@ -63,10 +80,16 @@ if ($show_menu) { echo elgg_view_menu('user_hover', $params); } -echo elgg_view('output/url', array( - 'href' => $user->getURL(), - 'text' => $icon, - 'is_trusted' => true, -)); +if ($use_link) { + $class = elgg_extract('link_class', $vars, ''); + echo elgg_view('output/url', array( + 'href' => $user->getURL(), + 'text' => $icon, + 'is_trusted' => true, + 'class' => $class, + )); +} else { + echo "$icon"; +} ?>
        diff --git a/views/default/input/friendspicker.php b/views/default/input/friendspicker.php index ecf468da3..b41449fbf 100644 --- a/views/default/input/friendspicker.php +++ b/views/default/input/friendspicker.php @@ -187,7 +187,7 @@ if (!isset($vars['replacement'])) { } //echo "

        " . $user->name . "

        "; - $label = elgg_view_entity_icon($friend, 'tiny', array('hover' => false)); + $label = elgg_view_entity_icon($friend, 'tiny', array('use_hover' => false)); $options[$label] = $friend->getGUID(); if ($vars['highlight'] == 'all' diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php index 5c4b297b1..246c462da 100644 --- a/views/default/input/userpicker.php +++ b/views/default/input/userpicker.php @@ -27,7 +27,7 @@ function user_picker_add_user($user_id) { return false; } - $icon = elgg_view_entity_icon($user, 'tiny', array('hover' => false)); + $icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => false)); // this html must be synced with the userpicker.js library $code = '
      • '; diff --git a/views/default/profile/icon.php b/views/default/profile/icon.php index a69c41f1e..5f06cfd54 100644 --- a/views/default/profile/icon.php +++ b/views/default/profile/icon.php @@ -12,6 +12,6 @@ elgg_deprecated_notice('The profile/icon view was deprecated. Use elgg_view_entity_icon()', 1.8); $override = elgg_extract('override', $vars, false); -$vars['hover'] = !$override; +$vars['use_hover'] = !$override; echo elgg_view('icon/user/default', $vars); diff --git a/views/default/river/user/default/profileiconupdate.php b/views/default/river/user/default/profileiconupdate.php index 160ffd252..271064a06 100644 --- a/views/default/river/user/default/profileiconupdate.php +++ b/views/default/river/user/default/profileiconupdate.php @@ -17,5 +17,8 @@ $string = elgg_echo('river:update:user:avatar', array($subject_link)); echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'summary' => $string, - 'attachments' => elgg_view_entity_icon($subject, 'tiny', array('hover' => false)), + 'attachments' => elgg_view_entity_icon($subject, 'tiny', array( + 'use_hover' => false, + 'use_link' => false, + )), )); -- cgit v1.2.3