* @category Widget
* @package GNU Social
* @author Ian Denhardt <ian@zenhack.net>
+ * @author Max Shinn <trombonechamp@gmail.com>
* @copyright 2010 Free Software Foundation, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
*/
{
$m->connect(':nickname/photos', array('action' => 'photos'));
$m->connect('main/uploadphoto', array('action' => 'photoupload'));
- $m->connect(':nickname/photo/:photoid', array('action' => 'photo'));
+ $m->connect('photo/:photoid', array('action' => 'photo'));
return true;
}
if($photo) {
$action->out->elementStart('div', 'entry-title');
$action->showAuthor();
- $action->out->elementStart('a', array('href' => $photo->uri));
+ $action->out->elementStart('a', array('href' => $photo->getPageLink()));
$action->out->element('img', array('src' => $photo->thumb_uri,
'width' => 256, 'height' => 192));
$action->out->elementEnd('a');
return true;
}
+ /* function onEndShowNoticeFormData($action)
+ {
+ $link = "/main/uploadphoto";
+ $action->out->element('label', array('for' => 'photofile'),_('Attach'));
+ $action->out->element('input', array('id' => 'photofile',
+ 'type' => 'file',
+ 'name' => 'photofile',
+ 'title' => _('Upload a photo')));
+ }
+ */
function onEndPersonalGroupNav($nav)
{
+
$nav->out->menuItem(common_local_url('photos',
- array('nickname' => $nav->action->trimmed('nickname'))), 'Photos');
+ array('nickname' => $nav->action->trimmed('nickname'))), _('Photos'),
+ _('Photo gallery'), $nav->action->trimmed('action') == 'photos', 'nav_photos');
}
}
+
parent::prepare($args);
$args = $this->returnToArgs();
- $username = $args[1]['nickname'];
$this->photoid = $args[1]['photoid'];
- if (common_valid_profile_tag($username) == 0) {
- $this->user = null;
- } else {
- $this->user = Profile::staticGet('nickname', $username);
- }
$this->photo = GNUsocialPhoto::staticGet('notice_id', $this->photoid);
-
$this->notice = Notice::staticGet('id', $this->photoid);
- $notices = Notice::conversationStream((int)$this->photoid-1, null, null); //Why do I have to do -1?
+ $this->user = Profile::staticGet('id', $this->notice->profile_id);
+
+ $notices = Notice::conversationStream((int)$this->photoid-1, null, null); //Why do I have to do -1?
$this->conversation = new ConversationTree($notices, $this);
return true;
$this->elementEnd('a');
$this->element('p', array(), $this->photo->photo_description);
//This is a hack to hide the top-level comment
- //$this->element('style', array(), "#notice-{$this->photoid} div { display: none } #notice-{$this->photoid} ol li div { display: inline }");
+ $this->element('style', array(), "#notice-{$this->photoid} div { display: none } #notice-{$this->photoid} ol li div { display: inline }");
$this->conversation->show();
}
}
exit(1);
}
+require_once INSTALLDIR.'/lib/personalgroupnav.php';
+
class PhotosAction extends Action
{
var $user = null;
function showLocalNav()
{
- $nav = new GNUsocialPhotoNav($this);
+ $nav = new PersonalGroupNav($this);
$nav->show();
}
$page = 1;
}
- if ($page > 1) {
- $this->element('a', array('href' => 'photos?pageid=' . ($page-1)), 'Previous page');
- }
- $this->element('a', array('href' => 'photos?pageid=' . ($page+1) ), 'Next page');
-
//TODO choice of available albums by user.
//Currently based on fact that each user can only have one album.
$album = GNUSocialPhotoAlbum::staticGet('profile_id', $this->user->id);
$photos = GNUsocialPhoto::getGalleryPage($page, $album->album_id, 9);
+ if ($page > 1) {
+ $this->element('a', array('href' => 'photos?pageid=' . ($page-1)), 'Previous page');
+ }
+ if (GNUsocialPhoto::getGalleryPage($page+1, $album->album_id, 9)) {
+ $this->element('a', array('href' => 'photos?pageid=' . ($page+1) ), 'Next page');
+ }
+
$this->elementStart('ul', array('class' => 'photothumbs'));
foreach ($photos as $photo) {
$this->elementStart('li');
- $photolink = '/' . $this->user->nickname . '/photo/' . $photo->notice_id;
- $this->elementStart('a', array('href' => $photolink));
+ $this->elementStart('a', array('href' => $photo->getPageLink()));
$this->element('img', array('src' => $photo->thumb_uri));
$this->elementEnd('a');
$this->elementEnd('li');
}
}
+ function getPageLink()
+ {
+ return '/photo/' . $this->notice_id;
+ }
/*
* TODO: -Sanitize input