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

Commit

Permalink
Added Title to newsfeed.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchisari authored and The Appleseed Project committed Nov 22, 2010
1 parent c942674 commit c57dd68
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 11 deletions.
13 changes: 9 additions & 4 deletions components/newsfeed/controllers/newsfeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private function _Prep ( ) {
$sentenceData['Context'] = $Context = $this->Model->Get ( 'Context' );
$sentenceData['ContextOwner'] = $ContextOwner = $this->Model->Get ( 'ContextOwner' );
$sentenceData['ContextLink'] = $ContextLink = $this->Model->Get ( 'ContextLink' );
$sentenceData['Title'] = $Title = $this->Model->Get ( 'Title' );
$sentenceData['Icon'] = $Icon = $this->Model->Get ( 'Icon' );
$sentenceData['Comment'] = $Comment = $this->Model->Get ( 'Comment' );
$sentenceData['Description'] = $Description = $this->Model->Get ( 'Description' );
Expand Down Expand Up @@ -134,6 +135,7 @@ private function _Sentence ( $pData ) {
$Context = $sentenceData['Context'] = $Context = $this->Model->Get ( 'Context' );
$ContextOwner = $sentenceData['ContextOwner'] = $ContextOwner = $this->Model->Get ( 'ContextOwner' );
$ContextLink = $sentenceData['ContextLink'] = $ContextLink = $this->Model->Get ( 'ContextLink' );
$Title = $sentenceData['Title'] = $Icon = $this->Model->Get ( 'Title' );
$Icon = $sentenceData['Icon'] = $Icon = $this->Model->Get ( 'Icon' );
$Comment = $sentenceData['Comment'] = $Comment = $this->Model->Get ( 'Comment' );
$Description = $sentenceData['Description'] = $Description = $this->Model->Get ( 'Description' );
Expand Down Expand Up @@ -192,6 +194,7 @@ public function Notify ( $pView = null, $pData = array ( ) ) {
$Context = $pData['Context'];
$ContextOwner = $pData['ContextOwner'];
$ContextLink = $pData['ContextLink'];
$Title = $pData['Title'];
$Icon = $pData['Icon'];
$Comment = $pData['Comment'];
$Description = $pData['Description'];
Expand All @@ -202,17 +205,17 @@ public function Notify ( $pView = null, $pData = array ( ) ) {
$Incoming = $this->GetModel ( 'Incoming' );
$Outgoing = $this->GetModel ( 'Outgoing' );

$Incoming->Queue ( $OwnerId, $Action, $ActionOwner, $ActionLink, $SubjectOwner, $Context, $ContextOwner, $ContextLink, $Icon, $Comment, $Description, $Identifier );
$Incoming->Queue ( $OwnerId, $Action, $ActionOwner, $ActionLink, $SubjectOwner, $Context, $ContextOwner, $ContextLink, $Title, $Icon, $Comment, $Description, $Identifier );

foreach ( $Friends as $f => $friend ) {
list ( $username, $domain ) = explode ( '@', $friend );
if ( $domain == ASD_DOMAIN ) {
// Process a local request
$Recipient = $this->Talk ( 'User', 'Account', array ( 'Username' => $username ) );
$Incoming->Queue ( $Recipient->Id, $Action, $ActionOwner, $ActionLink, $SubjectOwner, $Context, $ContextOwner, $ContextLink, $Icon, $Comment, $Description, $Identifier );
$Incoming->Queue ( $Recipient->Id, $Action, $ActionOwner, $ActionLink, $SubjectOwner, $Context, $ContextOwner, $ContextLink, $Title, $Icon, $Comment, $Description, $Identifier );
} else {
// Add remote requests to the outgoing queue.
$Outgoing->Queue ( $OwnerId, $friend, $Action, $ActionOwner, $ActionLink, $SubjectOwner, $Context, $ContextOwner, $ContextLink, $Icon, $Comment, $Description, $Identifier );
$Outgoing->Queue ( $OwnerId, $friend, $Action, $ActionOwner, $ActionLink, $SubjectOwner, $Context, $ContextOwner, $ContextLink, $Title, $Icon, $Comment, $Description, $Identifier );
}
}

Expand All @@ -229,6 +232,7 @@ public function AddToIncoming ( $pView = null, $pData = array ( ) ) {
$Context = $pData['Context'];
$ContextOwner = $pData['ContextOwner'];
$ContextLink = $pData['ContextLink'];
$Title = $pData['Title'];
$Icon = $pData['Icon'];
$Comment = $pData['Comment'];
$Description = $pData['Description'];
Expand All @@ -238,7 +242,7 @@ public function AddToIncoming ( $pView = null, $pData = array ( ) ) {

$Incoming = $this->GetModel ( 'Incoming' );

$Incoming->Queue ( $OwnerId, $Action, $ActionOwner, $ActionLink, $SubjectOwner, $Context, $ContextOwner, $ContextLink, $Icon, $Comment, $Description, $Identifier, $Created, $Updated );
$Incoming->Queue ( $OwnerId, $Action, $ActionOwner, $ActionLink, $SubjectOwner, $Context, $ContextOwner, $ContextLink, $Title, $Icon, $Comment, $Description, $Identifier, $Created, $Updated );

return ( true );
}
Expand All @@ -261,6 +265,7 @@ public function ProcessQueue ( $pView = null, $pData = array ( ) ) {
$Context = $data['Context'] = $this->Outgoing->Get ( 'Context' );
$ContextOwner = $data['ContextOwner'] = $this->Outgoing->Get ( 'ContextOwner' );
$ContextLink = $data['ContextLink'] = $this->Outgoing->Get ( 'ContextLink' );
$Title = $data['Title'] = $this->Outgoing->Get ( 'Title' );
$Icon = $data['Icon'] = $this->Outgoing->Get ( 'Icon' );
$Comment = $data['Comment'] = $this->Outgoing->Get ( 'Comment' );
$Description = $data['Description'] = $this->Outgoing->Get ( 'Description' );
Expand Down
3 changes: 2 additions & 1 deletion components/newsfeed/models/incoming.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct ( $pTables = null ) {
parent::__construct( $pTables );
}

public function Queue ( $pOwnerId, $pAction, $pActionOwner, $pActionLink, $pSubjectOwner, $pContext, $pContextOwner, $pContextLink, $pIcon, $pComment, $pDescription, $pIdentifier, $pCreated = null, $pUpdated = null ) {
public function Queue ( $pOwnerId, $pAction, $pActionOwner, $pActionLink, $pSubjectOwner, $pContext, $pContextOwner, $pContextLink, $pTitle, $pIcon, $pComment, $pDescription, $pIdentifier, $pCreated = null, $pUpdated = null ) {

if ( $pIdentifier ) {
$this->Retrieve ( array ( 'Owner_FK' => $pOwnerId, 'Identifier' => $pIdentifier ) );
Expand All @@ -53,6 +53,7 @@ public function Queue ( $pOwnerId, $pAction, $pActionOwner, $pActionLink, $pSubj
$this->Set ( 'Context', $pContext );
$this->Set ( 'ContextOwner', $pContextOwner );
$this->Set ( 'ContextLink', $pContextLink );
$this->Set ( 'Title', $pTitle );
$this->Set ( 'Icon', $pIcon );
$this->Set ( 'Comment', $pComment );
$this->Set ( 'Description', $pDescription );
Expand Down
3 changes: 2 additions & 1 deletion components/newsfeed/models/outgoing.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct ( $pTables = null ) {
parent::__construct( $pTables );
}

public function Queue ( $pOwnerId, $pRecipient, $pAction, $pActionOwner, $pActionLink, $pSubjectOwner, $pContext, $pContextOwner, $pContextLink, $pIcon, $pComment, $pDescription, $pIdentifier ) {
public function Queue ( $pOwnerId, $pRecipient, $pAction, $pActionOwner, $pActionLink, $pSubjectOwner, $pContext, $pContextOwner, $pContextLink, $pTitle, $pIcon, $pComment, $pDescription, $pIdentifier ) {

$this->Protect ( 'Outgoing_PK', null );
$this->Set ( 'Owner_FK', $pOwnerId );
Expand All @@ -43,6 +43,7 @@ public function Queue ( $pOwnerId, $pRecipient, $pAction, $pActionOwner, $pActio
$this->Set ( 'Context', $pContext );
$this->Set ( 'ContextOwner', $pContextOwner );
$this->Set ( 'ContextLink', $pContextLink );
$this->Set ( 'Title', $pTitle );
$this->Set ( 'Icon', $pIcon );
$this->Set ( 'Comment', $pComment );
$this->Set ( 'Description', $pDescription );
Expand Down
2 changes: 1 addition & 1 deletion components/page/controllers/share.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function _ShareLink ( ) {
if ( !$Access ) unset ( $friends[$f] );
}

$notifyData = array ( 'OwnerId' => $this->_Focus->Id, 'Friends' => $friends, 'ActionOwner' => $this->_Current->Account, 'Action' => $Action, 'ContextOwner' => $this->_Focus->Account, 'Context' => 'page', 'Comment' => $Content, 'Identifier' => $Identifier );
$notifyData = array ( 'OwnerId' => $this->_Focus->Id, 'Friends' => $friends, 'ActionOwner' => $this->_Current->Account, 'Action' => $Action, 'ActionLink' => $Link, 'ContextOwner' => $this->_Focus->Account, 'Context' => 'page', 'Comment' => $Content, 'Title' => $LinkTitle, 'Icon' => $LinkThumb, 'Description' => $LinkDescription, 'Identifier' => $Identifier );
$this->Talk ( 'Newsfeed', 'Notify', $notifyData );

// Don't send an email if we're posting on our own page.
Expand Down
6 changes: 3 additions & 3 deletions components/page/models/link.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function RetrievePageLinks ( $pUserId ) {
return ( true );
}

public function RetrievePost ( $pUserId, $pIdentifier ) {
public function RetrieveLink ( $pUserId, $pIdentifier ) {

$criteria = array ('User_FK' => $pUserId, 'Identifier' => $pIdentifier );

Expand All @@ -108,7 +108,7 @@ public function Link ( $pComment, $pPrivacy, $pUserId, $pOwner, $pLink, $pTitle,
$privacyData = array ( 'Privacy' => $pPrivacy, 'Type' => 'Link', 'Identifier' => $Identifier );
$this->GetSys ( 'Components' )->Talk ( 'Privacy', 'Store', $privacyData );

$this->Protect ( 'Post_PK', null );
$this->Protect ( 'Link_PK', null );
$this->Set ( 'User_FK', $pUserId );
$this->Set ( 'Owner', $pOwner );
$this->Set ( 'Identifier', $Identifier );
Expand All @@ -131,7 +131,7 @@ public function Link ( $pComment, $pPrivacy, $pUserId, $pOwner, $pLink, $pTitle,

$Reference = new cPageReferencesModel ();

$Reference->Create ( 'Post', $Identifier, $pUserId );
$Reference->Create ( 'Link', $Identifier, $pUserId );

return ( true );
}
Expand Down
45 changes: 44 additions & 1 deletion components/page/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ public function RegisterPageType ( $pData = null ) {
$post->Component = $this->Get ( 'Component' );
$post->Function = 'GetPost';

$return = array ( 'Post' => $post );
$link = new stdClass();
$link->Component = $this->Get ( 'Component' );
$link->Function = 'GetLink';

$return = array ( 'Post' => $post, 'Link' => $link );

return ( $return );
}
Expand Down Expand Up @@ -168,6 +172,45 @@ public function GetPost ( $pData = null ) {
return ( false );
}

public function GetLink ( $pData = null ) {

if ( $this->_Source != 'Component' ) return ( false );

$this->_Current = $this->Talk ( 'User', 'Current' );
$this->_Focus = $this->Talk ( 'User', 'Focus' );

$Identifier = $pData['Identifier'];
$Account = $pData['Account'];

// Check the privacy settings on this item.
$Access = $this->Talk ( 'Privacy', 'Check', array ( 'Type' => 'Link', 'Identifier' => $Identifier ) );

// Load the Post data
include_once ( ASD_PATH . 'components/page/models/link.php' );
$Model = new cPageLinkModel();

$Link = $Model->RetrieveLink ( $this->_Focus->Id, $Identifier );

$return['Owner'] = $Link['Owner'];
$return['Comment'] = $Link['Content'];

// If true, then return the post.
if ( $Access ) {
return ( $return );
} else {
// If the person viewing is the owner, grant access.
if ( $this->_Current->Account == $Link['Owner'] ) {
return ( $return );
} else if ( $this->_Focus->Account == $this->_Current->Account ) {
return ( $return );
} else {
return ( false );
}
}

return ( false );
}

public function Scrape ( $pData = null ) {

$return = array ();
Expand Down

0 comments on commit c57dd68

Please sign in to comment.