From 4103344e482990d9d4936e82681fa8d92f1f564f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 20 Dec 2016 16:45:12 -0800 Subject: abook_vcard first commit --- Zotlabs/Module/Connedit.php | 53 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 5968ccde6..3aaa2a874 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -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['abook_xchan'],'system','vcard',$serialised_vcard); + if(intval($orig_record[0]['abook_self'])) { $autoperms = intval($_POST['autoperms']); $is_self = true; @@ -647,6 +653,14 @@ class Connedit extends \Zotlabs\Web\Controller { $abook_prev = $abook_next = 0; } + $vc = get_abconfig(local_channel(),$contact['abook_xchan'],'system','vcard'); +logger('vc: ' . $vc); + + $vctmp = (($vc) ? \Sabre\VObject\Reader::read($vc) : null); + $vcard = (($vctmp) ? get_vcard_array($vctmp) : [] ); + +logger('vcard: ' . print_r($vcard,true)); + $tpl = get_markup_template("abook_edit.tpl"); if(feature_enabled(local_channel(),'affinity')) { @@ -781,6 +795,7 @@ class Connedit extends \Zotlabs\Web\Controller { '$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), '$addr' => $contact['xchan_addr'], '$section' => $section, + '$vcard' => $vcard, '$addr_text' => t('This connection\'s primary address is'), '$loc_text' => t('Available locations:'), '$locstr' => $locstr, @@ -823,7 +838,43 @@ class Connedit extends \Zotlabs\Web\Controller { '$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); -- cgit v1.2.3 From 6ff462abf39b76fb8ad6f5734c058e9b19dbc774 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 20 Dec 2016 17:19:53 -0800 Subject: more abook_vcard --- Zotlabs/Module/Connedit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 3aaa2a874..aac42abb9 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -90,7 +90,7 @@ class Connedit extends \Zotlabs\Web\Controller { $vcard = (($vc) ? \Sabre\VObject\Reader::read($vc) : null); $serialised_vcard = update_vcard($_REQUEST,$vcard); if($serialised_vcard) - set_abconfig(local_channel(),$orig_record['abook_xchan'],'system','vcard',$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']); -- cgit v1.2.3 From 493aa9f20d3a48132a83b1da0c643f80c038e617 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 20 Dec 2016 18:43:20 -0800 Subject: progress on abook_vcard --- Zotlabs/Module/Connedit.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index aac42abb9..55113eb82 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -654,12 +654,9 @@ class Connedit extends \Zotlabs\Web\Controller { } $vc = get_abconfig(local_channel(),$contact['abook_xchan'],'system','vcard'); -logger('vc: ' . $vc); $vctmp = (($vc) ? \Sabre\VObject\Reader::read($vc) : null); - $vcard = (($vctmp) ? get_vcard_array($vctmp) : [] ); - -logger('vcard: ' . print_r($vcard,true)); + $vcard = (($vctmp) ? get_vcard_array($vctmp,$contact['abook_id']) : [] ); $tpl = get_markup_template("abook_edit.tpl"); -- cgit v1.2.3 From a270ca51014e8bf98554bd5e8eda33a44aa60460 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 20 Dec 2016 19:31:50 -0800 Subject: allow update of fn and initial setting from channel name --- Zotlabs/Module/Connedit.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 55113eb82..9d55d8ace 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -657,6 +657,9 @@ class Connedit extends \Zotlabs\Web\Controller { $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"); -- cgit v1.2.3 From f3ec818a66e7909bcb744868cfef43c3481c4e43 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 20 Dec 2016 20:37:06 -0800 Subject: abook_vcard cleanup --- Zotlabs/Module/Connedit.php | 75 ++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 42 deletions(-) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 9d55d8ace..29471ed99 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); } } @@ -373,7 +373,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; @@ -665,13 +665,13 @@ class Connedit extends \Zotlabs\Web\Controller { if(feature_enabled(local_channel(),'affinity')) { - $labels = array( + $labels = [ t('Me'), t('Family'), t('Friends'), t('Acquaintances'), t('All') - ); + ]; call_hooks('affinity_labels',$labels); $label_str = ''; @@ -789,8 +789,7 @@ 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), '$addr' => $contact['xchan_addr'], @@ -840,42 +839,34 @@ class Connedit extends \Zotlabs\Web\Controller { '$abook_prev' => $abook_prev, '$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') - - - - - - - - - )); + '$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); -- cgit v1.2.3 From bb85e139f110d2d65a54f8aefbd3777a99d053e2 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 21 Dec 2016 15:03:33 -0800 Subject: more vcard work --- Zotlabs/Module/Connedit.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 29471ed99..d60ffcd56 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -832,6 +832,7 @@ class Connedit extends \Zotlabs\Web\Controller { '$permnote_self' => t('Some permissions may be inherited from your channel\'s privacy settings, 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'], -- cgit v1.2.3 From b8f0e565f53109cd2d36c748d61fd8ab17d674bb Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 9 Jan 2017 12:03:32 +0100 Subject: implement a menu to select a section to be open by default --- Zotlabs/Module/Connedit.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index d60ffcd56..92f4fc345 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -645,6 +645,15 @@ class Connedit extends \Zotlabs\Web\Controller { ), ); + + $sections = []; + + $sections['perms'] = [ + 'label' => t('Permissions'), + 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/?f=§ion=perms', + 'sel' => '', + 'title' => t('Open Individual Permissions section by default'), + ]; $self = false; @@ -664,6 +673,13 @@ class Connedit extends \Zotlabs\Web\Controller { $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=§ion=affinity', + 'sel' => '', + 'title' => t('Open Set Affinity section by default'), + ]; $labels = [ t('Me'), @@ -693,6 +709,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=§ion=filter', + 'sel' => '', + 'title' => t('Open Custom Filter section by default'), + ]; + } $rating_val = 0; $rating_text = ''; @@ -794,6 +819,7 @@ class Connedit extends \Zotlabs\Web\Controller { '$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), '$addr' => $contact['xchan_addr'], '$section' => $section, + '$sections' => $sections, '$vcard' => $vcard, '$addr_text' => t('This connection\'s primary address is'), '$loc_text' => t('Available locations:'), -- cgit v1.2.3 From 723b51c931e7365b3c8d531bf25c6c02308cba9f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 7 Feb 2017 17:17:38 -0800 Subject: provide a few system defined permcats; will require a permission editor page to define new (personal) ones. --- Zotlabs/Module/Connedit.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 92f4fc345..8f382246a 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -793,6 +793,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' @@ -817,6 +826,7 @@ class Connedit extends \Zotlabs\Web\Controller { $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 ], '$addr' => $contact['xchan_addr'], '$section' => $section, '$sections' => $sections, -- cgit v1.2.3 From 91819bfc2d475e1b16d3f5e9ca685ca2531a9084 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 8 Feb 2017 17:21:32 -0800 Subject: bringer - all basic functionality is implemented --- Zotlabs/Module/Connedit.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 8f382246a..ccaf5cd5b 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -827,6 +827,8 @@ class Connedit extends \Zotlabs\Web\Controller { '$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, -- cgit v1.2.3 From 1fb37f93ccf4739a6f92f3f36c1ee4ec8ef66a07 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 9 Feb 2017 19:52:13 -0800 Subject: more permissions optimisations --- Zotlabs/Module/Connedit.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index ccaf5cd5b..d8422266c 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -212,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 @@ -221,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']); -- cgit v1.2.3 From ccdfbc721fa0cf6710cce262cbaa219e2803e8c2 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 12 Feb 2017 15:56:33 -0800 Subject: Create virtual privacy groups for private profile member lists --- Zotlabs/Module/Connedit.php | 8 -------- 1 file changed, 8 deletions(-) (limited to 'Zotlabs/Module/Connedit.php') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index d8422266c..7a753c286 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -245,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 -- cgit v1.2.3