Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Added Block view to profile component, commentd out group and events …
Browse files Browse the repository at this point in the history
…tabs
  • Loading branch information
michaelchisari authored and The Appleseed Project committed Dec 2, 2010
1 parent 2d3ff9a commit 0123dd7
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/events/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function AddToProfileTabs ( $pData = null ) {

$return = array ();

$return[] = array ( 'id' => 'events', 'title' => 'Events Tab', 'link' => '/events/' );
//$return[] = array ( 'id' => 'events', 'title' => 'Events Tab', 'link' => '/events/' );

return ( $return );
}
Expand Down
2 changes: 1 addition & 1 deletion components/groups/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function AddToProfileTabs ( $pData = null ) {

$return = array ();

$return[] = array ( 'id' => 'groups', 'title' => 'Groups Tab', 'link' => '/groups/' );
// $return[] = array ( 'id' => 'groups', 'title' => 'Groups Tab', 'link' => '/groups/' );

return ( $return );
}
Expand Down
93 changes: 93 additions & 0 deletions components/profile/controllers/block.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php
/**
* @version $Id$
* @package Appleseed.Components
* @subpackage Profile
* @copyright Copyright (C) 2004 - 2010 Michael Chisari. All rights reserved.
* @link http://opensource.appleseedproject.org
* @license GNU General Public License version 2.0 (See LICENSE.txt)
*/

// Restrict direct access
defined( 'APPLESEED' ) or die( 'Direct Access Denied' );

/** Profile Component Block Controller
*
* Profile Component Block Controller Class
*
* @package Appleseed.Components
* @subpackage Profile
*/
class cProfileBlockController extends cController {

/**
* Constructor
*
* @access public
*/
public function __construct ( ) {
parent::__construct( );
}

public function Display ( $pView = null, $pData = array ( ) ) {

$this->View = $this->GetView ( $pView );

$focus = $this->Talk ( 'User', 'Focus' );
$current = $this->Talk ( 'User', 'Current' );

// If the user isn't logged in, or we're viewing our own profile, don't display.
if ( ( $current->Account == $focus->Account ) or ( !$current ) ) {
return ( false );
}

if ( $current ) {
$currentAccount = $current->Username . '@' . $current->Domain;
$data = array ( "account" => $currentAccount, 'source' => ASD_DOMAIN, 'request' => $currentAccount );
$currentInfo = $this->GetSys ( "Event" )->Trigger ( "On", "User", "Info", $data );
$currentInfo->username = $current->Username;
$currentInfo->domain = $current->Domain;
$currentInfo->account = $current->Username . '@' . $current->Domain;
}

$focusAccount = $focus->Username . '@' . $focus->Domain;
$data = array ( "account" => $focusAccount, 'source' => ASD_DOMAIN, 'request' => $focusAccount );
$focusInfo = $this->GetSys ( "Event" )->Trigger ( "On", "User", "Info", $data );
$focusInfo->username = $focus->Username;
$focusInfo->domain = $focus->Domain;
$focusInfo->account = $focus->Username . '@' . $focus->Domain;

// If the user is already a friend, don't show the Add Friend button.
$data = array ( "account" => $current->Account, "request" => $focus->Account );
$this->View->Find ( "[class=profile-add-friend-link]", 0 )->href = $this->GetSys ( "Event" )->Trigger ( "Create", "Friend", "Addlink", $data );
$this->View->Find ( "[class=profile-remove-friend-link]", 0 )->href = $this->GetSys ( "Event" )->Trigger ( "Create", "Friend", "Removelink", $data );

$this->View->Find ( "[class=profile-send-message-link]", 0 )->href = $this->GetSys ( "Event" )->Trigger ( "Create", "Messages", "Sendlink", $data );

$this->View->Find ( "[class=profile-block-user-link]", 0 )->href = null;

$this->View->Find ( '.profile-block-user-link', 0 )->innertext = __ ( 'Block Contact User', array ( 'fullname' => $focus->Fullname ) );
list ( $firstname, $lastname ) = explode ( ' ', $focus->Fullname );
$this->View->Find ( '.profile-ping-user-link', 0 )->innertext = __ ( 'Ping Contact User', array ( 'firstname' => $firstname ) );
$this->View->Find ( '.profile-send-message-link', 0 )->innertext = __ ( 'Send Message To Contact', array ( 'firstname' => $firstname ) );

if ( in_array ( $currentInfo->account, $focusInfo->friends ) ) {
// Remove "add as friend" if already friends
$this->View->Find ( "[class=profile-add-friend]", 0 )->outertext = "";
} else if ( $currentInfo->account == $focusInfo->account ) {
// Remove both since we're looking at our own account.
$this->View->Find ( "[class=profile-remove-friend]", 0 )->outertext = "";
$this->View->Find ( "[class=profile-add-friend]", 0 )->outertext = "";
} else {
// Remove "remove from friends" if not friends
$this->View->Find ( "[class=profile-remove-friend]", 0 )->outertext = "";
}


$this->View->Display();

return ( true );
}

}

