several unrelated things - auto_follow wasn't working for new accounts, error returned in private mention to a collection, and added auto-completion to photo tags; though it only matches people so the hover text is now wrong. Also made the photo edit form XHTML (XML) compliant.

This commit is contained in:
friendica 2014-10-27 19:21:41 -07:00
parent 1b53d1c1d3
commit 9cc76cb33d
6 changed files with 31 additions and 13 deletions

View File

@ -13,6 +13,8 @@ require_once('include/zot.php');
function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) { function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) {
$result = array('success' => false,'message' => ''); $result = array('success' => false,'message' => '');
$a = get_app(); $a = get_app();

View File

@ -176,6 +176,7 @@ function create_identity($arr) {
// save this for auto_friending // save this for auto_friending
$total_identities = $ret['total_identities']; $total_identities = $ret['total_identities'];
$nick = mb_strtolower(trim($arr['nickname'])); $nick = mb_strtolower(trim($arr['nickname']));
if(! $nick) { if(! $nick) {
$ret['message'] = t('Nickname is required.'); $ret['message'] = t('Nickname is required.');
@ -404,6 +405,7 @@ function create_identity($arr) {
$accts = get_config('system','auto_follow'); $accts = get_config('system','auto_follow');
if(($accts) && (! $total_identities)) { if(($accts) && (! $total_identities)) {
require_once('include/follow.php');
if(! is_array($accts)) if(! is_array($accts))
$accts = array($accts); $accts = array($accts);
foreach($accts as $acct) { foreach($accts as $acct) {

View File

@ -87,7 +87,7 @@ function acl_init(&$a){
$contact_count = (int)$r[0]['c']; $contact_count = (int)$r[0]['c'];
} }
elseif ($type == 'a') { elseif (($type == 'a')||($type == 'p')) {
// autocomplete for Contacts // autocomplete for Contacts
@ -168,7 +168,7 @@ function acl_init(&$a){
intval(XCHAN_FLAGS_DELETED) intval(XCHAN_FLAGS_DELETED)
); );
} }
elseif($type == 'a') { elseif(($type == 'a') || ($type == 'p')) {
$r = q("SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash $r = q("SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d WHERE abook_channel = %d
and not (xchan_flags & %d) and not (xchan_flags & %d)
@ -204,7 +204,7 @@ function acl_init(&$a){
$r = array(); $r = array();
if($type == 'm' || $type == 'a') { if($type == 'm' || $type == 'a' || $type == 'p') {
$x = array(); $x = array();
$x['query'] = $search; $x['query'] = $search;
$x['photos'] = array(); $x['photos'] = array();
@ -216,7 +216,7 @@ function acl_init(&$a){
$x['photos'][] = $g['micro']; $x['photos'][] = $g['micro'];
$x['links'][] = $g['url']; $x['links'][] = $g['url'];
$x['suggestions'][] = $g['name']; $x['suggestions'][] = $g['name'];
$x['data'][] = $g['id']; $x['data'][] = (($type === 'p') ? '@' . str_replace(' ','_',$g['name']) : $g['id']);
} }
} }
echo json_encode($x); echo json_encode($x);

View File

@ -1181,9 +1181,10 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
if(local_user() && local_user() == $profile_uid) { if(local_user() && local_user() == $profile_uid) {
require_once('include/group.php'); require_once('include/group.php');
$grp = group_byname($profile_uid,$name); $grp = group_byname($profile_uid,$name);
if($grp) { if($grp) {
$g = q("select hash from groups where id = %d and visible = 1 limit 1", $g = q("select hash from groups where id = %d and visible = 1 limit 1",
intval($grp[0]['id']) intval($grp)
); );
if($g && $exclusive) { if($g && $exclusive) {
$access_tag .= 'gid:' . $g[0]['hash']; $access_tag .= 'gid:' . $g[0]['hash'];

View File

@ -13,6 +13,19 @@ $(document).ready(function() {
'transition' : 'elastic' 'transition' : 'elastic'
}); });
var a;
a = $("#photo-edit-newtag").autocomplete({
serviceUrl: baseurl + '/acl',
minChars: 2,
width: 250,
id: 'newtag-ac',
onSelect: function(value,data) {
$("#photo-edit-newtag").val(data);
},
});
a.setOptions({ params: { type: 'p' }});
$('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() { $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
var selstr; var selstr;
$('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() { $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {

View File

@ -33,9 +33,9 @@
</div> </div>
<div id="photo-edit-edit"> <div id="photo-edit-edit">
<form action="photos/{{$edit.nickname}}/{{$edit.resource_id}}" method="post" id="photo_edit_form"> <form action="photos/{{$edit.nickname}}/{{$edit.resource_id}}" method="post" id="photo_edit_form">
<input type="hidden" name="item_id" value="{{$edit.item_id}}"> <input type="hidden" name="item_id" value="{{$edit.item_id}}" />
<label id="photo-edit-albumname-label" for="photo-edit-albumname">{{$edit.newalbum}}</label> <label id="photo-edit-albumname-label" for="photo-edit-albumname">{{$edit.newalbum}}</label>
<input id="photo-edit-albumname" type="text" name="albname" value="{{$edit.album}}" list="dl-albums"> <input id="photo-edit-albumname" type="text" name="albname" value="{{$edit.album}}" list="dl-albums" />
{{if $edit.albums}} {{if $edit.albums}}
<datalist id="dl-albums"> <datalist id="dl-albums">
{{foreach $edit.albums as $al}} {{foreach $edit.albums as $al}}
@ -47,18 +47,18 @@
{{/if}} {{/if}}
<div id="photo-edit-albumname-end"></div> <div id="photo-edit-albumname-end"></div>
<label id="photo-edit-caption-label" for="photo-edit-caption">{{$edit.capt_label}}</label> <label id="photo-edit-caption-label" for="photo-edit-caption">{{$edit.capt_label}}</label>
<input id="photo-edit-caption" type="text" name="desc" value="{{$edit.caption}}"> <input id="photo-edit-caption" type="text" name="desc" value="{{$edit.caption}}" />
<div id="photo-edit-caption-end"></div> <div id="photo-edit-caption-end"></div>
<label id="photo-edit-tags-label" for="photo-edit-newtag" >{{$edit.tag_label}}</label> <label id="photo-edit-tags-label" for="photo-edit-newtag" >{{$edit.tag_label}}</label>
<input name="newtag" id="photo-edit-newtag" title="{{$edit.help_tags}}" type="text"> <input name="newtag" id="photo-edit-newtag" title="{{$edit.help_tags}}" type="text" />
<div id="photo-edit-tags-end"></div> <div id="photo-edit-tags-end"></div>
<div id="photo-edit-rotate-wrapper"> <div id="photo-edit-rotate-wrapper">
<div id="photo-edit-rotate-label"> <div id="photo-edit-rotate-label">
{{$edit.rotatecw}}<br> {{$edit.rotatecw}}<br>
{{$edit.rotateccw}} {{$edit.rotateccw}}
</div> </div>
<input type="radio" name="rotate" value="1"><br> <input type="radio" name="rotate" value="1" /><br>
<input type="radio" name="rotate" value="2"> <input type="radio" name="rotate" value="2" />
</div> </div>
<div id="photo-edit-rotate-end"></div> <div id="photo-edit-rotate-end"></div>
<div id="settings-default-perms" class="settings-default-perms"> <div id="settings-default-perms" class="settings-default-perms">
@ -69,8 +69,8 @@
</div> </div>
<br/> <br/>
<div id="settings-default-perms-end"></div> <div id="settings-default-perms-end"></div>
<input id="photo-edit-submit-button" type="submit" name="submit" value="{{$edit.submit}}"> <input id="photo-edit-submit-button" type="submit" name="submit" value="{{$edit.submit}}" />
<input id="photo-edit-delete-button" type="submit" name="delete" value="{{$edit.delete}}" onclick="return confirmDelete();"> <input id="photo-edit-delete-button" type="submit" name="delete" value="{{$edit.delete}}" onclick="return confirmDelete();" />
<div id="photo-edit-end"></div> <div id="photo-edit-end"></div>
</form> </form>
</div> </div>