aboutsummaryrefslogtreecommitdiffstats
path: root/mod/photos.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-09-06 00:37:15 -0700
committerfriendica <info@friendica.com>2014-09-06 00:37:15 -0700
commit28b75b028dcb1633a9407a5a5c79e5d2423e18a5 (patch)
tree7d7e061cd6fb3c1c92ecdf086c668e500f4e93b1 /mod/photos.php
parent7a9b1c4a77f279b04fa710df25aa289d7b2b47c1 (diff)
downloadvolse-hubzilla-28b75b028dcb1633a9407a5a5c79e5d2423e18a5.tar.gz
volse-hubzilla-28b75b028dcb1633a9407a5a5c79e5d2423e18a5.tar.bz2
volse-hubzilla-28b75b028dcb1633a9407a5a5c79e5d2423e18a5.zip
ajax work
Diffstat (limited to 'mod/photos.php')
-rw-r--r--mod/photos.php65
1 files changed, 52 insertions, 13 deletions
diff --git a/mod/photos.php b/mod/photos.php
index 428aff2a0..3bc105ba1 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -697,8 +697,10 @@ function photos_content(&$a) {
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</a></div>';
}
+ $ajaxout = '';
+
$tpl = get_markup_template('photo_album.tpl');
- if(count($r))
+ if(count($r)) {
$twist = 'rotright';
foreach($r as $rr) {
@@ -728,7 +730,9 @@ function photos_content(&$a) {
$rel=("photo");
// }
- $o .= replace_macros($tpl,array(
+ $o .= "<script> var page_query = '" . $a->query_string . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
+
+ $tmp = replace_macros($tpl,array(
'$id' => $rr['id'],
'$twist' => ' ' . $twist . rand(2,4),
'$photolink' => $imagelink,
@@ -740,10 +744,24 @@ function photos_content(&$a) {
'$ext' => $ext,
'$hash'=> $rr['resource_id'],
));
-
+ if($_REQUEST['aj'])
+ $ajaxout .= $tmp;
+ else
+ $o .= $tmp;
+ }
+ }
+ if($_REQUEST['aj']) {
+ if(! $r)
+ $ajaxout .= '<div id="content-complete"></div>';
+ echo $ajaxout;
+ killme();
}
+
+ $o .= '<div id="page-end"></div>';
$o .= '<div id="photo-album-end"></div>';
- $o .= paginate($a);
+ $o .= '<script>$(document).ready(function() { loadingPage = false;});</script>';
+ $o .= '<div id="page-spinner"></div>';
+// $o .= paginate($a);
return $o;
@@ -1192,16 +1210,37 @@ function photos_content(&$a) {
}
}
- $tpl = get_markup_template('photos_recent.tpl');
- $o .= replace_macros($tpl, array(
- '$title' => t('Recent Photos'),
- '$can_post' => $can_post,
- '$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'),
- '$photos' => $photos,
- ));
+ if($_REQUEST['aj']) {
+ if($photos) {
+ $o = replace_macros(get_markup_template('photosajax.tpl'),array(
+ '$photos' => $photos
+ ));
+ }
+ else {
+ $o = '<div id="content-complete"></div>';
+ }
+ echo $o;
+ killme();
+ }
+ else {
+ $o .= "<script> var page_query = '" . $a->query_string . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
+ $tpl = get_markup_template('photos_recent.tpl');
+ $o .= replace_macros($tpl, array(
+ '$title' => t('Recent Photos'),
+ '$can_post' => $can_post,
+ '$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'),
+ '$photos' => $photos,
+ ));
-
- $o .= paginate($a);
+ }
+
+ if((! $photos) && ($_REQUEST['aj'])) {
+ $o .= '<div id="content-complete"></div>';
+ echo $o;
+ killme();
+ }
+
+// $o .= paginate($a);
return $o;
}