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) {
$result = array('success' => false,'message' => '');
$a = get_app();

View File

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

View File

@ -87,7 +87,7 @@ function acl_init(&$a){
$contact_count = (int)$r[0]['c'];
}
elseif ($type == 'a') {
elseif (($type == 'a')||($type == 'p')) {
// autocomplete for Contacts
@ -168,7 +168,7 @@ function acl_init(&$a){
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
WHERE abook_channel = %d
and not (xchan_flags & %d)
@ -204,7 +204,7 @@ function acl_init(&$a){
$r = array();
if($type == 'm' || $type == 'a') {
if($type == 'm' || $type == 'a' || $type == 'p') {
$x = array();
$x['query'] = $search;
$x['photos'] = array();
@ -216,7 +216,7 @@ function acl_init(&$a){
$x['photos'][] = $g['micro'];
$x['links'][] = $g['url'];
$x['suggestions'][] = $g['name'];
$x['data'][] = $g['id'];
$x['data'][] = (($type === 'p') ? '@' . str_replace(' ','_',$g['name']) : $g['id']);
}
}
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) {
require_once('include/group.php');
$grp = group_byname($profile_uid,$name);
if($grp) {
$g = q("select hash from groups where id = %d and visible = 1 limit 1",
intval($grp[0]['id'])
intval($grp)
);
if($g && $exclusive) {
$access_tag .= 'gid:' . $g[0]['hash'];

View File

@ -13,6 +13,19 @@ $(document).ready(function() {
'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() {
var selstr;
$('#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 id="photo-edit-edit">
<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>
<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}}
<datalist id="dl-albums">
{{foreach $edit.albums as $al}}
@ -47,18 +47,18 @@
{{/if}}
<div id="photo-edit-albumname-end"></div>
<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>
<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-rotate-wrapper">
<div id="photo-edit-rotate-label">
{{$edit.rotatecw}}<br>
{{$edit.rotateccw}}
</div>
<input type="radio" name="rotate" value="1"><br>
<input type="radio" name="rotate" value="2">
<input type="radio" name="rotate" value="1" /><br>
<input type="radio" name="rotate" value="2" />
</div>
<div id="photo-edit-rotate-end"></div>
<div id="settings-default-perms" class="settings-default-perms">
@ -69,8 +69,8 @@
</div>
<br/>
<div id="settings-default-perms-end"></div>
<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-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();" />
<div id="photo-edit-end"></div>
</form>
</div>