4 changes: 3 additions & 1 deletion components/profile/controllers/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public function Display ( $pView = null, $pData = array ( ) ) {

$this->View->Find ( "[class=profile-send-message-link]", 0 )->href = $this->GetSys ( "Event" )->Trigger ( "Create", "Messages", "Sendlink", $data );

$this->View->Find ( "[class=profile-block-user-link]", 0 )->href = null;
list ( $firstname, $lastname ) = explode ( ' ', $focus->Fullname );
$this->View->Find ( '.profile-ping-user-link', 0 )->innertext = __ ( 'Ping Contact User', array ( 'firstname' => $firstname ) );
$this->View->Find ( '.profile-send-message-link', 0 )->innertext = __ ( 'Send Message To Contact', array ( 'firstname' => $firstname ) );

if ( in_array ( $currentInfo->account, $focusInfo->friends ) ) {
// Remove "add as friend" if already friends
Expand Down
5 changes: 3 additions & 2 deletions components/profile/languages/en-US/profile.lang
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ NO_USER_INFORMATION_FOR="No user information for %fullname$s"
[contact]
ADD_CONTACT_AS_FRIEND="Add as a friend"
REMOVE_CONTACT_AS_FRIEND="Remove from friends"
SEND_MESSAGE_TO_CONTACT="Send a message"
BLOCK_CONTACT_USER="Block this person"
SEND_MESSAGE_TO_CONTACT="Send %firstname$s a message"
BLOCK_CONTACT_USER="Block %fullname$s"
PING_CONTACT_USER="Ping %firstname$s"

[mutual-summary]
SEE_ALL_MUTUAL_FRIENDS="See all"
Expand Down
3 changes: 3 additions & 0 deletions components/profile/views/block.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ul>
<li class="profile-block-user"><a class="profile-block-user-link" href="">Block Contact User</a></span>
</ul>
2 changes: 1 addition & 1 deletion components/profile/views/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<li class="profile-add-friend"><a class="profile-add-friend-link" href="">Add Contact As friend</a></span>
<li class="profile-remove-friend"><a class="profile-remove-friend-link" href="">Remove Contact As friend</a></span>
<li class="profile-send-message"><a class="profile-send-message-link" href="">Send Message To Contact</a></span>
<li class="profile-block-user"><a class="profile-block-user-link" href="">Block Contact User</a></span>
<li class="profile-ping-user"><a class="profile-ping-user-link" href="">Ping Contact User</a></span>
</ul>
6 changes: 6 additions & 0 deletions themes/default/style/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,12 @@
#profile-mutual #friends-mutual-summary ul li img { float:left; width:32px; height:32px; margin:5px 5px 0 0; }
#profile-mutual #friends-mutual-summary a.all-mutual-friends-link { float:right; clear:both;}

/* profile-block */
#profile-block ul li { float:left; clear:both; font-size:90%; list-style-type:none; margin:105px 0 5px 10px; padding:2px; }
#profile-block ul li button { text-decoration:none; border:none; background:none no-repeat left center; }
#profile-block ul li button { color:#406300; padding-left:8px; background-image:url('/themes/default/images/appleseed-icons.png'); background-position: -120px -43px; }
#profile-block ul li button:hover { text-decoration:underline; cursor:pointer; }

/* user-invites */
#user-invites { float:left; width:100%; padding:0; margin:0; margin-bottom:10px; }
#user-invites .invite-count em { padding:0 2px; font-style:normal; font-weight:bold; font-size:130%; color:#bf4630; }
Expand Down

0 comments on commit 0123dd7

Please sign in to comment.