From 0ffda3e1b6c4bddee2ec45ea0bce793844b02bf6 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 27 Dec 2010 20:37:17 +0000 Subject: more clean up of the basic profile plugin - reorged views and removed a lot of cruft git-svn-id: http://code.elgg.org/elgg/trunk@7726 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/graphics/drag_handle.png | Bin 594 -> 0 bytes mod/profile/graphics/twitter16px.png | Bin 724 -> 0 bytes mod/profile/languages/en.php | 117 +-------------------- mod/profile/start.php | 35 +----- mod/profile/views/default/profile/box.php | 26 ----- mod/profile/views/default/profile/css.php | 39 ++----- mod/profile/views/default/profile/details.php | 12 ++- mod/profile/views/default/profile/listing.php | 49 --------- .../views/default/profile/menu/adminlinks.php | 28 ----- .../views/default/profile/menu/friendlinks.php | 23 ---- mod/profile/views/default/profile/menu/links.php | 9 -- mod/profile/views/default/profile/owner_block.php | 65 ++++++++++++ mod/profile/views/default/profile/ownerblock.php | 84 --------------- mod/profile/views/default/profile/sidebar.php | 13 --- mod/profile/views/default/profile/wrapper.php | 18 ++++ 15 files changed, 102 insertions(+), 416 deletions(-) delete mode 100644 mod/profile/graphics/drag_handle.png delete mode 100644 mod/profile/graphics/twitter16px.png delete mode 100644 mod/profile/views/default/profile/box.php delete mode 100644 mod/profile/views/default/profile/listing.php delete mode 100644 mod/profile/views/default/profile/menu/adminlinks.php delete mode 100644 mod/profile/views/default/profile/menu/friendlinks.php delete mode 100644 mod/profile/views/default/profile/menu/links.php create mode 100755 mod/profile/views/default/profile/owner_block.php delete mode 100755 mod/profile/views/default/profile/ownerblock.php delete mode 100644 mod/profile/views/default/profile/sidebar.php create mode 100644 mod/profile/views/default/profile/wrapper.php diff --git a/mod/profile/graphics/drag_handle.png b/mod/profile/graphics/drag_handle.png deleted file mode 100644 index 2e9bc42be..000000000 Binary files a/mod/profile/graphics/drag_handle.png and /dev/null differ diff --git a/mod/profile/graphics/twitter16px.png b/mod/profile/graphics/twitter16px.png deleted file mode 100644 index de51c6953..000000000 Binary files a/mod/profile/graphics/twitter16px.png and /dev/null differ diff --git a/mod/profile/languages/en.php b/mod/profile/languages/en.php index 6017a590c..50f04bb33 100644 --- a/mod/profile/languages/en.php +++ b/mod/profile/languages/en.php @@ -4,121 +4,8 @@ */ $english = array( - -/** - * Profile - */ - - 'profile' => "Profile", - 'profile:edit:default' => 'Profile fields', - 'profile:preview' => 'Preview', - -/** - * Profile menu items and titles - */ - - 'profile:yours' => "My profile", - 'profile:user' => "%s's profile", - - 'profile:edit' => "Edit profile", - 'profile:profilepictureinstructions' => "Your avatar is the image that's displayed on your profile page.
You can change it as often as you'd like. (File formats accepted: GIF, JPG or PNG)", - 'profile:icon' => "Avatar", - 'profile:createicon' => "Create your avatar", - 'profile:currentavatar' => "Current avatar", - 'profile:createicon:header' => "Profile picture", - 'profile:profilepicturecroppingtool' => "Avatar cropping tool", - 'profile:createicon:instructions' => "Click and drag a square below to match how you want your avatar cropped. A preview will appear in the box on the right. When you are happy with the preview, click 'Create your avatar'. This cropped version will be used throughout the site as your avatar. ", - - 'profile:editdetails' => "Edit profile", - 'profile:editicon' => "Edit avatar", - - 'profile:aboutme' => "About me", - 'profile:description' => "About me", - 'profile:briefdescription' => "Brief description", - 'profile:location' => "Location", - 'profile:skills' => "Skills", - 'profile:interests' => "Interests", - 'profile:contactemail' => "Contact email", - 'profile:phone' => "Telephone", - 'profile:mobile' => "Mobile phone", - 'profile:website' => "Website", - - 'profile:banned' => 'This user account has been suspended.', - 'profile:deleteduser' => 'Deleted user', - - 'profile:river:update' => "%s updated their profile", - 'profile:river:iconupdate' => "%s updated their profile icon", - - 'profile:label' => "Profile label", - 'profile:type' => "Profile type", - 'profile:twitter' => "Twitter username", - 'twitter:visit' => "Visit this Twitter account", - 'profile:editdefault:fail' => 'Default profile could not be saved', - 'profile:editdefault:success' => 'Item successfully added to default profile', - - - 'profile:editdefault:delete:fail' => 'Removed default profile item field failed', - 'profile:editdefault:delete:success' => 'Default profile item deleted!', - - 'profile:defaultprofile:reset' => 'Default system profile reset', - - 'profile:resetdefault' => 'Reset default profile', - 'profile:explainchangefields' => 'You can replace the existing profile fields with your own using the form below.

