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

Commit

Permalink
Began building out photos component.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchisari authored and The Appleseed Project committed Feb 14, 2011
1 parent 91be30e commit 398d539
Show file tree
Hide file tree
Showing 13 changed files with 301 additions and 21 deletions.
14 changes: 11 additions & 3 deletions components/photos/controllers/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,21 @@ public function Display ( $pView = null, $pData = array ( ) ) {

$Set = $this->GetSys ( 'Request' )->Get ( 'Set' );
$Photo = $this->GetSys ( 'Request' )->Get ( 'Photo' );

$focusLinkData = $this->Talk ( 'User', 'Link', array ( 'request' => $this->_Focus->Account ) );

if ( $Photo ) {
$this->Navigation->Find ( '.breadcrumb', 0 )->innertext = __ ( 'Back To Photoset', array ( 'photosetlink' => 'Photo album name' ) );
$this->Set = $this->GetModel ( 'Sets' );

$this->Set->Load ( $this->_Focus->Id, $Set );
$this->Set->Fetch();

$setlink = 'http://' . ASD_DOMAIN . '/profile/' . $this->_Focus->Username . '/photos/' . $this->Set->Get ( 'Directory' );
$setname = $this->Set->Get ( 'Name' );
$this->Navigation->Find ( '.breadcrumb', 0 )->innertext = __ ( 'Back To Photoset', array ( 'setlink' => $setlink, 'setname' => $setname ) );
} else if ( $Set ) {
$this->Navigation->Find ( '.breadcrumb', 0 )->innertext = __ ( 'Back To Photosets' , array ( 'userlink' => $focusLinkData['link'] ) );
$setlink = 'http://' . ASD_DOMAIN . '/profile/' . $this->_Focus->Username . '/photos/';
$this->Navigation->Find ( '.breadcrumb', 0 )->innertext = __ ( 'Back To Photosets' , array ( 'fullname' => $this->_Focus->Fullname, 'setlink' => $setlink ) );
} else {
$this->Navigation->Find ( '.breadcrumb', 0 )->innertext = __ ( 'Back To Profile' , array ( 'userlink' => $focusLinkData['link'] ) );
}
Expand Down
73 changes: 73 additions & 0 deletions components/photos/controllers/photo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/**
* @version $Id$
* @package Appleseed.Components
* @subpackage Photos
* @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' );

/** Photos Component Photo Controller
*
* Photos Component Photo Controller Class
*
* @package Appleseed.Components
* @subpackage Photos
*/
class cPhotosPhotoController extends cController {

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

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

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

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

$this->Set = $this->GetModel ( 'Sets' );

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

$Set = $this->GetSys ( 'Request' )->Get ( 'Set' );
$Identifier = $this->GetSys ( 'Request' )->Get ( 'Photo' );

$this->Set->Load ( $this->_Focus->Id, $Set );
$this->Set->Fetch();

$this->Photos->Load ( $Identifier );
$this->Photos->Fetch();

$this->_Prep();

$this->View->Display();

return ( true );
}

private function _Prep ( ) {

$id = $this->Photos->Get ( 'Photo_PK' );

$filename = $this->Photos->Get ( 'Filename' );
$extension = pathinfo ( $filename, PATHINFO_EXTENSION );

list ( $file ) = explode ( '.' . $extension, $filename );

$photoLocation = 'http://' . ASD_DOMAIN . '/_storage/photos/admin/' . $this->Set->Get ( 'Directory' ) . '/' . $file . '_n.' . $extension;
$this->View->Find ( '.original', 0 )->src = $photoLocation;

$this->View->Find ( '.description', 0 )->innertext = $this->Photos->Get ( 'Description' );
}

}
83 changes: 83 additions & 0 deletions components/photos/controllers/photos.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/**
* @version $Id$
* @package Appleseed.Components
* @subpackage Photos
* @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' );

/** Photos Component Photos Controller
*
* Photos Component Photos Controller Class
*
* @package Appleseed.Components
* @subpackage Photos
*/
class cPhotosPhotosController extends cController {

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

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

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

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

$this->Set = $this->GetModel ( 'Sets' );

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

$Set = $this->GetSys ( 'Request' )->Get ( 'Set' );

$this->Set->Load ( $this->_Focus->Id, $Set );
$this->Set->Fetch();

$this->Photos->LoadFromSet ( $this->Set->Get ( 'Set_PK' ) );

$this->_Prep();

$this->View->Display();

return ( true );
}

