From 73f9d06e3e28e9146eb82254d5dcd2ccd497aff9 Mon Sep 17 00:00:00 2001 From: Rabuzarus Date: Thu, 25 Dec 2014 16:20:55 +0100 Subject: [PATCH] move some html code from photos.php to photo_album.tpl --- mod/photos.php | 50 ++++++++++++++++++++-------------- view/templates/photo_album.tpl | 17 ++++++++++-- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index 605f6153a..8fc26d985 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1211,25 +1211,18 @@ function photos_content(&$a) { else { if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { - $o .= ''; + $edit = array(t('Edit Album'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit'); } } } if($_GET['order'] === 'posted') - $o .= ''; + $order = array(t('Show Newest First'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album)); else - $o .= ''; + $order = array(t('Show Oldest First'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted'); + $photos = array(); - if($can_post) { - $o .= ''; - } - - - $tpl = get_markup_template('photo_album.tpl'); if(count($r)) $twist = 'rotright'; foreach($r as $rr) { @@ -1248,19 +1241,34 @@ function photos_content(&$a) { $imgalt_e = $rr['filename']; $desc_e = $rr['desc']; } + + $rel=("photo"); - $o .= replace_macros($tpl,array( - '$id' => $rr['id'], - '$twist' => ' ' . $twist . rand(2,4), - '$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'] + $photos[] = array( + 'id' => $rr['id'], + 'twist' => ' ' . $twist . rand(2,4), + 'link' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''), - '$phototitle' => t('View Photo'), - '$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext, - '$imgalt' => $imgalt_e, - '$desc'=> $desc_e - )); - + 'rel' => $rel, + 'title' => t('View Photo'), + 'src' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext, + 'alt' => $imgalt_e, + 'desc'=> $desc_e, + 'ext' => $ext, + 'hash'=> $rr['resource_id'], + ); } + + $tpl = get_markup_template('photo_album.tpl'); + $o .= replace_macros($tpl, array( + '$photos' => $photos, + '$album' => $album, + '$can_post' => $can_post, + '$upload' => array(t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)), + '$order' => $order, + '$edit' => $edit + )); + $o .= '
'; $o .= paginate($a); diff --git a/view/templates/photo_album.tpl b/view/templates/photo_album.tpl index 20162a91a..882070d20 100644 --- a/view/templates/photo_album.tpl +++ b/view/templates/photo_album.tpl @@ -1,8 +1,19 @@ +

{{$album}}

+{{if $edit}} + +{{/if}} + +{{if $can_post}} + +{{/if}} + +{{foreach $photos as $photo}}
- - {{$imgalt}} -

{{$desc}}

+
+ {{if $photo.album.name}}{{$photo.album.name}}{{elseif $photo.desc}}{{$photo.desc}}{{elseif $photo.alt}}{{$photo.alt}}{{else}}{{$photo.unknown}}{{/if}} +

{{$photo.desc}}

+{{/foreach}} \ No newline at end of file