Give the new profile field a label, for example, \'Favorite team\', then select the field type (eg. text, url, tags), and click the \'Add\' button. To re-order the fields drag on the handle next to the field label. To edit a field label - click on the label\'s text to make it editable.
At any time you can revert back to the default profile set up, but you will loose any information already entered into custom fields on profile pages.', - - -/** - * Profile status messages - */ - - 'profile:saved' => "Your profile was successfully saved.", - 'profile:icon:uploaded' => "Your profile picture was successfully uploaded.", - -/** - * Profile comment wall - **/ - 'profile:commentwall:add' => "Add to the wall", - 'profile:commentwall' => "Comment Wall", - 'profile:commentwall:posted' => "You successfully posted on the comment wall.", - 'profile:commentwall:deleted' => "You successfully deleted the message.", - 'profile:commentwall:blank' => "Sorry; you need to actually put something in the message area before we can save it.", - 'profile:commentwall:notfound' => "Sorry; we could not find the specified item.", - 'profile:commentwall:notdeleted' => "Sorry; we could not delete this message.", - 'profile:commentwall:none' => "No comment wall posts found.", - 'profile:commentwall:somethingwentwrong' => "Something went wrong when trying to save your message, make sure you actually wrote a message.", - 'profile:commentwall:failure' => "An unexpected error occurred when adding your message. Please try again.", - -/** - * Email messages commentwall - */ - - 'profile:comment:subject' => 'You have a new message on your comment wall!', - 'profile:comment:body' => "You have a new message on your comment wall from %s. It reads: - - -%s - - -To view your message board comments, click here: - - %s - -To view %s's profile, click here: - - %s - -You cannot reply to this email.", - -/** - * Profile error messages - */ - - 'profile:no_friends' => 'This person hasn\'t added any friends yet!', - 'profile:no_groups' => 'This user has not joined any groups yet.', - 'profile:noaccess' => "You do not have permission to edit this profile.", - 'profile:notfound' => "Sorry, we could not find the specified profile.", - 'profile:icon:notfound' => "Sorry, there was a problem uploading your profile picture.", - 'profile:icon:noaccess' => 'You cannot change this profile icon', - 'profile:field_too_long' => 'Cannot save your profile information because the "%s" section is too long.', + 'profile' => 'Profile', + 'profile:notfound' => 'Sorry. We could not find the requested profile.', ); diff --git a/mod/profile/start.php b/mod/profile/start.php index 017f91378..49f310882 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -8,8 +8,7 @@ elgg_register_event_handler('init', 'system', 'profile_init', 1); /** - * Profile init function; sets up the profile functions - * + * Profile init function */ function profile_init() { global $CONFIG; @@ -33,12 +32,6 @@ function profile_init() { elgg_extend_view('html_head/extend', 'profile/metatags'); elgg_extend_view('css/screen', 'profile/css'); - - // Register actions - elgg_register_action("profile/addcomment", $CONFIG->pluginspath . "profile/actions/addcomment.php"); - elgg_register_action("profile/deletecomment", $CONFIG->pluginspath . "profile/actions/deletecomment.php"); - - elgg_register_event_handler('profileupdate', 'all', 'object_notifications'); // allow ECML in parts of the profile elgg_register_plugin_hook_handler('get_views', 'ecml', 'profile_ecml_views_hook'); @@ -70,14 +63,14 @@ function profile_page_handler($page) { } if ($action == 'edit') { - // use for the core profile edit page + // use the core profile edit page require $CONFIG->path . 'pages/profile/edit.php'; return; } // main profile page $params = array( - 'box' => elgg_view('profile/box'), + 'box' => elgg_view('profile/wrapper'), 'num_columns' => 3, ); $content = elgg_view_layout('widgets', $params); @@ -86,28 +79,6 @@ function profile_page_handler($page) { echo elgg_view_page($title, $body); } -/** - * Returns the html for a user profile. - * - * @param string $username The username of the profile to display - * @param string $section Which section is currently selected. - * - * @todo - This should really use a plugin hook to get the list of plugin tabs - * - * @return mixed FALSE or html for the profile. - */ -function profile_get_user_profile_html($user, $section = 'activity') { - $body = elgg_view('profile/tab_navigation', array('section' => $section, 'entity' => $user)); - $view_options = array('entity' => $user); - - $content = elgg_view("profile/tabs/$section", $view_options); - - $body .= elgg_view('profile/content_wrapper', array('content' => $content)); - - $body .= elgg_view('profile/sidebar', array('section' => $section)); - return $body; -} - /** * Profile URL generator for $user->getUrl(); * diff --git a/mod/profile/views/default/profile/box.php b/mod/profile/views/default/profile/box.php deleted file mode 100644 index 77c408536..000000000 --- a/mod/profile/views/default/profile/box.php +++ /dev/null @@ -1,26 +0,0 @@ - -
-
- 'details')); - echo elgg_view('profile/details', array('entity' => elgg_get_page_owner())); -?> -
-
- - \ No newline at end of file diff --git a/mod/profile/views/default/profile/css.php b/mod/profile/views/default/profile/css.php index 1d1f1ccb1..f280db565 100644 --- a/mod/profile/views/default/profile/css.php +++ b/mod/profile/views/default/profile/css.php @@ -1,12 +1,12 @@ /* *************************************** - main layout blocks + Profile *************************************** */ .profile { float: left; @@ -18,23 +18,17 @@ -webkit-border-radius: 8px; -moz-border-radius: 8px; } -#profile-sidebar { - width:230px; - float:left; -} #profile-details { padding: 15px; } - -/* *************************************** - ownerblock in sidebar -*************************************** */ +/*** ownerblock ***/ #profile-owner-block { + width: 200px; + float: left; background-color: #eeeeee; padding: 15px; } -.owner_block_icon { - overflow: hidden; +#profile-owner-block .large { margin-bottom: 10px; } #profile-owner-block a.elgg-action-button { @@ -54,10 +48,6 @@ color: white; text-decoration: none; } - -/* *************************************** - admin menu in sidebar -*************************************** */ .profile-admin-menu { display: none; } @@ -82,10 +72,7 @@ .profile-admin-menu-wrapper a:hover { color: black; } - -/* *************************************** - full profile info panel -*************************************** */ +/*** profile details ***/ #profile-details .odd { background-color:#f4f4f4; -webkit-border-radius: 4px; @@ -110,10 +97,6 @@ #profile-details .aboutme_contents { padding:2px 0 0 3px; } - -/* *************************************** - banned user -*************************************** */ /* banned user full profile panel */ #profile_content .banned_user { border:2px solid red; @@ -121,11 +104,3 @@ -webkit-border-radius: 6px; -moz-border-radius: 6px; } -/* banned user in friends lists */ -.entity-listing-info p.entity-title.user.banned { - text-decoration: line-through; -} -.entity-listing-info p.entity-title.user.banned a { - color:red; -} - diff --git a/mod/profile/views/default/profile/details.php b/mod/profile/views/default/profile/details.php index c2f4cc01b..b81db30fd 100644 --- a/mod/profile/views/default/profile/details.php +++ b/mod/profile/views/default/profile/details.php @@ -4,14 +4,16 @@ * @uses $vars['entity'] The user entity */ +$user = elgg_get_page_owner(); + echo '
'; -echo "