private function _Prep ( ) {

$list = $this->View->Find ( '.list', 0);

$item = $this->View->Find ( '.item', 0 );

$list->innertext = "";

while ( $this->Photos->Fetch() ) {
$id = $this->Photos->Get ( 'Photo_PK' );

$filename = $this->Photos->Get ( 'Filename' );
$extension = pathinfo ( $filename, PATHINFO_EXTENSION );

$link = 'http://' . ASD_DOMAIN . '/profile/' . $this->_Focus->Username . '/photos/' . $this->Set->Get ( 'Directory' ) . '/' . $this->Photos->Get ( 'Identifier' );
$item->Find ( '.photo-link', 0 )->href = $link;

list ( $file ) = explode ( '.' . $extension, $filename );

$photoLocation = 'http://' . ASD_DOMAIN . '/_storage/photos/admin/' . $this->Set->Get ( 'Directory' ) . '/' . $file . '_m.' . $extension;
$item->Find ( '.photo', 0 )->src = $photoLocation;

$item->Find ( '.description', 0 )->innertext = $this->Photos->Get ( 'Description' );
$list->innertext .= $item->outertext;
}
}

}
35 changes: 32 additions & 3 deletions components/photos/controllers/sets.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ public function Display ( $pView = null, $pData = array ( ) ) {

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

$this->Model = $this->GetModel ( 'Sets' );
$this->Model->Load ( $this->_Focus->Id );
$this->Sets = $this->GetModel ( 'Sets' );

$this->Photo = $this->GetModel ( 'Photos' );

$this->Sets->Load ( $this->_Focus->Id );

$this->_Prep();

$this->View->Display();
Expand All @@ -47,6 +49,33 @@ public function Display ( $pView = null, $pData = array ( ) ) {
}

private function _Prep ( ) {

$list = $this->View->Find ( '.list', 0);

$item = $this->View->Find ( '.item', 0 );

$list->innertext = "";

while ( $this->Sets->Fetch() ) {
$id = $this->Sets->Get ( 'Set_PK' );

$this->Photo->GetCover ( $id );
$item->Find ( '.name', 0 )->innertext = $this->Sets->Get ( 'Name' );
$item->Find ( '.description', 0 )->innertext = $this->Sets->Get ( 'Description' );

$filename = $this->Photo->Get ( 'Filename' );
$extension = pathinfo ( $filename, PATHINFO_EXTENSION );

$link = 'http://' . ASD_DOMAIN . '/profile/' . $this->_Focus->Username . '/photos/' . $this->Sets->Get ( 'Directory' );
$item->Find ( '.photoset-name-link', 0 )->href = $link;
$item->Find ( '.photoset-cover-link', 0 )->href = $link;

list ( $file ) = explode ( '.' . $extension, $filename );

$coverLocation = 'http://' . ASD_DOMAIN . '/_storage/photos/admin/' . $this->Sets->Get ( 'Directory' ) . '/' . $file . '_m.' . $extension;
$item->Find ( '.cover', 0 )->src = $coverLocation;
$list->innertext .= $item->outertext;
}
}

}
5 changes: 3 additions & 2 deletions components/photos/languages/en-US/photos.lang
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; @todo: refactor this into different views
BACK_TO_PROFILE="&laquo; %userlink$s"
BACK_TO_PHOTOSETS="&laquo; %userlink$s's Albums"
BACK_TO_PHOTOSET="&laquo; %photosetlink$s"
BACK_TO_PHOTOSETS="&laquo; <a href=\"%setlink$s\">%fullname$s's Albums</a>"
BACK_TO_PHOTOSET="&laquo; <a href=\"%setlink$s\">%setname$s</a>"
55 changes: 55 additions & 0 deletions components/photos/models/photos.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* @version $Id$
* @package Appleseed.Components
* @subpackage Photos
* @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' );

/** Photos Component Photos Model
*
* Photos Component Photos Model Class
*
* @package Appleseed.Components
* @subpackage Photos
*/
class cPhotosModel extends cModel {

protected $_Tablename = 'Photos';

/**
* Constructor
*
* @access public
*/
public function __construct ( $pTables = null ) {
parent::__construct( $pTables );
}

public function LoadFromSet ( $pSetId ) {
$this->Retrieve ( array ( 'Set_FK' => $pSetId ) );

return ( true );
}

public function Load ( $pIdentifier ) {

$this->Retrieve ( array ( 'Identifier' => $pIdentifier ) );

return ( true );
}

public function GetCover ( $pSetId ) {

$this->Retrieve ( array ( 'Set_FK' => $pSetId ) );
$this->Fetch();

return ( true );
}

}
8 changes: 6 additions & 2 deletions components/photos/models/sets.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ public function __construct ( $pTables = null ) {
parent::__construct( $pTables );
}

