From 73f9d06e3e28e9146eb82254d5dcd2ccd497aff9 Mon Sep 17 00:00:00 2001 From: Rabuzarus Date: Thu, 25 Dec 2014 16:20:55 +0100 Subject: [PATCH 1/5] 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 From 432cf6f2ce26b8a3b8271476a5a58b94b2024b15 Mon Sep 17 00:00:00 2001 From: Rabuzarus Date: Thu, 25 Dec 2014 16:31:52 +0100 Subject: [PATCH 2/5] insert new line at the end --- view/templates/photo_album.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/templates/photo_album.tpl b/view/templates/photo_album.tpl index 882070d20..770eaf14c 100644 --- a/view/templates/photo_album.tpl +++ b/view/templates/photo_album.tpl @@ -16,4 +16,4 @@
-{{/foreach}} \ No newline at end of file +{{/foreach}} From cb47fdfcb9f61fd3c6b0c308448e66481482aafb Mon Sep 17 00:00:00 2001 From: Rabuzarus Date: Fri, 26 Dec 2014 03:32:21 +0100 Subject: [PATCH 3/5] minor change: rel should not be part of the PHP --- mod/photos.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index 8fc26d985..2521a1cf0 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1242,14 +1242,11 @@ function photos_content(&$a) { $desc_e = $rr['desc']; } - $rel=("photo"); - $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' : ''), - 'rel' => $rel, 'title' => t('View Photo'), 'src' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext, 'alt' => $imgalt_e, From f59e574068e1bab0345fb66a6e9877871f755040 Mon Sep 17 00:00:00 2001 From: Rabuzarus Date: Fri, 26 Dec 2014 12:54:23 +0100 Subject: [PATCH 4/5] removed Pagination --- mod/photos.php | 1 - 1 file changed, 1 deletion(-) diff --git a/mod/photos.php b/mod/photos.php index 2521a1cf0..d3300c800 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1267,7 +1267,6 @@ function photos_content(&$a) { )); $o .= '
'; - $o .= paginate($a); return $o; From 5939a8cea59dd94ee18704c955666c3d0083989f Mon Sep 17 00:00:00 2001 From: Rabuzarus Date: Fri, 26 Dec 2014 14:44:48 +0100 Subject: [PATCH 5/5] revert last commit f59e574, remove some html code --- mod/photos.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index d3300c800..003bcd915 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1183,8 +1183,6 @@ function photos_content(&$a) { intval($a->pager['itemspage']) ); - $o .= '

' . $album . '

'; - if($cmd === 'edit') { if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { @@ -1266,7 +1264,7 @@ function photos_content(&$a) { '$edit' => $edit )); - $o .= '
'; + $o .= paginate($a); return $o;