{$vars['entity']->name}

"; +echo "

{$user->name}

"; $even_odd = null; if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0) { foreach($vars['config']->profile as $shortname => $valtype) { if ($shortname != "description") { - $value = $vars['entity']->$shortname; + $value = $user->$shortname; if (!empty($value)) { //This function controls the alternating class $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; @@ -21,7 +23,7 @@ if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0) echo elgg_echo("profile:{$shortname}"); ?>: $vars['entity']->$shortname)); + echo elgg_view("output/{$valtype}", array('value' => $user->$shortname)); ?>

profile) && sizeof($vars['config']->profile) > 0) } if (!get_plugin_setting('user_defined_fields', 'profile')) { - if ($vars['entity']->isBanned()) { + if ($user->isBanned()) { echo "
"; - echo elgg_echo('profile:banned'); + echo elgg_echo('banned'); echo "
"; } else { if ($vars['entity']->description) { diff --git a/mod/profile/views/default/profile/listing.php b/mod/profile/views/default/profile/listing.php deleted file mode 100644 index 489b1d50e..000000000 --- a/mod/profile/views/default/profile/listing.php +++ /dev/null @@ -1,49 +0,0 @@ - $vars['entity'], - 'size' => 'tiny', - ) -); - -$banned = $vars['entity']->isBanned(); - -// Simple XFN -$rel_type = ""; -if (get_loggedin_userid() == $vars['entity']->guid) { - $rel_type = 'me'; -} elseif (check_entity_relationship(get_loggedin_userid(), 'friend', $vars['entity']->guid)) { - $rel_type = 'friend'; -} - -if ($rel_type) { - $rel = "rel=\"$rel_type\""; -} - -if (!$banned) { - $info .= "

getUrl() . "\" $rel>" . $vars['entity']->name . "

"; - $location = $vars['entity']->location; - if (!empty($location)) { - $info .= "

" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "

"; - } - //create a view that a status plugin could extend - in the default case, this is the wire - $info .= elgg_view("profile/status", array("entity" => $vars['entity'])); -}else{ - $info .= "

"; - if (isadminloggedin()) - $info .= "getUrl() . "\">"; - $info .= $vars['entity']->name; - if (isadminloggedin()) - $info .= ""; - $info .= "

"; -} - -echo elgg_view_image_block($icon, $info); diff --git a/mod/profile/views/default/profile/menu/adminlinks.php b/mod/profile/views/default/profile/menu/adminlinks.php deleted file mode 100644 index 39807764a..000000000 --- a/mod/profile/views/default/profile/menu/adminlinks.php +++ /dev/null @@ -1,28 +0,0 @@ -guid){ -?> - -isBanned()) { - echo elgg_view('output/confirmlink', array('text' => elgg_echo("ban"), 'href' => "action/admin/user/ban?guid={$vars['entity']->guid}")); - } else { - echo elgg_view('output/confirmlink', array('text' => elgg_echo("unban"), 'href' => "action/admin/user/unban?guid={$vars['entity']->guid}")); - } - echo elgg_view('output/confirmlink', array('text' => elgg_echo("delete"), 'href' => "action/admin/user/delete?guid={$vars['entity']->guid}")); - echo elgg_view('output/confirmlink', array('text' => elgg_echo("resetpassword"), 'href' => "action/admin/user/resetpassword?guid={$vars['entity']->guid}")); - if (!$vars['entity']->isAdmin()) { - echo elgg_view('output/confirmlink', array('text' => elgg_echo("makeadmin"), 'href' => "action/admin/user/makeadmin?guid={$vars['entity']->guid}")); - } else { - echo elgg_view('output/confirmlink', array('text' => elgg_echo("removeadmin"), 'href' => "action/admin/user/removeadmin?guid={$vars['entity']->guid}")); - } - } - } diff --git a/mod/profile/views/default/profile/menu/friendlinks.php b/mod/profile/views/default/profile/menu/friendlinks.php deleted file mode 100644 index ed13edb8b..000000000 --- a/mod/profile/views/default/profile/menu/friendlinks.php +++ /dev/null @@ -1,23 +0,0 @@ -isFriend()) { - echo elgg_view('output/confirmlink', array( - 'href' => "action/friends/remove?friend={$vars['entity']->getGUID()}", - 'text' => elgg_echo('friend:remove'), - 'class' => 'remove_friend' - )); -} else { - echo elgg_view('output/confirmlink', array( - 'href' => "action/friends/add?friend={$vars['entity']->getGUID()}", - 'text' => elgg_echo('friend:add'), - 'class' => 'add_friend' - )); -} \ No newline at end of file diff --git a/mod/profile/views/default/profile/menu/links.php b/mod/profile/views/default/profile/menu/links.php deleted file mode 100644 index 4233d7ec5..000000000 --- a/mod/profile/views/default/profile/menu/links.php +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/mod/profile/views/default/profile/owner_block.php b/mod/profile/views/default/profile/owner_block.php new file mode 100755 index 000000000..acff5c2d4 --- /dev/null +++ b/mod/profile/views/default/profile/owner_block.php @@ -0,0 +1,65 @@ + $user, + 'size' => 'large', + 'override' => 'true' +)); + +// grab the actions and admin menu items from user hover +$menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array()); +$builder = new ElggMenuBuilder($menu); +$menu = $builder->getMenu(); +$actions = elgg_get_array_value('action', $menu, array()); +$admin = elgg_get_array_value('admin', $menu, array()); + +$profile_actions = ''; +if (isloggedin() && $actions) { + $profile_actions = ''; +} + +// if admin, display admin links +$admin_links = ''; +if (isadminloggedin() && get_loggedin_userid() != elgg_get_page_owner_guid()) { + $admin_links = ''; +} + +// content links +$content_menu = elgg_view_menu('owner_block', array( + 'entity' => elgg_get_page_owner(), + 'class' => 'profile-content-menu', +)); + +echo << + $icon + $profile_actions + $content_menu + $admin_links +
+ +HTML; diff --git a/mod/profile/views/default/profile/ownerblock.php b/mod/profile/views/default/profile/ownerblock.php deleted file mode 100755 index ac0cb5b54..000000000 --- a/mod/profile/views/default/profile/ownerblock.php +++ /dev/null @@ -1,84 +0,0 @@ -container_guid); - } else { - $user = get_entity($vars['entity']->guid); - } -} else { - $user = elgg_get_page_owner(); -} -if (!$user) { - // no user so we quit view - echo elgg_echo('viewfailure', array(__FILE__)); - return TRUE; -} - -$more_info = ''; - -$location = elgg_view("output/tags", array('value' => $user->location)); - -$icon = elgg_view("profile/icon", array( - 'entity' => $user, - 'size' => 'large', - 'override' => 'true' -)); -$icon_class = "large"; - -// grab the actions and admin menu items from user hover -$menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array()); -$builder = new ElggMenuBuilder($menu); -$menu = $builder->getMenu(); -$actions = elgg_get_array_value('action', $menu, array()); -$admin = elgg_get_array_value('admin', $menu, array()); - -$profile_actions = ''; -if (isloggedin() && $actions) { - $profile_actions = ''; -} - -// if admin, display admin links -$admin_links = ''; -if (isadminloggedin() && get_loggedin_userid() != elgg_get_page_owner_guid()) { - $admin_links = ''; -} - -// content links -$content_menu = elgg_view_menu('owner_block', array( - 'entity' => elgg_get_page_owner(), - 'class' => 'profile-content-menu', -)); - -//contruct the display -$display = << -
- $icon -
- $more_info - $profile_actions - $content_menu - $admin_links - - -EOT; - -echo $display; diff --git a/mod/profile/views/default/profile/sidebar.php b/mod/profile/views/default/profile/sidebar.php deleted file mode 100644 index d98964f5b..000000000 --- a/mod/profile/views/default/profile/sidebar.php +++ /dev/null @@ -1,13 +0,0 @@ - -
- $section)); -?> -
\ No newline at end of file diff --git a/mod/profile/views/default/profile/wrapper.php b/mod/profile/views/default/profile/wrapper.php new file mode 100644 index 000000000..88e1cd22f --- /dev/null +++ b/mod/profile/views/default/profile/wrapper.php @@ -0,0 +1,18 @@ + +
+
+ + +
+
+ + \ No newline at end of file -- cgit v1.2.3