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

Commit

Permalink
Added newsfeed updates to photo component, refactored logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchisari authored and The Appleseed Project committed Feb 23, 2011
1 parent eee6fd9 commit 758e0a1
Show file tree
Hide file tree
Showing 15 changed files with 715 additions and 526 deletions.
77 changes: 77 additions & 0 deletions components/newsfeed/controllers/newsfeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ private function _Prep ( ) {
$row->Find ( '.item', 0 )->innertext = $this->_PrepJournal ( );
break;

case 'added a photo':
$row->Find ( '.item', 0 )->class .= ' link';
$row->Find ( '.item', 0 )->innertext = $this->_PrepPhoto ( );
break;

case 'posted a link':
$row->Find ( '.item', 0 )->class .= ' link';
$row->Find ( '.item', 0 )->innertext = $this->_PrepLink ( );
Expand Down Expand Up @@ -161,6 +166,78 @@ private function _PrepPost ( ) {
return ( $row->outertext );
}

private function _PrepPhoto ( ) {
$sentenceData['ActionOwner'] = $ActionOwner = $this->Model->Get ( 'ActionOwner' );
$sentenceData['Action'] = $Action = $this->Model->Get ( 'Action' );
$sentenceData['ActionLink'] = $ActionLink = $this->Model->Get ( 'ActionLink' );
$sentenceData['SubjectOwner'] = $SubjectOwner = $this->Model->Get ( 'SubjectOwner' );
$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' );
$sentenceData['Identifier'] = $Identifier = $this->Model->Get ( 'Identifier' );
$sentenceData['Updated'] = $Updated = $this->Model->Get ( 'Updated' );
$sentenceData['Created'] = $Created = $this->Model->Get ( 'Created' );

$row = $this->GetView ( 'newsfeed.photo' );

$row->Find ( '.stamp', 0 )->innertext = $this->GetSys ( 'Date' )->Format ( $Updated );
//$Comment = $this->GetSys ( 'Render' )->LiveLinks ( $this->Model->Get ( 'Comment' ) );

$Comment = $this->GetSys ( 'Render' )->Format ( $this->Model->Get ( 'Comment' ) );
$Comment = $this->GetSys ( 'Render' )->LiveLinks ( $Comment );

$row->Find ( '.comment', 0 )->innertext = str_replace ( "\n", "<br />", $Comment );
$row->Find ( '.actionowner-link', 0 )->rel = $ActionOwner;
$row->Find ( '.actionowner-link', 0 )->innertext = $ActionOwner;

list ( $contextUsername, $contextDomain ) = explode ( '@', $ContextOwner );
if ( $Icon )
$row->Find ( '.thumb', 0 )->src = $Icon;
else
$row->Find ( '.thumb', 0 )->outertext = "";

if ( $Description )
$row->Find ( '.description', 0 )->innertext = $Description;
else
$row->Find ( '.description', 0 )->outertext = "";

if ( $Title )
$row->Find ( '.title', 0 )->innertext = $Title;
else
$row->Find ( '.title', 0 )->outertext = "";

if ( $ActionLink ) {
$row->Find ( '.info-link', 0 )->href = $ActionLink;
$row->Find ( '.info-link', 0 )->innertext = $ActionLink;
$row->Find ( '.title-link', 0 )->href = $ActionLink;
$row->Find ( '.thumb-link', 0 )->href = $ActionLink;
}

$row->Find ( '.remove', 0 )->innertext = '';

list ( $username, $domain ) = explode ( '@', $ActionOwner );
$data = array ( 'username' => $username, 'domain' => $domain, 'width' => 64, 'height' => 64 );
$row->Find ( '.actionowner-icon', 0 )->src = $this->GetSys ( 'Event' )->Trigger ( 'On', 'User', 'Icon', $data );

$row->Find ( '.sentence', 0 )->innertext = $this->_Sentence ( $sentenceData );

$data = array ( 'account' => $ActionOwner, 'source' => ASD_DOMAIN );
$OwnerLink = $this->GetSys ( 'Event' )->Trigger ( 'Create', 'User', 'Link', $data );
$row->Find ( '.actionowner-link', 0 )->href = $OwnerLink;
$row->Find ( '.actionowner-icon-link', 0 )->href = $OwnerLink;

$row->Find ( '[name=Context]', 0 )->value = $this->Get ( 'Context' );
$row->Find ( '[name=Identifier]', 0 )->value = $Identifier;

$row->Find ( '.add-comment', 0 )->href = 'http://' . $domain . '/profile/' . $username . '/page/' . $Identifier . '#comments';

return ( $row->outertext );
}

private function _PrepLink ( ) {
$sentenceData['ActionOwner'] = $ActionOwner = $this->Model->Get ( 'ActionOwner' );
$sentenceData['Action'] = $Action = $this->Model->Get ( 'Action' );
Expand Down
27 changes: 27 additions & 0 deletions components/newsfeed/views/newsfeed.photo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<a class="actionowner-icon-link" href=""><img class="actionowner-icon" src=""></a>
<span class="info">
<span class="content">
<span class="sentence"></span>
<span class="comment"></span>
</span>
<span class="data">
<a target="__new" class="thumb-link"><img class="thumb" /></a>
<span class="desc">
<a target="__new" class="title-link"><h3 class="title"></h3></a>
<a target="__new" class="info-link"></a>
<p class="description"></p>
</span>
</span>
<span class="actions">
<abbr class="stamp"></abbr>
<a class='add-comment'>Add Comment</a>
<a class='like'>Like</a>
</span>
</span>
<form class="remove" method="post">
<input type="hidden" name="Task" value="Remove" />
<input type="hidden" name="Context" />
<input type="hidden" name="Identifier" />
<button class="remove-post">Remove Post</button>
</form>

0 comments on commit 758e0a1

Please sign in to comment.