ajax work
This commit is contained in:
parent
7a9b1c4a77
commit
28b75b028d
@ -2033,4 +2033,18 @@ function normalise_openid($s) {
|
|||||||
return trim(str_replace(array('http://','https://'),array('',''),$s),'/');
|
return trim(str_replace(array('http://','https://'),array('',''),$s),'/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// used in ajax endless scroll request to find out all the args that the master page was viewing
|
||||||
|
|
||||||
|
|
||||||
|
function extra_query_args() {
|
||||||
|
$s = '';
|
||||||
|
if(count($_REQUEST)) {
|
||||||
|
foreach($_REQUEST as $k => $v) {
|
||||||
|
// these are request vars we don't want to duplicate
|
||||||
|
if(! in_array($k, array('q','f','zid','page','PHPSESSID'))) {
|
||||||
|
$s .= '&' . $k . '=' . $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $s;
|
||||||
|
}
|
@ -216,7 +216,7 @@ function directory_content(&$a) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
$o .= "<script> var page_query_args = '" . $a->query_string . "'; </script>";
|
$o .= "<script> var page_query = '" . $a->query_string . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
|
||||||
$o .= replace_macros($tpl, array(
|
$o .= replace_macros($tpl, array(
|
||||||
'$search' => $search,
|
'$search' => $search,
|
||||||
'$desc' => t('Find'),
|
'$desc' => t('Find'),
|
||||||
|
@ -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>';
|
$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');
|
$tpl = get_markup_template('photo_album.tpl');
|
||||||
if(count($r))
|
if(count($r)) {
|
||||||
$twist = 'rotright';
|
$twist = 'rotright';
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
|
|
||||||
@ -728,7 +730,9 @@ function photos_content(&$a) {
|
|||||||
$rel=("photo");
|
$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'],
|
'$id' => $rr['id'],
|
||||||
'$twist' => ' ' . $twist . rand(2,4),
|
'$twist' => ' ' . $twist . rand(2,4),
|
||||||
'$photolink' => $imagelink,
|
'$photolink' => $imagelink,
|
||||||
@ -740,10 +744,24 @@ function photos_content(&$a) {
|
|||||||
'$ext' => $ext,
|
'$ext' => $ext,
|
||||||
'$hash'=> $rr['resource_id'],
|
'$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 .= '<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;
|
return $o;
|
||||||
|
|
||||||
@ -1192,16 +1210,37 @@ function photos_content(&$a) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl = get_markup_template('photos_recent.tpl');
|
if($_REQUEST['aj']) {
|
||||||
$o .= replace_macros($tpl, array(
|
if($photos) {
|
||||||
'$title' => t('Recent Photos'),
|
$o = replace_macros(get_markup_template('photosajax.tpl'),array(
|
||||||
'$can_post' => $can_post,
|
'$photos' => $photos
|
||||||
'$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'),
|
));
|
||||||
'$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;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
2014-09-05.789
|
2014-09-06.790
|
||||||
|
@ -689,7 +689,7 @@ function updateConvItems(mode,data) {
|
|||||||
bParam_page = 1;
|
bParam_page = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_url = baseurl + '/directory/?f=&aj=1&page=' + bParam_page;
|
update_url = baseurl + '/' + page_query + '/?f=&aj=1&page=' + bParam_page + extra_args ;
|
||||||
|
|
||||||
$("#page-spinner").spin('small');
|
$("#page-spinner").spin('small');
|
||||||
update_mode = 'append';
|
update_mode = 'append';
|
||||||
|
37
view/js/mod_events.js
Normal file
37
view/js/mod_events.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
$(document).ready( function() { showHideFinishDate(); });
|
||||||
|
|
||||||
|
function showHideFinishDate() {
|
||||||
|
if( $('#event-nofinish-checkbox').is(':checked'))
|
||||||
|
$('#event-finish-wrapper').hide();
|
||||||
|
else
|
||||||
|
$('#event-finish-wrapper').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function eventGetStart() {
|
||||||
|
//reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
|
||||||
|
$('#startModal').modal();
|
||||||
|
$('#start-modal-OKButton').on('click', function() {
|
||||||
|
reply=$('#start-date').val();
|
||||||
|
if(reply && reply.length) {
|
||||||
|
$('#start-text').val(reply);
|
||||||
|
$('#startModal').modal('hide');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
function eventGetFinish() {
|
||||||
|
//reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
|
||||||
|
$('#finishModal').modal();
|
||||||
|
$('#finish-modal-OKButton').on('click', function() {
|
||||||
|
reply=$('#finish-date').val();
|
||||||
|
if(reply && reply.length) {
|
||||||
|
$('#finish-text').val(reply);
|
||||||
|
$('#finishModal').modal('hide');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
@ -7,5 +7,8 @@
|
|||||||
{{foreach $photos as $photo}}
|
{{foreach $photos as $photo}}
|
||||||
{{include file="photo_top.tpl"}}
|
{{include file="photo_top.tpl"}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
<div id="page-end"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="photos-end"></div>
|
<div class="photos-end"></div>
|
||||||
|
<script>$(document).ready(function() { loadingPage = false;});</script>
|
||||||
|
<div id="page-spinner"></div>
|
||||||
|
4
view/tpl/photosajax.tpl
Executable file
4
view/tpl/photosajax.tpl
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
<!-- -->
|
||||||
|
{{foreach $photos as $photo}}
|
||||||
|
{{include file="photo_top.tpl"}}
|
||||||
|
{{/foreach}}
|
Reference in New Issue
Block a user