aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Connedit.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module/Connedit.php')
-rw-r--r--Zotlabs/Module/Connedit.php124
1 files changed, 95 insertions, 29 deletions
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index 5968ccde6..7a753c286 100644
--- a/Zotlabs/Module/Connedit.php
+++ b/Zotlabs/Module/Connedit.php
@@ -37,7 +37,7 @@ class Connedit extends \Zotlabs\Web\Controller {
intval(argv(1))
);
if($r) {
- \App::$poi = $r[0];
+ \App::$poi = array_shift($r);
}
}
@@ -86,6 +86,12 @@ class Connedit extends \Zotlabs\Web\Controller {
call_hooks('contact_edit_post', $_POST);
+ $vc = get_abconfig(local_channel(),$orig_record['abook_xchan'],'system','vcard');
+ $vcard = (($vc) ? \Sabre\VObject\Reader::read($vc) : null);
+ $serialised_vcard = update_vcard($_REQUEST,$vcard);
+ if($serialised_vcard)
+ set_abconfig(local_channel(),$orig_record[0]['abook_xchan'],'system','vcard',$serialised_vcard);
+
if(intval($orig_record[0]['abook_self'])) {
$autoperms = intval($_POST['autoperms']);
$is_self = true;
@@ -206,6 +212,7 @@ class Connedit extends \Zotlabs\Web\Controller {
}
if(($_REQUEST['pending']) && intval($orig_record[0]['abook_pending'])) {
+
$new_friend = true;
// @fixme it won't be common, but when you accept a new connection request
@@ -215,21 +222,13 @@ class Connedit extends \Zotlabs\Web\Controller {
// request. The workaround is to approve the connection, then go back and
// adjust permissions as desired.
- $abook_my_perms = get_channel_default_perms(local_channel());
-
- $role = get_pconfig(local_channel(),'system','permissions_role');
- if($role) {
- $x = \Zotlabs\Access\PermissionRoles::role_perms($role);
- if($x['perms_connect']) {
- $abook_my_perms = $x['perms_connect'];
+ $p = \Zotlabs\Access\Permissions::connect_perms(local_channel());
+ $my_perms = $p['perms'];
+ if($my_perms) {
+ foreach($my_perms as $k => $v) {
+ set_abconfig($channel['channel_id'],$orig_record[0]['abook_xchan'],'my_perms',$k,$v);
}
}
-
- $filled_perms = \Zotlabs\Access\Permissions::FilledPerms($abook_my_perms);
- foreach($filled_perms as $k => $v) {
- set_abconfig($channel['channel_id'],$orig_record[0]['abook_xchan'],'my_perms',$k,$v);
- }
-
}
$abook_pending = (($new_friend) ? 0 : $orig_record[0]['abook_pending']);
@@ -246,14 +245,6 @@ class Connedit extends \Zotlabs\Web\Controller {
intval(local_channel())
);
- if($orig_record[0]['abook_profile'] != $profile_id) {
- //Update profile photo permissions
-
- logger('A new profile was assigned - updating profile photos');
- profile_photo_set_profile_perms(local_channel(),$profile_id);
-
- }
-
if($r)
info( t('Connection updated.') . EOL);
else
@@ -367,7 +358,7 @@ class Connedit extends \Zotlabs\Web\Controller {
intval(\App::$poi['abook_id'])
);
if($r) {
- \App::$poi = $r[0];
+ \App::$poi = array_shift($r);
}
$clone = \App::$poi;
@@ -639,6 +630,15 @@ class Connedit extends \Zotlabs\Web\Controller {
),
);
+
+ $sections = [];
+
+ $sections['perms'] = [
+ 'label' => t('Permissions'),
+ 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/?f=&section=perms',
+ 'sel' => '',
+ 'title' => t('Open Individual Permissions section by default'),
+ ];
$self = false;
@@ -647,17 +647,32 @@ class Connedit extends \Zotlabs\Web\Controller {
$abook_prev = $abook_next = 0;
}
+ $vc = get_abconfig(local_channel(),$contact['abook_xchan'],'system','vcard');
+
+ $vctmp = (($vc) ? \Sabre\VObject\Reader::read($vc) : null);
+ $vcard = (($vctmp) ? get_vcard_array($vctmp,$contact['abook_id']) : [] );
+ if(! $vcard)
+ $vcard['fn'] = $contact['xchan_name'];
+
+
$tpl = get_markup_template("abook_edit.tpl");
if(feature_enabled(local_channel(),'affinity')) {
+
+ $sections['affinity'] = [
+ 'label' => t('Affinity'),
+ 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/?f=&section=affinity',
+ 'sel' => '',
+ 'title' => t('Open Set Affinity section by default'),
+ ];
- $labels = array(
+ $labels = [
t('Me'),
t('Family'),
t('Friends'),
t('Acquaintances'),
t('All')
- );
+ ];
call_hooks('affinity_labels',$labels);
$label_str = '';
@@ -679,6 +694,15 @@ class Connedit extends \Zotlabs\Web\Controller {
'$labels' => $label_str,
));
}
+
+ if(feature_enabled(local_channel(),'connfilter')) {
+ $sections['filter'] = [
+ 'label' => t('Filter'),
+ 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/?f=&section=filter',
+ 'sel' => '',
+ 'title' => t('Open Custom Filter section by default'),
+ ];
+ }
$rating_val = 0;
$rating_text = '';
@@ -754,6 +778,15 @@ class Connedit extends \Zotlabs\Web\Controller {
$perms[] = array('perms_' . $k, $v, ((array_key_exists($k,$their_perms)) ? intval($their_perms[$k]) : ''),$thisperm, 1, (($checkinherited & PERMS_SPECIFIC) ? '' : '1'), '', $checkinherited);
}
+ $pcat = new \Zotlabs\Lib\Permcat(local_channel());
+ $pcatlist = $pcat->listing();
+ $permcats = [];
+ if($pcatlist) {
+ foreach($pcatlist as $pc) {
+ $permcats[$pc['name']] = $pc['localname'];
+ }
+ }
+
$locstr = '';
$locs = q("select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s'
@@ -775,12 +808,16 @@ class Connedit extends \Zotlabs\Web\Controller {
else
$locstr = t('none');
- $o .= replace_macros($tpl,array(
-
+ $o .= replace_macros($tpl, [
'$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])),
'$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('Connection requests will be approved without your interaction'), $yes_no),
+ '$permcat' => [ 'permcat', t('Permission role'), '', '',$permcats ],
+ '$permcat_new' => t('Add permission role'),
+ '$permcat_enable' => feature_enabled(local_channel(),'permcats'),
'$addr' => $contact['xchan_addr'],
'$section' => $section,
+ '$sections' => $sections,
+ '$vcard' => $vcard,
'$addr_text' => t('This connection\'s primary address is'),
'$loc_text' => t('Available locations:'),
'$locstr' => $locstr,
@@ -818,13 +855,42 @@ class Connedit extends \Zotlabs\Web\Controller {
'$permnote_self' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can change those settings here but they wont have any impact unless the inherited setting changes.'),
'$lastupdtext' => t('Last update:'),
'$last_update' => relative_date($contact['abook_connected']),
+ '$is_mobile' => ((\App::$is_mobile || \App::$is_tablet) ? true : false),
'$profile_select' => contact_profile_assign($contact['abook_profile']),
'$multiprofs' => $multiprofs,
'$contact_id' => $contact['abook_id'],
'$name' => $contact['xchan_name'],
'$abook_prev' => $abook_prev,
- '$abook_next' => $abook_next
- ));
+ '$abook_next' => $abook_next,
+ '$vcard_label' => t('Details'),
+ '$displayname' => $displayname,
+ '$name_label' => t('Name'),
+ '$org_label' => t('Organisation'),
+ '$title_label' => t('Title'),
+ '$tel_label' => t('Phone'),
+ '$email_label' => t('Email'),
+ '$impp_label' => t('Instant messenger'),
+ '$url_label' => t('Website'),
+ '$adr_label' => t('Address'),
+ '$note_label' => t('Note'),
+ '$mobile' => t('Mobile'),
+ '$home' => t('Home'),
+ '$work' => t('Work'),
+ '$other' => t('Other'),
+ '$add_card' => t('Add Contact'),
+ '$add_field' => t('Add Field'),
+ '$create' => t('Create'),
+ '$update' => t('Update'),
+ '$delete' => t('Delete'),
+ '$cancel' => t('Cancel'),
+ '$po_box' => t('P.O. Box'),
+ '$extra' => t('Additional'),
+ '$street' => t('Street'),
+ '$locality' => t('Locality'),
+ '$region' => t('Region'),
+ '$zip_code' => t('ZIP Code'),
+ '$country' => t('Country')
+ ]);
$arr = array('contact' => $contact,'output' => $o);