provide option to view photo albums in posted order (rather than blog order)
This commit is contained in:
parent
032507bd6d
commit
7bec5778ba
|
@ -1054,8 +1054,13 @@ function photos_content(&$a) {
|
||||||
$a->set_pager_itemspage(20);
|
$a->set_pager_itemspage(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($_GET['order'] === 'posted')
|
||||||
|
$order = 'ASC';
|
||||||
|
else
|
||||||
|
$order = 'DESC';
|
||||||
|
|
||||||
$r = q("SELECT `resource-id`, `id`, `filename`, type, max(`scale`) AS `scale`, `desc` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
|
$r = q("SELECT `resource-id`, `id`, `filename`, type, max(`scale`) AS `scale`, `desc` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
|
||||||
AND `scale` <= 4 $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
|
AND `scale` <= 4 $sql_extra GROUP BY `resource-id` ORDER BY `created` $order LIMIT %d , %d",
|
||||||
intval($owner_uid),
|
intval($owner_uid),
|
||||||
dbesc($album),
|
dbesc($album),
|
||||||
intval($a->pager['start']),
|
intval($a->pager['start']),
|
||||||
|
@ -1089,10 +1094,17 @@ function photos_content(&$a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($_GET['order'] === 'posted')
|
||||||
|
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '" >' . t('Show Newest First') . '</a></div>';
|
||||||
|
else
|
||||||
|
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted" >' . t('Show Oldest First') . '</a></div>';
|
||||||
|
|
||||||
|
|
||||||
if($can_post) {
|
if($can_post) {
|
||||||
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</a></div>';
|
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$tpl = get_markup_template('photo_album.tpl');
|
$tpl = get_markup_template('photo_album.tpl');
|
||||||
if(count($r))
|
if(count($r))
|
||||||
$twist = 'rotright';
|
$twist = 'rotright';
|
||||||
|
@ -1107,7 +1119,8 @@ function photos_content(&$a) {
|
||||||
$o .= replace_macros($tpl,array(
|
$o .= replace_macros($tpl,array(
|
||||||
'$id' => $rr['id'],
|
'$id' => $rr['id'],
|
||||||
'$twist' => ' ' . $twist . rand(2,4),
|
'$twist' => ' ' . $twist . rand(2,4),
|
||||||
'$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
|
'$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
|
||||||
|
. (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''),
|
||||||
'$phototitle' => t('View Photo'),
|
'$phototitle' => t('View Photo'),
|
||||||
'$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
|
'$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
|
||||||
'$imgalt' => template_escape($rr['filename']),
|
'$imgalt' => template_escape($rr['filename']),
|
||||||
|
@ -1152,8 +1165,14 @@ function photos_content(&$a) {
|
||||||
$prevlink = '';
|
$prevlink = '';
|
||||||
$nextlink = '';
|
$nextlink = '';
|
||||||
|
|
||||||
|
if($_GET['order'] === 'posted')
|
||||||
|
$order = 'ASC';
|
||||||
|
else
|
||||||
|
$order = 'DESC';
|
||||||
|
|
||||||
|
|
||||||
$prvnxt = q("SELECT `resource-id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
|
$prvnxt = q("SELECT `resource-id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
|
||||||
$sql_extra ORDER BY `created` DESC ",
|
$sql_extra ORDER BY `created` $order ",
|
||||||
dbesc($ph[0]['album']),
|
dbesc($ph[0]['album']),
|
||||||
intval($owner_uid)
|
intval($owner_uid)
|
||||||
);
|
);
|
||||||
|
@ -1171,8 +1190,8 @@ function photos_content(&$a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
|
$edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
|
||||||
$prevlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix;
|
$prevlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
|
||||||
$nextlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix;
|
$nextlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user