Merge remote-tracking branch 'mike/master' into dev

This commit is contained in:
Mario Vavti 2018-02-25 13:01:23 +01:00
commit 673cf8d35e
4 changed files with 27 additions and 9 deletions

View File

@ -304,7 +304,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
} }
$channel = \App::get_channel(); $channel = \App::get_channel();
$pf = 0;
$newuser = false; $newuser = false;
if(argc() == 2 && argv(1) === 'new') if(argc() == 2 && argv(1) === 'new')
@ -318,8 +318,8 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$resource_id = argv(2); $resource_id = argv(2);
// When using an existing photo, we don't have a dialogue to offer a choice of profiles,
// so it gets attached to the default $pf = (($_REQUEST['pf']) ? intval($_REQUEST['pf']) : 0);
$c = q("select id, is_default from profile where uid = %d", $c = q("select id, is_default from profile where uid = %d",
intval(local_channel()) intval(local_channel())
@ -331,6 +331,9 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$_REQUEST['profile'] = $c[0]['id']; $_REQUEST['profile'] = $c[0]['id'];
$multi_profiles = false; $multi_profiles = false;
} }
else {
$_REQUEST['profile'] = $pf;
}
$r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC", $r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC",
intval(local_channel()), intval(local_channel()),
@ -430,6 +433,16 @@ class Profile_photo extends \Zotlabs\Web\Controller {
intval(local_channel()) intval(local_channel())
); );
if($profiles) {
for($x = 0; $x < count($profiles); $x ++) {
$profiles[$x]['selected'] = false;
if($pf && $profiles[$x]['id'] == $pf)
$profiles[$x]['selected'] = true;
if((! $pf) && $profiles[$x]['is_default'])
$profiles[$x]['selected'] = true;
}
}
$importing = ((array_key_exists('importfile',\App::$data)) ? true : false); $importing = ((array_key_exists('importfile',\App::$data)) ? true : false);
if(! x(\App::$data,'imagecrop')) { if(! x(\App::$data,'imagecrop')) {

View File

@ -1617,13 +1617,16 @@ function get_site_info() {
'lastpoll' => get_config('system','lastpoll'), 'lastpoll' => get_config('system','lastpoll'),
'info' => (($site_info) ? $site_info : ''), 'info' => (($site_info) ? $site_info : ''),
'channels_total' => $channels_total_stat, 'channels_total' => $channels_total_stat,
'channels_active_halfyear' => $channels_active_halfyear_stat,
'channels_active_monthly' => $channels_active_monthly_stat,
'local_posts' => $local_posts_stat,
'local_comments' => $local_comments_stat,
'hide_in_statistics' => $hide_in_statistics 'hide_in_statistics' => $hide_in_statistics
]; ];
if(! $hide_in_statistics) {
$data['channels_active_halfyear'] = $channels_active_halfyear_stat;
$data['channels_active_monthly'] = $channels_active_monthly_stat;
$data['local_posts'] = $local_posts_stat;
$data['local_comments'] = $local_comments_stat;
}
return $data; return $data;
} }

View File

@ -37,7 +37,9 @@
$.post("embedphotos/photolink", {href: href}, $.post("embedphotos/photolink", {href: href},
function(ddata) { function(ddata) {
if (ddata['status']) { if (ddata['status']) {
window.location.href = 'profile_photo/use/' + ddata['resource_id']; var pf = $('#profile-photo-profiles').val();
var prof = ((typeof pf !== 'undefined') ? '?f=&pf=' + pf : '');
window.location.href = 'profile_photo/use/' + ddata['resource_id'] + prof;
} else { } else {
window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']); window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']);
} }

View File

@ -27,7 +27,7 @@
<label id="profile-photo-profiles-label" class="form-label" for="profile-photo-profiles">{{$lbl_profiles}}</label> <label id="profile-photo-profiles-label" class="form-label" for="profile-photo-profiles">{{$lbl_profiles}}</label>
<select name="profile" id="profile-photo-profiles" class="form-control" > <select name="profile" id="profile-photo-profiles" class="form-control" >
{{foreach $profiles as $p}} {{foreach $profiles as $p}}
<option value="{{$p.id}}" {{if $p.is_default}}selected="selected"{{/if}}>{{$p.name}}</option> <option value="{{$p.id}}" {{if $p.selected}}selected="selected"{{/if}}>{{$p.name}}</option>
{{/foreach}} {{/foreach}}
</select> </select>
<div class="clear"></div> <div class="clear"></div>