public function Load ( $pOwner ) {
public function Load ( $pOwner, $pDirectory = null ) {

$this->Retrieve ( array ( 'Owner_FK' => $pOwner ), 'Created DESC' );
if ( $pDirectory ) {
$this->Retrieve ( array ( 'Owner_FK' => $pOwner, 'Directory' => $pDirectory ), 'Created DESC' );
} else {
$this->Retrieve ( array ( 'Owner_FK' => $pOwner ), 'Created DESC' );
}
}

}
6 changes: 6 additions & 0 deletions components/photos/views/photo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<section class="photo">

<img class="original" />
<p class="description"></p>

</section>
12 changes: 12 additions & 0 deletions components/photos/views/photos.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<section class="photos">

<ul class="list">
<li class="item">
<a class="photo-link"><img class="photo" /></a>
<p class="description"></p>
<span class="count"></span>
<abbr class="created"></abbr>
</li>
</ul>

</section>
8 changes: 4 additions & 4 deletions components/photos/views/sets.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<section class="photosets">

<ul class="photosets list">
<li class="photosets item">
<ul class="list">
<li class="item">
<a class="photoset-cover-link"><img class="cover" /></a>
<span="name"><a class="photoset-name-link">Photoset name</a></span>
<span class="name"><a class="photoset-name-link">Photoset name</a></span>
<p class="description">Photoset description</p>
<span class="count"></span>
<abbr class="created"></abbr>
</li>
</ul>

</section>
</section>
2 changes: 0 additions & 2 deletions foundations/default/profile/photos/photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
<div id="photos-navigation">
<?php $zApp->Components->Go ( "photos", "navigation", "navigation" ); ?>
</div>
</div>
<div id="appleseed-profile-content" class="grid_12 omega">
<?php $zApp->Components->Go ( "photos", "photo", "photo" ); ?>
</div>
</div>
Expand Down
2 changes: 0 additions & 2 deletions foundations/default/profile/photos/photos.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
<div id="photos-navigation">
<?php $zApp->Components->Go ( "photos", "navigation", "navigation" ); ?>
</div>
</div>
<div id="appleseed-profile-content" class="grid_12 omega">
<?php $zApp->Components->Go ( "photos", "photos", "photos" ); ?>
</div>
</div>
Expand Down
19 changes: 16 additions & 3 deletions themes/default/style/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,21 @@
#photos-navigation a { background:none; padding:0; }

#profile-photos .photosets a { background:none; padding:0; }
#profile-photos .photosets .item { list-style-type:none; }
#profile-photos .photosets .item .cover { float:left; width:160px; height:160px; border:1px; }
#profile-photos .photosets { float:left; width:100%; }
#profile-photos .photosets .item { clear:none; float:left; list-style-type:none; width:128px; margin-right:10px; }
#profile-photos .photosets .item .cover { float:left; width:124px; height:124px; border:2px solid #a4bcc2; }
#profile-photos .photosets .item .cover:hover { border:2px solid #81a8b8; -webkit-box-shadow: 0px 0px 10px #000; }
#profile-photos .photosets .item .name { float:left; width:100%; text-align:center; color: #81a8b8; font-weight:bold; margin-top:5px; }
#profile-photos .photosets .item .description { display:none; }

#profile-photos .photos .item { list-style-type:none; width:124px; }
#profile-photos .photos .item .photo { float:left; width:124px; height:124px; border:1px; border:2px solid #a4bcc2; }
#profile-photos .photos .item .photo:hover { border:2px solid #81a8b8; -webkit-box-shadow: 0px 0px 10px #000; }
#profile-photos .photos .item .description { display:none; }

#profile-photos .photo { float:left; clear:both; width:100%; text-align:center; }
#profile-photos .photo .original { }
#profile-photos .photo .description { clear:both; float:left; width:100%; }

/* profile-contact */
#profile-contact ul li { font-size:90%; list-style-type:none; margin:5px 0 5px 10px; padding:2px; }
Expand Down Expand Up @@ -636,4 +649,4 @@
.debug-network-request:hover { display:inline; white-space:nowrap; height:14px; font-style:italic; float:left; text-align:left; width:900px; margin-left:5px; overflow:visible; }
.debug-network-return { display:inline; font-weight:bold; float:left; text-align:left; clear:both; width:900px; margin-left:5px; overflow:hidden; text-overflow: ellipsis; -o-text-overflow: ellipsis; }
.debug-network-id { background-color:#a4bcc2; color:#fafafa; font-weight:bold; width:20px; }


0 comments on commit 398d539

Please sign in to comment.